Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added PaymentFlow param to Bancontact PayIn #228

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MangoPay.SDK.Tests/ApiPayInsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@
var wallet = await this.GetJohnsWallet();
var user = await this.GetJohn();

var payInPost = new PayInPayPalPostDTO(user.Id, new Money { Amount = 1000, Currency = CurrencyIso.EUR }, new Money { Amount = 0, Currency = CurrencyIso.EUR }, wallet.Id, "http://test/test");

Check warning on line 68 in MangoPay.SDK.Tests/ApiPayInsTest.cs

View workflow job for this annotation

GitHub Actions / dotnet 6.0.x

'PayInPayPalPostDTO' is obsolete: 'PayInPayPalPostDTO is deprecated, please use PayInPayPalWebPostDTO instead.'

var payIn = await this.Api.PayIns.CreatePayPalAsync(payInPost);

Check warning on line 70 in MangoPay.SDK.Tests/ApiPayInsTest.cs

View workflow job for this annotation

GitHub Actions / dotnet 6.0.x

'ApiPayIns.CreatePayPalAsync(PayInPayPalPostDTO, string)' is obsolete: 'CreatePayPalAsync is deprecated, please use CreatePayPalWebAsync instead.'

Assert.IsTrue(payIn.Id.Length > 0);
Assert.IsTrue(payIn.PaymentType == PayInPaymentType.PAYPAL);
Expand Down Expand Up @@ -197,12 +197,12 @@
PostalCode = "11222",
Region = "Region"
};
var payInPost = new PayInPayPalPostDTO(user.Id, new Money { Amount = 1000, Currency = CurrencyIso.EUR }, new Money { Amount = 0, Currency = CurrencyIso.EUR }, wallet.Id, "http://test/test")

Check warning on line 200 in MangoPay.SDK.Tests/ApiPayInsTest.cs

View workflow job for this annotation

GitHub Actions / dotnet 6.0.x

'PayInPayPalPostDTO' is obsolete: 'PayInPayPalPostDTO is deprecated, please use PayInPayPalWebPostDTO instead.'
{
ShippingAddress = new ShippingAddress("recipient name", AddressForShippingAddress)
};

var payIn = await this.Api.PayIns.CreatePayPalAsync(payInPost);

Check warning on line 205 in MangoPay.SDK.Tests/ApiPayInsTest.cs

View workflow job for this annotation

GitHub Actions / dotnet 6.0.x

'ApiPayIns.CreatePayPalAsync(PayInPayPalPostDTO, string)' is obsolete: 'CreatePayPalAsync is deprecated, please use CreatePayPalWebAsync instead.'

Assert.IsNotNull(payIn.ShippingAddress);
Assert.AreEqual("recipient name", payIn.ShippingAddress.RecipientName);
Expand Down Expand Up @@ -523,6 +523,7 @@
Assert.IsNotNull(fetched.Id);
Assert.AreEqual(CultureCode.NL, fetched.Culture);
Assert.AreEqual(false, fetched.Recurring);
Assert.AreEqual(PaymentFlow.APP, payIn.PaymentFlow);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -978,15 +979,15 @@
var wallet = await this.GetJohnsWallet();
var user = await this.GetJohn();

var payInPost = new PayInPayPalPostDTO(user.Id, new Money { Amount = 1000, Currency = CurrencyIso.EUR }, new Money { Amount = 0, Currency = CurrencyIso.EUR }, wallet.Id, "http://test/test");

Check warning on line 982 in MangoPay.SDK.Tests/ApiPayInsTest.cs

View workflow job for this annotation

GitHub Actions / dotnet 6.0.x

'PayInPayPalPostDTO' is obsolete: 'PayInPayPalPostDTO is deprecated, please use PayInPayPalWebPostDTO instead.'

payIn = await this.Api.PayIns.CreatePayPalAsync(payInPost);

Check warning on line 984 in MangoPay.SDK.Tests/ApiPayInsTest.cs

View workflow job for this annotation

GitHub Actions / dotnet 6.0.x

'ApiPayIns.CreatePayPalAsync(PayInPayPalPostDTO, string)' is obsolete: 'CreatePayPalAsync is deprecated, please use CreatePayPalWebAsync instead.'

Assert.IsTrue(payIn.Id.Length > 0);
Assert.IsTrue(payIn.PaymentType == PayInPaymentType.PAYPAL);
Assert.IsTrue(payIn.ExecutionType == PayInExecutionType.WEB);

var getPayIn = await this.Api.PayIns.GetPayPalAsync(payIn.Id);

Check warning on line 990 in MangoPay.SDK.Tests/ApiPayInsTest.cs

View workflow job for this annotation

