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

Fix account holder payment context source #405

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
15 changes: 9 additions & 6 deletions src/CheckoutSdk/Common/AccountHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,23 @@
public class AccountHolder
{
public AccountHolderType? Type { get; set; }

public string FullName { get; set; }

public string FirstName { get; set; }

public string MiddleName { get; set; }

public string LastName { get; set; }

public string Email { get; set; }

public string Gender { get; set; }

public string CompanyName { get; set; }

public string TaxId { get; set; }

public string DateOfBirth { get; set; }

public CountryCode? CountryOfBirth { get; set; }
Expand All @@ -24,10 +32,5 @@ public class AccountHolder

public AccountHolderIdentification Identification { get; set; }

public string Email { get; set; }

public string Gender { get; set; }

public string MiddleName { get; set; }
}
}
1 change: 0 additions & 1 deletion src/CheckoutSdk/Common/PaymentSourceType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public enum PaymentSourceType
[EnumMember(Value = "customer")] Customer,
[EnumMember(Value = "provider_token")] ProviderToken,
[EnumMember(Value = "dLocal")] DLocal,

[EnumMember(Value = "currency_account")] CurrencyAccount,
[EnumMember(Value = "boleto")] Boleto,
[EnumMember(Value = "fawry")] Fawry,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ namespace Checkout.Payments.Response.Source.Contexts
public abstract class AbstractPaymentContextsResponseSource
{
public PaymentSourceType? Type { get; set; }

public AccountHolder AccountHolder { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@ public class PaymentContextsKlarnaResponseSource : AbstractPaymentContextsRespon
{
return base.Type;
}

public AccountHolder AccountHolder { get; set; }
}
}
3 changes: 3 additions & 0 deletions test/CheckoutSdkTest/CheckoutSdkTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
</ItemGroup>
<ItemGroup>
<None Update="nlog.config" CopyToOutputDirectory="Always" />
<None Update="Resources\PaymentContextsPayPalDetailsResponse.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="Resources\AppSettingsPreviousTest.json">
Expand Down
17 changes: 14 additions & 3 deletions test/CheckoutSdkTest/JsonSerializerTest.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
using Checkout.Accounts;
using Checkout.Accounts.Regional.US;
using Checkout.Financial;
using Checkout.Issuing.Cards;
using Checkout.Issuing.Cards.Requests.Create;
using Checkout.Issuing.Cards.Responses;
using Checkout.Issuing.Controls;
using Checkout.Issuing.Controls.Requests.Create;
using Checkout.Issuing.Controls.Responses.Create;
using Checkout.Payments.Contexts;
using Checkout.Payments.Response;
using Checkout.Payments.Response.Source.Contexts;
using Checkout.Payments.Sender;
using Shouldly;
using System;
using System.Globalization;
using Xunit;
using Xunit.Abstractions;
using CardType = Checkout.Issuing.Cards.CardType;

namespace Checkout
{
Expand Down Expand Up @@ -150,6 +150,17 @@ public void ShouldSerializeOnBoardSubEntityUSCompanyFromJson()
onboardEntityDetailsResponse.ShouldNotBeNull();
onboardEntityDetailsResponse.Company.BusinessType.ShouldBeOfType<USBusinessType>();
}

[Fact]
public void ShouldSerializePaymentContextsPayPalDetailsResponseFromJson()
{
var fileContent = GetJsonFileContent("./Resources/PaymentContextsPayPalDetailsResponse.json");
PaymentContextDetailsResponse paymentContextsPayPalResponseSource =
(PaymentContextDetailsResponse)new JsonSerializer().Deserialize(fileContent,
typeof(PaymentContextDetailsResponse));
paymentContextsPayPalResponseSource.ShouldNotBeNull();
paymentContextsPayPalResponseSource.PaymentRequest.Source.ShouldBeOfType<PaymentContextsPayPalResponseSource>();
}

[Fact]
public void ShouldDeserializeDateTimeFormatsFromStrings()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ private async Task ShouldMakeFawryPayment()
source.Type().ShouldBe(PaymentSourceType.Fawry);
}

[Fact]
[Fact(Skip = "skipped temporally")]
private async Task ShouldMakeGiropayPayment()
{
var giropaySource = new RequestGiropaySource
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"partner_metadata": {
"customer_id": "WXZ3YUKYW27V4",
"order_id": "0UX64350RX431305J"
},
"payment_request": {
"amount": 2500,
"authorization_type": "Final",
"capture": true,
"currency": "GBP",
"failure_url": "https://www.spaseekers.com/checkout/checkoutdotcom3/payment-failed",
"items": [
{
"discount_amount": 0,
"name": "£25.00 Voucher",
"quantity": 1,
"tax_amount": 0,
"total_amount": 2500,
"unit_price": 2500
}
],
"payment_type": "Regular",
"processing": {
"shipping_amount": 0,
"user_action": "PAY_NOW"
},
"processing_channel_id": "pc_strugfrty47ellyymdfg6fzhc4i",
"reference": "770859",
"shipping": {
"address": {
"address_line1": "6 May Close",
"address_line2": "Goring-by-Sea",
"city": "Worthing",
"country": "GB",
"state": "WEST SUSSEX",
"zip": "BN12 6HW"
},
"first_name": "Matthew Abbott"
},
"source": {
"account_holder": {
"email": "[email protected]",
"full_name": "Matthew Abbott"
},
"type": "paypal"
},
"success_url": "https://www.spaseekers.com/checkout/checkoutdotcom3/payment-successful"
},
"status": "Created"
}
Loading