Project

General

Profile

Marketplace » History » Version 33

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