Skip to content

Commit d6851f5

Browse files
Fix properties payment contexts (#374)
1 parent 13d9602 commit d6851f5

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

src/CheckoutSdk/Payments/Contexts/PaymentContexts.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@ public class PaymentContexts
1111

1212
public PaymentType? PaymentType { get; set; }
1313

14+
public string AuthorizationType { get; set; }
15+
1416
public bool? Capture { get; set; }
1517

18+
public CustomerRequest Customer { get; set; }
19+
1620
public ShippingDetails Shipping { get; set; }
1721

1822
public PaymentContextsProcessing Processing { get; set; }

test/CheckoutSdkTest/Payments/Contexts/PaymentContextsIntegrationTest.cs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Checkout.Common;
22
using Checkout.Payments.Request.Source.Contexts;
3+
using Checkout.Sessions;
34
using Shouldly;
45
using System.Collections.Generic;
56
using System.Threading.Tasks;
@@ -52,9 +53,23 @@ private async Task ShouldGetAPaymentContext()
5253
{
5354
Source = new PaymentContextsPaypalSource(),
5455
Amount = 2000,
55-
Currency = Currency.EUR,
56+
Currency = Currency.USD,
5657
PaymentType = PaymentType.Regular,
58+
Customer = GetCustomer(),
5759
Capture = true,
60+
Shipping = new ShippingDetails
61+
{
62+
FirstName = "John",
63+
LastName = "Smith",
64+
Email = "[email protected]",
65+
Address = GetAddress(),
66+
Phone = GetPhone(),
67+
FromAddressZip = "43434",
68+
Timeframe = DeliveryTimeframe.ElectronicDelivery,
69+
Method = PaymentContextsShippingMethod.Digital,
70+
Delay = 0
71+
},
72+
5873
ProcessingChannelId = System.Environment.GetEnvironmentVariable("CHECKOUT_PROCESSING_CHANNEL_ID"),
5974
SuccessUrl = "https://example.com/payments/success",
6075
FailureUrl = "https://example.com/payments/fail",
@@ -66,7 +81,7 @@ private async Task ShouldGetAPaymentContext()
6681
Quantity = 1,
6782
UnitPrice = 2000
6883
}
69-
},
84+
}
7085
};
7186

7287
var paymentContextResponse = await DefaultApi.PaymentContextsClient().RequestPaymentContexts(paymentContextsRequest);
@@ -76,8 +91,9 @@ private async Task ShouldGetAPaymentContext()
7691
response.ShouldNotBeNull();
7792
response.PaymentRequest.ShouldNotBeNull();
7893
response.PaymentRequest.Amount.ShouldBe(2000);
79-
response.PaymentRequest.Currency.ShouldBe(Currency.EUR);
94+
response.PaymentRequest.Currency.ShouldBe(Currency.USD);
8095
response.PaymentRequest.PaymentType.ShouldBe(PaymentType.Regular);
96+
response.PaymentRequest.AuthorizationType.ShouldBe("Final");
8197
response.PaymentRequest.Capture.ShouldBe(true);
8298
response.PaymentRequest.Items[0].Name.ShouldBe("mask");
8399
response.PaymentRequest.Items[0].Quantity.ShouldBe(1);

0 commit comments

Comments
 (0)