Skip to content

[ACL-252] Add support for scheme_id in merchant account transactions#247

Closed
federico1525 wants to merge 4 commits intomainfrom
feature/acl-252-scheme-id-support
Closed

[ACL-252] Add support for scheme_id in merchant account transactions#247
federico1525 wants to merge 4 commits intomainfrom
feature/acl-252-scheme-id-support

Conversation

@federico1525
Copy link
Contributor

Summary

  • Added SchemeId property to ExecutedPayout and Refund transaction models in merchant account transactions endpoint
  • The SchemeId field identifies the payment scheme used for outbound transactions (payouts and refunds)
  • Supports all TrueLayer payment schemes: faster_payments_service, sepa_credit_transfer, sepa_credit_transfer_instant, etc.

Changes Made

  • Models: Added nullable string? SchemeId parameter to ExecutedPayout and Refund records in GetTransactions.cs
  • Tests: Updated acceptance tests to validate SchemeId field with expected payment scheme enum values
  • Documentation: Added new README section with usage examples for merchant account transactions
  • Changelog: Updated with new feature entry

Test Plan

  • Build passes without errors
  • Unit tests pass (193/193)
  • Acceptance tests updated with proper validation
  • Code formatting applied
  • Documentation updated with usage examples

The implementation follows the OpenAPI specification structure and maintains backward compatibility as the field is nullable.

🤖 Generated with Claude Code

federico1525 and others added 4 commits June 12, 2025 16:53
- 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>
@federico1525 federico1525 requested review from a team as code owners July 1, 2025 19:52
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 SchemeId in ExecutedPayout and Refund records.
  • 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 SchemeId is 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)
Copy link

Copilot AI Jul 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
string PaymentId,
string ReturnedBy)
string ReturnedBy,
string? SchemeId)
Copy link

Copilot AI Jul 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, the SchemeId on the Refund record needs a [property: JsonPropertyName("scheme_id")] attribute so JSON scheme_id maps correctly during deserialization.

Copilot uses AI. Check for mistakes.
{
executedPayout.SchemeId.Should().NotBeNullOrWhiteSpace();
// Validate it matches expected payment scheme enum values
var validSchemes = new[]
Copy link

Copilot AI Jul 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Copilot uses AI. Check for mistakes.
@dili91 dili91 closed this Aug 7, 2025
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