Skip to content

Commit

Permalink
Merge pull request #207 from Mangopay/feature/add_parameter_to_ideal_…
Browse files Browse the repository at this point in the history
…endpoint

improvement / Added new parameters to legacy IDEAL payin
  • Loading branch information
iulian03 authored Dec 7, 2023
2 parents ab1bbc5 + 5bc7d06 commit bad969f
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
20 changes: 20 additions & 0 deletions MangoPay.SDK.Tests/ApiPayInsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,26 @@ public async Task Test_PayIns_Create_GiropayWeb()
Assert.Fail(ex.Message);
}
}

[Test]
public async Task Test_PayIns_Create_Legacy_IdealWeb()
{
var john = await GetJohn();

var wallet = await CreateJohnsWallet();
PayInCardWebDTO payIn = await CreateLegacyIdealPayInCardWeb(wallet.Id);

Assert.IsNotNull(payIn.BankName);
Assert.IsTrue(payIn.Id.Length > 0);
Assert.AreEqual(PayInPaymentType.CARD, payIn.PaymentType);
Assert.AreEqual(PayInExecutionType.WEB, payIn.ExecutionType);
Assert.IsTrue(payIn.DebitedFunds is Money);
Assert.IsTrue(payIn.CreditedFunds is Money);
Assert.IsTrue(payIn.Fees is Money);
Assert.AreEqual(TransactionStatus.CREATED, payIn.Status);
Assert.AreEqual(TransactionType.PAYIN, payIn.Type);
Assert.AreEqual(TransactionNature.REGULAR, payIn.Nature);
}

[Test]
public async Task Test_Payins_CardDirect_Create_WithBilling()
Expand Down
19 changes: 19 additions & 0 deletions MangoPay.SDK.Tests/BaseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,25 @@ protected async Task<PayInGiropayWebDTO> GetNewPayInGiropayWeb()
PayInGiropayWebPostDTO payIn = await GetPayInGiropayWebPost();
return await this.Api.PayIns.CreateGiropayWebAsync(payIn);
}

protected async Task<PayInCardWebDTO> CreateLegacyIdealPayInCardWeb(string walletId)
{
var user = await this.GetJohn();

var payIn = new PayInCardWebPostDTO(
user.Id,
new Money { Amount = 1000, Currency = CurrencyIso.EUR },
new Money { Amount = 0, Currency = CurrencyIso.EUR },
walletId,
"https://test.com",
CultureCode.FR,
CardType.IDEAL,
bic: "REVOLT21"
);

return await this.Api.PayIns.CreateCardWebAsync(payIn);
}


/// <summary>Creates PayIn Card Direct object.</summary>
/// <param name="userId">User identifier.</param>
Expand Down
3 changes: 3 additions & 0 deletions MangoPay.SDK/Entities/GET/PayInCardWebDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,8 @@ public class PayInCardWebDTO : PayInDTO
public string StatementDescriptor { get; set; }

public Shipping Shipping { get; set; }

/// <summary> Name of the end-user’s bank </summary>
public string BankName { get; set; }
}
}
6 changes: 5 additions & 1 deletion MangoPay.SDK/Entities/POST/PayInCardWebPostDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace MangoPay.SDK.Entities.POST
/// <summary>PayIn card web POST entity.</summary>
public class PayInCardWebPostDTO : EntityPostBase
{
public PayInCardWebPostDTO(string authorId, Money debitedFunds, Money fees, string creditedWalletId, string returnUrl, CultureCode culture, CardType cardType, string statementDescriptor = null)
public PayInCardWebPostDTO(string authorId, Money debitedFunds, Money fees, string creditedWalletId, string returnUrl, CultureCode culture, CardType cardType, string statementDescriptor = null, string bic = null)
{
AuthorId = authorId;
DebitedFunds = debitedFunds;
Expand All @@ -19,6 +19,7 @@ public PayInCardWebPostDTO(string authorId, Money debitedFunds, Money fees, stri
Culture = culture;
CardType = cardType;
StatementDescriptor = statementDescriptor;
Bic = bic;
}

/// <summary>Author identifier.</summary>
Expand Down Expand Up @@ -58,5 +59,8 @@ public PayInCardWebPostDTO(string authorId, Money debitedFunds, Money fees, stri
public string StatementDescriptor { get; set; }

public Shipping Shipping { get; set; }

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

0 comments on commit bad969f

Please sign in to comment.