Skip to content

Commit

Permalink
bnpl payment integration
Browse files Browse the repository at this point in the history
  • Loading branch information
deryacakmak committed Nov 6, 2023
1 parent 761e3b5 commit cd7c4da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 5 additions & 5 deletions adapter/payment.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,20 +537,20 @@ func (api *Payment) OfferBnplPayment(ctx context.Context, request BnplPaymentOff
return response.Data, nil
}

func (api *Payment) ApproveBnplPayment(ctx context.Context, paymentId int64) (*ApmPaymentResponse, error) {
func (api *Payment) ApproveBnplPayment(ctx context.Context, paymentId int64) error {

newRequest, err := api.Client.NewRequest(ctx, http.MethodPost, fmt.Sprintf("/payment/v1/bnpl-payments/%d/approve", paymentId), nil)
if err != nil {
return nil, err
return err
}

response := &Response[ApmPaymentResponse]{}
response := &Void{}
err = api.Client.Do(ctx, newRequest, response)
if err != nil {
return nil, err
return err
}

return response.Data, nil
return nil
}

func (c *Payment) Is3DSecureCallbackVerified(threeDSecureCallbackKey string, params map[string]string) bool {
Expand Down
4 changes: 1 addition & 3 deletions tests/payment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -856,9 +856,7 @@ func TestPayment_OfferBnplPayment(t *testing.T) {
}

func TestPayment_ApproveBnplPayment(t *testing.T) {
res, err := paymentClient.Payment.ApproveBnplPayment(context.Background(), 407016)
_, _ = spew.Printf("%#v\n", res)

err := paymentClient.Payment.ApproveBnplPayment(context.Background(), 407016)
if err != nil {
t.Errorf("Error %s", err)
}
Expand Down

0 comments on commit cd7c4da

Please sign in to comment.