Skip to content

Conversation

@armando-rodriguez-cko
Copy link
Contributor

This pull request introduces support for reversing payments in the SDK, allowing clients to return funds to customers by performing the appropriate payment action based on the payment's status. It adds new request and response models, updates the payments client interface and implementation, and provides comprehensive unit tests to validate the new functionality.

Payment reversal feature

  • Added ReverseAPaymentRequest and ReverseAPaymentResponse models to represent the request and response for reversing a payment. These models include fields for internal references, metadata, and action identifiers. (src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPaymentsIdReversals/Requests/ReverseAPaymentRequest/ReverseAPaymentRequest.cs, src/CheckoutSdk/HandlePaymentsAndPayouts/Payments/POSTPaymentsIdReversals/Responses/ReverseAPaymentResponse/ReverseAPaymentResponse.cs) [1] [2]
  • Updated the IPaymentsClient interface to include the new ReverseAPayment method, supporting optional request objects, idempotency keys, and cancellation tokens. (src/CheckoutSdk/Payments/IPaymentsClient.cs)
  • Implemented the ReverseAPayment method in PaymentsClient, including parameter validation and API client integration for posting reversal requests. (src/CheckoutSdk/Payments/PaymentsClient.cs)

OAuth scope extension

  • Added a new OAuth scope gateway:payment-cancellations to the OAuthScope enum to support authorization for payment reversals. (src/CheckoutSdk/OAuthScope.cs)

Testing

  • Added a suite of unit tests in HandleReversalsClientTest to verify successful reversals, error handling for invalid payment IDs, idempotency behavior, and cancellation token support. (test/CheckoutSdkTest/HandlePaymentsAndPayouts/Payments/POSTPaymentsIdReversals/HandleReversalsClientTest.cs)

@armando-rodriguez-cko armando-rodriguez-cko requested a review from a team September 1, 2025 10:52
@armando-rodriguez-cko armando-rodriguez-cko marked this pull request as ready for review September 1, 2025 10:52
@armando-rodriguez-cko armando-rodriguez-cko force-pushed the feature/add-payment-reversal-support branch from 9bdcde0 to 172b9d3 Compare September 1, 2025 11:30
@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 1, 2025

@armando-rodriguez-cko armando-rodriguez-cko merged commit 7471869 into master Sep 1, 2025
12 of 19 checks passed
@armando-rodriguez-cko armando-rodriguez-cko deleted the feature/add-payment-reversal-support branch September 1, 2025 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants