diff --git a/src/CheckoutSdk/Common/AccountHolder.cs b/src/CheckoutSdk/Common/AccountHolder.cs index fa104320..9fa13a47 100644 --- a/src/CheckoutSdk/Common/AccountHolder.cs +++ b/src/CheckoutSdk/Common/AccountHolder.cs @@ -32,5 +32,7 @@ public class AccountHolder public AccountHolderIdentification Identification { get; set; } + public bool AccountNameInquiry { get; set; } + } } \ No newline at end of file diff --git a/src/CheckoutSdk/Common/PaymentSourceType.cs b/src/CheckoutSdk/Common/PaymentSourceType.cs index 1492f5bd..550835fd 100644 --- a/src/CheckoutSdk/Common/PaymentSourceType.cs +++ b/src/CheckoutSdk/Common/PaymentSourceType.cs @@ -8,6 +8,7 @@ public enum PaymentSourceType [EnumMember(Value = "id")] Id, [EnumMember(Value = "network_token")] NetworkToken, [EnumMember(Value = "token")] Token, + [EnumMember(Value = "ach")] Ach, [EnumMember(Value = "customer")] Customer, [EnumMember(Value = "provider_token")] ProviderToken, [EnumMember(Value = "dLocal")] DLocal, @@ -26,11 +27,14 @@ public enum PaymentSourceType [EnumMember(Value = "alipay")] Alipay, [EnumMember(Value = "paypal")] PayPal, [EnumMember(Value = "multibanco")] Multibanco, + [EnumMember(Value = "octopus")] Octopus, + [EnumMember(Value = "plaid")] Plaid, [EnumMember(Value = "eps")] EPS, [EnumMember(Value = "illicado")] Illicado, [EnumMember(Value = "poli")] Poli, [EnumMember(Value = "p24")] Przelewy24, [EnumMember(Value = "benefitpay")] BenefitPay, + [EnumMember(Value = "bizum")] Bizum, [EnumMember(Value = "bancontact")] Bancontact, [EnumMember(Value = "tamara")] Tamara, [EnumMember(Value = "bank_account")] BankAccount, @@ -51,6 +55,7 @@ public enum PaymentSourceType [EnumMember(Value = "alma")] Alma, [EnumMember(Value = "trustly")] Trustly, [EnumMember(Value = "cvconnect")] Cvconnect, - [EnumMember(Value = "sepa")] Sepa + [EnumMember(Value = "sepa")] Sepa, + [EnumMember(Value = "sequra")] Sequra } } \ No newline at end of file diff --git a/src/CheckoutSdk/Payments/Request/Source/Apm/RequestAchSource.cs b/src/CheckoutSdk/Payments/Request/Source/Apm/RequestAchSource.cs new file mode 100644 index 00000000..64b562b8 --- /dev/null +++ b/src/CheckoutSdk/Payments/Request/Source/Apm/RequestAchSource.cs @@ -0,0 +1,21 @@ +using Checkout.Common; + +namespace Checkout.Payments.Request.Source.Apm +{ + public class RequestAchSource : AbstractRequestSource + { + public AccountType? AccountType { get; set; } + + public CountryCode? Country { get; set; } + + public string AccountNumber { get; set; } + + public string BankCode { get; set; } + + public AccountHolder AccountHolder { get; set; } + + public RequestAchSource() : base(PaymentSourceType.Ach) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Payments/Request/Source/Apm/RequestBizumSource.cs b/src/CheckoutSdk/Payments/Request/Source/Apm/RequestBizumSource.cs new file mode 100644 index 00000000..d35ea19a --- /dev/null +++ b/src/CheckoutSdk/Payments/Request/Source/Apm/RequestBizumSource.cs @@ -0,0 +1,13 @@ +using Checkout.Common; + +namespace Checkout.Payments.Request.Source.Apm +{ + public class RequestBizumSource : AbstractRequestSource + { + public string MobileNumber { get; set; } + + public RequestBizumSource() : base(PaymentSourceType.Bizum) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Payments/Request/Source/Apm/RequestEpsSource.cs b/src/CheckoutSdk/Payments/Request/Source/Apm/RequestEpsSource.cs index a472ce07..e4f4602b 100644 --- a/src/CheckoutSdk/Payments/Request/Source/Apm/RequestEpsSource.cs +++ b/src/CheckoutSdk/Payments/Request/Source/Apm/RequestEpsSource.cs @@ -5,6 +5,8 @@ namespace Checkout.Payments.Request.Source.Apm public class RequestEpsSource : AbstractRequestSource { public string Purpose { get; set; } + + public AccountHolder AccountHolder { get; set; } public RequestEpsSource() : base(PaymentSourceType.EPS) { diff --git a/src/CheckoutSdk/Payments/Request/Source/Apm/RequestOctopusSource.cs b/src/CheckoutSdk/Payments/Request/Source/Apm/RequestOctopusSource.cs new file mode 100644 index 00000000..6e2cd91e --- /dev/null +++ b/src/CheckoutSdk/Payments/Request/Source/Apm/RequestOctopusSource.cs @@ -0,0 +1,11 @@ +using Checkout.Common; + +namespace Checkout.Payments.Request.Source.Apm +{ + public class RequestOctopusSource : AbstractRequestSource + { + public RequestOctopusSource() : base(PaymentSourceType.Octopus) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Payments/Request/Source/Apm/RequestPlaidSource.cs b/src/CheckoutSdk/Payments/Request/Source/Apm/RequestPlaidSource.cs new file mode 100644 index 00000000..610e2151 --- /dev/null +++ b/src/CheckoutSdk/Payments/Request/Source/Apm/RequestPlaidSource.cs @@ -0,0 +1,15 @@ +using Checkout.Common; + +namespace Checkout.Payments.Request.Source.Apm +{ + public class RequestPlaidSource : AbstractRequestSource + { + public string Token { get; set; } + + public AccountHolder AccountHolder { get; set; } + + public RequestPlaidSource() : base(PaymentSourceType.Plaid) + { + } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Payments/Request/Source/Apm/RequestSepaSource.cs b/src/CheckoutSdk/Payments/Request/Source/Apm/RequestSepaSource.cs index 7c163a68..2c0ce400 100644 --- a/src/CheckoutSdk/Payments/Request/Source/Apm/RequestSepaSource.cs +++ b/src/CheckoutSdk/Payments/Request/Source/Apm/RequestSepaSource.cs @@ -21,5 +21,6 @@ public RequestSepaSource() : base(PaymentSourceType.Sepa) public string DateOfSignature { get; set; } public AccountHolder AccountHolder { get; set; } + } } \ No newline at end of file diff --git a/src/CheckoutSdk/Payments/Request/Source/Apm/RequestSequraSource.cs b/src/CheckoutSdk/Payments/Request/Source/Apm/RequestSequraSource.cs new file mode 100644 index 00000000..4e5e4df7 --- /dev/null +++ b/src/CheckoutSdk/Payments/Request/Source/Apm/RequestSequraSource.cs @@ -0,0 +1,13 @@ +using Checkout.Common; + +namespace Checkout.Payments.Request.Source.Apm +{ + public class RequestSequraSource : AbstractRequestSource + { + public RequestSequraSource() : base(PaymentSourceType.Sequra) + { + } + + public Address BillingAddress { get; set; } + } +} \ No newline at end of file diff --git a/src/CheckoutSdk/Payments/Request/Source/RequestCardSource.cs b/src/CheckoutSdk/Payments/Request/Source/RequestCardSource.cs index e5c22e04..9edbbbc2 100644 --- a/src/CheckoutSdk/Payments/Request/Source/RequestCardSource.cs +++ b/src/CheckoutSdk/Payments/Request/Source/RequestCardSource.cs @@ -25,5 +25,8 @@ public RequestCardSource() : base(PaymentSourceType.Card) public Address BillingAddress { get; set; } public Phone Phone { get; set; } + + public AccountHolder AccountHolder { get; set; } + } } \ No newline at end of file diff --git a/src/CheckoutSdk/Payments/Request/Source/RequestCustomerSource.cs b/src/CheckoutSdk/Payments/Request/Source/RequestCustomerSource.cs index 9db2dbb8..cb15ebba 100644 --- a/src/CheckoutSdk/Payments/Request/Source/RequestCustomerSource.cs +++ b/src/CheckoutSdk/Payments/Request/Source/RequestCustomerSource.cs @@ -9,6 +9,8 @@ public RequestCustomerSource() : base(PaymentSourceType.Customer) } public string Id { get; set; } + + public AccountHolder AccountHolder { get; set; } } } \ No newline at end of file diff --git a/src/CheckoutSdk/Payments/Request/Source/RequestIdSource.cs b/src/CheckoutSdk/Payments/Request/Source/RequestIdSource.cs index 121d2077..1f53e860 100644 --- a/src/CheckoutSdk/Payments/Request/Source/RequestIdSource.cs +++ b/src/CheckoutSdk/Payments/Request/Source/RequestIdSource.cs @@ -17,5 +17,8 @@ public RequestIdSource() : base(PaymentSourceType.Id) public bool? Stored { get; set; } public bool? StoreForFutureUse { get; set; } + + public AccountHolder AccountHolder { get; set; } + } } \ No newline at end of file diff --git a/src/CheckoutSdk/Payments/Request/Source/RequestNetworkTokenSource.cs b/src/CheckoutSdk/Payments/Request/Source/RequestNetworkTokenSource.cs index a54b3477..094d5fb7 100644 --- a/src/CheckoutSdk/Payments/Request/Source/RequestNetworkTokenSource.cs +++ b/src/CheckoutSdk/Payments/Request/Source/RequestNetworkTokenSource.cs @@ -29,5 +29,8 @@ public RequestNetworkTokenSource() : base(PaymentSourceType.NetworkToken) public Address BillingAddress { get; set; } public Phone Phone { get; set; } + + public AccountHolder AccountHolder { get; set; } + } } \ No newline at end of file diff --git a/src/CheckoutSdk/Payments/Request/Source/RequestProviderTokenSource.cs b/src/CheckoutSdk/Payments/Request/Source/RequestProviderTokenSource.cs index f71127ea..4dce9474 100644 --- a/src/CheckoutSdk/Payments/Request/Source/RequestProviderTokenSource.cs +++ b/src/CheckoutSdk/Payments/Request/Source/RequestProviderTokenSource.cs @@ -13,5 +13,6 @@ public RequestProviderTokenSource() : base(PaymentSourceType.ProviderToken) public string Token { get; set; } public AccountHolder AccountHolder { get; set; } + } } \ No newline at end of file diff --git a/src/CheckoutSdk/Payments/Request/Source/RequestTokenSource.cs b/src/CheckoutSdk/Payments/Request/Source/RequestTokenSource.cs index d6dfafaa..193fbc7c 100644 --- a/src/CheckoutSdk/Payments/Request/Source/RequestTokenSource.cs +++ b/src/CheckoutSdk/Payments/Request/Source/RequestTokenSource.cs @@ -17,5 +17,8 @@ public RequestTokenSource() : base(PaymentSourceType.Token) public bool? Stored { get; set; } public bool? StoreForFutureUse { get; set; } + + public AccountHolder AccountHolder { get; set; } + } } \ No newline at end of file diff --git a/test/CheckoutSdkTest/Payments/AbstractPaymentsIntegrationTest.cs b/test/CheckoutSdkTest/Payments/AbstractPaymentsIntegrationTest.cs index 7114927a..c58eaac7 100644 --- a/test/CheckoutSdkTest/Payments/AbstractPaymentsIntegrationTest.cs +++ b/test/CheckoutSdkTest/Payments/AbstractPaymentsIntegrationTest.cs @@ -16,6 +16,7 @@ public abstract class AbstractPaymentsIntegrationTest : SandboxTestFixture protected const string IdempotencyKey = "test.net"; protected const string PayeeNotOnboarded = "payee_not_onboarded"; protected const string ApmServiceUnavailable = "apm_service_unavailable"; + protected const string ApmCurrencyNotSupported = "currency_not_supported"; protected AbstractPaymentsIntegrationTest(PlatformType platform = PlatformType.Default) : base(platform) { @@ -37,7 +38,8 @@ protected async Task MakeCardPayment(bool shouldCapture = false ExpiryMonth = TestCardSource.Visa.ExpiryMonth, Cvv = TestCardSource.Visa.Cvv, BillingAddress = GetAddress(), - Phone = GetPhone() + Phone = GetPhone(), + AccountHolder = GetAccountHolder() }; var customerRequest = new CustomerRequest {Email = GenerateRandomEmail(), Name = "Customer"}; diff --git a/test/CheckoutSdkTest/Payments/RequestApmPaymentsIntegrationTest.cs b/test/CheckoutSdkTest/Payments/RequestApmPaymentsIntegrationTest.cs index 38ca3c2b..9f41235c 100644 --- a/test/CheckoutSdkTest/Payments/RequestApmPaymentsIntegrationTest.cs +++ b/test/CheckoutSdkTest/Payments/RequestApmPaymentsIntegrationTest.cs @@ -271,7 +271,7 @@ private async Task ShouldMakeEpsPayment() { var request = new PaymentRequest { - Source = new RequestEpsSource { Purpose = "Mens black t-shirt L" }, + Source = new RequestEpsSource { AccountHolder = GetAccountHolder(), Purpose = "Mens black t-shirt L" }, Amount = 10L, Currency = Currency.EUR, Reference = "REFERENCE", @@ -282,13 +282,14 @@ private async Task ShouldMakeEpsPayment() await CheckErrorItem(async () => await DefaultApi.PaymentsClient().RequestPayment(request), PayeeNotOnboarded); } - + [Fact] private async Task ShouldMakeIllicadoPayment() { var request = new PaymentRequest { - Source = new RequestIllicadoSource { + Source = new RequestIllicadoSource + { BillingAddress = new Address { AddressLine1 = "Cecilia Chapman", @@ -314,11 +315,8 @@ await CheckErrorItem(async () => await DefaultApi.PaymentsClient().RequestPaymen private async Task ShouldMakeGiropayPayment() { var accountHolder = new AccountHolder { FirstName = "Firstname", LastName = "Lastname" }; - - var source = new RequestGiropaySource - { - AccountHolder = accountHolder, - }; + + var source = new RequestGiropaySource { AccountHolder = accountHolder, }; var request = new PaymentRequest { @@ -327,11 +325,7 @@ private async Task ShouldMakeGiropayPayment() Currency = Currency.EUR, Reference = "REFERENCE", Description = "Description", - Shipping = new ShippingDetails - { - Address = GetAddress(), - Phone = GetPhone(), - }, + Shipping = new ShippingDetails { Address = GetAddress(), Phone = GetPhone(), }, SuccessUrl = "https://testing.checkout.com/sucess", FailureUrl = "https://testing.checkout.com/failure", }; @@ -371,12 +365,11 @@ private async Task ShouldMakeKnetPayment() Source = new RequestKnetSource { Language = "en", - PaymentMethodDetails = new PaymentMethodDetails - { - DisplayName = "name", - Type = "type", - Network = "card_network" - } + PaymentMethodDetails = + new PaymentMethodDetails + { + DisplayName = "name", Type = "type", Network = "card_network" + } }, Currency = Currency.KWD, Amount = 100, @@ -406,9 +399,9 @@ private async Task ShouldMakeBancontactPayment() SuccessUrl = "https://testing.checkout.com/sucess", FailureUrl = "https://testing.checkout.com/failure" }; - + var response = await DefaultApi.PaymentsClient().RequestPayment(request); - + response.Id.ShouldNotBeNull(); response.Status.ShouldBe(PaymentStatus.Pending); response.Reference.ShouldNotBeNull(); @@ -534,9 +527,9 @@ private async Task ShouldMakePayPalPayment() SuccessUrl = "https://testing.checkout.com/sucess", FailureUrl = "https://testing.checkout.com/failure" }; - + var response = await DefaultApi.PaymentsClient().RequestPayment(request); - + response.Id.ShouldNotBeNull(); response.Status.ShouldBe(PaymentStatus.Pending); response.Reference.ShouldNotBeNull(); @@ -607,7 +600,7 @@ private async Task ShouldMakeCvConnectPayment() await CheckErrorItem(async () => await DefaultApi.PaymentsClient().RequestPayment(request), PayeeNotOnboarded); } - + [Fact] private async Task ShouldMakeSepaPayment() { @@ -633,5 +626,115 @@ private async Task ShouldMakeSepaPayment() await CheckErrorItem(async () => await DefaultApi.PaymentsClient().RequestPayment(request), ApmServiceUnavailable); } + + [Fact] + private async Task ShouldMakeAchPayment() + { + var request = new PaymentRequest + { + Source = new RequestAchSource + { + AccountType = AccountType.Savings, + Country = CountryCode.GB, + AccountNumber = "8784738748973829", + BankCode = "BANK", + AccountHolder = GetAccountHolder() + }, + Amount = 10L, + Currency = Currency.EUR, + ProcessingChannelId = System.Environment.GetEnvironmentVariable("CHECKOUT_PROCESSING_CHANNEL_ID"), + SuccessUrl = "https://testing.checkout.com/sucess", + FailureUrl = "https://testing.checkout.com/failure", + }; + + var response = await DefaultApi.PaymentsClient().RequestPayment(request); + + response.Id.ShouldNotBeNull(); + response.Status.ShouldBe(PaymentStatus.Pending); + var source = response.Source as AlternativePaymentSourceResponse; + source.ShouldNotBeNull(); + source.Type().ShouldBe(PaymentSourceType.Ach); + } + + [Fact] + private async Task ShouldMakeBizumPayment() + { + var request = new PaymentRequest + { + Source = new RequestBizumSource { MobileNumber = "+447700900986", }, + Amount = 10L, + Currency = Currency.EUR, + ProcessingChannelId = System.Environment.GetEnvironmentVariable("CHECKOUT_PROCESSING_CHANNEL_ID"), + SuccessUrl = "https://testing.checkout.com/sucess", + FailureUrl = "https://testing.checkout.com/failure", + }; + + await CheckErrorItem(async () => await DefaultApi.PaymentsClient().RequestPayment(request), + ApmServiceUnavailable); + } + + [Fact] + private async Task ShouldMakeOctopusPayment() + { + var request = new PaymentRequest + { + Source = new RequestOctopusSource(), + Amount = 10L, + Currency = Currency.USD, + ProcessingChannelId = System.Environment.GetEnvironmentVariable("CHECKOUT_PROCESSING_CHANNEL_ID"), + SuccessUrl = "https://testing.checkout.com/sucess", + FailureUrl = "https://testing.checkout.com/failure", + }; + + await CheckErrorItem(async () => await DefaultApi.PaymentsClient().RequestPayment(request), + ApmCurrencyNotSupported); + } + + [Fact] + private async Task ShouldMakePlaidPayment() + { + var request = new PaymentRequest + { + Source = new RequestPlaidSource + { + Token = "token", + AccountHolder = + new AccountHolder + { + FirstName = "John", + LastName = "Doe", + Phone = GetPhone(), + BillingAddress = GetAddress(), + Type = AccountHolderType.Individual, + AccountNameInquiry = false + } + }, + Amount = 10L, + Currency = Currency.USD, + ProcessingChannelId = System.Environment.GetEnvironmentVariable("CHECKOUT_PROCESSING_CHANNEL_ID"), + SuccessUrl = "https://testing.checkout.com/sucess", + FailureUrl = "https://testing.checkout.com/failure", + }; + + await CheckErrorItem(async () => await DefaultApi.PaymentsClient().RequestPayment(request), + PayeeNotOnboarded); + } + + [Fact] + private async Task ShouldMakeSequraPayment() + { + var request = new PaymentRequest + { + Source = new RequestSequraSource { BillingAddress = GetAddress() }, + Currency = Currency.EUR, + Amount = 10, + Reference = Guid.NewGuid().ToString(), + SuccessUrl = "https://testing.checkout.com/sucess", + FailureUrl = "https://testing.checkout.com/failure" + }; + + await CheckErrorItem(async () => await DefaultApi.PaymentsClient().RequestPayment(request), + PayeeNotOnboarded); + } } } \ No newline at end of file