-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #569 from SwedbankPay/release/3.3.0
Release/3.3.0
- Loading branch information
Showing
54 changed files
with
622 additions
and
229 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
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
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
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
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 |
---|---|---|
|
@@ -6,7 +6,8 @@ public enum Option | |
{ | ||
Anonymous, | ||
Standard, | ||
LocalPaymentMenu | ||
LocalPaymentMenu, | ||
LocalPaymentMenuVerification, | ||
} | ||
} | ||
} |
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
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
93 changes: 93 additions & 0 deletions
93
...mples/Sample.AspNetCore.SystemTests/Test/PaymentTests/Payment/PaymentVerificationTests.cs
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 |
---|---|---|
@@ -0,0 +1,93 @@ | ||
using Atata; | ||
using NUnit.Framework; | ||
using Sample.AspNetCore.SystemTests.Services; | ||
using Sample.AspNetCore.SystemTests.Test.Helpers; | ||
using SwedbankPay.Sdk; | ||
using SwedbankPay.Sdk.PaymentInstruments; | ||
using SwedbankPay.Sdk.PaymentOrders; | ||
using System; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace Sample.AspNetCore.SystemTests.Test.PaymentTests.Payment | ||
{ | ||
public class PaymentVerificationTests : Base.PaymentTests | ||
{ | ||
public PaymentVerificationTests(string driverAlias) | ||
: base(driverAlias) | ||
{ | ||
} | ||
|
||
|
||
[Test] | ||
[Retry(2)] | ||
[TestCaseSource(nameof(TestData), new object[] { false, PaymentMethods.Recurring })] | ||
public async Task Payment_Card_Verification(Product[] products, PayexInfo payexInfo) | ||
{ | ||
GoToOrdersPage(products, payexInfo, Checkout.Option.LocalPaymentMenu) | ||
.RefreshPageUntil(x => x.Orders[y => y.Attributes["data-paymentlink"] == _referenceLink].IsVisible, 60, 10); | ||
|
||
var cardPayment = await SwedbankPayClient.Payments.CardPayments.Get(new Uri(_referenceLink, UriKind.RelativeOrAbsolute), PaymentExpand.All); | ||
|
||
// Global Order | ||
Assert.That(cardPayment.Payment.Amount.InLowestMonetaryUnit, Is.EqualTo(0)); | ||
Assert.That(cardPayment.Payment.Currency.ToString(), Is.EqualTo("SEK")); | ||
Assert.That(cardPayment.Payment.State, Is.EqualTo(State.Ready)); | ||
|
||
// Operations | ||
Assert.That(cardPayment.Operations.Count, Is.EqualTo(2)); | ||
Assert.That(cardPayment.Operations[LinkRelation.ViewPayment], Is.Not.Null); | ||
Assert.That(cardPayment.Operations[LinkRelation.PaidPayment], Is.Not.Null); | ||
|
||
Assert.That(cardPayment.Payment.RecurrenceToken, Is.Not.Null); | ||
|
||
// Transactions | ||
Assert.That(cardPayment.Payment.Transactions.TransactionList.Count, Is.EqualTo(1)); | ||
Assert.That(cardPayment.Payment.Transactions.TransactionList.First(x => x.Type == TransactionType.Verification).State, | ||
Is.EqualTo(State.Completed)); | ||
} | ||
|
||
[Test] | ||
[Retry(2)] | ||
[TestCaseSource(nameof(TestData), new object[] { false, PaymentMethods.Recurring })] | ||
public async Task Payment_Card_Recurring(Product[] products, PayexInfo payexInfo) | ||
{ | ||
var page = GoToOrdersPage(products, payexInfo, Checkout.Option.LocalPaymentMenu) | ||
.RefreshPageUntil(x => x.Orders[y => y.Attributes["data-paymentlink"] == _referenceLink].IsVisible, 60, 10) | ||
.Orders[y => y.Attributes["data-paymentlink"] == _referenceLink].Actions.Rows[y => y.Name.Value.Contains("create-recurring")].ExecuteAction.ClickAndGo(); | ||
|
||
var paymentUriLink1 = page.SuccessMessage.StorePaymentUri(); | ||
|
||
await VerifyPayment(paymentUriLink1, products); | ||
|
||
|
||
page = page.Orders[y => y.Attributes["data-paymentlink"] == _referenceLink].Actions.Rows[y => y.Name.Value.Contains("create-recurring")].ExecuteAction.ClickAndGo(); | ||
|
||
var paymentUriLink2 = page.SuccessMessage.StorePaymentUri(); | ||
|
||
await VerifyPayment(paymentUriLink2, products); | ||
} | ||
|
||
private async Task VerifyPayment(string paymentLink, Product[] products) | ||
{ | ||
var cardPayment = await SwedbankPayClient.Payments.CardPayments.Get(new Uri(paymentLink, UriKind.RelativeOrAbsolute), PaymentExpand.All); | ||
|
||
// Global Order | ||
Assert.That(cardPayment.Payment.Amount.InLowestMonetaryUnit, Is.EqualTo(products.Select(x => x.UnitPrice * x.Quantity).Sum())); | ||
Assert.That(cardPayment.Payment.Currency.ToString(), Is.EqualTo("SEK")); | ||
Assert.That(cardPayment.Payment.State, Is.EqualTo(State.Ready)); | ||
|
||
// Operations | ||
Assert.That(cardPayment.Operations.Count, Is.EqualTo(2)); | ||
Assert.That(cardPayment.Operations[LinkRelation.CreateReversal], Is.Not.Null); | ||
Assert.That(cardPayment.Operations[LinkRelation.PaidPayment], Is.Not.Null); | ||
|
||
// Transactions | ||
Assert.That(cardPayment.Payment.Transactions.TransactionList.Count, Is.EqualTo(2)); | ||
Assert.That(cardPayment.Payment.Transactions.TransactionList.First(x => x.Type == TransactionType.Authorization).State, | ||
Is.EqualTo(State.Completed)); | ||
Assert.That(cardPayment.Payment.Transactions.TransactionList.First(x => x.Type == TransactionType.Capture).State, | ||
Is.EqualTo(State.Completed)); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.