-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix properties payment contexts (#374)
- Loading branch information
1 parent
13d9602
commit d6851f5
Showing
2 changed files
with
23 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
@@ -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", | ||
|
@@ -66,7 +81,7 @@ private async Task ShouldGetAPaymentContext() | |
Quantity = 1, | ||
UnitPrice = 2000 | ||
} | ||
}, | ||
} | ||
}; | ||
|
||
var paymentContextResponse = await DefaultApi.PaymentContextsClient().RequestPaymentContexts(paymentContextsRequest); | ||
|
@@ -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); | ||
|