From 5fc56fb66733a31d4511ae851bcf3f387e5127f9 Mon Sep 17 00:00:00 2001 From: Vincent Kok Date: Wed, 29 Jan 2025 13:03:19 +0100 Subject: [PATCH] Add support for reusable payment links (#415) --- .../Models/PaymentLink/Request/PaymentLinkRequest.cs | 7 +++++++ .../Models/PaymentLink/Response/PaymentLinkResponse.cs | 7 +++++++ tests/Mollie.Tests.Integration/Api/PaymentLinkTests.cs | 2 ++ 3 files changed, 16 insertions(+) diff --git a/src/Mollie.Api/Models/PaymentLink/Request/PaymentLinkRequest.cs b/src/Mollie.Api/Models/PaymentLink/Request/PaymentLinkRequest.cs index 7cccf2a7..be278d5a 100644 --- a/src/Mollie.Api/Models/PaymentLink/Request/PaymentLinkRequest.cs +++ b/src/Mollie.Api/Models/PaymentLink/Request/PaymentLinkRequest.cs @@ -32,6 +32,13 @@ public record PaymentLinkRequest /// public string? ProfileId { get; set; } + /// + /// Indicates whether the payment link is reusable. If this field is set to true, customers can make multiple + /// payments using the same link. If no value is specified, the field defaults to false, allowing only a single + /// payment per link. + /// + public bool? Reusable { get; set; } + /// /// The expiry date of the payment link in ISO 8601 format. For example: 2021-12-24T12:00:16+01:00. /// diff --git a/src/Mollie.Api/Models/PaymentLink/Response/PaymentLinkResponse.cs b/src/Mollie.Api/Models/PaymentLink/Response/PaymentLinkResponse.cs index 7d7c15ea..921f1ad4 100644 --- a/src/Mollie.Api/Models/PaymentLink/Response/PaymentLinkResponse.cs +++ b/src/Mollie.Api/Models/PaymentLink/Response/PaymentLinkResponse.cs @@ -53,6 +53,13 @@ public record PaymentLinkResponse /// public string? ProfileId { get; set; } + /// + /// Indicates whether the payment link is reusable. If this field is set to true, customers can make multiple + /// payments using the same link. If no value is specified, the field defaults to false, allowing only a single + /// payment per link. + /// + public bool? Reusable { get; set; } + /// /// The payment link’s date and time of creation, in ISO 8601 format. /// diff --git a/tests/Mollie.Tests.Integration/Api/PaymentLinkTests.cs b/tests/Mollie.Tests.Integration/Api/PaymentLinkTests.cs index b235381d..15571fa1 100644 --- a/tests/Mollie.Tests.Integration/Api/PaymentLinkTests.cs +++ b/tests/Mollie.Tests.Integration/Api/PaymentLinkTests.cs @@ -39,6 +39,7 @@ public async Task CanCreatePaymentLinkAndRetrieveIt() { Amount = new Amount(Currency.EUR, 50), WebhookUrl = DefaultWebhookUrl, RedirectUrl = DefaultRedirectUrl, + Reusable = true, ExpiresAt = DateTime.Now.AddDays(1) }; var createdPaymentLinkResponse = await _paymentLinkClient.CreatePaymentLinkAsync(paymentLinkRequest); @@ -55,6 +56,7 @@ public async Task CanCreatePaymentLinkAndRetrieveIt() { response.Description.ShouldBe(paymentLinkRequest.Description); response.RedirectUrl.ShouldBe(paymentLinkRequest.RedirectUrl); response.Archived.ShouldBeFalse(); + response.Reusable.ShouldBe(paymentLinkRequest.Reusable); }); verifyPaymentLinkResponse(createdPaymentLinkResponse);