-
Notifications
You must be signed in to change notification settings - Fork 1
/
PrivatBankAutoClient.cs
108 lines (88 loc) · 3.17 KB
/
PrivatBankAutoClient.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
using System;
using System.Threading.Tasks;
using NUnit.Framework;
using Privatbank.Business.Data.Models;
namespace Privatbank.Business.Tests
{
public class Tests
{
private PrivatbankAutoClient _client;
[SetUp]
public void SetUp()
{
_client = new PrivatbankAutoClient(
Environment.GetEnvironmentVariable("CLIENT_ID"),
Environment.GetEnvironmentVariable("CLIENT_TOKEN"));
}
[Test]
public async Task TestStatementsSettings()
{
var result = await _client.GetStatementsSettingsAsync();
Assert.IsNotEmpty(result.Phase);
Assert.IsNotEmpty(result.NonOperationalDays);
Assert.AreNotEqual(result.PreviousOperationalDay, DateTime.MinValue);
Assert.AreNotEqual(result.CurrentOperationalDay, DateTime.MinValue);
Assert.AreNotEqual(result.ServerDateTime, DateTime.MinValue);
Assert.AreNotEqual(result.DateTimeOfFinalStatement, DateTime.MinValue);
}
[Test]
public async Task TestGetBalance()
{
var result = await _client.GetBalanceAsync(DateTime.Now);
Assert.IsNotEmpty(result);
}
[Test]
public async Task TestGetBalanceInterim()
{
var result = await _client.GetBalanceInterimAsync();
Assert.IsNotEmpty(result);
}
[Test]
public async Task TestGetBalanceFinal()
{
var result = await _client.GetBalanceFinalAsync();
Assert.IsNotEmpty(result);
}
[Test]
public async Task TestGetTransactions()
{
var result = await _client.GetTransactionsAsync(
DateTime.Now - TimeSpan.FromDays(30));
Assert.IsNotEmpty(result);
}
[Test]
public async Task TestGetTransactionsInterim()
{
var result = await _client.GetTransactionsInterimAsync();
Assert.IsNotEmpty(result);
}
[Test]
public async Task TestGetTransactionsFinal()
{
var result = await _client.GetTransactionsFinalAsync();
Assert.NotNull(result);
}
[Test]
public async Task TestCreatePayment()
{
var result = await _client.CreatePaymentAsync(new Payment
{
DocumentNumber = "1",
PayerAccount = Environment.GetEnvironmentVariable("PAYER_ACCOUNT"),
RecipientCode = "00034022",
RecipientAccount = "UA458201720313281002302018611",
PaymentNaming = "Міністерство оборони України",
PaymentAmount = 1000,
PaymentDestination = "Грошовий благодійний внесок на матеріально-технічне " +
"забезпечення Збройних Сил України"
});
Assert.NotNull(result.Reference);
Assert.NotNull(result.PackedReference);
}
[TearDown]
public void TearDown()
{
_client.Dispose();
}
}
}