@congminh1254/shopee-sdk 0.4.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.
Files changed (108) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +85 -0
  3. package/lib/errors.d.ts +8 -0
  4. package/lib/errors.js +15 -0
  5. package/lib/errors.js.map +1 -0
  6. package/lib/fetch.d.ts +5 -0
  7. package/lib/fetch.js +105 -0
  8. package/lib/fetch.js.map +1 -0
  9. package/lib/managers/ads.manager.d.ts +53 -0
  10. package/lib/managers/ads.manager.js +74 -0
  11. package/lib/managers/ads.manager.js.map +1 -0
  12. package/lib/managers/auth.manager.d.ts +9 -0
  13. package/lib/managers/auth.manager.js +58 -0
  14. package/lib/managers/auth.manager.js.map +1 -0
  15. package/lib/managers/base.manager.d.ts +5 -0
  16. package/lib/managers/base.manager.js +7 -0
  17. package/lib/managers/base.manager.js.map +1 -0
  18. package/lib/managers/index.d.ts +10 -0
  19. package/lib/managers/index.js +11 -0
  20. package/lib/managers/index.js.map +1 -0
  21. package/lib/managers/logistics.manager.d.ts +33 -0
  22. package/lib/managers/logistics.manager.js +42 -0
  23. package/lib/managers/logistics.manager.js.map +1 -0
  24. package/lib/managers/order.manager.d.ts +105 -0
  25. package/lib/managers/order.manager.js +173 -0
  26. package/lib/managers/order.manager.js.map +1 -0
  27. package/lib/managers/payment.manager.d.ts +30 -0
  28. package/lib/managers/payment.manager.js +39 -0
  29. package/lib/managers/payment.manager.js.map +1 -0
  30. package/lib/managers/product.manager.d.ts +114 -0
  31. package/lib/managers/product.manager.js +147 -0
  32. package/lib/managers/product.manager.js.map +1 -0
  33. package/lib/managers/public.manager.d.ts +9 -0
  34. package/lib/managers/public.manager.js +34 -0
  35. package/lib/managers/public.manager.js.map +1 -0
  36. package/lib/managers/push.manager.d.ts +36 -0
  37. package/lib/managers/push.manager.js +60 -0
  38. package/lib/managers/push.manager.js.map +1 -0
  39. package/lib/managers/voucher.manager.d.ts +70 -0
  40. package/lib/managers/voucher.manager.js +114 -0
  41. package/lib/managers/voucher.manager.js.map +1 -0
  42. package/lib/schemas/access-token.d.ts +27 -0
  43. package/lib/schemas/access-token.js +2 -0
  44. package/lib/schemas/access-token.js.map +1 -0
  45. package/lib/schemas/ads.d.ts +62 -0
  46. package/lib/schemas/ads.js +2 -0
  47. package/lib/schemas/ads.js.map +1 -0
  48. package/lib/schemas/api-range.d.ts +1 -0
  49. package/lib/schemas/api-range.js +2 -0
  50. package/lib/schemas/api-range.js.map +1 -0
  51. package/lib/schemas/attribute.d.ts +33 -0
  52. package/lib/schemas/attribute.js +2 -0
  53. package/lib/schemas/attribute.js.map +1 -0
  54. package/lib/schemas/authed-merchant.d.ts +6 -0
  55. package/lib/schemas/authed-merchant.js +2 -0
  56. package/lib/schemas/authed-merchant.js.map +1 -0
  57. package/lib/schemas/authed-shop.d.ts +11 -0
  58. package/lib/schemas/authed-shop.js +2 -0
  59. package/lib/schemas/authed-shop.js.map +1 -0
  60. package/lib/schemas/base.d.ts +11 -0
  61. package/lib/schemas/base.js +2 -0
  62. package/lib/schemas/base.js.map +1 -0
  63. package/lib/schemas/category.d.ts +12 -0
  64. package/lib/schemas/category.js +2 -0
  65. package/lib/schemas/category.js.map +1 -0
  66. package/lib/schemas/fetch.d.ts +13 -0
  67. package/lib/schemas/fetch.js +2 -0
  68. package/lib/schemas/fetch.js.map +1 -0
  69. package/lib/schemas/index.d.ts +11 -0
  70. package/lib/schemas/index.js +12 -0
  71. package/lib/schemas/index.js.map +1 -0
  72. package/lib/schemas/logistics.d.ts +157 -0
  73. package/lib/schemas/logistics.js +115 -0
  74. package/lib/schemas/logistics.js.map +1 -0
  75. package/lib/schemas/order.d.ts +592 -0
  76. package/lib/schemas/order.js +2 -0
  77. package/lib/schemas/order.js.map +1 -0
  78. package/lib/schemas/payment.d.ts +298 -0
  79. package/lib/schemas/payment.js +2 -0
  80. package/lib/schemas/payment.js.map +1 -0
  81. package/lib/schemas/product.d.ts +604 -0
  82. package/lib/schemas/product.js +14 -0
  83. package/lib/schemas/product.js.map +1 -0
  84. package/lib/schemas/public.d.ts +25 -0
  85. package/lib/schemas/public.js +2 -0
  86. package/lib/schemas/public.js.map +1 -0
  87. package/lib/schemas/push.d.ts +64 -0
  88. package/lib/schemas/push.js +2 -0
  89. package/lib/schemas/push.js.map +1 -0
  90. package/lib/schemas/region.d.ts +14 -0
  91. package/lib/schemas/region.js +16 -0
  92. package/lib/schemas/region.js.map +1 -0
  93. package/lib/schemas/voucher.d.ts +241 -0
  94. package/lib/schemas/voucher.js +15 -0
  95. package/lib/schemas/voucher.js.map +1 -0
  96. package/lib/sdk.d.ts +42 -0
  97. package/lib/sdk.js +77 -0
  98. package/lib/sdk.js.map +1 -0
  99. package/lib/storage/custom-token-storage.d.ts +10 -0
  100. package/lib/storage/custom-token-storage.js +47 -0
  101. package/lib/storage/custom-token-storage.js.map +1 -0
  102. package/lib/storage/token-storage.interface.d.ts +6 -0
  103. package/lib/storage/token-storage.interface.js +2 -0
  104. package/lib/storage/token-storage.interface.js.map +1 -0
  105. package/lib/utils/signature.d.ts +1 -0
  106. package/lib/utils/signature.js +9 -0
  107. package/lib/utils/signature.js.map +1 -0
  108. package/package.json +84 -0
