From 8a56ef87c1b89154c5bb4509358535d9187a14a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Armando=20Rodr=C3=ADguez?= <127134616+armando-rodriguez-cko@users.noreply.github.com> Date: Thu, 12 Jun 2025 16:46:51 +0200 Subject: [PATCH] Add retry configuration for payment requests with Dunning and Downtime classes --- src/CheckoutSdk/Payments/Downtime.cs | 11 +++++++++++ src/CheckoutSdk/Payments/Dunning.cs | 16 ++++++++++++++++ .../Payments/Request/PaymentRequest.cs | 4 ++-- src/CheckoutSdk/Payments/RetryRequest.cs | 11 +++++++++++ 4 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 src/CheckoutSdk/Payments/Downtime.cs create mode 100644 src/CheckoutSdk/Payments/Dunning.cs create mode 100644 src/CheckoutSdk/Payments/RetryRequest.cs diff --git a/src/CheckoutSdk/Payments/Downtime.cs b/src/CheckoutSdk/Payments/Downtime.cs new file mode 100644 index 00000000..d5209899 --- /dev/null +++ b/src/CheckoutSdk/Payments/Downtime.cs @@ -0,0 +1,11 @@ +namespace Checkout.Payments +{ + public class Downtime + { + /// + /// Indicates if Checkout.com retries the payment when it's declined due to issuer or acquirer downtime + /// (Required) + /// + public bool Enabled { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Payments/Dunning.cs b/src/CheckoutSdk/Payments/Dunning.cs new file mode 100644 index 00000000..73a1541f --- /dev/null +++ b/src/CheckoutSdk/Payments/Dunning.cs @@ -0,0 +1,16 @@ +namespace Checkout.Payments +{ + public class Dunning + { + /// + /// Indicates if Checkout.com retries the payment when it's declined with a supported decline code (Required) + /// + public bool Enabled { get; set; } + + /// (Optional, [ 1 .. 15 ], default: 6) + public int? MaxAttempts { get; set; } = 6; + + /// (Optional, [ 1 .. 60 ] default: 30) + public int? EndAfterDays { get; set; } = 30; + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Payments/Request/PaymentRequest.cs b/src/CheckoutSdk/Payments/Request/PaymentRequest.cs index 562d5361..23d7ba33 100644 --- a/src/CheckoutSdk/Payments/Request/PaymentRequest.cs +++ b/src/CheckoutSdk/Payments/Request/PaymentRequest.cs @@ -72,10 +72,10 @@ public class PaymentRequest public IList Items { get; set; } - public PaymentRetryRequest Retry { get; set; } + public RetryRequest Retry { get; set; } public IDictionary Metadata { get; set; } = new Dictionary(); public PaymentInstruction Instruction { get; set; } } -} \ No newline at end of file +} diff --git a/src/CheckoutSdk/Payments/RetryRequest.cs b/src/CheckoutSdk/Payments/RetryRequest.cs new file mode 100644 index 00000000..bbf7a6ba --- /dev/null +++ b/src/CheckoutSdk/Payments/RetryRequest.cs @@ -0,0 +1,11 @@ +namespace Checkout.Payments +{ + public class RetryRequest + { + /// Configuration of asynchronous Dunning retries (Optional) + public Dunning Dunning { get; set; } + + /// Configuration of asynchronous Downtime retries (Optional) + public Downtime Downtime { get; set; } + } +} \ No newline at end of file