Skip to content

Commit

Permalink
Fix properties payment contexts (#374)
Browse files Browse the repository at this point in the history
  • Loading branch information
armando-rodriguez-cko authored Mar 7, 2024
1 parent 13d9602 commit d6851f5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/CheckoutSdk/Payments/Contexts/PaymentContexts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ public class PaymentContexts

public PaymentType? PaymentType { get; set; }

public string AuthorizationType { get; set; }

public bool? Capture { get; set; }

public CustomerRequest Customer { get; set; }

public ShippingDetails Shipping { get; set; }

public PaymentContextsProcessing Processing { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Checkout.Common;
using Checkout.Payments.Request.Source.Contexts;
using Checkout.Sessions;
using Shouldly;
using System.Collections.Generic;
using System.Threading.Tasks;
Expand Down Expand Up @@ -52,9 +53,23 @@ private async Task ShouldGetAPaymentContext()
{
Source = new PaymentContextsPaypalSource(),
Amount = 2000,
Currency = Currency.EUR,
Currency = Currency.USD,
PaymentType = PaymentType.Regular,
Customer = GetCustomer(),
Capture = true,
Shipping = new ShippingDetails
{
FirstName = "John",
LastName = "Smith",
Email = "[email protected]",
Address = GetAddress(),
Phone = GetPhone(),
FromAddressZip = "43434",
Timeframe = DeliveryTimeframe.ElectronicDelivery,
Method = PaymentContextsShippingMethod.Digital,
Delay = 0
},

ProcessingChannelId = System.Environment.GetEnvironmentVariable("CHECKOUT_PROCESSING_CHANNEL_ID"),
SuccessUrl = "https://example.com/payments/success",
FailureUrl = "https://example.com/payments/fail",
Expand All @@ -66,7 +81,7 @@ private async Task ShouldGetAPaymentContext()
Quantity = 1,
UnitPrice = 2000
}
},
}
};

var paymentContextResponse = await DefaultApi.PaymentContextsClient().RequestPaymentContexts(paymentContextsRequest);
Expand All @@ -76,8 +91,9 @@ private async Task ShouldGetAPaymentContext()
response.ShouldNotBeNull();
response.PaymentRequest.ShouldNotBeNull();
response.PaymentRequest.Amount.ShouldBe(2000);
response.PaymentRequest.Currency.ShouldBe(Currency.EUR);
response.PaymentRequest.Currency.ShouldBe(Currency.USD);
response.PaymentRequest.PaymentType.ShouldBe(PaymentType.Regular);
response.PaymentRequest.AuthorizationType.ShouldBe("Final");
response.PaymentRequest.Capture.ShouldBe(true);
response.PaymentRequest.Items[0].Name.ShouldBe("mask");
response.PaymentRequest.Items[0].Quantity.ShouldBe(1);
Expand Down

0 comments on commit d6851f5

Please sign in to comment.