Skip to content

Commit

Permalink
[ACL-242] Add CreditableAt in GetPaymentResult
Browse files Browse the repository at this point in the history
  • Loading branch information
tl-Roberto-Mancinelli committed Dec 11, 2024
1 parent 99d7cc1 commit f67a0cf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
9 changes: 6 additions & 3 deletions src/TrueLayer/Payments/Model/GetPaymentResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,21 @@ public record Authorizing : PaymentDetails;

/// <summary>
/// Represents a payment that has been authorized by the end user
/// <param name="CreditableAt">The date and time that TrueLayer determined that the payment was ready to be credited</param>
/// </summary>
/// <returns></returns>
[JsonDiscriminator("authorized")]
public record Authorized : PaymentDetails;
public record Authorized(DateTime? CreditableAt) : PaymentDetails;

/// <summary>
/// Represents a payment that has been executed
/// For open loop payments this state is terminal. For closed-loop payments, wait for Settled.
/// </summary>
/// <param name="ExecutedAt">The date and time the payment executed</param>
/// <param name="CreditableAt">The date and time that TrueLayer determined that the payment was ready to be credited</param>
/// <returns></returns>
[JsonDiscriminator("executed")]
public record Executed(DateTime ExecutedAt) : PaymentDetails;
public record Executed(DateTime ExecutedAt, DateTime? CreditableAt) : PaymentDetails;

/// <summary>
/// Represents a payment that has settled
Expand All @@ -97,9 +99,10 @@ public record Executed(DateTime ExecutedAt) : PaymentDetails;
/// <param name="ExecutedAt">The date and time the payment executed</param>
/// <param name="SettledAt">The date and time the payment was settled</param>
/// <param name="PaymentSource">Details of the source of funds for the payment</param>
/// <param name="CreditableAt">The date and time that TrueLayer determined that the payment was ready to be credited</param>
/// <returns></returns>
[JsonDiscriminator("settled")]
public record Settled(DateTime ExecutedAt, DateTime SettledAt, PaymentSource PaymentSource) : PaymentDetails;
public record Settled(DateTime ExecutedAt, DateTime SettledAt, PaymentSource PaymentSource, DateTime? CreditableAt) : PaymentDetails;

/// <summary>
/// Represents a payment that failed to complete. This is a terminal state.
Expand Down
10 changes: 5 additions & 5 deletions test/TrueLayer.AcceptanceTests/PaymentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public PaymentTests(ApiTestFixture fixture)

[Theory]
[MemberData(nameof(ExternalAccountPaymentRequests))]
public async Task can_create_external_account_payment(CreatePaymentRequest paymentRequest)
public async Task Can_Create_External_Account_Payment(CreatePaymentRequest paymentRequest)
{
var response = await _fixture.Client.Payments.CreatePayment(
paymentRequest, idempotencyKey: Guid.NewGuid().ToString());
Expand Down Expand Up @@ -139,7 +139,7 @@ public async Task can_create_merchant_account_gbp_verification_Payment()
}

[Fact]
public async Task can_create_merchant_account_eur_Payment()
public async Task Can_Create_Merchant_Account_Eur_Payment()
{
var paymentRequest = CreateTestPaymentRequest(
new Provider.Preselected("mock-payments-fr-redirect",
Expand Down Expand Up @@ -169,7 +169,7 @@ public async Task can_create_merchant_account_eur_Payment()
}

[Fact]
public async Task Can_create_payment_with_auth_flow()
public async Task Can_Create_payment_with_auth_flow()
{
var sortCodeAccountNumber = new AccountIdentifier.SortCodeAccountNumber("567890", "12345678");
var providerSelection = new Provider.Preselected("mock-payments-gb-redirect", "faster_payments_service")
Expand Down Expand Up @@ -204,7 +204,7 @@ public async Task Can_create_payment_with_auth_flow()

[Theory]
[MemberData(nameof(ExternalAccountPaymentRequests))]
public async Task Can_get_authorization_required_payment(CreatePaymentRequest paymentRequest)
public async Task Can_Get_Authorization_Required_Payment(CreatePaymentRequest paymentRequest)
{
var response = await _fixture.Client.Payments.CreatePayment(
paymentRequest, idempotencyKey: Guid.NewGuid().ToString());
Expand Down Expand Up @@ -250,7 +250,7 @@ var getPaymentResponse
}

[Fact]
public async Task Can_create_payment_with_retry_option_and_get_attemptFailed_error()
public async Task Can_Create_Payment_With_Retry_Option_And_Get_AttemptFailed_Error()
{
// Arrange
var paymentRequest = CreateTestPaymentRequest(
Expand Down

0 comments on commit f67a0cf

Please sign in to comment.