-
Notifications
You must be signed in to change notification settings - Fork 21
/
Transfer.http
78 lines (64 loc) · 1.91 KB
/
Transfer.http
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
### 创建源账户
POST http://localhost:8080/account/create_account
Content-Type: application/json
Command-Wait-Stage: PROCESSED
Command-Wait-Timeout: 30000
Command-Request-Id: {{$uuid}}
Command-Aggregate-Id: sourceId
{
"name": "source",
"balance": 100
}
> {%
client.test("Request executed successfully", function () {
client.assert(response.status === 200, "Response status is not 200");
});
%}
### 创建目标账户
POST http://localhost:8080/account/create_account
Content-Type: application/json
Command-Wait-Stage: PROCESSED
Command-Wait-Timeout: 30000
Command-Request-Id: {{$uuid}}
Command-Aggregate-Id: targetId
{
"name": "targetId",
"balance": 0
}
> {%
client.test("Request executed successfully", function () {
client.assert(response.status === 200, "Response status is not 200");
});
%}
### 准备转账
POST http://localhost:8080/account/sourceId/prepare
Content-Type: application/json
Command-Wait-Stage: PROCESSED
Command-Wait-Timeout: 30000
Command-Request-Id: {{$uuid}}
{
"to": "targetId",
"amount": 10
}
> {%
client.test("Request executed successfully", function () {
client.assert(response.status === 200, "Response status is not 200");
});
%}
### 获取源账户余额
GET http://localhost:8080/account/sourceId/state
> {%
client.test("Request executed successfully", function () {
client.assert(response.status === 200, "Response status is not 200");
client.assert(response.body.balanceAmount === 90, "balanceAmount is not 90");
client.assert(response.body.lockedAmount === 0, "lockedAmount is not 90");
});
%}
### 获取目标账户余额
GET http://localhost:8080/account/targetId/state
> {%
client.test("Request executed successfully", function () {
client.assert(response.status === 200, "Response status is not 200");
client.assert(response.body.balanceAmount === 10, "balanceAmount is not 10");
});
%}