Project

General

Profile

Marketplace » History » Version 34

Ryan Supawarapong, 02/23/2026 08:20 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 34 Ryan Supawarapong
| customerName | string | `"firstname Lastname"` | yes |
125 23 Ryan Supawarapong
| quantity | number | `5` | yes (`> 0`) |
126
| price | number | `10` | yes (`> 0`) |
127
| totalAmount | number | `50` | yes (`> 0`) |
128
129
### Success Response (200)
130
131
| JSON Path | Type | Example | Required |
132
|---|---|---|---|
133
| status | string | `"success"` | yes |
134
135
### Error Response
136
137
#### Bad Request (400) - bind error
138
| JSON Path | Type | Example | Required |
139
|---|---|---|---|
140
| status | string | `"failed"` | yes |
141
| data | object | `{"error":"...bind error..."}` | yes |
142
| data.error | string | `"code=400, message=..."` | yes |
143
144
#### Unauthorized (401) - token missing/invalid
145
| JSON Path | Type | Example | Required |
146
|---|---|---|---|
147
| status | string | `"failed"` | yes |
148
| data | object | `{"error":"invalid token claims"}` | yes |
149
| data.error | string | `"invalid token claims"` | yes |
150
151
#### Bad Request (400) - validation error
152
| JSON Path | Type | Example | Required |
153
|---|---|---|---|
154
| status | string | `"failed"` | yes |
155
| data | object | `{"errors":{"assetCode":"required"}}` | yes |
156
| data.errors | object | `{"field":"message"}` | yes |
157
158
#### Internal Server Error (500)
159
| JSON Path | Type | Example | Required |
160
|---|---|---|---|
161
| status | string | `"error"` | yes |
162 1 Ryan Supawarapong
| message | string | `"internal error"` | yes |
163 23 Ryan Supawarapong
164
---
165
166 28 Ryan Supawarapong
## Interested
167 23 Ryan Supawarapong
168
| Type | Value |
169
|---|---|
170
| API Path | `/api/v1/customer/marketplace/interested` |
171
| Request Type | `POST` |
172
| Content-Type | `application/json` |
173 24 Ryan Supawarapong
| Authorization | `bearer ...` |
174 23 Ryan Supawarapong
175
### Request Body
176
177
178
| Key | Type | Example | Required |
179
|---|---|---|---|
180
| assetCode | string | `"ASSET001"` | yes |
181
| assetName | string | `"Asset 001"` | yes |
182
| assetShortName | string | `"A001"` | yes |
183
| quantity | number | `5` | yes (`> 0`) |
184
| price | number | `10` | yes (`> 0`) |
185
| totalAmount | number | `50` | yes (`> 0`) |
186
| transactionId | string | `"TXN_123"` | yes |
187
188
### Success Response (200)
189
190
| JSON Path | Type | Example | Required |
191
|---|---|---|---|
192
| status | string | `"success"` | yes |
193
| data | object | `{"emailID":"emailID"}` | yes |
194
| data.emailID | string | `"emailID"` | yes |
195
196
### Error Response
197
198
#### Bad Request (400) - bind error
199
| JSON Path | Type | Example | Required |
200
|---|---|---|---|
201
| status | string | `"failed"` | yes |
202
| data | object | `{"error":"...bind error..."}` | yes |
203
| data.error | string | `"code=400, message=..."` | yes |
204
205
#### Unauthorized (401) - token missing/invalid
206
| JSON Path | Type | Example | Required |
207
|---|---|---|---|
208
| status | string | `"failed"` | yes |
209
| data | object | `{"error":"invalid token claims"}` | yes |
210
| data.error | string | `"invalid token claims"` | yes |
211 1 Ryan Supawarapong
212
#### Bad Request (400) - validation error
213
| JSON Path | Type | Example | Required |
214
|---|---|---|---|
215
| status | string | `"failed"` | yes |
216
| data | object | `{"errors":{"transactionId":"required"}}` | yes |
217
| data.errors | object | `{"field":"message"}` | yes |
218 26 Ryan Supawarapong
219
#### Internal Server Error (500)
220
| JSON Path | Type | Example | Required |
221
|---|---|---|---|
222 1 Ryan Supawarapong
| status | string | `"error"` | yes |
223 26 Ryan Supawarapong
| message | string | `"internal error"` | yes |
224
225
---
226
227 28 Ryan Supawarapong
## Get Interested
228 26 Ryan Supawarapong
229
| Type | Value |
230
|---|---|
231
| API Path | `/api/v1/customer/marketplace/interested/lists` |
232
| Request Type | `GET` |
233
| Content-Type | `application/json` |
234
| Authorization | `bearer ...` |
235
236
### Success Response (200)
237
238
| JSON Path | Type | Example | Required |
239
|---|---|---|---|
240
| status | string | `"success"` | yes |
241
| data | object | `{"interestedList":[...]}` | yes |
242 32 Ryan Supawarapong
| data.interestedList | array<object> | `[{"id":"TXN_123",...}]` | yes |
243 31 Ryan Supawarapong
| data.interestedList[].id | number | `1` | no (`omitempty`) |
244
| data.interestedList[].sellerCode | string | `"90000005"` | no |
245
| data.interestedList[].sellerName | string | `"First Last"` | no |
246
| data.interestedList[].buyerCode | string | `"90000004"` | no |
247
| data.interestedList[].buyerName | string | `"First Last2"` | no |
248
| data.interestedList[].assetCode | string | `"ASSET001"` | no |
249
| data.interestedList[].assetName | string | `"Asset 001"` | no |
250
| data.interestedList[].assetShortName | string | `"A001"` | no |
251
| data.interestedList[].quantity | number | `10` | no |
252
| data.interestedList[].price | number | `10.01` | no |
253
| data.interestedList[].totalAmount | number | `100.10` | no |
254
| data.interestedList[].currency | string | `"THB"` | no |
255
| data.interestedList[].status | number | `1` | no |
256 26 Ryan Supawarapong
257
### Error Response
258
259
#### Unauthorized (401) - token missing/invalid
260
| JSON Path | Type | Example | Required |
261
|---|---|---|---|
262
| status | string | `"failed"` | yes |
263
| data | object | `{"error":"invalid token claims"}` | yes |
264
| data.error | string | `"invalid token claims"` | yes |
265 23 Ryan Supawarapong
266
#### Internal Server Error (500)
267
| JSON Path | Type | Example | Required |
268
|---|---|---|---|
269
| status | string | `"error"` | yes |
270
| message | string | `"internal error"` | yes |