generated from fegoworks/express-babel-setup-template
-
Notifications
You must be signed in to change notification settings - Fork 3
/
apiary.apib
227 lines (170 loc) · 6.83 KB
/
apiary.apib
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
FORMAT: 1A
HOST: https://ewallet-api-fe.herokuapp.com/
# eWallet
eWallet is a simple REST API to allow customers pre-load their wallet from their Debit cards and transfer virtual money as a gift to other customers within the platform
# Authentication Sign up [/api/v1/auth/create-user]
## Sign Up [POST ]
Sign Up to the Application takes a JSON object containing user credentials
+ Request (application/json)
{
"firstName": "fego",
"lastName": "edafe",
"email": "fego@mail.com",
"password": "password",
}
+ Response 201 (application/json)
+ Headers
Cookie: sid
+ body
{
"status": "success",
"data": {
"id": "4d21f615-54b6-466f-a96d-cd486af02fec",
"firstName": "fego",
"lastName": "edafe",
"email": "fego@mail.com",
"updatedAt": "2020-07-06T23:40:30.417Z",
"createdAt": "2020-07-06T23:40:30.417Z"
}
}
# Authentication Sign In [/api/v1/auth/signin]
### Sign in [POST]
Sign In to the Application takes a JSON object containing user credentials
+ Request (application/json)
{
"email": "fego@mail.com",
"password": "password",
}
+ response 200 (application/json)
+ Headers
Cookie: sid
+ body
{
"status": "success",
"message": "Welcome fego",
"data": {
"userId": "4d21f615-54b6-466f-a96d-cd486af02fec",
"firstName": "fego",
"lastName": "edafe",
"email": "fego@mail.com"
},
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMjFmNjE1LTU0YjYtNDY2Zi1hOTZkLWNkNDg2YWYwMmZlYyIsImVtYWlsIjoiZmVnb0BtYWlsLmNvbSIsImlzQWRtaW4iOmZhbHNlLCJpYXQiOjE1OTQwNzk0OTIsImV4cCI6MTU5NDA4NjY5Mn0.5qi2mRRhNiYv83z7IZxENv__bpcXmjkEQlssLT9hOzc"
}
# Fund Account [/api/v1/fundAccount]
### Fund [POST]
Fund Account takes a JSON object containing debit card details. Funding an account automatically creates a wallet
+ Request (application/json)
{
"amount": "15500000",
"cvv": "408",
"number": "4084084084084081",
"expiry_month": "01",
"expiry_year": "2099"
}
+ Response 201 (application/json)
+ Headers
Cookie: sid
+ body
{
"status": "success",
"data": {
"id": "21a762f0-c9b7-479f-aa17-e594d3af750e",
"customerId": "4d21f615-54b6-466f-a96d-cd486af02fec",
"amount": 15500000,
"reference": "3cdyxkqziq54u4h",
"updatedAt": "2020-07-07T00:01:01.975Z",
"createdAt": "2020-07-07T00:01:01.975Z"
}
}
# Get Wallet Details [/api/v1/wallets/{customerId}]
### Wallet [GET]
+ parameters
+ customerId
This returns a JSON object containing the wallet accountNumber and other details. A wallet is generated only after the initial deposit from a debit card.
+ Request (application/json)
+ Headers
+ Response 200 (application/json)
+ Headers
Cookie: sid
+ body
{
"status": "success",
"data": {
"id": "3a419291-2c93-41f0-b296-6866b8133375",
"customerId": "441a9684-6640-4b98-a5c4-121b144b8363",
"accountNumber": 27513619,
"balance": 15500000,
"type": "customer",
"createdAt": "2020-07-07T00:12:19.677Z",
"updatedAt": "2020-07-07T00:12:19.677Z"
}
}
# Transfer to another wallet [/api/v1/wallets/transfer]
### Transfer [POST]
Transfer takes a JSON object containing the amount in kobo and the receiving account number.
+ Request (application/json)
{
"amount": "15500000",
"accountNumber": "4084084",
}
+ Response 201 (application/json)
+ Headers
Cookie: sid
+ body
{
"status": "success",
"data": {
"transaction": {
"id": "cf49c7e5-f92a-48eb-80f9-ea82f7efd382",
"amount": -110000,
"accountNumber": 97365121,
"narration": "transfer_to_account: 27513619",
"type": "transfer",
"updatedAt": "2020-07-07T00:13:47.834Z",
"createdAt": "2020-07-07T00:13:47.834Z"
},
"wallet": {
"id": "537a5bb1-3c72-4882-913a-5a77e542e453",
"customerId": "4d21f615-54b6-466f-a96d-cd486af02fec",
"accountNumber": 97365121,
"balance": 15390000,
"type": "customer",
"createdAt": "2020-07-07T00:01:02.205Z",
"updatedAt": "2020-07-07T00:13:47.737Z"
}
}
}
# Get Wallet Transactions [/api/v1/transactions/{accountNumber}]
### Wallet [GET]
+ parameters
+ accountNumber
This returns a JSON object containing all transactions associated with the wallet.
+ Request (application/json)
+ Headers
+ Response 200 (application/json)
+ Headers
Cookie: sid
+ body
{
"status": "success",
"data": [
{
"id": "cad6e56e-513d-4bb7-a576-726c44922dde",
"accountNumber": 27513619,
"amount": 15500000,
"type": "funding",
"narration": "fund_account_wallet: 27513619",
"createdAt": "2020-07-07T00:12:19.686Z",
"updatedAt": "2020-07-07T00:12:19.686Z"
},
{
"id": "a5816c03-b824-42f8-8420-0255deaf4a0d",
"accountNumber": 27513619,
"amount": 110000,
"type": "transfer",
"narration": "transfer_from_account: 97365121",
"createdAt": "2020-07-07T00:13:47.842Z",
"updatedAt": "2020-07-07T00:13:47.842Z"
}
]
}