Shop API
The Shop API allows Web User to manage shop-realted management.
Endpoints
# Endpoints
Get voucher
This endpoint gets a voucher.
Request
GET /web/shop/vouchers/codes/{redeem_code}
Response (VoucherResDTO)
{
"success": true,
"message": "",
"data": {
"username": "eWZeVb",
"nickname": null,
"voucherName": "Lv. 3 現金券兌換碼",
"redeemCode": "490aeb5b-4c31-49c4-9e7f-7f5dc86d30fa",
"status": 2,
"isValid": true
}
}
Redeem voucher
This endpoint redeems a voucher.
Request
POST /web/shop/vouchers/codes/{redeem_code}/redeem
Response
{
"success": true,
"message": "",
"data": null
}
Get vouchers
This endpoint gets a list of vouchers.
Request
GET /web/shop/vouchers
Response (VoucherItemResDTO)
{
"success": true,
"message": "",
"data": [
{
"name": "Lv. 3 現金券兌換碼",
"description": "10元現金劵兌換碼",
"priceTag": "$10",
"level": 3
}
]
}
Filter shop items
This endpoint filters shop items.
Request (FilterShopItemReqDTO)
POST /web/shop/page
{
"pagination": {
"page": 1,
"size": 10
},
"sortings": [],
"searchKey": "",
"subcategoryIds": [
1,
3
]
}
Response (FilterShopResDTO)
{
"success": true,
"message": "",
"data": [
{
"pagination": {
"page": 1,
"size": 10,
"totalItems": 1,
"totalPages": 1
},
"sortings": [],
"items": [
{
"name": "聖誕節麋鹿車",
"coin": 0,
"categoryName": "地上玩具",
"publishedAt": "2024-07-24T16:14:07Z"
}
]
}
]
}
Filter user vouchers
This endpoint filters users' vouchers.
Request (FilterUserVoucherReqDTO)
POST /web/shop/vouchers/users/page
{
"pagination": {
"page": 1,
"size": 10
},
"sortings": [],
"searchKey": "",
"voucherRedeemStatuses": [
1,
3
],
"staffIds": [
"a75f8b21-f0e8-4750-9b60-76c77cfbb5d8"
]
}
Response (FilterUserVoucherResDTO)
{
"success": true,
"message": "",
"data": [
{
"username": "username1",
"phone": "phone",
"email": "email",
"district": "district",
"serviceNumber": "serviceNumber",
"staff": "staff",
"voucherName": "voucherName",
"voucherRedeemStatus": 2,
"expiredAt": "2024-11-25T03:37:17.217527Z",
"redeemAt": "2024-08-16T03:28:38.950301Z",
"redeemCode": "490aeb5b-4c31-49c4-9e7f-7f5dc86d30fa"
}
]
}
Item total
Get user vouchers total
Request
GET /web/shop/vouchers/item-total
Response (VoucherTotal)
{
"success": true,
"message": "",
"data": [
{
"purchased": 7
}
]
}
Resources
VoucherResDTO
properties
username
stringThe username of the user.
nickname
stringThe nickname of the user.
voucherName
stringThe name of the voucher.
redeemCode
stringThe url of the redeem QR code.
status
The voucher redeem status.
isValid
booleanIt indicates if the voucher is allowed to be redeemed or not. If false, frontend may display '兌換券不存在或已兌換'
VoucherItemResDTO
properties
name
stringThe name of the voucher.
description
stringThe description of the voucher.
priceTag
stringThe price tag of the voucher.
level
numberThe level.
FilterShopItemReqDTO
properties
Indicates the page information of the resource.
sortings
A list of sorting elements, the order of the list matters.
searchKey
stringThe search key should be about title.
subcategoryIds
The subcategory id of the shop item.
FilterShopResDTO
properties
Indicates the page information of the resource.
sortings
A list of sorting elements, the order of the list matters.
A list of filtered elements.
FilterShopItemResDTO
properties
name
stringThe name id of the shop item.
coin
numberThe coin needed to purchase the shop item.
categoryName
stringThe category name of the shop item.
publishedAt
datetimeThe published time.
FilterUserVoucherReqDTO
properties
Indicates the page information of the resource.
sortings
A list of sorting elements, the order of the list matters.
searchKey
stringThe search key should be about title.
VoucherRedeemStatuses
The voucher redeem status.
staffIds
arrayThe list of staff Ids. Multiple selection is allowed. If no staff is selected, please pass empty array to the server.
FilterUserVoucherResDTO
properties
username
string用戶名稱
phone
string電話號碼
email
string電郵地址
district
string所屬地區
serviceNumber
string服務編號,
staff
string服務職員,
voucherName
stringThe name of the voucher.
VoucherRedeemStatus
The voucher redeem status.
expiredAt
datetimeThe time when the voucher is expired.
redeemedAt
datetimeThe time when the voucher is redeemed.
redeemCode
stringThe url of the redeem QR code.
VoucherTotal
properties
purchased
intAwaiting exchange
VoucherRedeemStatus
Name | Value |
---|---|
- | 0 |
待換領 | 1 |
已換領 | 2 |
已過期 | 3 |