This repository has been archived by the owner on Mar 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
TokenTest.cs
54 lines (49 loc) · 2 KB
/
TokenTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using NUnit.Framework;
using Ingenico.Connect.Sdk.Domain.Token;
using Ingenico.Connect.Sdk.Domain.Token.Definitions;
using Ingenico.Connect.Sdk.Domain.Definitions;
using Ingenico.Connect.Sdk.Merchant.Tokens;
using System.Threading.Tasks;
namespace Ingenico.Connect.Sdk.It
{
public class TokenTest : IntegrationTest
{
/// <summary>
/// Smoke Test for token calls.
/// </summary>
[TestCase]
public async Task Test()
{
CreateTokenRequest createTokenRequest = new CreateTokenRequest();
createTokenRequest.PaymentProductId = (1);
TokenCard card = new TokenCard();
createTokenRequest.Card = (card);
CustomerToken customer = new CustomerToken();
card.Customer = (customer);
Address billingAddress = new Address();
customer.BillingAddress = (billingAddress);
billingAddress.CountryCode = ("NL");
TokenCardData mandate = new TokenCardData();
card.Data = (mandate);
CardWithoutCvv cardWithoutCvv = new CardWithoutCvv();
mandate.CardWithoutCvv = (cardWithoutCvv);
cardWithoutCvv.CardholderName = ("Jan");
cardWithoutCvv.IssueNumber = ("12");
cardWithoutCvv.CardNumber = ("4567350000427977");
cardWithoutCvv.ExpiryDate = ("1225");
using (Client client = GetClient())
{
CreateTokenResponse createTokenResponse = await client
.Merchant(GetMerchantId())
.Tokens()
.Create(createTokenRequest);
Assert.NotNull(createTokenResponse.Token);
DeleteTokenParams deleteTokenRequest = new DeleteTokenParams();
await client
.Merchant(GetMerchantId())
.Tokens()
.Delete(createTokenResponse.Token, deleteTokenRequest);
}
}
}
}