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