Skip to content

Move payment transaction approval and update to settlement and add settlement payout read methods - #229

Open
tuncaserhat wants to merge 2 commits into
masterfrom
settlement-payout-apis
Open

tuncaserhat wants to merge 2 commits into
masterfrom
settlement-payout-apis

Conversation

@tuncaserhat

Copy link
Copy Markdown
Member

Summary

Payment transaction approval and update move to the settlement adapter, and the settlement reporting adapter gets read methods for the new payout model. Payout data is removed from payment responses; read it from the new payout methods instead.

Migration guide: https://developer.craftgate.io/migration/settlement-payout

-func (api *Payment) ApprovePaymentTransactions(ctx, PaymentTransactionsApprovalRequest) (*DataResponse[PaymentTransactionsApprovalResponse], error)
-func (api *Payment) DisapprovePaymentTransactions(ctx, PaymentTransactionsApprovalRequest) (*DataResponse[PaymentTransactionsApprovalResponse], error)
-func (api *Payment) UpdatePaymentTransaction(ctx, id int64, UpdatePaymentTransactionRequest) (*PaymentTransactionResponse, error)
+func (api *Settlement) ApprovePaymentTransactions(ctx, PaymentTransactionsApprovalRequest) (*DataResponse[PaymentTransactionsApprovalResponse], error)
+func (api *Settlement) DisapprovePaymentTransactions(ctx, PaymentTransactionsApprovalRequest) (*DataResponse[PaymentTransactionsApprovalResponse], error)
+func (api *Settlement) UpdatePaymentTransaction(ctx, id int64, UpdatePaymentTransactionRequest) (*PaymentTxPayoutResponse, error)

+func (api *SettlementReporting) RetrievePaymentTransactionPayout(ctx, paymentTransactionId int64) (*PaymentTxPayoutResponse, error)
+func (api *SettlementReporting) SearchPaymentTransactionPayouts(ctx, SearchPaymentTransactionPayoutsRequest) (*DataResponse[PaymentTxPayoutResponse], error)
-func (api *SettlementReporting) SearchPayoutCompletedTransactions(ctx, SearchPayoutCompletedTransactionsRequest) (*DataResponse[SearchPayoutCompletedTransactionsResponse], error)
+func (api *SettlementReporting) SearchPayoutCompletedItems(ctx, SearchPayoutCompletedItemsRequest) (*DataResponse[PayoutCompletedItem], error)
-func (api *SettlementReporting) RetrievePayoutDetails(ctx, payoutDetailId int64) (*PayoutDetailResponse, error)
+func (api *SettlementReporting) RetrieveSettlementRow(ctx, settlementRowId int64) (*SettlementRowResponse, error)

Models:

  • New: PaymentTxPayoutResponse, PayoutItem, PayoutCompletedItem (replaces SearchPayoutCompletedTransactionsResponse), SettlementRowResponse (replaces PayoutDetailResponse), SettlementRowItem, SearchPaymentTransactionPayoutsRequest, SearchPayoutCompletedItemsRequest (replaces SearchPayoutCompletedTransactionsRequest).
  • New enum types: MerchantType, SettlementSource, PayoutApprovalStatus, PayoutItemSubject, SettlementRowItemSubject.
  • Removed fields: Payout, MerchantPayoutAmount, SubMerchantMemberPayoutAmount, SubMerchantMemberPayoutRate from PaymentTransactionResponse; the same plus PayoutStatus from ReportingPaymentTransactionResponse.
  • Removed types: Payout, PayoutStatus, PayoutDetailTransactionResponse, RetrievePayoutDetailsRequest.
  • Added fields: FailedReasonCode on PaymentTransactionsApprovalResponse, SettlementRowId on PayoutRowResponse.
  • Sandbox tests moved from tests/payment_test.go to tests/settlement_test.go and tests/settlement_reporting_test.go.

Evidence

  • Before: the client calls the old payment-side approval/update endpoints and reads payout data from payment responses.
  • After: rebased on master (one conflict in adapter/payment.go: kept the upstream RetrieveBnplOffers return type and dropped the three methods that moved to Settlement); go build ./... and go vet ./... pass. The tests in tests/ call the sandbox and were not run.

Merge Danger

Door: one-way
Blast Radius: merchants

Compile-time breaks for users who call ApprovePaymentTransactions, DisapprovePaymentTransactions or UpdatePaymentTransaction on Payment (now on Settlement), SearchPayoutCompletedTransactions or RetrievePayoutDetails, or use any removed field or type above. Runtime: nothing changes for code still on an older client version; the old endpoints keep working until their announced shutdown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant