From cd7c4da608c261f058871967933583f05eeaa9e2 Mon Sep 17 00:00:00 2001 From: Derya Cakmak <97deryacakmak@gmail.com> Date: Mon, 6 Nov 2023 11:17:26 +0300 Subject: [PATCH] bnpl payment integration --- adapter/payment.go | 10 +++++----- tests/payment_test.go | 4 +--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/adapter/payment.go b/adapter/payment.go index b9ff4c5..be896d0 100644 --- a/adapter/payment.go +++ b/adapter/payment.go @@ -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 { diff --git a/tests/payment_test.go b/tests/payment_test.go index c67c106..42712e2 100644 --- a/tests/payment_test.go +++ b/tests/payment_test.go @@ -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) }