Skip to content

Commit

Permalink
[ACL-245] Add support for scheme selection override fields (#238)
Browse files Browse the repository at this point in the history
  • Loading branch information
tl-Roberto-Mancinelli authored Dec 18, 2024
1 parent 89fa3a5 commit 22de350
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
24 changes: 24 additions & 0 deletions src/TrueLayer/Payments/Model/SchemeSelection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ public record InstantOnly : IDiscriminated
/// Unless explicitly set, will default to false.
/// </summary>
public bool AllowRemitterFee { get; init; } = false;

/// <summary>
/// An array of provider ids. If the user selects one of the providers specified in this list,
/// the payment always goes through an instant scheme. This ignores any settings you specify for allow_remitter_fee.
/// </summary>
public string[]? InstantOverrideProviderIds { get; init; }

/// <summary>
/// An array of provider ids. If the user selects one of the providers specified in this list,
/// the payment always goes through a non instant scheme. This ignores any settings you specify for allow_remitter_fee.
/// </summary>
public string[]? NonInstantOverrideProviderIds { get; init; }
}

/// <summary>
Expand All @@ -45,6 +57,18 @@ public record InstantPreferred : IDiscriminated
/// Unless explicitly set, will default to false.
/// </summary>
public bool AllowRemitterFee { get; init; } = false;

/// <summary>
/// An array of provider ids. If the user selects one of the providers specified in this list,
/// the payment always goes through an instant scheme. This ignores any settings you specify for allow_remitter_fee.
/// </summary>
public string[]? InstantOverrideProviderIds { get; init; }

/// <summary>
/// An array of provider ids. If the user selects one of the providers specified in this list,
/// the payment always goes through a non instant scheme. This ignores any settings you specify for allow_remitter_fee.
/// </summary>
public string[]? NonInstantOverrideProviderIds { get; init; }
}

/// <summary>
Expand Down
14 changes: 12 additions & 2 deletions test/TrueLayer.AcceptanceTests/PaymentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,12 @@ public static IEnumerable<object[]> ExternalAccountPaymentRequests()
CreateTestPaymentRequest(new Provider.UserSelected
{
Filter = providerFilterMockGbRedirect,
SchemeSelection = new SchemeSelection.InstantOnly { AllowRemitterFee = false },
SchemeSelection = new SchemeSelection.InstantOnly
{
AllowRemitterFee = false,
InstantOverrideProviderIds = ["mock-payments-gb-redirect"],
NonInstantOverrideProviderIds = ["mock-payments-de-redirect"]
},
},
sortCodeAccountNumber)
];
Expand All @@ -543,7 +548,12 @@ public static IEnumerable<object[]> ExternalAccountPaymentRequests()
CreateTestPaymentRequest(new Provider.UserSelected
{
Filter = providerFilterMockGbRedirect,
SchemeSelection = new SchemeSelection.InstantPreferred { AllowRemitterFee = true },
SchemeSelection = new SchemeSelection.InstantPreferred
{
AllowRemitterFee = true,
InstantOverrideProviderIds = ["mock-payments-de-embedded"],
NonInstantOverrideProviderIds = ["mock-payments-de-redirect"]
},
},
sortCodeAccountNumber)
];
Expand Down

0 comments on commit 22de350

Please sign in to comment.