Project

General

Profile

Marketplace » History » Version 35

Ryan Supawarapong, 02/26/2026 03:19 AM

1 1 Ryan Supawarapong
# Marketplace
2
3 13 Ryan Supawarapong
There are the following API:
4 29 Ryan Supawarapong
1. [Lists](#Lists)
5 28 Ryan Supawarapong
2. [Posted](#Posted)
6
3. [Interested](#Interested)
7
4. [Get Interested](#Get-Interested)
8 13 Ryan Supawarapong
9 4 Ryan Supawarapong
## Diagram
10 35 Ryan Supawarapong
<img style="width: 875px;" src="clipboard-202602261019-lnw25.png"><br>
11 16 karnake ruengchaicharnkij
```
12
title Market Place
13 1 Ryan Supawarapong
14 16 karnake ruengchaicharnkij
actor "customer" as c
15
actor "owner" as o
16
actor "admin" as a
17
participant "frontend" as fe
18
participant "admin" as adm
19
participant "backend" as be
20
database "database" as db
21
participant "notification" as n
22 1 Ryan Supawarapong
23 35 Ryan Supawarapong
group posted
24 16 karnake ruengchaicharnkij
o->fe: post sell asset
25
fe->be: verify asset and quantities
26
be<->db: query database
27
be->fe: true/false
28 1 Ryan Supawarapong
fe->c: true: dispaly new post
29 35 Ryan Supawarapong
end 
30
group interested
31 16 karnake ruengchaicharnkij
c->fe: click "interest" button
32
fe->be: update status and count down 15 minutes
33
be<->db: update database
34
be->fe: true/false
35
fe->c: show status "locked"
36
be->n: update payment notification
37 1 Ryan Supawarapong
n->c: email bank account info and payment noti within 15 minutes
38 35 Ryan Supawarapong
end
39
group confirm payment
40 16 karnake ruengchaicharnkij
c->n: click confirm payment
41
c->fe: totp to confirm payment
42
fe->be: update payment
43
fe->fe: update status to "pending payment confirm"
44
be<->db: update database
45
be->n: update payment confirmation
46 1 Ryan Supawarapong
n->o: email payment acknowledge confirmation and pay service fees
47 35 Ryan Supawarapong
end
48
group confirm service fee
49 16 karnake ruengchaicharnkij
o->n: click confirm service fees
50
o->fe: totp to confirm service fees
51
fe->be: update service fees transaction
52
fe->fe: update status to "pending service fees confirm"
53
be<->db: update database
54
be->n: send service fees notification
55 1 Ryan Supawarapong
n->a: get noti for new service fees
56 35 Ryan Supawarapong
end
57
group admin cofirm service fee
58 16 karnake ruengchaicharnkij
adm<->be: get new service fees
59
a->adm: verify service fees
60
adm<->be: show service fees
61
a->adm: approved service fees
62
adm->be: update service fees status
63
be<->db: update database
64
be->n: send notification
65
n->o: get noti service fees approved
66 1 Ryan Supawarapong
fe->fe: update status to "complete"
67 35 Ryan Supawarapong
end
68 1 Ryan Supawarapong
```
69 17 Ryan Supawarapong
70 1 Ryan Supawarapong
## API route
71
72 28 Ryan Supawarapong
## Lists
73 8 Ryan Supawarapong
74 23 Ryan Supawarapong
| Type | Value |
75
|---|---|
76
| API Path | `/api/v1/customer/marketplace/lists` |
77 17 Ryan Supawarapong
| Request Type | `GET` |
78 1 Ryan Supawarapong
| Content-Type | `application/json` |
79 24 Ryan Supawarapong
| Authorization | `bearer ...` |
80 17 Ryan Supawarapong
81 13 Ryan Supawarapong
### Request Body
82 17 Ryan Supawarapong
83 3 Ryan Supawarapong
| Key | Type | Example | Required |
84 23 Ryan Supawarapong
|---|---|---|---|
85
| - | - | - | no body |
86 1 Ryan Supawarapong
87 23 Ryan Supawarapong
### Success Response (200)
88 1 Ryan Supawarapong
89
| JSON Path | Type | Example | Required |
90
|---|---|---|---|
91 23 Ryan Supawarapong
| status | string | `"success"` | yes |
92
| data | object | `{"transactions":[...]}` | yes |
93
| data.transactions | array<object> | `[{"id":1,"transactionId":"TXN_123",...}]` | yes |
94
| data.transactions[].id | number | `1` | no (`omitempty`) |
95
| data.transactions[].sellerCode | string | `"90000005"` | no |
96
| data.transactions[].sellerName | string | `"First Last"` | no |
97
| data.transactions[].assetCode | string | `"ASSET001"` | no |
98
| data.transactions[].assetName | string | `"Asset 001"` | no |
99
| data.transactions[].assetShortName | string | `"A001"` | no |
100
| data.transactions[].quantity | number | `10` | no |
101
| data.transactions[].price | number | `10.01` | no |
102
| data.transactions[].totalAmount | number | `100.10` | no |
103
| data.transactions[].currency | string | `"THB"` | no |
104
| data.transactions[].status | number | `1` | no |
105 1 Ryan Supawarapong
106 23 Ryan Supawarapong
### Error Response
107 1 Ryan Supawarapong
108 23 Ryan Supawarapong
#### Internal Server Error (500)
109
| JSON Path | Type | Example | Required |
110
|---|---|---|---|
111
| status | string | `"error"` | yes |
112
| message | string | `"database error"` | yes |
113 1 Ryan Supawarapong
114 23 Ryan Supawarapong
---
115
116 28 Ryan Supawarapong
## Posted
117 23 Ryan Supawarapong
118
| Type | Value |
119 1 Ryan Supawarapong
|---|---|
120 23 Ryan Supawarapong
| API Path | `/api/v1/customer/marketplace/posted` |
121
| Request Type | `POST` |
122
| Content-Type | `application/json` |
123 24 Ryan Supawarapong
| Authorization | `bearer ...` |
124 1 Ryan Supawarapong
125 23 Ryan Supawarapong
### Request Body
126
127
> `customerCode` and `customerName` are injected from auth token by handler, not required from client body.
128
129
| Key | Type | Example | Required |
130
|---|---|---|---|
131
| assetCode | string | `"ASSET001"` | yes |
132
| assetName | string | `"Asset 001"` | yes |
133
| assetShortName | string | `"A001"` | yes |
134 34 Ryan Supawarapong
| customerName | string | `"firstname Lastname"` | yes |
135 23 Ryan Supawarapong
| quantity | number | `5` | yes (`> 0`) |
136
| price | number | `10` | yes (`> 0`) |
137
| totalAmount | number | `50` | yes (`> 0`) |
138
139
### Success Response (200)
140
141
| JSON Path | Type | Example | Required |
142
|---|---|---|---|
143
| status | string | `"success"` | yes |
144
145
### Error Response
146
147
#### Bad Request (400) - bind error
148
| JSON Path | Type | Example | Required |
149
|---|---|---|---|
150
| status | string | `"failed"` | yes |
151
| data | object | `{"error":"...bind error..."}` | yes |
152
| data.error | string | `"code=400, message=..."` | yes |
153
154
#### Unauthorized (401) - token missing/invalid
155
| JSON Path | Type | Example | Required |
156
|---|---|---|---|
157
| status | string | `"failed"` | yes |
158
| data | object | `{"error":"invalid token claims"}` | yes |
159
| data.error | string | `"invalid token claims"` | yes |
160
161
#### Bad Request (400) - validation error
162
| JSON Path | Type | Example | Required |
163
|---|---|---|---|
164
| status | string | `"failed"` | yes |
165
| data | object | `{"errors":{"assetCode":"required"}}` | yes |
166
| data.errors | object | `{"field":"message"}` | yes |
167
168
#### Internal Server Error (500)
169
| JSON Path | Type | Example | Required |
170
|---|---|---|---|
171
| status | string | `"error"` | yes |
172 1 Ryan Supawarapong
| message | string | `"internal error"` | yes |
173 23 Ryan Supawarapong
174
---
175
176 28 Ryan Supawarapong
## Interested
177 23 Ryan Supawarapong
178
| Type | Value |
179
|---|---|
180
| API Path | `/api/v1/customer/marketplace/interested` |
181
| Request Type | `POST` |
182
| Content-Type | `application/json` |
183 24 Ryan Supawarapong
| Authorization | `bearer ...` |
184 23 Ryan Supawarapong
185
### Request Body
186
187
188
| Key | Type | Example | Required |
189
|---|---|---|---|
190
| assetCode | string | `"ASSET001"` | yes |
191
| assetName | string | `"Asset 001"` | yes |
192
| assetShortName | string | `"A001"` | yes |
193
| quantity | number | `5` | yes (`> 0`) |
194
| price | number | `10` | yes (`> 0`) |
195
| totalAmount | number | `50` | yes (`> 0`) |
196
| transactionId | string | `"TXN_123"` | yes |
197
198
### Success Response (200)
199
200
| JSON Path | Type | Example | Required |
201
|---|---|---|---|
202
| status | string | `"success"` | yes |
203
| data | object | `{"emailID":"emailID"}` | yes |
204
| data.emailID | string | `"emailID"` | yes |
205
206
### Error Response
207
208
#### Bad Request (400) - bind error
209
| JSON Path | Type | Example | Required |
210
|---|---|---|---|
211
| status | string | `"failed"` | yes |
212
| data | object | `{"error":"...bind error..."}` | yes |
213
| data.error | string | `"code=400, message=..."` | yes |
214
215
#### Unauthorized (401) - token missing/invalid
216
| JSON Path | Type | Example | Required |
217
|---|---|---|---|
218
| status | string | `"failed"` | yes |
219
| data | object | `{"error":"invalid token claims"}` | yes |
220
| data.error | string | `"invalid token claims"` | yes |
221 1 Ryan Supawarapong
222
#### Bad Request (400) - validation error
223
| JSON Path | Type | Example | Required |
224
|---|---|---|---|
225
| status | string | `"failed"` | yes |
226
| data | object | `{"errors":{"transactionId":"required"}}` | yes |
227
| data.errors | object | `{"field":"message"}` | yes |
228 26 Ryan Supawarapong
229
#### Internal Server Error (500)
230
| JSON Path | Type | Example | Required |
231
|---|---|---|---|
232 1 Ryan Supawarapong
| status | string | `"error"` | yes |
233 26 Ryan Supawarapong
| message | string | `"internal error"` | yes |
234
235
---
236
237 28 Ryan Supawarapong
## Get Interested
238 26 Ryan Supawarapong
239
| Type | Value |
240
|---|---|
241
| API Path | `/api/v1/customer/marketplace/interested/lists` |
242
| Request Type | `GET` |
243
| Content-Type | `application/json` |
244
| Authorization | `bearer ...` |
245
246
### Success Response (200)
247
248
| JSON Path | Type | Example | Required |
249
|---|---|---|---|
250
| status | string | `"success"` | yes |
251
| data | object | `{"interestedList":[...]}` | yes |
252 32 Ryan Supawarapong
| data.interestedList | array<object> | `[{"id":"TXN_123",...}]` | yes |
253 31 Ryan Supawarapong
| data.interestedList[].id | number | `1` | no (`omitempty`) |
254
| data.interestedList[].sellerCode | string | `"90000005"` | no |
255
| data.interestedList[].sellerName | string | `"First Last"` | no |
256
| data.interestedList[].buyerCode | string | `"90000004"` | no |
257
| data.interestedList[].buyerName | string | `"First Last2"` | no |
258
| data.interestedList[].assetCode | string | `"ASSET001"` | no |
259
| data.interestedList[].assetName | string | `"Asset 001"` | no |
260
| data.interestedList[].assetShortName | string | `"A001"` | no |
261
| data.interestedList[].quantity | number | `10` | no |
262
| data.interestedList[].price | number | `10.01` | no |
263
| data.interestedList[].totalAmount | number | `100.10` | no |
264
| data.interestedList[].currency | string | `"THB"` | no |
265
| data.interestedList[].status | number | `1` | no |
266 26 Ryan Supawarapong
267
### Error Response
268
269
#### Unauthorized (401) - token missing/invalid
270
| JSON Path | Type | Example | Required |
271
|---|---|---|---|
272
| status | string | `"failed"` | yes |
273
| data | object | `{"error":"invalid token claims"}` | yes |
274
| data.error | string | `"invalid token claims"` | yes |
275 23 Ryan Supawarapong
276
#### Internal Server Error (500)
277
| JSON Path | Type | Example | Required |
278
|---|---|---|---|
279
| status | string | `"error"` | yes |
280
| message | string | `"internal error"` | yes |