[ACL-252] Add support for scheme_id in merchant account transactions#247
[ACL-252] Add support for scheme_id in merchant account transactions#247federico1525 wants to merge 4 commits intomainfrom
Conversation
- Add UltimateCounterparty base classes with business_client and business_division types - Add PaymentSubMerchants model supporting both counterparty types with required ultimate_counterparty - Add PayoutSubMerchants model supporting only business_client type with optional ultimate_counterparty - Add SubMerchants property to CreatePaymentRequest, GetPaymentResponse.PaymentDetails, and CreatePayoutRequest - Update .gitignore to exclude Claude Code configuration files 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add PaymentSubMerchants property to GetPayoutsResponse.PayoutDetails - Add sub_merchant test cases for Payments with business_client and business_division types - Add sub_merchant test cases for Payouts with business_client type - Update RequestBuilders with helper methods for creating test sub_merchant objects - Verify sub_merchant data serialization and API integration in acceptance tests
- Add JsonPropertyName attributes with snake_case property names - Fix ultimate_counterparty, commercial_name, registration_number, mcc, address, id, name, type properties - Fix sub_merchants property name in requests and responses - Ensure proper API compliance with OpenAPI v3 specifications
- Add SchemeId property to ExecutedPayout and Refund transaction models - Update acceptance tests to validate SchemeId field with expected payment scheme values - Add documentation and usage examples for the new SchemeId field - Update CHANGELOG.md with new feature 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for the SchemeId field to merchant account transaction models and propagates it through tests, documentation, and changelog.
- Introduces nullable
SchemeIdinExecutedPayoutandRefundrecords. - Updates acceptance tests to validate scheme identifiers and adds helper methods for sub-merchant request building.
- Updates README and CHANGELOG to document and record the new feature.
Reviewed Changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/TrueLayer.AcceptanceTests/RequestBuilders.cs | Added factory methods for building payment/payout sub-merchant objects |
| test/TrueLayer.AcceptanceTests/PayoutTests.cs | Added tests for creating payouts with and without sub-merchants |
| test/TrueLayer.AcceptanceTests/PaymentTests.cs | Added tests for creating payments with business client/division sub-merchants |
| test/TrueLayer.AcceptanceTests/MerchantAccountsTests.cs | Validates SchemeId against allowed schemes in transaction assertions |
| src/TrueLayer/Payouts/Model/SubMerchants.cs | Introduced PayoutSubMerchants model |
| src/TrueLayer/Payouts/Model/GetPayoutsResponse.cs | Added SubMerchants to PayoutDetails |
| src/TrueLayer/Payouts/Model/CreatePayoutRequest.cs | Added subMerchants parameter and JSON mapping |
| src/TrueLayer/Payments/Model/SubMerchants.cs | Introduced PaymentSubMerchants model |
| src/TrueLayer/Payments/Model/GetPaymentResponse.cs | Added SubMerchants to PaymentDetails |
| src/TrueLayer/Payments/Model/CreatePaymentRequest.cs | Added subMerchants parameter and JSON mapping |
| src/TrueLayer/MerchantAccounts/Model/GetTransactions.cs | Added SchemeId to ExecutedPayout and Refund records |
| README.md | Documented usage example for SchemeId |
| CHANGELOG.md | Recorded new feature entry for SchemeId support |
Comments suppressed due to low confidence (1)
test/TrueLayer.AcceptanceTests/MerchantAccountsTests.cs:159
- [nitpick] Consider adding a test case where
SchemeIdis not returned (null) to exercise the guard branch and ensure no unexpected errors occur when the field is absent.
if (executedPayout.SchemeId != null)
| string PayoutId, | ||
| string ReturnedBy) | ||
| string ReturnedBy, | ||
| string? SchemeId) |
There was a problem hiding this comment.
The new SchemeId property lacks a JSON mapping attribute, which may prevent deserialization of the JSON field scheme_id. Add [property: JsonPropertyName("scheme_id")] before the parameter to ensure correct binding.
| string PaymentId, | ||
| string ReturnedBy) | ||
| string ReturnedBy, | ||
| string? SchemeId) |
There was a problem hiding this comment.
Similarly, the SchemeId on the Refund record needs a [property: JsonPropertyName("scheme_id")] attribute so JSON scheme_id maps correctly during deserialization.
| { | ||
| executedPayout.SchemeId.Should().NotBeNullOrWhiteSpace(); | ||
| // Validate it matches expected payment scheme enum values | ||
| var validSchemes = new[] |
There was a problem hiding this comment.
[nitpick] The validSchemes array is duplicated in both ExecutedPayout and Refund assertions. Extract it to a shared constant or helper to reduce duplication and simplify future updates.
Summary
SchemeIdproperty toExecutedPayoutandRefundtransaction models in merchant account transactions endpointSchemeIdfield identifies the payment scheme used for outbound transactions (payouts and refunds)Changes Made
string? SchemeIdparameter toExecutedPayoutandRefundrecords inGetTransactions.csSchemeIdfield with expected payment scheme enum valuesTest Plan
The implementation follows the OpenAPI specification structure and maintains backward compatibility as the field is nullable.
🤖 Generated with Claude Code