GitHub Actions / dotnet 6.0.x

'ApiPayIns.GetPayPalAsync(string)' is obsolete: 'GetPayPalAsync is deprecated, please use GetPayPalWebAsync instead.'

Assert.IsNotNull(getPayIn);
Assert.IsTrue(getPayIn.Id == payIn.Id);
Expand Down Expand Up @@ -1015,14 +1016,14 @@
Region = "Region"
};

var payInPost = new PayInPayPalPostDTO(user.Id, new Money { Amount = 1000, Currency = CurrencyIso.EUR }, new Money { Amount = 0, Currency = CurrencyIso.EUR }, wallet.Id, "http://test/test")

Check warning on line 1019 in MangoPay.SDK.Tests/ApiPayInsTest.cs

View workflow job for this annotation

GitHub Actions / dotnet 6.0.x

'PayInPayPalPostDTO' is obsolete: 'PayInPayPalPostDTO is deprecated, please use PayInPayPalWebPostDTO instead.'
{
ShippingAddress = new ShippingAddress("recipient name", addressForShippingAddress)
};

payIn = await this.Api.PayIns.CreatePayPalAsync(payInPost);

Check warning on line 1024 in MangoPay.SDK.Tests/ApiPayInsTest.cs

View workflow job for this annotation

GitHub Actions / dotnet 6.0.x

'ApiPayIns.CreatePayPalAsync(PayInPayPalPostDTO, string)' is obsolete: 'CreatePayPalAsync is deprecated, please use CreatePayPalWebAsync instead.'

var getPayIn = await this.Api.PayIns.GetPayPalAsync(payIn.Id);

Check warning on line 1026 in MangoPay.SDK.Tests/ApiPayInsTest.cs

View workflow job for this annotation

GitHub Actions / dotnet 6.0.x

'ApiPayIns.GetPayPalAsync(string)' is obsolete: 'GetPayPalAsync is deprecated, please use GetPayPalWebAsync instead.'

Assert.IsNotNull(getPayIn.ShippingAddress);
Assert.AreEqual("recipient name", getPayIn.ShippingAddress.RecipientName);
Expand Down
3 changes: 2 additions & 1 deletion MangoPay.SDK.Tests/BaseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,8 @@ protected async Task<PayInBancontactWebPostDTO> GetPayInBancontactWebPost()
null,
null,
false,
CultureCode.NL
CultureCode.NL,
PaymentFlow.APP
);

return payIn;
Expand Down
9 changes: 9 additions & 0 deletions MangoPay.SDK/Core/Enumerations/PaymentFlow.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

namespace MangoPay.SDK.Core.Enumerations
{
public enum PaymentFlow
{
WEB,
APP
}
}
4 changes: 4 additions & 0 deletions MangoPay.SDK/Entities/GET/PayInBancontactWebDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,9 @@ public class PayInBancontactWebDTO : PayInDTO

/// <summary>Whether the Bancontact pay-ins are being made to be re-used in a recurring payment flow</summary>
public bool? Recurring { get; set; }

/// <summary>Payment flow (default WEB).</summary>
[JsonConverter(typeof(StringEnumConverter))]
public PaymentFlow? PaymentFlow { get; set; }
}
}
8 changes: 7 additions & 1 deletion MangoPay.SDK/Entities/POST/PayInBancontactWebPostDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ namespace MangoPay.SDK.Entities.POST
public class PayInBancontactWebPostDTO : EntityPostBase
{
public PayInBancontactWebPostDTO(string authorId, Money debitedFunds, Money fees, string creditedWalletId,
string returnUrl, string tag = null, string statementDescriptor = null, bool? recurring = null, CultureCode? culture = null)
string returnUrl, string tag = null, string statementDescriptor = null, bool? recurring = null,
CultureCode? culture = null, PaymentFlow? paymentFlow = null)
{
AuthorId = authorId;
DebitedFunds = debitedFunds;
Expand All @@ -18,6 +19,7 @@ public PayInBancontactWebPostDTO(string authorId, Money debitedFunds, Money fees
Tag = tag;
Recurring = recurring;
Culture = culture;
PaymentFlow = paymentFlow;
}

/// <summary>Author identifier.</summary>
Expand All @@ -44,5 +46,9 @@ public PayInBancontactWebPostDTO(string authorId, Money debitedFunds, Money fees

/// <summary>Whether the Bancontact pay-ins are being made to be re-used in a recurring payment flow</summary>
public bool? Recurring { get; set; }

/// <summary>Payment flow (default WEB).</summary>
[JsonConverter(typeof(StringEnumConverter))]
public PaymentFlow? PaymentFlow { get; set; }
}
}
Loading