Skip to content

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

Open
tuncaserhat wants to merge 1 commit into
masterfrom
settlement-payout-apis
Open

tuncaserhat wants to merge 1 commit 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

 PaymentAdapter
-  approve_payment_transactions(request)
-  disapprove_payment_transactions(request)
-  update_payment_transaction(request) -> PaymentTransactionResponse

 SettlementAdapter
+  approve_payment_transactions(request) -> PaymentTransactionApprovalListResponse
+  disapprove_payment_transactions(request) -> PaymentTransactionApprovalListResponse
+  update_payment_transaction(request) -> PaymentTxPayoutResponse

 SettlementReportingAdapter
+  retrieve_payment_transaction_payout(payment_transaction_id) -> PaymentTxPayoutResponse
+  search_payment_transaction_payouts(request) -> PaymentTxPayoutListResponse
-  search_payout_completed_transactions(request) -> PayoutCompletedTransactionListResponse
+  search_payout_completed_items(request) -> PayoutCompletedItemListResponse
-  retrieve_payout_details(id) -> PayoutDetailResponse
+  retrieve_settlement_row(settlement_row_id) -> SettlementRowResponse

Models:

  • New: PaymentTxPayoutResponse, PaymentTxPayoutListResponse, PayoutItem, PayoutCompletedItem (replaces PayoutCompletedTransaction), PayoutCompletedItemListResponse, SettlementRowResponse (replaces PayoutDetailResponse), SettlementRowItem, SearchPaymentTransactionPayoutsRequest, SearchPayoutCompletedItemsRequest (replaces SearchPayoutCompletedTransactionsRequest).
  • New enums: PayoutApprovalStatus, PayoutItemSubject, SettlementRowItemSubject. TransactionPayoutStatus gains ELIMINATED_BY_FULLY_REFUND.
  • Removed fields: payout, merchant_payout_amount, sub_merchant_member_payout_amount, sub_merchant_member_payout_rate from PaymentTransaction; payout_status from ReportingPaymentTransaction.
  • Removed classes: PaymentTransactionResponse, Payout, PayoutStatus, PayoutDetailTransaction, PayoutCompletedTransactionListResponse.
  • Added fields: failed_reason_code on PaymentTransactionApproval, settlement_row_id on PayoutRow.
  • Samples moved from test_payment_sample.py to test_settlement_sample.py and test_settlement_reporting_sample.py.

Evidence

  • Before: the client calls the old payment-side approval/update endpoints and reads payout data from payment responses.
  • After: rebased on master; python -m compileall craftgate tests passes, the offline unit tests (tests.test_client_version, tests.test_idempotency, 18 tests) pass, and the changed sample modules import cleanly. Samples were not run against the sandbox.

Merge Danger

Door: one-way
Blast Radius: merchants

Python has no compile step, so the breaks show at runtime after upgrading: importing a removed class raises ImportError, calling the moved or renamed methods on the old adapter raises AttributeError, and reading a removed field raises AttributeError. Type checkers flag the same spots ahead of time. 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