From f50d1d9e8ff8c73dd631a8af70dbe5289a41970b Mon Sep 17 00:00:00 2001 From: Silviana Ghita Date: Mon, 2 Oct 2023 14:24:27 +0300 Subject: [PATCH] Integrated Ideal and Giropay mops --- MangoPay.SDK.Tests/BaseTest.cs | 8 ++-- MangoPay.SDK/Core/APIs/ApiBase.cs | 2 + MangoPay.SDK/Core/APIs/ApiPayIns.cs | 16 ++++++++ .../Core/Enumerations/PayInPaymentType.cs | 4 ++ .../Entities/GET/PayInGiropayWebDTO.cs | 14 +++++++ MangoPay.SDK/Entities/GET/PayInIdealWebDTO.cs | 17 ++++++++ .../Entities/POST/PayInGiropayWebPostDTO.cs | 35 +++++++++++++++++ .../Entities/POST/PayInIdealWebPostDTO.cs | 39 +++++++++++++++++++ 8 files changed, 132 insertions(+), 3 deletions(-) create mode 100644 MangoPay.SDK/Entities/GET/PayInGiropayWebDTO.cs create mode 100644 MangoPay.SDK/Entities/GET/PayInIdealWebDTO.cs create mode 100644 MangoPay.SDK/Entities/POST/PayInGiropayWebPostDTO.cs create mode 100644 MangoPay.SDK/Entities/POST/PayInIdealWebPostDTO.cs diff --git a/MangoPay.SDK.Tests/BaseTest.cs b/MangoPay.SDK.Tests/BaseTest.cs index e20470a..15d58e0 100644 --- a/MangoPay.SDK.Tests/BaseTest.cs +++ b/MangoPay.SDK.Tests/BaseTest.cs @@ -735,7 +735,8 @@ protected async Task GetPayInIdealWebPost() new Money { Amount = 20, Currency = CurrencyIso.EUR }, wallet.Id, "http://www.my-site.com/returnURL?transactionId=wt_71a08458-b0cc-468d-98f7-1302591fc238", - "mango@mangopay.com", + "RBRBNL21", + "Ideal tag", "Ideal test" ); @@ -753,8 +754,9 @@ protected async Task GetPayInGiropayWebPost() new Money { Amount = 20, Currency = CurrencyIso.EUR }, wallet.Id, "http://www.my-site.com/returnURL?transactionId=wt_71a08458-b0cc-468d-98f7-1302591fc238", - "mango@mangopay.com", - "Giropay test" + "Giropay tag", + "test" + ); return payIn; diff --git a/MangoPay.SDK/Core/APIs/ApiBase.cs b/MangoPay.SDK/Core/APIs/ApiBase.cs index bff54a8..8a74705 100644 --- a/MangoPay.SDK/Core/APIs/ApiBase.cs +++ b/MangoPay.SDK/Core/APIs/ApiBase.cs @@ -70,6 +70,8 @@ public abstract class ApiBase { MethodKey.PayinsSatispayWebCreate, new ApiEndPoint("/payins/payment-methods/satispay", RequestType.POST)}, { MethodKey.PayinsBlikWebCreate, new ApiEndPoint("/payins/payment-methods/blik", RequestType.POST)}, { MethodKey.PayinsKlarnaWebCreate, new ApiEndPoint("/payins/payment-methods/klarna", RequestType.POST)}, + { MethodKey.PayinsIdealWebCreate, new ApiEndPoint("/payins/payment-methods/ideal", RequestType.POST)}, + { MethodKey.PayinsGiropayWebCreate, new ApiEndPoint("/payins/payment-methods/giropay", RequestType.POST)}, { MethodKey.PayinsRecurringRegistration, new ApiEndPoint("/recurringpayinregistrations", RequestType.POST)}, { MethodKey.PayinsGetRecurringRegistration, new ApiEndPoint("/recurringpayinregistrations/{0}", RequestType.GET)}, diff --git a/MangoPay.SDK/Core/APIs/ApiPayIns.cs b/MangoPay.SDK/Core/APIs/ApiPayIns.cs index 942c54b..c77971c 100644 --- a/MangoPay.SDK/Core/APIs/ApiPayIns.cs +++ b/MangoPay.SDK/Core/APIs/ApiPayIns.cs @@ -310,6 +310,22 @@ public async Task GetKlarnaAsync(string payInId) { return await this.GetObjectAsync(MethodKey.PayinsGet, entitiesId: payInId); } + + /// Gets PayIn Ideal entity by its identifier. + /// PayIn identifier. + /// PayIn object returned from API. + public async Task GetIdealAsync(string payInId) + { + return await this.GetObjectAsync(MethodKey.PayinsGet, entitiesId: payInId); + } + + /// Gets PayIn Giropay entity by its identifier. + /// PayIn identifier. + /// PayIn object returned from API. + public async Task GetGiropayAsync(string payInId) + { + return await this.GetObjectAsync(MethodKey.PayinsGet, entitiesId: payInId); + } /// Creates refund for PayIn object. /// Idempotent key for this request. diff --git a/MangoPay.SDK/Core/Enumerations/PayInPaymentType.cs b/MangoPay.SDK/Core/Enumerations/PayInPaymentType.cs index c79a3f2..dd2144b 100644 --- a/MangoPay.SDK/Core/Enumerations/PayInPaymentType.cs +++ b/MangoPay.SDK/Core/Enumerations/PayInPaymentType.cs @@ -46,5 +46,9 @@ public enum PayInPaymentType BLIK, /// Klarna payment type KLARNA, + /// Ideal payment type + IDEAL, + /// Giropay payment type + GIROPAY, } } diff --git a/MangoPay.SDK/Entities/GET/PayInGiropayWebDTO.cs b/MangoPay.SDK/Entities/GET/PayInGiropayWebDTO.cs new file mode 100644 index 0000000..05a607e --- /dev/null +++ b/MangoPay.SDK/Entities/GET/PayInGiropayWebDTO.cs @@ -0,0 +1,14 @@ +namespace MangoPay.SDK.Entities.GET +{ + public class PayInGiropayWebDTO: PayInDTO + { + /// An optional value to be specified on the user's bank statement. + public string StatementDescriptor { get; set; } + + /// The URL to redirect to after the payment, whether the transaction was successful or not + public string ReturnURL { get; set; } + + /// The URL to which the user is redirected to complete the payment + public string RedirectURL { get; set; } + } +} \ No newline at end of file diff --git a/MangoPay.SDK/Entities/GET/PayInIdealWebDTO.cs b/MangoPay.SDK/Entities/GET/PayInIdealWebDTO.cs new file mode 100644 index 0000000..a4bccb3 --- /dev/null +++ b/MangoPay.SDK/Entities/GET/PayInIdealWebDTO.cs @@ -0,0 +1,17 @@ +namespace MangoPay.SDK.Entities.GET +{ + public class PayInIdealWebDTO : PayInDTO + { + /// An optional value to be specified on the user's bank statement. + public string StatementDescriptor { get; set; } + + /// The URL to redirect to after the payment, whether the transaction was successful or not + public string ReturnURL { get; set; } + + /// The URL to which the user is redirected to complete the payment + public string RedirectURL { get; set; } + + /// Name of the end-user’s bank + public string BankName { get; set; } + } +} \ No newline at end of file diff --git a/MangoPay.SDK/Entities/POST/PayInGiropayWebPostDTO.cs b/MangoPay.SDK/Entities/POST/PayInGiropayWebPostDTO.cs new file mode 100644 index 0000000..25161cf --- /dev/null +++ b/MangoPay.SDK/Entities/POST/PayInGiropayWebPostDTO.cs @@ -0,0 +1,35 @@ +namespace MangoPay.SDK.Entities.POST +{ + public class PayInGiropayWebPostDTO : EntityPostBase + { + public PayInGiropayWebPostDTO(string authorId, Money debitedFunds, Money fees, string creditedWalletId, + string returnUrl, string tag = null, string statementDescriptor = null) + { + AuthorId = authorId; + DebitedFunds = debitedFunds; + Fees = fees; + CreditedWalletId = creditedWalletId; + ReturnURL = returnUrl; + StatementDescriptor = statementDescriptor; + Tag = tag; + } + + /// Author identifier. + public string AuthorId { get; set; } + + /// Debited funds. + public Money DebitedFunds { get; set; } + + /// Fees. + public Money Fees { get; set; } + + /// Credited wallet identifier. + public string CreditedWalletId { get; set; } + + /// The URL to redirect to after the payment, whether the transaction was successful or not + public string ReturnURL { get; set; } + + /// An optional value to be specified on the user's bank statement. + public string StatementDescriptor { get; set; } + } +} \ No newline at end of file diff --git a/MangoPay.SDK/Entities/POST/PayInIdealWebPostDTO.cs b/MangoPay.SDK/Entities/POST/PayInIdealWebPostDTO.cs new file mode 100644 index 0000000..a6639e3 --- /dev/null +++ b/MangoPay.SDK/Entities/POST/PayInIdealWebPostDTO.cs @@ -0,0 +1,39 @@ +namespace MangoPay.SDK.Entities.POST +{ + public class PayInIdealWebPostDTO : EntityPostBase + { + public PayInIdealWebPostDTO(string authorId, Money debitedFunds, Money fees, string creditedWalletId, + string returnUrl, string bic, string tag = null, string statementDescriptor = null) + { + AuthorId = authorId; + DebitedFunds = debitedFunds; + Fees = fees; + CreditedWalletId = creditedWalletId; + ReturnURL = returnUrl; + Bic = bic; + StatementDescriptor = statementDescriptor; + Tag = tag; + } + + /// Author identifier. + public string AuthorId { get; set; } + + /// Debited funds. + public Money DebitedFunds { get; set; } + + /// Fees. + public Money Fees { get; set; } + + /// Credited wallet identifier. + public string CreditedWalletId { get; set; } + + /// The URL to redirect to after the payment, whether the transaction was successful or not + public string ReturnURL { get; set; } + + /// The BIC identifier of the end-user’s bank + public string Bic { get; set; } + + /// An optional value to be specified on the user's bank statement. + public string StatementDescriptor { get; set; } + } +} \ No newline at end of file