Skip to content

Commit

Permalink
Update bnpl approve response type (#125)
Browse files Browse the repository at this point in the history
* Update bnpl approve response
  • Loading branch information
abalikci authored Feb 27, 2025
1 parent 07999c9 commit 1b07448
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 5 additions & 5 deletions adapter/payment.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,20 +553,20 @@ func (api *Payment) InitBnplPayment(ctx context.Context, request InitBnplPayment
return response.Data, nil
}

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

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

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

return nil
return response.Data, nil
}

func (api *Payment) RetrieveActiveBanks(ctx context.Context) (*InstantTransferBanksResponse, error) {
Expand Down
4 changes: 3 additions & 1 deletion tests/payment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,9 @@ func TestPayment_InitTomFinanceBnplPayment(t *testing.T) {
}

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

if err != nil {
t.Errorf("Error %s", err)
}
Expand Down

0 comments on commit 1b07448

Please sign in to comment.