Skip to content

Commit

Permalink
Integrated Ideal and Giropay mops
Browse files Browse the repository at this point in the history
  • Loading branch information
Silviana Ghita committed Oct 2, 2023
1 parent e6fd8a7 commit f50d1d9
Show file tree
Hide file tree
Showing 8 changed files with 132 additions and 3 deletions.
8 changes: 5 additions & 3 deletions MangoPay.SDK.Tests/BaseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,8 @@ protected async Task<PayInIdealWebPostDTO> GetPayInIdealWebPost()
new Money { Amount = 20, Currency = CurrencyIso.EUR },
wallet.Id,
"http://www.my-site.com/returnURL?transactionId=wt_71a08458-b0cc-468d-98f7-1302591fc238",
"[email protected]",
"RBRBNL21",
"Ideal tag",
"Ideal test"
);

Expand All @@ -753,8 +754,9 @@ protected async Task<PayInGiropayWebPostDTO> GetPayInGiropayWebPost()
new Money { Amount = 20, Currency = CurrencyIso.EUR },
wallet.Id,
"http://www.my-site.com/returnURL?transactionId=wt_71a08458-b0cc-468d-98f7-1302591fc238",
"[email protected]",
"Giropay test"
"Giropay tag",
"test"

);

return payIn;
Expand Down
2 changes: 2 additions & 0 deletions MangoPay.SDK/Core/APIs/ApiBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)},
Expand Down
16 changes: 16 additions & 0 deletions MangoPay.SDK/Core/APIs/ApiPayIns.cs
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,22 @@ public async Task<PayInKlarnaWebDTO> GetKlarnaAsync(string payInId)
{
return await this.GetObjectAsync<PayInKlarnaWebDTO>(MethodKey.PayinsGet, entitiesId: payInId);
}

/// <summary>Gets PayIn Ideal entity by its identifier.</summary>
/// <param name="payInId">PayIn identifier.</param>
/// <returns>PayIn object returned from API.</returns>
public async Task<PayInIdealWebDTO> GetIdealAsync(string payInId)
{
return await this.GetObjectAsync<PayInIdealWebDTO>(MethodKey.PayinsGet, entitiesId: payInId);
}

/// <summary>Gets PayIn Giropay entity by its identifier.</summary>
/// <param name="payInId">PayIn identifier.</param>
/// <returns>PayIn object returned from API.</returns>
public async Task<PayInGiropayWebDTO> GetGiropayAsync(string payInId)
{
return await this.GetObjectAsync<PayInGiropayWebDTO>(MethodKey.PayinsGet, entitiesId: payInId);
}

/// <summary>Creates refund for PayIn object.</summary>
/// <param name="idempotentKey">Idempotent key for this request.</param>
Expand Down
4 changes: 4 additions & 0 deletions MangoPay.SDK/Core/Enumerations/PayInPaymentType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,9 @@ public enum PayInPaymentType
BLIK,
/// <summary> Klarna payment type </summary>
KLARNA,
/// <summary> Ideal payment type </summary>
IDEAL,
/// <summary> Giropay payment type </summary>
GIROPAY,
}
}
14 changes: 14 additions & 0 deletions MangoPay.SDK/Entities/GET/PayInGiropayWebDTO.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace MangoPay.SDK.Entities.GET
{
public class PayInGiropayWebDTO: PayInDTO
{
/// <summary>An optional value to be specified on the user's bank statement.</summary>
public string StatementDescriptor { get; set; }

/// <summary> The URL to redirect to after the payment, whether the transaction was successful or not
public string ReturnURL { get; set; }

/// <summary> The URL to which the user is redirected to complete the payment
public string RedirectURL { get; set; }
}
}
17 changes: 17 additions & 0 deletions MangoPay.SDK/Entities/GET/PayInIdealWebDTO.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace MangoPay.SDK.Entities.GET
{
public class PayInIdealWebDTO : PayInDTO
{
/// <summary>An optional value to be specified on the user's bank statement.</summary>
public string StatementDescriptor { get; set; }

/// <summary> The URL to redirect to after the payment, whether the transaction was successful or not
public string ReturnURL { get; set; }

/// <summary> The URL to which the user is redirected to complete the payment
public string RedirectURL { get; set; }

/// <summary> Name of the end-user’s bank </summary>
public string BankName { get; set; }
}
}
35 changes: 35 additions & 0 deletions MangoPay.SDK/Entities/POST/PayInGiropayWebPostDTO.cs
Original file line number Diff line number Diff line change
@@ -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;
}

/// <summary>Author identifier.</summary>
public string AuthorId { get; set; }

/// <summary>Debited funds.</summary>
public Money DebitedFunds { get; set; }

/// <summary>Fees.</summary>
public Money Fees { get; set; }

/// <summary>Credited wallet identifier.</summary>
public string CreditedWalletId { get; set; }

/// <summary> The URL to redirect to after the payment, whether the transaction was successful or not
public string ReturnURL { get; set; }

/// <summary>An optional value to be specified on the user's bank statement.</summary>
public string StatementDescriptor { get; set; }
}
}
39 changes: 39 additions & 0 deletions MangoPay.SDK/Entities/POST/PayInIdealWebPostDTO.cs
Original file line number Diff line number Diff line change
@@ -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;
}

/// <summary>Author identifier.</summary>
public string AuthorId { get; set; }

/// <summary>Debited funds.</summary>
public Money DebitedFunds { get; set; }

/// <summary>Fees.</summary>
public Money Fees { get; set; }

/// <summary>Credited wallet identifier.</summary>
public string CreditedWalletId { get; set; }

/// <summary> The URL to redirect to after the payment, whether the transaction was successful or not
public string ReturnURL { get; set; }

/// <summary> The BIC identifier of the end-user’s bank
public string Bic { get; set; }

/// <summary>An optional value to be specified on the user's bank statement.</summary>
public string StatementDescriptor { get; set; }
}
}

0 comments on commit f50d1d9

Please sign in to comment.