@congminh1254/shopee-sdk 0.10.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +172 -36
- package/lib/fetch.js +13 -0
- package/lib/fetch.js.map +1 -1
- package/lib/managers/add-on-deal.manager.d.ts +140 -0
- package/lib/managers/add-on-deal.manager.js +240 -0
- package/lib/managers/add-on-deal.manager.js.map +1 -0
- package/lib/managers/ads.manager.d.ts +217 -1
- package/lib/managers/ads.manager.js +312 -0
- package/lib/managers/ads.manager.js.map +1 -1
- package/lib/managers/bundle-deal.manager.d.ts +106 -0
- package/lib/managers/bundle-deal.manager.js +178 -0
- package/lib/managers/bundle-deal.manager.js.map +1 -0
- package/lib/managers/discount.manager.d.ts +102 -0
- package/lib/managers/discount.manager.js +167 -0
- package/lib/managers/discount.manager.js.map +1 -0
- package/lib/managers/fbs.manager.d.ts +115 -0
- package/lib/managers/fbs.manager.js +145 -0
- package/lib/managers/fbs.manager.js.map +1 -0
- package/lib/managers/first-mile.manager.d.ts +150 -0
- package/lib/managers/first-mile.manager.js +264 -0
- package/lib/managers/first-mile.manager.js.map +1 -0
- package/lib/managers/follow-prize.manager.d.ts +108 -0
- package/lib/managers/follow-prize.manager.js +152 -0
- package/lib/managers/follow-prize.manager.js.map +1 -0
- package/lib/managers/global-product.manager.d.ts +664 -0
- package/lib/managers/global-product.manager.js +904 -0
- package/lib/managers/global-product.manager.js.map +1 -0
- package/lib/managers/index.d.ts +17 -1
- package/lib/managers/index.js +17 -1
- package/lib/managers/index.js.map +1 -1
- package/lib/managers/livestream.manager.d.ts +377 -0
- package/lib/managers/livestream.manager.js +529 -0
- package/lib/managers/livestream.manager.js.map +1 -0
- package/lib/managers/logistics.manager.d.ts +267 -1
- package/lib/managers/logistics.manager.js +544 -0
- package/lib/managers/logistics.manager.js.map +1 -1
- package/lib/managers/media-space.manager.d.ts +179 -0
- package/lib/managers/media-space.manager.js +220 -0
- package/lib/managers/media-space.manager.js.map +1 -0
- package/lib/managers/media.manager.d.ts +226 -0
- package/lib/managers/media.manager.js +274 -0
- package/lib/managers/media.manager.js.map +1 -0
- package/lib/managers/merchant.manager.d.ts +100 -0
- package/lib/managers/merchant.manager.js +144 -0
- package/lib/managers/merchant.manager.js.map +1 -0
- package/lib/managers/order.manager.d.ts +213 -1
- package/lib/managers/order.manager.js +305 -0
- package/lib/managers/order.manager.js.map +1 -1
- package/lib/managers/payment.manager.d.ts +186 -1
- package/lib/managers/payment.manager.js +288 -0
- package/lib/managers/payment.manager.js.map +1 -1
- package/lib/managers/returns.manager.d.ts +200 -0
- package/lib/managers/returns.manager.js +300 -0
- package/lib/managers/returns.manager.js.map +1 -0
- package/lib/managers/sbs.manager.d.ts +112 -0
- package/lib/managers/sbs.manager.js +149 -0
- package/lib/managers/sbs.manager.js.map +1 -0
- package/lib/managers/shop-category.manager.d.ts +207 -0
- package/lib/managers/shop-category.manager.js +258 -0
- package/lib/managers/shop-category.manager.js.map +1 -0
- package/lib/managers/shop-flash-sale.manager.d.ts +242 -0
- package/lib/managers/shop-flash-sale.manager.js +321 -0
- package/lib/managers/shop-flash-sale.manager.js.map +1 -0
- package/lib/managers/shop.manager.d.ts +173 -0
- package/lib/managers/shop.manager.js +217 -0
- package/lib/managers/shop.manager.js.map +1 -0
- package/lib/managers/top-picks.manager.d.ts +62 -0
- package/lib/managers/top-picks.manager.js +91 -0
- package/lib/managers/top-picks.manager.js.map +1 -0
- package/lib/schemas/add-on-deal.d.ts +390 -0
- package/lib/schemas/add-on-deal.js +45 -0
- package/lib/schemas/add-on-deal.js.map +1 -0
- package/lib/schemas/ads.d.ts +437 -0
- package/lib/schemas/bundle-deal.d.ts +300 -0
- package/lib/schemas/bundle-deal.js +27 -0
- package/lib/schemas/bundle-deal.js.map +1 -0
- package/lib/schemas/discount.d.ts +334 -0
- package/lib/schemas/discount.js +15 -0
- package/lib/schemas/discount.js.map +1 -0
- package/lib/schemas/fbs.d.ts +117 -0
- package/lib/schemas/fbs.js +2 -0
- package/lib/schemas/fbs.js.map +1 -0
- package/lib/schemas/first-mile.d.ts +551 -0
- package/lib/schemas/first-mile.js +2 -0
- package/lib/schemas/first-mile.js.map +1 -0
- package/lib/schemas/follow-prize.d.ts +198 -0
- package/lib/schemas/follow-prize.js +27 -0
- package/lib/schemas/follow-prize.js.map +1 -0
- package/lib/schemas/global-product.d.ts +1127 -0
- package/lib/schemas/global-product.js +2 -0
- package/lib/schemas/global-product.js.map +1 -0
- package/lib/schemas/index.d.ts +13 -0
- package/lib/schemas/index.js +17 -0
- package/lib/schemas/index.js.map +1 -1
- package/lib/schemas/livestream.d.ts +649 -0
- package/lib/schemas/livestream.js +2 -0
- package/lib/schemas/livestream.js.map +1 -0
- package/lib/schemas/logistics.d.ts +979 -0
- package/lib/schemas/logistics.js +13 -0
- package/lib/schemas/logistics.js.map +1 -1
- package/lib/schemas/media-space.d.ts +189 -0
- package/lib/schemas/media-space.js +2 -0
- package/lib/schemas/media-space.js.map +1 -0
- package/lib/schemas/media.d.ts +230 -0
- package/lib/schemas/media.js +2 -0
- package/lib/schemas/media.js.map +1 -0
- package/lib/schemas/merchant.d.ts +236 -0
- package/lib/schemas/merchant.js +2 -0
- package/lib/schemas/merchant.js.map +1 -0
- package/lib/schemas/order.d.ts +431 -0
- package/lib/schemas/payment.d.ts +397 -0
- package/lib/schemas/returns.d.ts +632 -0
- package/lib/schemas/returns.js +63 -0
- package/lib/schemas/returns.js.map +1 -0
- package/lib/schemas/sbs.d.ts +484 -0
- package/lib/schemas/sbs.js +2 -0
- package/lib/schemas/sbs.js.map +1 -0
- package/lib/schemas/shop-category.d.ts +176 -0
- package/lib/schemas/shop-category.js +2 -0
- package/lib/schemas/shop-category.js.map +1 -0
- package/lib/schemas/shop-flash-sale.d.ts +473 -0
- package/lib/schemas/shop-flash-sale.js +43 -0
- package/lib/schemas/shop-flash-sale.js.map +1 -0
- package/lib/schemas/shop.d.ts +250 -0
- package/lib/schemas/shop.js +2 -0
- package/lib/schemas/shop.js.map +1 -0
- package/lib/schemas/top-picks.d.ts +99 -0
- package/lib/schemas/top-picks.js +2 -0
- package/lib/schemas/top-picks.js.map +1 -0
- package/lib/sdk.d.ts +34 -0
- package/lib/sdk.js +34 -0
- package/lib/sdk.js.map +1 -1
- package/package.json +2 -4
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { ShopeeConfig } from "../sdk.js";
|
|
2
|
+
import { BaseManager } from "./base.manager.js";
|
|
3
|
+
import { AddDiscountParams, AddDiscountResponse, AddDiscountItemParams, AddDiscountItemResponse, DeleteDiscountParams, DeleteDiscountResponse, DeleteDiscountItemParams, DeleteDiscountItemResponse, EndDiscountParams, EndDiscountResponse, GetDiscountParams, GetDiscountResponse, GetDiscountListParams, GetDiscountListResponse, UpdateDiscountParams, UpdateDiscountResponse, UpdateDiscountItemParams, UpdateDiscountItemResponse } from "../schemas/discount.js";
|
|
4
|
+
export declare class DiscountManager extends BaseManager {
|
|
5
|
+
constructor(config: ShopeeConfig);
|
|
6
|
+
/**
|
|
7
|
+
* Add a new shop discount activity
|
|
8
|
+
* @param {AddDiscountParams} params - Parameters for creating a new discount
|
|
9
|
+
* @returns {Promise<AddDiscountResponse>} The response containing the created discount ID
|
|
10
|
+
*
|
|
11
|
+
* Note: The start time must be 1 hour later than current time.
|
|
12
|
+
* The end time must be 1 hour later than start time, and the discount period must be less than 180 days.
|
|
13
|
+
*/
|
|
14
|
+
addDiscount(params: AddDiscountParams): Promise<AddDiscountResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* Add items to an existing discount activity
|
|
17
|
+
* @param {AddDiscountItemParams} params - Parameters for adding items to a discount
|
|
18
|
+
* @returns {Promise<AddDiscountItemResponse>} The response containing the count of added items and any errors
|
|
19
|
+
*
|
|
20
|
+
* The response includes:
|
|
21
|
+
* - discount_id: The ID of the discount activity
|
|
22
|
+
* - count: Number of items successfully added
|
|
23
|
+
* - error_list: List of items that failed to be added with error details
|
|
24
|
+
* - warning: Warning message if any
|
|
25
|
+
*/
|
|
26
|
+
addDiscountItem(params: AddDiscountItemParams): Promise<AddDiscountItemResponse>;
|
|
27
|
+
/**
|
|
28
|
+
* Delete an existing discount activity
|
|
29
|
+
* @param {DeleteDiscountParams} params - Parameters for deleting a discount
|
|
30
|
+
* @returns {Promise<DeleteDiscountResponse>} The response containing the deleted discount ID and modification time
|
|
31
|
+
*
|
|
32
|
+
* Note: Can only delete upcoming discounts that haven't started yet.
|
|
33
|
+
* Will return an error if attempting to delete a discount that has already started.
|
|
34
|
+
*/
|
|
35
|
+
deleteDiscount(params: DeleteDiscountParams): Promise<DeleteDiscountResponse>;
|
|
36
|
+
/**
|
|
37
|
+
* Delete items from an existing discount activity
|
|
38
|
+
* @param {DeleteDiscountItemParams} params - Parameters for deleting items from a discount
|
|
39
|
+
* @returns {Promise<DeleteDiscountItemResponse>} The response containing the discount ID and any errors
|
|
40
|
+
*
|
|
41
|
+
* The response includes:
|
|
42
|
+
* - discount_id: The ID of the discount activity
|
|
43
|
+
* - error_list: List of items that failed to be deleted with error details
|
|
44
|
+
*/
|
|
45
|
+
deleteDiscountItem(params: DeleteDiscountItemParams): Promise<DeleteDiscountItemResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* End an ongoing discount activity immediately
|
|
48
|
+
* @param {EndDiscountParams} params - Parameters for ending a discount
|
|
49
|
+
* @returns {Promise<EndDiscountResponse>} The response containing the ended discount ID and modification time
|
|
50
|
+
*
|
|
51
|
+
* Note: Can only end discounts that are currently ongoing/active.
|
|
52
|
+
* Will return an error if attempting to end an upcoming or expired discount.
|
|
53
|
+
*/
|
|
54
|
+
endDiscount(params: EndDiscountParams): Promise<EndDiscountResponse>;
|
|
55
|
+
/**
|
|
56
|
+
* Get detailed information about a discount activity
|
|
57
|
+
* @param {GetDiscountParams} params - Parameters for getting discount details
|
|
58
|
+
* @returns {Promise<GetDiscountResponse>} The response containing comprehensive discount information
|
|
59
|
+
*
|
|
60
|
+
* The response includes:
|
|
61
|
+
* - Basic discount details (ID, name, status, timing, etc.)
|
|
62
|
+
* - Item list with detailed pricing information (original price, promotion price, stock, etc.)
|
|
63
|
+
* - For items with variations: detailed model information
|
|
64
|
+
* - Purchase limits for each item
|
|
65
|
+
* - Pagination info (more: boolean indicating if there are more pages)
|
|
66
|
+
*/
|
|
67
|
+
getDiscount(params: GetDiscountParams): Promise<GetDiscountResponse>;
|
|
68
|
+
/**
|
|
69
|
+
* Get a list of discount activities with pagination
|
|
70
|
+
* @param {GetDiscountListParams} params - Parameters for retrieving discount list
|
|
71
|
+
* @param {DiscountStatus} params.discount_status - Filter by discount status (UPCOMING, ONGOING, EXPIRED, or ALL)
|
|
72
|
+
* @param {number} [params.page_no] - Page number to retrieve (default: 1)
|
|
73
|
+
* @param {number} [params.page_size] - Number of items per page (default: 100, max: 100)
|
|
74
|
+
* @returns {Promise<GetDiscountListResponse>} The response containing a paginated list of discounts
|
|
75
|
+
*
|
|
76
|
+
* The response includes:
|
|
77
|
+
* - Pagination information (more: boolean indicating if there are more pages)
|
|
78
|
+
* - A list of discounts with basic details such as ID, name, status, start/end time, and source
|
|
79
|
+
*/
|
|
80
|
+
getDiscountList(params: GetDiscountListParams): Promise<GetDiscountListResponse>;
|
|
81
|
+
/**
|
|
82
|
+
* Update an existing discount activity
|
|
83
|
+
* @param {UpdateDiscountParams} params - Parameters for updating a discount
|
|
84
|
+
* @returns {Promise<UpdateDiscountResponse>} The response containing the updated discount ID and modification time
|
|
85
|
+
*
|
|
86
|
+
* Note: For ongoing discounts, update capabilities may be limited.
|
|
87
|
+
* Only certain fields can be modified depending on the discount status.
|
|
88
|
+
*/
|
|
89
|
+
updateDiscount(params: UpdateDiscountParams): Promise<UpdateDiscountResponse>;
|
|
90
|
+
/**
|
|
91
|
+
* Update items in an existing discount activity
|
|
92
|
+
* @param {UpdateDiscountItemParams} params - Parameters for updating discount items
|
|
93
|
+
* @returns {Promise<UpdateDiscountItemResponse>} The response containing the count of updated items and any errors
|
|
94
|
+
*
|
|
95
|
+
* The response includes:
|
|
96
|
+
* - discount_id: The ID of the discount activity
|
|
97
|
+
* - count: Number of items successfully updated
|
|
98
|
+
* - error_list: List of items that failed to be updated with error details
|
|
99
|
+
* - warning: Warning message if any
|
|
100
|
+
*/
|
|
101
|
+
updateDiscountItem(params: UpdateDiscountItemParams): Promise<UpdateDiscountItemResponse>;
|
|
102
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { BaseManager } from "./base.manager.js";
|
|
2
|
+
import { ShopeeFetch } from "../fetch.js";
|
|
3
|
+
export class DiscountManager extends BaseManager {
|
|
4
|
+
constructor(config) {
|
|
5
|
+
super(config);
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Add a new shop discount activity
|
|
9
|
+
* @param {AddDiscountParams} params - Parameters for creating a new discount
|
|
10
|
+
* @returns {Promise<AddDiscountResponse>} The response containing the created discount ID
|
|
11
|
+
*
|
|
12
|
+
* Note: The start time must be 1 hour later than current time.
|
|
13
|
+
* The end time must be 1 hour later than start time, and the discount period must be less than 180 days.
|
|
14
|
+
*/
|
|
15
|
+
async addDiscount(params) {
|
|
16
|
+
const response = await ShopeeFetch.fetch(this.config, "/discount/add_discount", {
|
|
17
|
+
method: "POST",
|
|
18
|
+
auth: true,
|
|
19
|
+
body: params,
|
|
20
|
+
});
|
|
21
|
+
return response;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Add items to an existing discount activity
|
|
25
|
+
* @param {AddDiscountItemParams} params - Parameters for adding items to a discount
|
|
26
|
+
* @returns {Promise<AddDiscountItemResponse>} The response containing the count of added items and any errors
|
|
27
|
+
*
|
|
28
|
+
* The response includes:
|
|
29
|
+
* - discount_id: The ID of the discount activity
|
|
30
|
+
* - count: Number of items successfully added
|
|
31
|
+
* - error_list: List of items that failed to be added with error details
|
|
32
|
+
* - warning: Warning message if any
|
|
33
|
+
*/
|
|
34
|
+
async addDiscountItem(params) {
|
|
35
|
+
const response = await ShopeeFetch.fetch(this.config, "/discount/add_discount_item", {
|
|
36
|
+
method: "POST",
|
|
37
|
+
auth: true,
|
|
38
|
+
body: params,
|
|
39
|
+
});
|
|
40
|
+
return response;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Delete an existing discount activity
|
|
44
|
+
* @param {DeleteDiscountParams} params - Parameters for deleting a discount
|
|
45
|
+
* @returns {Promise<DeleteDiscountResponse>} The response containing the deleted discount ID and modification time
|
|
46
|
+
*
|
|
47
|
+
* Note: Can only delete upcoming discounts that haven't started yet.
|
|
48
|
+
* Will return an error if attempting to delete a discount that has already started.
|
|
49
|
+
*/
|
|
50
|
+
async deleteDiscount(params) {
|
|
51
|
+
const response = await ShopeeFetch.fetch(this.config, "/discount/delete_discount", {
|
|
52
|
+
method: "POST",
|
|
53
|
+
auth: true,
|
|
54
|
+
body: params,
|
|
55
|
+
});
|
|
56
|
+
return response;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Delete items from an existing discount activity
|
|
60
|
+
* @param {DeleteDiscountItemParams} params - Parameters for deleting items from a discount
|
|
61
|
+
* @returns {Promise<DeleteDiscountItemResponse>} The response containing the discount ID and any errors
|
|
62
|
+
*
|
|
63
|
+
* The response includes:
|
|
64
|
+
* - discount_id: The ID of the discount activity
|
|
65
|
+
* - error_list: List of items that failed to be deleted with error details
|
|
66
|
+
*/
|
|
67
|
+
async deleteDiscountItem(params) {
|
|
68
|
+
const response = await ShopeeFetch.fetch(this.config, "/discount/delete_discount_item", {
|
|
69
|
+
method: "POST",
|
|
70
|
+
auth: true,
|
|
71
|
+
body: params,
|
|
72
|
+
});
|
|
73
|
+
return response;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* End an ongoing discount activity immediately
|
|
77
|
+
* @param {EndDiscountParams} params - Parameters for ending a discount
|
|
78
|
+
* @returns {Promise<EndDiscountResponse>} The response containing the ended discount ID and modification time
|
|
79
|
+
*
|
|
80
|
+
* Note: Can only end discounts that are currently ongoing/active.
|
|
81
|
+
* Will return an error if attempting to end an upcoming or expired discount.
|
|
82
|
+
*/
|
|
83
|
+
async endDiscount(params) {
|
|
84
|
+
const response = await ShopeeFetch.fetch(this.config, "/discount/end_discount", {
|
|
85
|
+
method: "POST",
|
|
86
|
+
auth: true,
|
|
87
|
+
body: params,
|
|
88
|
+
});
|
|
89
|
+
return response;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Get detailed information about a discount activity
|
|
93
|
+
* @param {GetDiscountParams} params - Parameters for getting discount details
|
|
94
|
+
* @returns {Promise<GetDiscountResponse>} The response containing comprehensive discount information
|
|
95
|
+
*
|
|
96
|
+
* The response includes:
|
|
97
|
+
* - Basic discount details (ID, name, status, timing, etc.)
|
|
98
|
+
* - Item list with detailed pricing information (original price, promotion price, stock, etc.)
|
|
99
|
+
* - For items with variations: detailed model information
|
|
100
|
+
* - Purchase limits for each item
|
|
101
|
+
* - Pagination info (more: boolean indicating if there are more pages)
|
|
102
|
+
*/
|
|
103
|
+
async getDiscount(params) {
|
|
104
|
+
const response = await ShopeeFetch.fetch(this.config, "/discount/get_discount", {
|
|
105
|
+
method: "GET",
|
|
106
|
+
auth: true,
|
|
107
|
+
params,
|
|
108
|
+
});
|
|
109
|
+
return response;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Get a list of discount activities with pagination
|
|
113
|
+
* @param {GetDiscountListParams} params - Parameters for retrieving discount list
|
|
114
|
+
* @param {DiscountStatus} params.discount_status - Filter by discount status (UPCOMING, ONGOING, EXPIRED, or ALL)
|
|
115
|
+
* @param {number} [params.page_no] - Page number to retrieve (default: 1)
|
|
116
|
+
* @param {number} [params.page_size] - Number of items per page (default: 100, max: 100)
|
|
117
|
+
* @returns {Promise<GetDiscountListResponse>} The response containing a paginated list of discounts
|
|
118
|
+
*
|
|
119
|
+
* The response includes:
|
|
120
|
+
* - Pagination information (more: boolean indicating if there are more pages)
|
|
121
|
+
* - A list of discounts with basic details such as ID, name, status, start/end time, and source
|
|
122
|
+
*/
|
|
123
|
+
async getDiscountList(params) {
|
|
124
|
+
const response = await ShopeeFetch.fetch(this.config, "/discount/get_discount_list", {
|
|
125
|
+
method: "GET",
|
|
126
|
+
auth: true,
|
|
127
|
+
params,
|
|
128
|
+
});
|
|
129
|
+
return response;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Update an existing discount activity
|
|
133
|
+
* @param {UpdateDiscountParams} params - Parameters for updating a discount
|
|
134
|
+
* @returns {Promise<UpdateDiscountResponse>} The response containing the updated discount ID and modification time
|
|
135
|
+
*
|
|
136
|
+
* Note: For ongoing discounts, update capabilities may be limited.
|
|
137
|
+
* Only certain fields can be modified depending on the discount status.
|
|
138
|
+
*/
|
|
139
|
+
async updateDiscount(params) {
|
|
140
|
+
const response = await ShopeeFetch.fetch(this.config, "/discount/update_discount", {
|
|
141
|
+
method: "POST",
|
|
142
|
+
auth: true,
|
|
143
|
+
body: params,
|
|
144
|
+
});
|
|
145
|
+
return response;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Update items in an existing discount activity
|
|
149
|
+
* @param {UpdateDiscountItemParams} params - Parameters for updating discount items
|
|
150
|
+
* @returns {Promise<UpdateDiscountItemResponse>} The response containing the count of updated items and any errors
|
|
151
|
+
*
|
|
152
|
+
* The response includes:
|
|
153
|
+
* - discount_id: The ID of the discount activity
|
|
154
|
+
* - count: Number of items successfully updated
|
|
155
|
+
* - error_list: List of items that failed to be updated with error details
|
|
156
|
+
* - warning: Warning message if any
|
|
157
|
+
*/
|
|
158
|
+
async updateDiscountItem(params) {
|
|
159
|
+
const response = await ShopeeFetch.fetch(this.config, "/discount/update_discount_item", {
|
|
160
|
+
method: "POST",
|
|
161
|
+
auth: true,
|
|
162
|
+
body: params,
|
|
163
|
+
});
|
|
164
|
+
return response;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=discount.manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version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AAkB,CAAC,MAAgC;QACvD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,gCAAgC,EAChC;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,MAAM;SACb,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { ShopeeConfig } from "../sdk.js";
|
|
2
|
+
import { BaseManager } from "./base.manager.js";
|
|
3
|
+
import { QueryBrShopEnrollmentStatusParams, QueryBrShopEnrollmentStatusResponse, QueryBrShopBlockStatusParams, QueryBrShopBlockStatusResponse, QueryBrShopInvoiceErrorParams, QueryBrShopInvoiceErrorResponse, QueryBrSkuBlockStatusParams, QueryBrSkuBlockStatusResponse } from "../schemas/fbs.js";
|
|
4
|
+
export declare class FbsManager extends BaseManager {
|
|
5
|
+
constructor(config: ShopeeConfig);
|
|
6
|
+
/**
|
|
7
|
+
* Check whether a given shop_id is eligible to enroll in the Brazil Fulfilled-by-Shopee (FBS) service.
|
|
8
|
+
* This API is for Brazil region only.
|
|
9
|
+
*
|
|
10
|
+
* @param params - Parameters for querying enrollment status (empty object)
|
|
11
|
+
*
|
|
12
|
+
* @returns A promise that resolves to the enrollment status response containing:
|
|
13
|
+
* - shop_id: Shopee's unique identifier for the shop
|
|
14
|
+
* - enrollment_status: 1=enable enrollment, 2=disable enrollment, 3=already enrollment
|
|
15
|
+
* - enable_enrollment_time: The time when the shop can enroll in FBS
|
|
16
|
+
*
|
|
17
|
+
* @throws {Error} When the API request fails or returns an error
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const status = await sdk.fbs.queryBrShopEnrollmentStatus({});
|
|
22
|
+
* if (status.response.enrollment_status === 1) {
|
|
23
|
+
* console.log('Shop can enroll in FBS');
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
queryBrShopEnrollmentStatus(params?: QueryBrShopEnrollmentStatusParams): Promise<QueryBrShopEnrollmentStatusResponse>;
|
|
28
|
+
/**
|
|
29
|
+
* Check whether an FBS shop is blocked due to invoice-related issues.
|
|
30
|
+
* When blocked, the shop cannot create new Inbound Requests, and its warehouse
|
|
31
|
+
* inventory is restricted from being sold. This API is for Brazil region only.
|
|
32
|
+
*
|
|
33
|
+
* @param params - Parameters for querying shop block status (empty object)
|
|
34
|
+
*
|
|
35
|
+
* @returns A promise that resolves to the block status response containing:
|
|
36
|
+
* - shop_id: Shopee's unique identifier for the shop
|
|
37
|
+
* - is_block: Whether the shop is blocked
|
|
38
|
+
*
|
|
39
|
+
* @throws {Error} When the API request fails or returns an error
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* const status = await sdk.fbs.queryBrShopBlockStatus({});
|
|
44
|
+
* if (status.response.is_block) {
|
|
45
|
+
* console.log('Shop is blocked due to invoice issues');
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
queryBrShopBlockStatus(params?: QueryBrShopBlockStatusParams): Promise<QueryBrShopBlockStatusResponse>;
|
|
50
|
+
/**
|
|
51
|
+
* Get failed invoice issuance information for FBS-related processes.
|
|
52
|
+
* This covers Inbound Requests, RTS Requests, Sales Orders, and Move Transfer Orders.
|
|
53
|
+
* This API is for Brazil region only.
|
|
54
|
+
*
|
|
55
|
+
* @param params - Parameters for querying invoice errors
|
|
56
|
+
* @param params.page_no - Page number (default: 1)
|
|
57
|
+
* @param params.page_size - Page size, max: 100 (default: 10)
|
|
58
|
+
*
|
|
59
|
+
* @returns A promise that resolves to the invoice error response containing:
|
|
60
|
+
* - total: Total number of invoice errors
|
|
61
|
+
* - list: List of invoice errors with details including:
|
|
62
|
+
* - biz_request_type: Type of business request (1=Inbound, 2=RTS, 3=Sales, 4=Move Transfer, 5=IA)
|
|
63
|
+
* - biz_request_id: Business request ID
|
|
64
|
+
* - fail_reason: Reason for invoice failure
|
|
65
|
+
* - fail_type: 1=SKU tax info error, 2=seller tax info error
|
|
66
|
+
* - invoice_deadline_time: Deadline to fix the issue
|
|
67
|
+
* - shop_sku_list: List of SKUs with errors
|
|
68
|
+
*
|
|
69
|
+
* @throws {Error} When the API request fails or returns an error
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* const errors = await sdk.fbs.queryBrShopInvoiceError({
|
|
74
|
+
* page_no: 1,
|
|
75
|
+
* page_size: 20,
|
|
76
|
+
* });
|
|
77
|
+
*
|
|
78
|
+
* errors.response.list.forEach(error => {
|
|
79
|
+
* console.log(`Request ID: ${error.biz_request_id}`);
|
|
80
|
+
* console.log(`Failed reason: ${error.fail_reason}`);
|
|
81
|
+
* });
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
queryBrShopInvoiceError(params?: QueryBrShopInvoiceErrorParams): Promise<QueryBrShopInvoiceErrorResponse>;
|
|
85
|
+
/**
|
|
86
|
+
* Check whether an FBS product is blocked due to invoice-related issues.
|
|
87
|
+
* When blocked, the product cannot be included in new Inbound Requests, and its
|
|
88
|
+
* warehouse inventory is restricted from being sold. This API is for Brazil region only.
|
|
89
|
+
*
|
|
90
|
+
* @param params - Parameters for querying SKU block status
|
|
91
|
+
* @param params.shop_sku_id - Shop SKU ID in format "itemID_modelID"
|
|
92
|
+
*
|
|
93
|
+
* @returns A promise that resolves to the SKU block status response containing:
|
|
94
|
+
* - shop_sku_id: The queried SKU ID
|
|
95
|
+
* - is_block: Whether the SKU is blocked
|
|
96
|
+
* - shop_item_id: Item ID
|
|
97
|
+
* - shop_model_id: Model ID
|
|
98
|
+
* - shop_item_name: Item name
|
|
99
|
+
* - shop_model_name: Model name
|
|
100
|
+
*
|
|
101
|
+
* @throws {Error} When the API request fails or returns an error
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* const status = await sdk.fbs.queryBrSkuBlockStatus({
|
|
106
|
+
* shop_sku_id: '123456_789012',
|
|
107
|
+
* });
|
|
108
|
+
*
|
|
109
|
+
* if (status.response.is_block) {
|
|
110
|
+
* console.log(`SKU ${status.response.shop_item_name} is blocked`);
|
|
111
|
+
* }
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
queryBrSkuBlockStatus(params: QueryBrSkuBlockStatusParams): Promise<QueryBrSkuBlockStatusResponse>;
|
|
115
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { BaseManager } from "./base.manager.js";
|
|
2
|
+
import { ShopeeFetch } from "../fetch.js";
|
|
3
|
+
export class FbsManager extends BaseManager {
|
|
4
|
+
constructor(config) {
|
|
5
|
+
super(config);
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Check whether a given shop_id is eligible to enroll in the Brazil Fulfilled-by-Shopee (FBS) service.
|
|
9
|
+
* This API is for Brazil region only.
|
|
10
|
+
*
|
|
11
|
+
* @param params - Parameters for querying enrollment status (empty object)
|
|
12
|
+
*
|
|
13
|
+
* @returns A promise that resolves to the enrollment status response containing:
|
|
14
|
+
* - shop_id: Shopee's unique identifier for the shop
|
|
15
|
+
* - enrollment_status: 1=enable enrollment, 2=disable enrollment, 3=already enrollment
|
|
16
|
+
* - enable_enrollment_time: The time when the shop can enroll in FBS
|
|
17
|
+
*
|
|
18
|
+
* @throws {Error} When the API request fails or returns an error
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const status = await sdk.fbs.queryBrShopEnrollmentStatus({});
|
|
23
|
+
* if (status.response.enrollment_status === 1) {
|
|
24
|
+
* console.log('Shop can enroll in FBS');
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
async queryBrShopEnrollmentStatus(params = {}) {
|
|
29
|
+
const response = await ShopeeFetch.fetch(this.config, "/fbs/query_br_shop_enrollment_status", {
|
|
30
|
+
method: "POST",
|
|
31
|
+
auth: true,
|
|
32
|
+
body: params,
|
|
33
|
+
});
|
|
34
|
+
return response;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Check whether an FBS shop is blocked due to invoice-related issues.
|
|
38
|
+
* When blocked, the shop cannot create new Inbound Requests, and its warehouse
|
|
39
|
+
* inventory is restricted from being sold. This API is for Brazil region only.
|
|
40
|
+
*
|
|
41
|
+
* @param params - Parameters for querying shop block status (empty object)
|
|
42
|
+
*
|
|
43
|
+
* @returns A promise that resolves to the block status response containing:
|
|
44
|
+
* - shop_id: Shopee's unique identifier for the shop
|
|
45
|
+
* - is_block: Whether the shop is blocked
|
|
46
|
+
*
|
|
47
|
+
* @throws {Error} When the API request fails or returns an error
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* const status = await sdk.fbs.queryBrShopBlockStatus({});
|
|
52
|
+
* if (status.response.is_block) {
|
|
53
|
+
* console.log('Shop is blocked due to invoice issues');
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
async queryBrShopBlockStatus(params = {}) {
|
|
58
|
+
const response = await ShopeeFetch.fetch(this.config, "/fbs/query_br_shop_block_status", {
|
|
59
|
+
method: "POST",
|
|
60
|
+
auth: true,
|
|
61
|
+
body: params,
|
|
62
|
+
});
|
|
63
|
+
return response;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Get failed invoice issuance information for FBS-related processes.
|
|
67
|
+
* This covers Inbound Requests, RTS Requests, Sales Orders, and Move Transfer Orders.
|
|
68
|
+
* This API is for Brazil region only.
|
|
69
|
+
*
|
|
70
|
+
* @param params - Parameters for querying invoice errors
|
|
71
|
+
* @param params.page_no - Page number (default: 1)
|
|
72
|
+
* @param params.page_size - Page size, max: 100 (default: 10)
|
|
73
|
+
*
|
|
74
|
+
* @returns A promise that resolves to the invoice error response containing:
|
|
75
|
+
* - total: Total number of invoice errors
|
|
76
|
+
* - list: List of invoice errors with details including:
|
|
77
|
+
* - biz_request_type: Type of business request (1=Inbound, 2=RTS, 3=Sales, 4=Move Transfer, 5=IA)
|
|
78
|
+
* - biz_request_id: Business request ID
|
|
79
|
+
* - fail_reason: Reason for invoice failure
|
|
80
|
+
* - fail_type: 1=SKU tax info error, 2=seller tax info error
|
|
81
|
+
* - invoice_deadline_time: Deadline to fix the issue
|
|
82
|
+
* - shop_sku_list: List of SKUs with errors
|
|
83
|
+
*
|
|
84
|
+
* @throws {Error} When the API request fails or returns an error
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* const errors = await sdk.fbs.queryBrShopInvoiceError({
|
|
89
|
+
* page_no: 1,
|
|
90
|
+
* page_size: 20,
|
|
91
|
+
* });
|
|
92
|
+
*
|
|
93
|
+
* errors.response.list.forEach(error => {
|
|
94
|
+
* console.log(`Request ID: ${error.biz_request_id}`);
|
|
95
|
+
* console.log(`Failed reason: ${error.fail_reason}`);
|
|
96
|
+
* });
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
async queryBrShopInvoiceError(params = {}) {
|
|
100
|
+
const response = await ShopeeFetch.fetch(this.config, "/fbs/query_br_shop_invoice_error", {
|
|
101
|
+
method: "POST",
|
|
102
|
+
auth: true,
|
|
103
|
+
body: params,
|
|
104
|
+
});
|
|
105
|
+
return response;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Check whether an FBS product is blocked due to invoice-related issues.
|
|
109
|
+
* When blocked, the product cannot be included in new Inbound Requests, and its
|
|
110
|
+
* warehouse inventory is restricted from being sold. This API is for Brazil region only.
|
|
111
|
+
*
|
|
112
|
+
* @param params - Parameters for querying SKU block status
|
|
113
|
+
* @param params.shop_sku_id - Shop SKU ID in format "itemID_modelID"
|
|
114
|
+
*
|
|
115
|
+
* @returns A promise that resolves to the SKU block status response containing:
|
|
116
|
+
* - shop_sku_id: The queried SKU ID
|
|
117
|
+
* - is_block: Whether the SKU is blocked
|
|
118
|
+
* - shop_item_id: Item ID
|
|
119
|
+
* - shop_model_id: Model ID
|
|
120
|
+
* - shop_item_name: Item name
|
|
121
|
+
* - shop_model_name: Model name
|
|
122
|
+
*
|
|
123
|
+
* @throws {Error} When the API request fails or returns an error
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* const status = await sdk.fbs.queryBrSkuBlockStatus({
|
|
128
|
+
* shop_sku_id: '123456_789012',
|
|
129
|
+
* });
|
|
130
|
+
*
|
|
131
|
+
* if (status.response.is_block) {
|
|
132
|
+
* console.log(`SKU ${status.response.shop_item_name} is blocked`);
|
|
133
|
+
* }
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
async queryBrSkuBlockStatus(params) {
|
|
137
|
+
const response = await ShopeeFetch.fetch(this.config, "/fbs/query_br_sku_block_status", {
|
|
138
|
+
method: "POST",
|
|
139
|
+
auth: true,
|
|
140
|
+
body: params,
|
|
141
|
+
});
|
|
142
|
+
return response;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=fbs.manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fbs.manager.js","sourceRoot":"","sources":["../../src/managers/fbs.manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAWhD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,OAAO,UAAW,SAAQ,WAAW;IACzC,YAAY,MAAoB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,KAAK,CAAC,2BAA2B,CAC/B,SAA4C,EAAE;QAE9C,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,sCAAsC,EACtC;YACE,MAAM,EAAE,MAAM;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