@@ -0,0 +1,105 @@
1
+ import { BaseManager } from './base.manager.js';
2
+ import { ShopeeConfig } from '../sdk.js';
3
+ import { GetOrderListParams, GetOrderListResponse, GetOrdersDetailParams, GetOrdersDetailResponse, GetShipmentListParams, GetShipmentListResponse, SplitOrderParams, SplitOrderResponse, UnsplitOrderParams, UnsplitOrderResponse, CancelOrderParams, CancelOrderResponse, GetBuyerInvoiceInfoParams, GetBuyerInvoiceInfoResponse } from '../schemas/order.js';
4
+ export declare class OrderManager extends BaseManager {
5
+ constructor(config: ShopeeConfig);
6
+ /**
7
+ * Use this api to search orders. You may also filter them by status, if needed.
8
+ *
9
+ * @param params - The parameters for getting order list
10
+ * @param params.time_range_field - The kind of time_from and time_to. Available value: create_time, update_time
11
+ * @param params.time_from - The starting date range for retrieving orders. The maximum date range is 15 days
12
+ * @param params.time_to - The ending date range for retrieving orders. The maximum date range is 15 days
13
+ * @param params.page_size - The maximum number of entries to return in a single page (between 1 and 100)
14
+ * @param params.cursor - Specifies the starting entry of data to return in the current call
15
+ * @param params.order_status - The order status filter for retrieving orders. Available value: UNPAID/READY_TO_SHIP/PROCESSED/SHIPPED/COMPLETED/IN_CANCEL/CANCELLED/INVOICE_PENDING
16
+ * @param params.response_optional_fields - Optional fields in response. Available value: order_status
17
+ * @param params.request_order_status_pending - Compatible parameter during migration period, send True will let API support PENDING status
18
+ * @param params.logistics_channel_id - The identity of logistic channel. Valid only for BR
19
+ * @returns Promise<GetOrderListResponse> - The response containing order list and pagination information
20
+ */
21
+ getOrderList(params: GetOrderListParams): Promise<GetOrderListResponse>;
22
+ /**
23
+ * Use this api to get order detail.
24
+ *
25
+ * @param params - The parameters for getting order details
26
+ * @param params.order_sn_list - The set of order_sn. If there are multiple order_sn, you need to use English comma to connect them. limit [1,50]
27
+ * @param params.request_order_status_pending - Compatible parameter during migration period, send True will let API support PENDING status and return pending_terms, send False or don't send will fallback to old logic
28
+ * @param params.response_optional_fields - A response fields you want to get. Please select from the below response parameters. If you input an object field, all the params under it will be included automatically in the response. If there are multiple response fields you want to get, you need to use English comma to connect them.
29
+ * @returns Promise<GetOrdersDetailResponse> - The response containing detailed order information
30
+ */
31
+ getOrdersDetail(params: GetOrdersDetailParams): Promise<GetOrdersDetailResponse>;
32
+ /**
33
+ * Use this api to get order list which order_status is READY_TO_SHIP to start process the whole shipping progress.
34
+ *
35
+ * @param params - The parameters for getting shipment list
36
+ * @param params.cursor - Specifies the starting entry of data to return in the current call
37
+ * @param params.page_size - The maximum number of entries to return in a single page (between 1 and 100)
38
+ * @returns Promise<GetShipmentListResponse> - The response containing shipment list and pagination information
39
+ */
40
+ getShipmentList(params: GetShipmentListParams): Promise<GetShipmentListResponse>;
41
+ /**
42
+ * Split an order into multiple packages
43
+ * @param params - Parameters for splitting the order
44
+ * @param params.order_sn - Shopee's unique identifier for an order
45
+ * @param params.package_list - The list of packages that you want to split
46
+ * @returns Promise resolving to the split order response
47
+ */
48
+ splitOrder(params: SplitOrderParams): Promise<SplitOrderResponse>;
49
+ /**
50
+ * Use this api to unsplit an order that has been split into multiple packages.
51
+ *
52
+ * @param params - Parameters for unsplitting the order
53
+ * @param params.order_sn - Shopee's unique identifier for an order
54
+ * @returns Promise<UnsplitOrderResponse> - Response containing the unsplit order details
55
+ * @throws {ShopeeApiError} - Throws error if:
56
+ * - Wrong parameters are provided
57
+ * - No permission to unsplit order
58
+ * - Order has not been split
59
+ * - Unsplit order failed
60
+ * - Cannot unsplit order with invalid items
61
+ * - Cannot unsplit order with missing items
62
+ */
63
+ unsplitOrder(params: UnsplitOrderParams): Promise<UnsplitOrderResponse>;
64
+ /**
65
+ * Use this api to cancel an order. This action can only be performed before an order has been shipped.
66
+ *
67
+ * @param params - Parameters for canceling the order
68
+ * @param params.order_sn - Shopee's unique identifier for an order
69
+ * @param params.cancel_reason - The reason seller want to cancel this order. Applicable values: OUT_OF_STOCK, UNDELIVERABLE_AREA(only apply for TW and MY)
70
+ * @param params.item_list - Required when cancel_reason is OUT_OF_STOCK. List of items to cancel
71
+ * @param params.item_list[].item_id - Shopee's unique identifier for an item
72
+ * @param params.item_list[].model_id - Shopee's unique identifier for a model of an item
73
+ * @returns Promise<CancelOrderResponse> - Response containing the update time of the canceled order
74
+ * @throws {ShopeeApiError} - Throws error if:
75
+ * - Wrong parameters are provided
76
+ * - No permission to cancel order
77
+ * - Cannot cancel warehouse order
78
+ * - Shop and partner are not linked on seller center
79
+ * - Order has already been shipped
80
+ */
81
+ cancelOrder(params: CancelOrderParams): Promise<CancelOrderResponse>;
82
+ /**
83
+ * Get buyer invoice information for orders
84
+ *
85
+ * Use this API to obtain buyer submitted invoice info for VN, TH and PH local sellers only.
86
+ *
87
+ * @param params - The parameters for getting buyer invoice info
88
+ * @param params.queries - List of order queries
89
+ * @param params.queries[].order_sn - Shopee's unique identifier for an order
90
+ *
91
+ * @returns A promise that resolves to the invoice info response containing:
92
+ * - invoice_info_list: List of invoice information for each order
93
+ * - order_sn: Order identifier
94
+ * - invoice_type: Type of invoice (personal/company)
95
+ * - invoice_detail: Detailed invoice information
96
+ * - error: Error message if any
97
+ * - is_requested: Whether buyer requested invoice
98
+ *
99
+ * @throws {Error} When the API request fails or returns an error
100
+ * - error_param: Missing or invalid parameters
101
+ * - error_auth: Authentication or permission errors
102
+ * - error_server: Internal server errors
103
+ */
104
+ getBuyerInvoiceInfo(params: GetBuyerInvoiceInfoParams): Promise<GetBuyerInvoiceInfoResponse>;
105
+ }
@@ -0,0 +1,173 @@
1
+ import { BaseManager } from './base.manager.js';
2
+ import { ShopeeFetch } from '../fetch.js';
3
+ export class OrderManager extends BaseManager {
4
+ constructor(config) {
5
+ super(config);
6
+ }
7
+ /**
8
+ * Use this api to search orders. You may also filter them by status, if needed.
9
+ *
10
+ * @param params - The parameters for getting order list
11
+ * @param params.time_range_field - The kind of time_from and time_to. Available value: create_time, update_time
12
+ * @param params.time_from - The starting date range for retrieving orders. The maximum date range is 15 days
13
+ * @param params.time_to - The ending date range for retrieving orders. The maximum date range is 15 days
14
+ * @param params.page_size - The maximum number of entries to return in a single page (between 1 and 100)
15
+ * @param params.cursor - Specifies the starting entry of data to return in the current call
16
+ * @param params.order_status - The order status filter for retrieving orders. Available value: UNPAID/READY_TO_SHIP/PROCESSED/SHIPPED/COMPLETED/IN_CANCEL/CANCELLED/INVOICE_PENDING
17
+ * @param params.response_optional_fields - Optional fields in response. Available value: order_status
18
+ * @param params.request_order_status_pending - Compatible parameter during migration period, send True will let API support PENDING status
19
+ * @param params.logistics_channel_id - The identity of logistic channel. Valid only for BR
20
+ * @returns Promise<GetOrderListResponse> - The response containing order list and pagination information
21
+ */
22
+ async getOrderList(params) {
23
+ const response = await ShopeeFetch.fetch(this.config, '/order/get_order_list', {
24
+ method: 'GET',
25
+ params,
26
+ auth: true,
27
+ });
28
+ return response;
29
+ }
30
+ /**
31
+ * Use this api to get order detail.
32
+ *
33
+ * @param params - The parameters for getting order details
34
+ * @param params.order_sn_list - The set of order_sn. If there are multiple order_sn, you need to use English comma to connect them. limit [1,50]
35
+ * @param params.request_order_status_pending - Compatible parameter during migration period, send True will let API support PENDING status and return pending_terms, send False or don't send will fallback to old logic
36
+ * @param params.response_optional_fields - A response fields you want to get. Please select from the below response parameters. If you input an object field, all the params under it will be included automatically in the response. If there are multiple response fields you want to get, you need to use English comma to connect them.
37
+ * @returns Promise<GetOrdersDetailResponse> - The response containing detailed order information
38
+ */
39
+ async getOrdersDetail(params) {
40
+ const response = await ShopeeFetch.fetch(this.config, `/order/get_order_detail`, {
41
+ method: 'GET',
42
+ auth: true,
43
+ params: {
44
+ ...params,
45
+ order_sn_list: params.order_sn_list.join(','),
46
+ },
47
+ });
48
+ return response;
49
+ }
50
+ /**
51
+ * Use this api to get order list which order_status is READY_TO_SHIP to start process the whole shipping progress.
52
+ *
53
+ * @param params - The parameters for getting shipment list
54
+ * @param params.cursor - Specifies the starting entry of data to return in the current call
55
+ * @param params.page_size - The maximum number of entries to return in a single page (between 1 and 100)
56
+ * @returns Promise<GetShipmentListResponse> - The response containing shipment list and pagination information
57
+ */
58
+ async getShipmentList(params) {
59
+ const response = await ShopeeFetch.fetch(this.config, '/order/get_shipment_list', {
60
+ method: 'GET',
61
+ params,
62
+ auth: true,
63
+ });
64
+ return response;
65
+ }
66
+ /**
67
+ * Split an order into multiple packages
68
+ * @param params - Parameters for splitting the order
69
+ * @param params.order_sn - Shopee's unique identifier for an order
70
+ * @param params.package_list - The list of packages that you want to split
71
+ * @returns Promise resolving to the split order response
72
+ */
73
+ async splitOrder(params) {
74
+ return ShopeeFetch.fetch(this.config, '/order/split_order', {
75
+ method: 'POST',
76
+ body: {
77
+ order_sn: params.order_sn,
78
+ package_list: params.package_list.map(pkg => ({
79
+ item_list: pkg.item_list.map(item => ({
80
+ item_id: item.item_id,
81
+ model_id: item.model_id,
82
+ order_item_id: item.order_item_id,
83
+ promotion_group_id: item.promotion_group_id,
84
+ model_quantity: item.model_quantity
85
+ }))
86
+ }))
87
+ },
88
+ auth: true
89
+ });
90
+ }
91
+ /**
92
+ * Use this api to unsplit an order that has been split into multiple packages.
93
+ *
94
+ * @param params - Parameters for unsplitting the order
95
+ * @param params.order_sn - Shopee's unique identifier for an order
96
+ * @returns Promise<UnsplitOrderResponse> - Response containing the unsplit order details
97
+ * @throws {ShopeeApiError} - Throws error if:
98
+ * - Wrong parameters are provided
99
+ * - No permission to unsplit order
100
+ * - Order has not been split
101
+ * - Unsplit order failed
102
+ * - Cannot unsplit order with invalid items
103
+ * - Cannot unsplit order with missing items
104
+ */
105
+ async unsplitOrder(params) {
106
+ return ShopeeFetch.fetch(this.config, '/order/unsplit_order', {
107
+ method: 'POST',
108
+ body: {
109
+ order_sn: params.order_sn
110
+ },
111
+ auth: true
112
+ });
113
+ }
114
+ /**
115
+ * Use this api to cancel an order. This action can only be performed before an order has been shipped.
116
+ *
117
+ * @param params - Parameters for canceling the order
118
+ * @param params.order_sn - Shopee's unique identifier for an order
119
+ * @param params.cancel_reason - The reason seller want to cancel this order. Applicable values: OUT_OF_STOCK, UNDELIVERABLE_AREA(only apply for TW and MY)
120
+ * @param params.item_list - Required when cancel_reason is OUT_OF_STOCK. List of items to cancel
121
+ * @param params.item_list[].item_id - Shopee's unique identifier for an item
122
+ * @param params.item_list[].model_id - Shopee's unique identifier for a model of an item
123
+ * @returns Promise<CancelOrderResponse> - Response containing the update time of the canceled order
124
+ * @throws {ShopeeApiError} - Throws error if:
125
+ * - Wrong parameters are provided
126
+ * - No permission to cancel order
127
+ * - Cannot cancel warehouse order
128
+ * - Shop and partner are not linked on seller center
129
+ * - Order has already been shipped
130
+ */
131
+ async cancelOrder(params) {
132
+ return ShopeeFetch.fetch(this.config, '/order/cancel_order', {
133
+ method: 'POST',
134
+ body: {
135
+ order_sn: params.order_sn,
136
+ cancel_reason: params.cancel_reason,
137
+ item_list: params.item_list
138
+ },
139
+ auth: true
140
+ });
141
+ }
142
+ /**
143
+ * Get buyer invoice information for orders
144
+ *
145
+ * Use this API to obtain buyer submitted invoice info for VN, TH and PH local sellers only.
146
+ *
147
+ * @param params - The parameters for getting buyer invoice info
148
+ * @param params.queries - List of order queries
149
+ * @param params.queries[].order_sn - Shopee's unique identifier for an order
150
+ *
151
+ * @returns A promise that resolves to the invoice info response containing:
152
+ * - invoice_info_list: List of invoice information for each order
153
+ * - order_sn: Order identifier
154
+ * - invoice_type: Type of invoice (personal/company)
155
+ * - invoice_detail: Detailed invoice information
156
+ * - error: Error message if any
157
+ * - is_requested: Whether buyer requested invoice
158
+ *
159
+ * @throws {Error} When the API request fails or returns an error
160
+ * - error_param: Missing or invalid parameters
161
+ * - error_auth: Authentication or permission errors
162
+ * - error_server: Internal server errors
163
+ */
164
+ async getBuyerInvoiceInfo(params) {
165
+ const response = await ShopeeFetch.fetch(this.config, `/order/get_buyer_invoice_info`, {
166
+ method: 'POST',
167
+ auth: true,
168
+ body: params,
169
+ });
170
+ return response;
171
+ }
172
+ }
173
+ //# sourceMappingURL=order.manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order.manager.js","sourceRoot":"","sources":["../../src/managers/order.manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAmBhD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC3C,YAAY,MAAoB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,YAAY,CAAC,MAA0B;QAC3C,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CAAuB,IAAI,CAAC,MAAM,EAAE,uBAAuB,EAAE;YACnG,MAAM,EAAE,KAAK;YACb,MAAM;YACN,IAAI,EAAE,IAAI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AAI,CAAC,cAAc;qBACpC,CAAC,CAAC;iBACJ,CAAC,CAAC;aACJ;YACD,IAAI,EAAE,IAAI;SACX,CACF,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,YAAY,CAAC,MAA0B;QAC3C,OAAO,WAAW,CAAC,KAAK,CACtB,IAAI,CAAC,MAAM,EACX,sBAAsB,EACtB;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,QAAQ,EAAE,MAAM,CAAC,QAAQ;aAC1B;YACD,IAAI,EAAE,IAAI;SACX,CACF,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,WAAW,CAAC,MAAyB;QACzC,OAAO,WAAW,CAAC,KAAK,CACtB,IAAI,CAAC,MAAM,EACX,qBAAqB,EACrB;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,aAAa,EAAE,MAAM,CAAC,aAAa;gBACnC,SAAS,EAAE,MAAM,CAAC,SAAS;aAC5B;YACD,IAAI,EAAE,IAAI;SACX,CACF,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,KAAK,CAAC,mBAAmB,CAAC,MAAiC;QACzD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,+BAA+B,EAC/B;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,30 @@
1
+ import { ShopeeConfig } from "../sdk.js";
2
+ import { BaseManager } from "./base.manager.js";
3
+ import { GetEscrowDetailParams, GetEscrowDetailResponse } from "../schemas/payment.js";
4
+ export declare class PaymentManager extends BaseManager {
5
+ constructor(config: ShopeeConfig);
6
+ /**
7
+ * Use this API to fetch the accounting detail of order.
8
+ *
9
+ * @param params - Parameters for getting escrow detail
10
+ * @param params.order_sn - Shopee's unique identifier for an order
11
+ *
12
+ * @returns A promise that resolves to the escrow detail response containing:
13
+ * - order_sn: Order identifier
14
+ * - buyer_user_name: Username of buyer
15
+ * - return_order_sn_list: List of return order numbers
16
+ * - order_income: Detailed breakdown of order income including:
17
+ * - escrow_amount: Expected amount seller will receive
18
+ * - buyer_total_amount: Total amount paid by buyer
19
+ * - items: List of items with pricing details
20
+ * - fees and adjustments: Various fees, taxes and adjustments
21
+ * - buyer_payment_info: Payment details from buyer's perspective
22
+ *
23
+ * @throws {Error} When the API request fails or returns an error:
24
+ * - error_param: Missing or invalid parameters
25
+ * - error_auth: Authentication or permission errors
26
+ * - error_server: Internal server errors
27
+ * - error_not_found: Order income details not found
28
+ */
29
+ getEscrowDetail(params: GetEscrowDetailParams): Promise<GetEscrowDetailResponse>;
30
+ }
@@ -0,0 +1,39 @@
1
+ import { BaseManager } from "./base.manager.js";
2
+ import { ShopeeFetch } from "../fetch.js";
3
+ export class PaymentManager extends BaseManager {
4
+ constructor(config) {
5
+ super(config);
6
+ }
7
+ /**
8
+ * Use this API to fetch the accounting detail of order.
9
+ *
10
+ * @param params - Parameters for getting escrow detail
11
+ * @param params.order_sn - Shopee's unique identifier for an order
12
+ *
13
+ * @returns A promise that resolves to the escrow detail response containing:
14
+ * - order_sn: Order identifier
15
+ * - buyer_user_name: Username of buyer
16
+ * - return_order_sn_list: List of return order numbers
17
+ * - order_income: Detailed breakdown of order income including:
18
+ * - escrow_amount: Expected amount seller will receive
19
+ * - buyer_total_amount: Total amount paid by buyer
20
+ * - items: List of items with pricing details
21
+ * - fees and adjustments: Various fees, taxes and adjustments
22
+ * - buyer_payment_info: Payment details from buyer's perspective
23
+ *
24
+ * @throws {Error} When the API request fails or returns an error:
25
+ * - error_param: Missing or invalid parameters
26
+ * - error_auth: Authentication or permission errors
27
+ * - error_server: Internal server errors
28
+ * - error_not_found: Order income details not found
29
+ */
30
+ async getEscrowDetail(params) {
31
+ const response = await ShopeeFetch.fetch(this.config, '/payment/get_escrow_detail', {
32
+ method: 'GET',
33
+ auth: true,
34
+ params,
35
+ });
36
+ return response;
37
+ }
38
+ }
39
+ //# sourceMappingURL=payment.manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment.manager.js","sourceRoot":"","sources":["../../src/managers/payment.manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,OAAO,cAAe,SAAQ,WAAW;IAC3C,YAAY,MAAoB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,KAAK,CAAC,eAAe,CAAC,MAA6B;QAC/C,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACpC,IAAI,CAAC,MAAM,EACX,4BAA4B,EAC5B;YACI,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI;YACV,MAAM;SACT,CACJ,CAAC;QACF,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ"}
@@ -0,0 +1,114 @@
1
+ import { BaseManager } from './base.manager.js';
2
+ import { ShopeeConfig } from '../sdk.js';
3
+ import { GetCommentParams, GetCommentResponse, ReplyCommentParams, ReplyCommentResponse, GetItemListParams, GetItemListResponse, GetItemBaseInfoParams, GetItemBaseInfoResponse } from '../schemas/product.js';
4
+ export declare class ProductManager extends BaseManager {
5
+ constructor(config: ShopeeConfig);
6
+ /**
7
+ * Get comments for products
8
+ *
9
+ * Use this API to get comments by shop_id, item_id, or comment_id. Can retrieve up to 1000 comments.
10
+ *
11
+ * @param params - The parameters for getting comments
12
+ * @param params.item_id - The identity of product item
13
+ * @param params.comment_id - The identity of comment
14
+ * @param params.cursor - Specifies the starting entry of data to return. Default is empty string
15
+ * @param params.page_size - Maximum number of entries to return per page (between 1 and 100)
16
+ *
17
+ * @returns A promise that resolves to the comment response containing:
18
+ * - request_id: The identifier for API request tracking
19
+ * - error: Error type if any error occurred
20
+ * - message: Error details if any error occurred
21
+ * - response: The response data containing comment list, pagination info
22
+ *
23
+ * @throws {Error} When the API request fails or returns an error
24
+ */
25
+ getComment(params: GetCommentParams): Promise<GetCommentResponse>;
26
+ /**
27
+ * Reply to buyer comments in batch
28
+ *
29
+ * Use this API to reply to comments from buyers in batch. You can reply to multiple comments at once.
30
+ *
31
+ * @param params - The parameters for replying to comments
32
+ * @param params.comment_list - List of comments to reply to (between 1 and 100 items)
33
+ * @param params.comment_list[].comment_id - The identity of comment to reply to
34
+ * @param params.comment_list[].comment - The content of the reply (between 1 and 500 characters)
35
+ *
36
+ * @returns A promise that resolves to the reply response containing:
37
+ * - request_id: The identifier for API request tracking
38
+ * - error: Error type if any error occurred
39
+ * - message: Error details if any error occurred
40
+ * - response: The response data containing result list and warnings
41
+ *
42
+ * @throws {Error} When the API request fails or returns an error
43
+ * - product.duplicate_request: You have already replied to this comment
44
+ * - product.comment_length_invalid: Comment length should be between 1 and 500
45
+ * - product.error_permission: Reply comment failed due to invalid shop token
46
+ * - product.error_not_exist: The comment you replied to does not exist
47
+ * - product.duplicate_comment_id: Duplicate comment id in the request
48
+ */
49
+ replyComment(params: ReplyCommentParams): Promise<ReplyCommentResponse>;
50
+ /**
51
+ * Use this call to get a list of items.
52
+ *
53
+ * @param params - Parameters for getting item list
54
+ * @param params.offset - Specifies the starting entry of data to return. Default is 0.
55
+ * @param params.page_size - The size of one page (1-100).
56
+ * @param params.update_time_from - Start of date range for item update time.
57
+ * @param params.update_time_to - End of date range for item update time.
58
+ * @param params.item_status - Array of item statuses to filter by.
59
+ *
60
+ * @returns A promise that resolves to the item list response containing:
61
+ * - item: List of item details (item_id, item_status, update_time, tag)
62
+ * - total_count: Total number of items matching the filter
63
+ * - has_next_page: Boolean indicating if there are more items
64
+ * - next_offset: Offset for the next page if has_next_page is true
65
+ * - warning: Optional warning message
66
+ *
67
+ * @throws {Error} When the API request fails or returns an error:
68
+ * - error_update_time_range: update_time_to before update_time_from
69
+ * - error_param_item_status: Invalid item status
70
+ * - error_param_shop_id_not_found: Shop ID not found
71
+ * - error_param: Offset over limit
72
+ * - error_item_not_found: Product not found
73
+ */
74
+ getItemList(params: GetItemListParams): Promise<GetItemListResponse>;
75
+ /**
76
+ * Use this API to get basic info of items by a list of item_ids.
77
+ *
78
+ * @param params - Parameters for getting item base info
79
+ * @param params.item_id_list - List of Shopee's unique identifiers for items. Max 50.
80
+ * @param params.need_tax_info - If true, tax_info will be included in the response.
81
+ * @param params.need_complaint_policy - If true, complaint_policy will be included in the response (PL region only).
82
+ *
83
+ * @returns A promise that resolves to the item base info response containing:
84
+ * - item_list: List of detailed item base information including:
85
+ * - item_id, category_id, item_name, description, item_sku, create_time, update_time
86
+ * - attribute_list: Item attributes
87
+ * - price_info: Pricing details (if no models)
88
+ * - image: Image URLs and IDs
89
+ * - weight, dimension: Physical characteristics
90
+ * - logistic_info: Enabled logistics channels and fees
91
+ * - pre_order: Pre-order status and days to ship
92
+ * - wholesales: Wholesale pricing tiers
93
+ * - condition, size_chart, item_status, deboost, has_model, promotion_id
94
+ * - video_info: Video URLs, thumbnails, and duration
95
+ * - brand: Brand ID and name
96
+ * - item_dangerous: Dangerous goods status
97
+ * - gtin_code, size_chart_id, promotion_image, compatibility_info, scheduled_publish_time
98
+ * - authorised_brand_id, ssp_id, is_fulfillment_by_shopee
99
+ * - complaint_policy: (If requested and applicable)
100
+ * - tax_info: (If requested)
101
+ * - description_info, description_type: Normal or extended description details
102
+ * - stock_info_v2: Detailed stock information (summary, seller, Shopee, advance)
103
+ * - certification_info: Product certifications
104
+ * - warning: Optional warning message
105
+ * - Note: The top-level complaint_policy and tax_info in the response object seem redundant as they are also part of each item in item_list if requested.
106
+ *
107
+ * @throws {Error} When the API request fails or returns an error:
108
+ * - error_item_not_found: Item ID not found
109
+ * - error_param_shop_id_not_found: Shop ID not found
110
+ * - error_invalid_language: Invalid language
111
+ * - error_query_over_itemid_size: Too many item_ids in list
112
+ */
113
+ getItemBaseInfo(params: GetItemBaseInfoParams): Promise<GetItemBaseInfoResponse>;
114
+ }
@@ -0,0 +1,147 @@
1
+ import { BaseManager } from './base.manager.js';
2
+ import { ShopeeFetch } from '../fetch.js';
3
+ export class ProductManager extends BaseManager {
4
+ constructor(config) {
5
+ super(config);
6
+ }
7
+ /**
8
+ * Get comments for products
9
+ *
10
+ * Use this API to get comments by shop_id, item_id, or comment_id. Can retrieve up to 1000 comments.
11
+ *
12
+ * @param params - The parameters for getting comments
13
+ * @param params.item_id - The identity of product item
14
+ * @param params.comment_id - The identity of comment
15
+ * @param params.cursor - Specifies the starting entry of data to return. Default is empty string
16
+ * @param params.page_size - Maximum number of entries to return per page (between 1 and 100)
17
+ *
18
+ * @returns A promise that resolves to the comment response containing:
19
+ * - request_id: The identifier for API request tracking
20
+ * - error: Error type if any error occurred
21
+ * - message: Error details if any error occurred
22
+ * - response: The response data containing comment list, pagination info
23
+ *
24
+ * @throws {Error} When the API request fails or returns an error
25
+ */
26
+ async getComment(params) {
27
+ const response = await ShopeeFetch.fetch(this.config, `/product/get_comment`, {
28
+ method: 'GET',
29
+ auth: true,
30
+ params,
31
+ });
32
+ return response;
33
+ }
34
+ /**
35
+ * Reply to buyer comments in batch
36
+ *
37
+ * Use this API to reply to comments from buyers in batch. You can reply to multiple comments at once.
38
+ *
39
+ * @param params - The parameters for replying to comments
40
+ * @param params.comment_list - List of comments to reply to (between 1 and 100 items)
41
+ * @param params.comment_list[].comment_id - The identity of comment to reply to
42
+ * @param params.comment_list[].comment - The content of the reply (between 1 and 500 characters)
43
+ *
44
+ * @returns A promise that resolves to the reply response containing:
45
+ * - request_id: The identifier for API request tracking
46
+ * - error: Error type if any error occurred
47
+ * - message: Error details if any error occurred
48
+ * - response: The response data containing result list and warnings
49
+ *
50
+ * @throws {Error} When the API request fails or returns an error
51
+ * - product.duplicate_request: You have already replied to this comment
52
+ * - product.comment_length_invalid: Comment length should be between 1 and 500
53
+ * - product.error_permission: Reply comment failed due to invalid shop token
54
+ * - product.error_not_exist: The comment you replied to does not exist
55
+ * - product.duplicate_comment_id: Duplicate comment id in the request
56
+ */
57
+ async replyComment(params) {
58
+ const response = await ShopeeFetch.fetch(this.config, `/product/reply_comment`, {
59
+ method: 'POST',
60
+ auth: true,
61
+ body: params,
62
+ });
63
+ return response;
64
+ }
65
+ /**
66
+ * Use this call to get a list of items.
67
+ *
68
+ * @param params - Parameters for getting item list
69
+ * @param params.offset - Specifies the starting entry of data to return. Default is 0.
70
+ * @param params.page_size - The size of one page (1-100).
71
+ * @param params.update_time_from - Start of date range for item update time.
72
+ * @param params.update_time_to - End of date range for item update time.
73
+ * @param params.item_status - Array of item statuses to filter by.
74
+ *
75
+ * @returns A promise that resolves to the item list response containing:
76
+ * - item: List of item details (item_id, item_status, update_time, tag)
77
+ * - total_count: Total number of items matching the filter
78
+ * - has_next_page: Boolean indicating if there are more items
79
+ * - next_offset: Offset for the next page if has_next_page is true
80
+ * - warning: Optional warning message
81
+ *
82
+ * @throws {Error} When the API request fails or returns an error:
83
+ * - error_update_time_range: update_time_to before update_time_from
84
+ * - error_param_item_status: Invalid item status
85
+ * - error_param_shop_id_not_found: Shop ID not found
86
+ * - error_param: Offset over limit
87
+ * - error_item_not_found: Product not found
88
+ */
89
+ async getItemList(params) {
90
+ const response = await ShopeeFetch.fetch(this.config, '/product/get_item_list', {
91
+ method: 'GET',
92
+ auth: true,
93
+ params,
94
+ });
95
+ return response;
96
+ }
97
+ /**
98
+ * Use this API to get basic info of items by a list of item_ids.
99
+ *
100
+ * @param params - Parameters for getting item base info
101
+ * @param params.item_id_list - List of Shopee's unique identifiers for items. Max 50.
102
+ * @param params.need_tax_info - If true, tax_info will be included in the response.
103
+ * @param params.need_complaint_policy - If true, complaint_policy will be included in the response (PL region only).
104
+ *
105
+ * @returns A promise that resolves to the item base info response containing:
106
+ * - item_list: List of detailed item base information including:
107
+ * - item_id, category_id, item_name, description, item_sku, create_time, update_time
108
+ * - attribute_list: Item attributes
109
+ * - price_info: Pricing details (if no models)
110
+ * - image: Image URLs and IDs
111
+ * - weight, dimension: Physical characteristics
112
+ * - logistic_info: Enabled logistics channels and fees
113
+ * - pre_order: Pre-order status and days to ship
114
+ * - wholesales: Wholesale pricing tiers
115
+ * - condition, size_chart, item_status, deboost, has_model, promotion_id
116
+ * - video_info: Video URLs, thumbnails, and duration
117
+ * - brand: Brand ID and name
118
+ * - item_dangerous: Dangerous goods status
119
+ * - gtin_code, size_chart_id, promotion_image, compatibility_info, scheduled_publish_time
120
+ * - authorised_brand_id, ssp_id, is_fulfillment_by_shopee
121
+ * - complaint_policy: (If requested and applicable)
122
+ * - tax_info: (If requested)
123
+ * - description_info, description_type: Normal or extended description details
124
+ * - stock_info_v2: Detailed stock information (summary, seller, Shopee, advance)
125
+ * - certification_info: Product certifications
126
+ * - warning: Optional warning message
127
+ * - Note: The top-level complaint_policy and tax_info in the response object seem redundant as they are also part of each item in item_list if requested.
128
+ *
129
+ * @throws {Error} When the API request fails or returns an error:
130
+ * - error_item_not_found: Item ID not found
131
+ * - error_param_shop_id_not_found: Shop ID not found
132
+ * - error_invalid_language: Invalid language
133
+ * - error_query_over_itemid_size: Too many item_ids in list
134
+ */
135
+ async getItemBaseInfo(params) {
136
+ const response = await ShopeeFetch.fetch(this.config, '/product/get_item_base_info', {
137
+ method: 'GET',
138
+ auth: true,
139
+ params: {
140
+ ...params,
141
+ item_id_list: params.item_id_list.join(',')
142
+ }
143
+ });
144
+ return response;
145
+ }
146
+ }
147
+ //# sourceMappingURL=product.manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product.manager.js","sourceRoot":"","sources":["../../src/managers/product.manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CA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MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC;aAC5C;SACF,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
@@ -0,0 +1,9 @@
1
+ import { ShopeeConfig } from '../sdk.js';
2
+ import { GetShopsByPartnerParams, GetMerchantsByPartnerParams, GetShopsByPartnerResponse, GetMerchantsByPartnerResponse, GetShopeeIpRangeResponse } from '../schemas/public.js';
3
+ import { BaseManager } from './base.manager.js';
4
+ export declare class PublicManager extends BaseManager {
5
+ constructor(config: ShopeeConfig);
6
+ getShopsByPartner(params?: GetShopsByPartnerParams): Promise<GetShopsByPartnerResponse>;
7
+ getMerchantsByPartner(params?: GetMerchantsByPartnerParams): Promise<GetMerchantsByPartnerResponse>;
8
+ getShopeeIpRange(): Promise<GetShopeeIpRangeResponse>;
9
+ }