-
Notifications
You must be signed in to change notification settings - Fork 0
/
LinkSample.cs
84 lines (72 loc) · 2.32 KB
/
LinkSample.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using System;
using NUnit.Framework;
using TokenPay;
using TokenPay.Model;
using TokenPay.Request;
using TokenPay.Response;
namespace Samples
{
public class LinkSample
{
private readonly TokenPayClient _tokenPayClient =
new TokenPayClient("api-key", "secret-key", "https://api-gateway.tokenpay.com.tr");
[Test]
public void Create_Link()
{
CreateLinkRequest createLinkRequest = new CreateLinkRequest
{
Name = "test link",
Description = "Test Link for payment",
Price = new decimal(10),
Stock = 100,
EnabledInstallments = "1,2,3,6",
ExpireDate = DateTime.Now.AddYears(20)
};
LinkResponse link = _tokenPayClient.LinkAdapter().CreateLink(createLinkRequest);
Assert.NotNull(link.Id);
}
[Test]
public void Update_Link()
{
long id = 1;
UpdateLinkRequest updateLinkRequest = new UpdateLinkRequest
{
Status = Status.Active,
Name = "new test link",
Description = "new Test Link for payment",
Price = new decimal(10),
Stock = 100,
EnabledInstallments = "1,2,3",
ExpireDate = DateTime.Now.AddYears(4)
};
LinkResponse link = _tokenPayClient.LinkAdapter().UpdateLink(id, updateLinkRequest);
Assert.NotNull(link.Id);
}
[Test]
public void Retrieve_Link()
{
long id = 1;
LinkResponse link = _tokenPayClient.LinkAdapter().RetrieveLink(id);
Assert.NotNull(link.Id);
}
[Test]
public void Delete_Link()
{
long id = 60;
_tokenPayClient.LinkAdapter().DeleteLink(id);
}
[Test]
public void Search_Links()
{
SearchLinksRequest searchLinksRequest = new SearchLinksRequest
{
Name = "name",
Token = "token",
Status = Status.Active
};
var response = _tokenPayClient.LinkAdapter().SearchLinks(searchLinksRequest);
Assert.NotNull(response);
Assert.AreEqual(0, response.Size);
}
}
}