reports.http90 lines, 2.4 KB
| 1 | # Reports, through the gateway. Send the requests in order, on a fresh |
| 2 | # database: Alice and Bob sign up, Alice deposits, and they pay each other. |
| 3 | @baseUrl = http://localhost:8080 |
| 4 | @password = correct horse battery staple |
| 5 | @alice = {{aliceLogin.response.body.access_token}} |
| 6 | @bob = {{bobLogin.response.body.access_token}} |
| 7 | @alicesWallet = {{aliceWallet.response.body.id}} |
| 8 | @bobsWallet = {{bobWallet.response.body.id}} |
| 9 | # A statement's days, in UTC, both included. |
| 10 | @from = 2026-11-01 |
| 11 | @to = 2026-11-30 |
| 12 | |
| 13 | ### Alice signs up |
| 14 | POST {{baseUrl}}/v1/auth/register |
| 15 | Content-Type: application/json |
| 16 | |
| 17 | {"email": "alice@example.com", "password": "{{password}}"} |
| 18 | |
| 19 | ### Alice logs in |
| 20 | # @name aliceLogin |
| 21 | POST {{baseUrl}}/v1/auth/login |
| 22 | Content-Type: application/json |
| 23 | |
| 24 | {"email": "alice@example.com", "password": "{{password}}"} |
| 25 | |
| 26 | ### Alice's wallet |
| 27 | # @name aliceWallet |
| 28 | POST {{baseUrl}}/v1/wallets |
| 29 | Authorization: Bearer {{alice}} |
| 30 | Content-Type: application/json |
| 31 | |
| 32 | {"currency": "USD"} |
| 33 | |
| 34 | ### Five hundred dollars |
| 35 | # @name deposit |
| 36 | POST {{baseUrl}}/v1/wallets/{{alicesWallet}}/deposits |
| 37 | Authorization: Bearer {{alice}} |
| 38 | Idempotency-Key: {{$guid}} |
| 39 | Content-Type: application/json |
| 40 | |
| 41 | {"amount": 50000, "currency": "USD"} |
| 42 | |
| 43 | ### Bob signs up |
| 44 | POST {{baseUrl}}/v1/auth/register |
| 45 | Content-Type: application/json |
| 46 | |
| 47 | {"email": "bob@example.com", "password": "{{password}}"} |
| 48 | |
| 49 | ### Bob logs in |
| 50 | # @name bobLogin |
| 51 | POST {{baseUrl}}/v1/auth/login |
| 52 | Content-Type: application/json |
| 53 | |
| 54 | {"email": "bob@example.com", "password": "{{password}}"} |
| 55 | |
| 56 | ### Bob's wallet |
| 57 | # @name bobWallet |
| 58 | POST {{baseUrl}}/v1/wallets |
| 59 | Authorization: Bearer {{bob}} |
| 60 | Content-Type: application/json |
| 61 | |
| 62 | {"currency": "USD"} |
| 63 | |
| 64 | ### Alice pays Bob twenty-five dollars |
| 65 | POST {{baseUrl}}/v1/transfers |
| 66 | Authorization: Bearer {{alice}} |
| 67 | Idempotency-Key: {{$guid}} |
| 68 | Content-Type: application/json |
| 69 | |
| 70 | {"from": "{{alicesWallet}}", "to": "{{bobsWallet}}", "amount": 2500, "currency": "USD"} |
| 71 | |
| 72 | ### Bob pays Alice ten dollars |
| 73 | POST {{baseUrl}}/v1/transfers |
| 74 | Authorization: Bearer {{bob}} |
| 75 | Idempotency-Key: {{$guid}} |
| 76 | Content-Type: application/json |
| 77 | |
| 78 | {"from": "{{bobsWallet}}", "to": "{{alicesWallet}}", "amount": 1000, "currency": "USD"} |
| 79 | |
| 80 | ### Alice's statement |
| 81 | GET {{baseUrl}}/v1/wallets/{{alicesWallet}}/statement.csv?from={{from}}&to={{to}} |
| 82 | Authorization: Bearer {{alice}} |
| 83 | |
| 84 | ### Bob asks for Alice's statement |
| 85 | GET {{baseUrl}}/v1/wallets/{{alicesWallet}}/statement.csv?from={{from}}&to={{to}} |
| 86 | Authorization: Bearer {{bob}} |
| 87 | |
| 88 | ### Alice's balance |
| 89 | GET {{baseUrl}}/v1/wallets/{{alicesWallet}}/balance |
| 90 | Authorization: Bearer {{alice}} |