@commercengine/pos 0.1.2 → 0.2.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 +104 -34
- package/dist/index.d.ts +3705 -161
- package/dist/index.js +1422 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -395,6 +395,15 @@ var BaseAPIClient = class {
|
|
|
395
395
|
getDefaultHeaders() {
|
|
396
396
|
return this.config.defaultHeaders;
|
|
397
397
|
}
|
|
398
|
+
/**
|
|
399
|
+
* Add middleware to the client
|
|
400
|
+
* This allows SDK extensions to add custom middleware like authentication
|
|
401
|
+
*
|
|
402
|
+
* @param middleware - Middleware to add to the client
|
|
403
|
+
*/
|
|
404
|
+
use(middleware) {
|
|
405
|
+
this.client.use(middleware);
|
|
406
|
+
}
|
|
398
407
|
};
|
|
399
408
|
/**
|
|
400
409
|
* Generic URL utility functions for any SDK
|
|
@@ -982,6 +991,20 @@ var PosAPIClient = class PosAPIClient extends BaseAPIClient {
|
|
|
982
991
|
console.warn("Failed to initialize tokens in storage:", error);
|
|
983
992
|
}
|
|
984
993
|
}
|
|
994
|
+
/**
|
|
995
|
+
* Get client typed for storefront POS operations (paths schema)
|
|
996
|
+
* This provides proper typing for storefront POS endpoints
|
|
997
|
+
*/
|
|
998
|
+
get storefrontClient() {
|
|
999
|
+
return this.client;
|
|
1000
|
+
}
|
|
1001
|
+
/**
|
|
1002
|
+
* Get client typed for admin POS operations (AdminPaths schema)
|
|
1003
|
+
* This provides proper typing for admin POS endpoints
|
|
1004
|
+
*/
|
|
1005
|
+
get adminClient() {
|
|
1006
|
+
return this.client;
|
|
1007
|
+
}
|
|
985
1008
|
};
|
|
986
1009
|
|
|
987
1010
|
//#endregion
|
|
@@ -995,6 +1018,21 @@ var PosClient = class extends PosAPIClient {
|
|
|
995
1018
|
* Login with email address for POS device
|
|
996
1019
|
* @param body - Login credentials containing device ID and email
|
|
997
1020
|
* @returns Promise with OTP token and action
|
|
1021
|
+
* @example
|
|
1022
|
+
* ```typescript
|
|
1023
|
+
* const { data, error } = await pos.loginWithEmail({
|
|
1024
|
+
* device_id: "pos-device-123",
|
|
1025
|
+
* email: "staff@example.com"
|
|
1026
|
+
* });
|
|
1027
|
+
*
|
|
1028
|
+
* if (error) {
|
|
1029
|
+
* console.error("Login failed:", error.message);
|
|
1030
|
+
* } else {
|
|
1031
|
+
* console.log("OTP sent:", data.otp_token);
|
|
1032
|
+
* console.log("Action:", data.otp_action);
|
|
1033
|
+
* // Use the otp_token to verify OTP
|
|
1034
|
+
* }
|
|
1035
|
+
* ```
|
|
998
1036
|
*/
|
|
999
1037
|
async loginWithEmail(body) {
|
|
1000
1038
|
return this.executeRequest(() => this.client.POST("/pos/auth/login/email", { body }));
|
|
@@ -1003,6 +1041,22 @@ var PosClient = class extends PosAPIClient {
|
|
|
1003
1041
|
* Login with phone number for POS device
|
|
1004
1042
|
* @param body - Login credentials containing device ID and phone
|
|
1005
1043
|
* @returns Promise with OTP token and action
|
|
1044
|
+
* @example
|
|
1045
|
+
* ```typescript
|
|
1046
|
+
* const { data, error } = await pos.loginWithPhone({
|
|
1047
|
+
* device_id: "pos-device-123",
|
|
1048
|
+
* phone: "234567890",
|
|
1049
|
+
* country_code: "+91" // default is +91
|
|
1050
|
+
* });
|
|
1051
|
+
*
|
|
1052
|
+
* if (error) {
|
|
1053
|
+
* console.error("Login failed:", error.message);
|
|
1054
|
+
* } else {
|
|
1055
|
+
* console.log("OTP sent:", data.otp_token);
|
|
1056
|
+
* console.log("Action:", data.otp_action);
|
|
1057
|
+
* // Use the otp_token to verify OTP
|
|
1058
|
+
* }
|
|
1059
|
+
* ```
|
|
1006
1060
|
*/
|
|
1007
1061
|
async loginWithPhone(body) {
|
|
1008
1062
|
return this.executeRequest(() => this.client.POST("/pos/auth/login/phone", { body }));
|
|
@@ -1011,6 +1065,22 @@ var PosClient = class extends PosAPIClient {
|
|
|
1011
1065
|
* Login with WhatsApp for POS device
|
|
1012
1066
|
* @param body - Login credentials containing device ID and phone
|
|
1013
1067
|
* @returns Promise with OTP token and action
|
|
1068
|
+
* @example
|
|
1069
|
+
* ```typescript
|
|
1070
|
+
* const { data, error } = await pos.loginWithWhatsapp({
|
|
1071
|
+
* device_id: "pos-device-123",
|
|
1072
|
+
* phone: "234567890",
|
|
1073
|
+
* country_code: "+91" // default is +91
|
|
1074
|
+
* });
|
|
1075
|
+
*
|
|
1076
|
+
* if (error) {
|
|
1077
|
+
* console.error("WhatsApp login failed:", error.message);
|
|
1078
|
+
* } else {
|
|
1079
|
+
* console.log("WhatsApp OTP sent:", data.otp_token);
|
|
1080
|
+
* console.log("Action:", data.otp_action);
|
|
1081
|
+
* // Use the otp_token to verify OTP
|
|
1082
|
+
* }
|
|
1083
|
+
* ```
|
|
1014
1084
|
*/
|
|
1015
1085
|
async loginWithWhatsapp(body) {
|
|
1016
1086
|
return this.executeRequest(() => this.client.POST("/pos/auth/login/whatsapp", { body }));
|
|
@@ -1019,6 +1089,20 @@ var PosClient = class extends PosAPIClient {
|
|
|
1019
1089
|
* Pair POS device with pairing code
|
|
1020
1090
|
* @param body - Pairing code received via phone/email
|
|
1021
1091
|
* @returns Promise with device information
|
|
1092
|
+
* @example
|
|
1093
|
+
* ```typescript
|
|
1094
|
+
* const { data, error } = await pos.pairDevice({
|
|
1095
|
+
* pairing_code: "ABC123"
|
|
1096
|
+
* });
|
|
1097
|
+
*
|
|
1098
|
+
* if (error) {
|
|
1099
|
+
* console.error("Device pairing failed:", error.message);
|
|
1100
|
+
* } else {
|
|
1101
|
+
* console.log("Device paired:", data.device.id);
|
|
1102
|
+
* console.log("Device name:", data.device.name);
|
|
1103
|
+
* // Store device_id for future use
|
|
1104
|
+
* }
|
|
1105
|
+
* ```
|
|
1022
1106
|
*/
|
|
1023
1107
|
async pairDevice(body) {
|
|
1024
1108
|
return this.executeRequest(() => this.client.POST("/pos/auth/pair-device", { body }));
|
|
@@ -1027,6 +1111,23 @@ var PosClient = class extends PosAPIClient {
|
|
|
1027
1111
|
* Verify OTP for POS login
|
|
1028
1112
|
* @param body - OTP verification data
|
|
1029
1113
|
* @returns Promise with user info and tokens
|
|
1114
|
+
* @example
|
|
1115
|
+
* ```typescript
|
|
1116
|
+
* const { data, error } = await pos.verifyOtp({
|
|
1117
|
+
* otp_token: "otp-token-from-login",
|
|
1118
|
+
* otp: "123456",
|
|
1119
|
+
* otp_action: "login"
|
|
1120
|
+
* });
|
|
1121
|
+
*
|
|
1122
|
+
* if (error) {
|
|
1123
|
+
* console.error("OTP verification failed:", error.message);
|
|
1124
|
+
* } else {
|
|
1125
|
+
* console.log("Login successful:", data.user);
|
|
1126
|
+
* console.log("Access token:", data.access_token);
|
|
1127
|
+
* console.log("Refresh token:", data.refresh_token);
|
|
1128
|
+
* // Tokens are automatically stored by the SDK
|
|
1129
|
+
* }
|
|
1130
|
+
* ```
|
|
1030
1131
|
*/
|
|
1031
1132
|
async verifyOtp(body) {
|
|
1032
1133
|
return this.executeRequest(() => this.client.POST("/pos/auth/verify-otp", { body }));
|
|
@@ -1035,6 +1136,20 @@ var PosClient = class extends PosAPIClient {
|
|
|
1035
1136
|
* Refresh POS access token
|
|
1036
1137
|
* @param body - Refresh token data
|
|
1037
1138
|
* @returns Promise with new tokens
|
|
1139
|
+
* @example
|
|
1140
|
+
* ```typescript
|
|
1141
|
+
* const { data, error } = await pos.refreshAccessToken({
|
|
1142
|
+
* refresh_token: "refresh-token-here"
|
|
1143
|
+
* });
|
|
1144
|
+
*
|
|
1145
|
+
* if (error) {
|
|
1146
|
+
* console.error("Token refresh failed:", error.message);
|
|
1147
|
+
* } else {
|
|
1148
|
+
* console.log("New access token:", data.access_token);
|
|
1149
|
+
* console.log("New refresh token:", data.refresh_token);
|
|
1150
|
+
* // New tokens are automatically stored by the SDK
|
|
1151
|
+
* }
|
|
1152
|
+
* ```
|
|
1038
1153
|
*/
|
|
1039
1154
|
async refreshAccessToken(body) {
|
|
1040
1155
|
return this.executeRequest(() => this.client.POST("/pos/auth/refresh-token", { body }));
|
|
@@ -1042,6 +1157,18 @@ var PosClient = class extends PosAPIClient {
|
|
|
1042
1157
|
/**
|
|
1043
1158
|
* Logout from POS device
|
|
1044
1159
|
* @returns Promise with logout confirmation
|
|
1160
|
+
* @example
|
|
1161
|
+
* ```typescript
|
|
1162
|
+
* const { data, error } = await pos.logout();
|
|
1163
|
+
*
|
|
1164
|
+
* if (error) {
|
|
1165
|
+
* console.error("Logout failed:", error.message);
|
|
1166
|
+
* } else {
|
|
1167
|
+
* console.log("Logout message:", data.message);
|
|
1168
|
+
* console.log("Success:", data.success);
|
|
1169
|
+
* // Tokens are automatically cleared by the SDK
|
|
1170
|
+
* }
|
|
1171
|
+
* ```
|
|
1045
1172
|
*/
|
|
1046
1173
|
async logout() {
|
|
1047
1174
|
return this.executeRequest(() => this.client.POST("/pos/auth/logout"));
|
|
@@ -1050,6 +1177,34 @@ var PosClient = class extends PosAPIClient {
|
|
|
1050
1177
|
* Create a new cart
|
|
1051
1178
|
* @param body - Cart creation data with items
|
|
1052
1179
|
* @returns Promise with created cart
|
|
1180
|
+
* @example
|
|
1181
|
+
* ```typescript
|
|
1182
|
+
* const { data, error } = await pos.createCart({
|
|
1183
|
+
* items: [
|
|
1184
|
+
* {
|
|
1185
|
+
* product_id: "01H9XYZ12345ABCDE",
|
|
1186
|
+
* variant_id: null,
|
|
1187
|
+
* quantity: 2
|
|
1188
|
+
* },
|
|
1189
|
+
* {
|
|
1190
|
+
* product_id: "01H9ABC67890FGHIJ",
|
|
1191
|
+
* variant_id: "01H9XYZ67890KLMNO",
|
|
1192
|
+
* quantity: 1
|
|
1193
|
+
* }
|
|
1194
|
+
* ],
|
|
1195
|
+
* metadata: {
|
|
1196
|
+
* "source": "pos-terminal-1",
|
|
1197
|
+
* "staff_id": "staff-123"
|
|
1198
|
+
* }
|
|
1199
|
+
* });
|
|
1200
|
+
*
|
|
1201
|
+
* if (error) {
|
|
1202
|
+
* console.error("Failed to create cart:", error.message);
|
|
1203
|
+
* } else {
|
|
1204
|
+
* console.log("Cart created:", data.cart.id);
|
|
1205
|
+
* console.log("Cart total:", data.cart.grand_total);
|
|
1206
|
+
* }
|
|
1207
|
+
* ```
|
|
1053
1208
|
*/
|
|
1054
1209
|
async createCart(body) {
|
|
1055
1210
|
return this.executeRequest(() => this.client.POST("/pos/carts", { body }));
|
|
@@ -1058,6 +1213,20 @@ var PosClient = class extends PosAPIClient {
|
|
|
1058
1213
|
* Get cart details
|
|
1059
1214
|
* @param pathParams - Cart ID
|
|
1060
1215
|
* @returns Promise with cart details
|
|
1216
|
+
* @example
|
|
1217
|
+
* ```typescript
|
|
1218
|
+
* const { data, error } = await pos.getCart({
|
|
1219
|
+
* id: "01H9CART12345ABCDE"
|
|
1220
|
+
* });
|
|
1221
|
+
*
|
|
1222
|
+
* if (error) {
|
|
1223
|
+
* console.error("Failed to get cart:", error.message);
|
|
1224
|
+
* } else {
|
|
1225
|
+
* const cart = data.cart;
|
|
1226
|
+
* console.log("Cart total:", cart.grand_total);
|
|
1227
|
+
* console.log("Items count:", cart.cart_items.length);
|
|
1228
|
+
* }
|
|
1229
|
+
* ```
|
|
1061
1230
|
*/
|
|
1062
1231
|
async getCart(pathParams) {
|
|
1063
1232
|
return this.executeRequest(() => this.client.GET("/pos/carts/{id}", { params: { path: pathParams } }));
|
|
@@ -1066,6 +1235,18 @@ var PosClient = class extends PosAPIClient {
|
|
|
1066
1235
|
* Delete cart (remove all items)
|
|
1067
1236
|
* @param pathParams - Cart ID
|
|
1068
1237
|
* @returns Promise with deletion confirmation
|
|
1238
|
+
* @example
|
|
1239
|
+
* ```typescript
|
|
1240
|
+
* const { data, error } = await pos.deleteCart({
|
|
1241
|
+
* id: "01H9CART12345ABCDE"
|
|
1242
|
+
* });
|
|
1243
|
+
*
|
|
1244
|
+
* if (error) {
|
|
1245
|
+
* console.error("Failed to delete cart:", error.message);
|
|
1246
|
+
* } else {
|
|
1247
|
+
* console.log("Cart deleted:", data.message);
|
|
1248
|
+
* }
|
|
1249
|
+
* ```
|
|
1069
1250
|
*/
|
|
1070
1251
|
async deleteCart(pathParams) {
|
|
1071
1252
|
return this.executeRequest(() => this.client.DELETE("/pos/carts/{id}", { params: { path: pathParams } }));
|
|
@@ -1075,6 +1256,34 @@ var PosClient = class extends PosAPIClient {
|
|
|
1075
1256
|
* @param pathParams - Cart ID
|
|
1076
1257
|
* @param body - Item update data
|
|
1077
1258
|
* @returns Promise with updated cart
|
|
1259
|
+
* @example
|
|
1260
|
+
* ```typescript
|
|
1261
|
+
* // Add item to cart
|
|
1262
|
+
* const { data, error } = await pos.updateCart(
|
|
1263
|
+
* { id: "01H9CART12345ABCDE" },
|
|
1264
|
+
* {
|
|
1265
|
+
* product_id: "01H9XYZ12345ABCDE",
|
|
1266
|
+
* variant_id: null,
|
|
1267
|
+
* quantity: 3
|
|
1268
|
+
* }
|
|
1269
|
+
* );
|
|
1270
|
+
*
|
|
1271
|
+
* if (error) {
|
|
1272
|
+
* console.error("Failed to update cart:", error.message);
|
|
1273
|
+
* } else {
|
|
1274
|
+
* console.log("Cart updated:", data.cart.cart_items.length);
|
|
1275
|
+
* }
|
|
1276
|
+
*
|
|
1277
|
+
* // Remove item from cart (set quantity to 0)
|
|
1278
|
+
* const { data: removeData, error: removeError } = await pos.updateCart(
|
|
1279
|
+
* { id: "01H9CART12345ABCDE" },
|
|
1280
|
+
* {
|
|
1281
|
+
* product_id: "01H9XYZ12345ABCDE",
|
|
1282
|
+
* variant_id: null,
|
|
1283
|
+
* quantity: 0
|
|
1284
|
+
* }
|
|
1285
|
+
* );
|
|
1286
|
+
* ```
|
|
1078
1287
|
*/
|
|
1079
1288
|
async updateCart(pathParams, body) {
|
|
1080
1289
|
return this.executeRequest(() => this.client.POST("/pos/carts/{id}/items", {
|
|
@@ -1087,6 +1296,62 @@ var PosClient = class extends PosAPIClient {
|
|
|
1087
1296
|
* @param pathParams - Cart ID
|
|
1088
1297
|
* @param body - Address data (registered user IDs or guest addresses)
|
|
1089
1298
|
* @returns Promise with updated cart
|
|
1299
|
+
* @example
|
|
1300
|
+
* ```typescript
|
|
1301
|
+
* // For registered users with saved addresses
|
|
1302
|
+
* const { data, error } = await pos.createCartAddress(
|
|
1303
|
+
* { id: "01H9CART12345ABCDE" },
|
|
1304
|
+
* {
|
|
1305
|
+
* billing_address_id: "01H9ADDR12345BILL",
|
|
1306
|
+
* shipping_address_id: "01H9ADDR12345SHIP"
|
|
1307
|
+
* }
|
|
1308
|
+
* );
|
|
1309
|
+
*
|
|
1310
|
+
* if (error) {
|
|
1311
|
+
* console.error("Failed to update cart address:", error.message);
|
|
1312
|
+
* } else {
|
|
1313
|
+
* console.log("Addresses updated:", data.message);
|
|
1314
|
+
* }
|
|
1315
|
+
*
|
|
1316
|
+
* // For guest checkout with new addresses
|
|
1317
|
+
* const { data: guestData, error: guestError } = await pos.createCartAddress(
|
|
1318
|
+
* { id: "01H9CART12345ABCDE" },
|
|
1319
|
+
* {
|
|
1320
|
+
* billing_address: {
|
|
1321
|
+
* first_name: "John",
|
|
1322
|
+
* last_name: "Doe",
|
|
1323
|
+
* email: "john@example.com",
|
|
1324
|
+
* phone: "9876543210",
|
|
1325
|
+
* country_code: "+91",
|
|
1326
|
+
* address_line1: "123 Main Street",
|
|
1327
|
+
* address_line2: "Apt 4B",
|
|
1328
|
+
* city: "Mumbai",
|
|
1329
|
+
* state: "Maharashtra",
|
|
1330
|
+
* pincode: "400001",
|
|
1331
|
+
* country: "India",
|
|
1332
|
+
* landmark: "Near Station",
|
|
1333
|
+
* tax_identification_number: null,
|
|
1334
|
+
* business_name: null
|
|
1335
|
+
* },
|
|
1336
|
+
* shipping_address: {
|
|
1337
|
+
* first_name: "John",
|
|
1338
|
+
* last_name: "Doe",
|
|
1339
|
+
* email: "john@example.com",
|
|
1340
|
+
* phone: "9876543210",
|
|
1341
|
+
* country_code: "+91",
|
|
1342
|
+
* address_line1: "456 Oak Avenue",
|
|
1343
|
+
* address_line2: null,
|
|
1344
|
+
* city: "Pune",
|
|
1345
|
+
* state: "Maharashtra",
|
|
1346
|
+
* pincode: "411001",
|
|
1347
|
+
* country: "India",
|
|
1348
|
+
* landmark: "Near Mall",
|
|
1349
|
+
* tax_identification_number: null,
|
|
1350
|
+
* business_name: null
|
|
1351
|
+
* }
|
|
1352
|
+
* }
|
|
1353
|
+
* );
|
|
1354
|
+
* ```
|
|
1090
1355
|
*/
|
|
1091
1356
|
async createCartAddress(pathParams, body) {
|
|
1092
1357
|
return this.executeRequest(() => this.client.POST("/pos/carts/{id}/address", {
|
|
@@ -1098,6 +1363,26 @@ var PosClient = class extends PosAPIClient {
|
|
|
1098
1363
|
* List all available coupons
|
|
1099
1364
|
* @param headers - Optional header parameters (customer_group_id, etc.)
|
|
1100
1365
|
* @returns Promise with available coupons
|
|
1366
|
+
* @example
|
|
1367
|
+
* ```typescript
|
|
1368
|
+
* // Get all available coupons
|
|
1369
|
+
* const { data, error } = await pos.listCoupons();
|
|
1370
|
+
*
|
|
1371
|
+
* if (error) {
|
|
1372
|
+
* console.error("Failed to get available coupons:", error.message);
|
|
1373
|
+
* } else {
|
|
1374
|
+
* const coupons = data.coupons || [];
|
|
1375
|
+
* console.log("Available coupons:", coupons.length);
|
|
1376
|
+
* coupons.forEach(coupon => {
|
|
1377
|
+
* console.log("Coupon:", coupon.code, "Discount:", coupon.discount_amount);
|
|
1378
|
+
* });
|
|
1379
|
+
* }
|
|
1380
|
+
*
|
|
1381
|
+
* // Override customer group ID for this specific request
|
|
1382
|
+
* const { data: overrideData, error: overrideError } = await pos.listCoupons({
|
|
1383
|
+
* "x-customer-group-id": "01H9GROUP12345ABC" // Override default SDK config
|
|
1384
|
+
* });
|
|
1385
|
+
* ```
|
|
1101
1386
|
*/
|
|
1102
1387
|
async listCoupons(headers) {
|
|
1103
1388
|
const mergedHeaders = this.mergeHeaders(headers);
|
|
@@ -1107,6 +1392,26 @@ var PosClient = class extends PosAPIClient {
|
|
|
1107
1392
|
* List all available promotions
|
|
1108
1393
|
* @param headers - Optional header parameters (customer_group_id, etc.)
|
|
1109
1394
|
* @returns Promise with available promotions
|
|
1395
|
+
* @example
|
|
1396
|
+
* ```typescript
|
|
1397
|
+
* // Get all available promotions
|
|
1398
|
+
* const { data, error } = await pos.listPromotions();
|
|
1399
|
+
*
|
|
1400
|
+
* if (error) {
|
|
1401
|
+
* console.error("Failed to get available promotions:", error.message);
|
|
1402
|
+
* } else {
|
|
1403
|
+
* const promotions = data.promotions || [];
|
|
1404
|
+
* console.log("Available promotions:", promotions.length);
|
|
1405
|
+
* promotions.forEach(promotion => {
|
|
1406
|
+
* console.log("Promotion:", promotion.name, "Type:", promotion.promotion_type);
|
|
1407
|
+
* });
|
|
1408
|
+
* }
|
|
1409
|
+
*
|
|
1410
|
+
* // Override customer group ID for this specific request
|
|
1411
|
+
* const { data: overrideData, error: overrideError } = await pos.listPromotions({
|
|
1412
|
+
* "x-customer-group-id": "01H9GROUP12345ABC" // Override default SDK config
|
|
1413
|
+
* });
|
|
1414
|
+
* ```
|
|
1110
1415
|
*/
|
|
1111
1416
|
async listPromotions(headers) {
|
|
1112
1417
|
const mergedHeaders = this.mergeHeaders(headers);
|
|
@@ -1117,6 +1422,20 @@ var PosClient = class extends PosAPIClient {
|
|
|
1117
1422
|
* @param pathParams - Cart ID
|
|
1118
1423
|
* @param body - Coupon code
|
|
1119
1424
|
* @returns Promise with updated cart
|
|
1425
|
+
* @example
|
|
1426
|
+
* ```typescript
|
|
1427
|
+
* const { data, error } = await pos.applyCoupon(
|
|
1428
|
+
* { id: "01H9CART12345ABCDE" },
|
|
1429
|
+
* { coupon_code: "FLAT100OFF" }
|
|
1430
|
+
* );
|
|
1431
|
+
*
|
|
1432
|
+
* if (error) {
|
|
1433
|
+
* console.error("Failed to apply coupon:", error.message);
|
|
1434
|
+
* } else {
|
|
1435
|
+
* console.log("Coupon applied, new total:", data.cart.grand_total);
|
|
1436
|
+
* console.log("Discount amount:", data.cart.coupon_discount_amount);
|
|
1437
|
+
* }
|
|
1438
|
+
* ```
|
|
1120
1439
|
*/
|
|
1121
1440
|
async applyCoupon(pathParams, body) {
|
|
1122
1441
|
return this.executeRequest(() => this.client.POST("/pos/carts/{id}/coupon", {
|
|
@@ -1128,6 +1447,18 @@ var PosClient = class extends PosAPIClient {
|
|
|
1128
1447
|
* Remove coupon from cart
|
|
1129
1448
|
* @param pathParams - Cart ID
|
|
1130
1449
|
* @returns Promise with updated cart
|
|
1450
|
+
* @example
|
|
1451
|
+
* ```typescript
|
|
1452
|
+
* const { data, error } = await pos.removeCoupon({
|
|
1453
|
+
* id: "01H9CART12345ABCDE"
|
|
1454
|
+
* });
|
|
1455
|
+
*
|
|
1456
|
+
* if (error) {
|
|
1457
|
+
* console.error("Failed to remove coupon:", error.message);
|
|
1458
|
+
* } else {
|
|
1459
|
+
* console.log("Coupon removed, new total:", data.cart.grand_total);
|
|
1460
|
+
* }
|
|
1461
|
+
* ```
|
|
1131
1462
|
*/
|
|
1132
1463
|
async removeCoupon(pathParams) {
|
|
1133
1464
|
return this.executeRequest(() => this.client.DELETE("/pos/carts/{id}/coupon", { params: { path: pathParams } }));
|
|
@@ -1136,6 +1467,29 @@ var PosClient = class extends PosAPIClient {
|
|
|
1136
1467
|
* Evaluate applicable/inapplicable coupons for cart
|
|
1137
1468
|
* @param pathParams - Cart ID
|
|
1138
1469
|
* @returns Promise with coupon evaluation results
|
|
1470
|
+
* @example
|
|
1471
|
+
* ```typescript
|
|
1472
|
+
* const { data, error } = await pos.evaluateCoupons({
|
|
1473
|
+
* id: "01H9CART12345ABCDE"
|
|
1474
|
+
* });
|
|
1475
|
+
*
|
|
1476
|
+
* if (error) {
|
|
1477
|
+
* console.error("Failed to evaluate coupons:", error.message);
|
|
1478
|
+
* } else {
|
|
1479
|
+
* const applicable = data.applicable_coupons || [];
|
|
1480
|
+
* const inapplicable = data.inapplicable_coupons || [];
|
|
1481
|
+
*
|
|
1482
|
+
* console.log("Applicable coupons:", applicable.length);
|
|
1483
|
+
* applicable.forEach(coupon => {
|
|
1484
|
+
* console.log(`- ${coupon.code}: Save $${coupon.estimated_discount}`);
|
|
1485
|
+
* });
|
|
1486
|
+
*
|
|
1487
|
+
* console.log("Inapplicable coupons:", inapplicable.length);
|
|
1488
|
+
* inapplicable.forEach(coupon => {
|
|
1489
|
+
* console.log(`- ${coupon.code}: ${coupon.reason}`);
|
|
1490
|
+
* });
|
|
1491
|
+
* }
|
|
1492
|
+
* ```
|
|
1139
1493
|
*/
|
|
1140
1494
|
async evaluateCoupons(pathParams) {
|
|
1141
1495
|
return this.executeRequest(() => this.client.GET("/pos/carts/{id}/evaluate-coupons", { params: { path: pathParams } }));
|
|
@@ -1144,6 +1498,29 @@ var PosClient = class extends PosAPIClient {
|
|
|
1144
1498
|
* Evaluate applicable/inapplicable promotions for cart
|
|
1145
1499
|
* @param pathParams - Cart ID
|
|
1146
1500
|
* @returns Promise with promotion evaluation results
|
|
1501
|
+
* @example
|
|
1502
|
+
* ```typescript
|
|
1503
|
+
* const { data, error } = await pos.evaluatePromotions({
|
|
1504
|
+
* id: "01H9CART12345ABCDE"
|
|
1505
|
+
* });
|
|
1506
|
+
*
|
|
1507
|
+
* if (error) {
|
|
1508
|
+
* console.error("Failed to evaluate promotions:", error.message);
|
|
1509
|
+
* } else {
|
|
1510
|
+
* const applicable = data.applicable_promotions || [];
|
|
1511
|
+
* const inapplicable = data.inapplicable_promotions || [];
|
|
1512
|
+
*
|
|
1513
|
+
* console.log("Applicable promotions:", applicable.length);
|
|
1514
|
+
* applicable.forEach(promo => {
|
|
1515
|
+
* console.log(`- ${promo.name}: ${promo.savings_message}`);
|
|
1516
|
+
* });
|
|
1517
|
+
*
|
|
1518
|
+
* console.log("Inapplicable promotions:", inapplicable.length);
|
|
1519
|
+
* inapplicable.forEach(promo => {
|
|
1520
|
+
* console.log(`- ${promo.name}: ${promo.reason}`);
|
|
1521
|
+
* });
|
|
1522
|
+
* }
|
|
1523
|
+
* ```
|
|
1147
1524
|
*/
|
|
1148
1525
|
async evaluatePromotions(pathParams) {
|
|
1149
1526
|
return this.executeRequest(() => this.client.GET("/pos/carts/{id}/evaluate-promotions", { params: { path: pathParams } }));
|
|
@@ -1153,6 +1530,20 @@ var PosClient = class extends PosAPIClient {
|
|
|
1153
1530
|
* @param pathParams - Cart ID
|
|
1154
1531
|
* @param body - Credit balance amount to use
|
|
1155
1532
|
* @returns Promise with updated cart
|
|
1533
|
+
* @example
|
|
1534
|
+
* ```typescript
|
|
1535
|
+
* const { data, error } = await pos.redeemCreditBalance(
|
|
1536
|
+
* { id: "01H9CART12345ABCDE" },
|
|
1537
|
+
* { credit_balance_used: 250.00 }
|
|
1538
|
+
* );
|
|
1539
|
+
*
|
|
1540
|
+
* if (error) {
|
|
1541
|
+
* console.error("Failed to redeem credit balance:", error.message);
|
|
1542
|
+
* } else {
|
|
1543
|
+
* console.log("Credit applied, new total:", data.cart.grand_total);
|
|
1544
|
+
* console.log("Credit used:", data.cart.credit_balance_used);
|
|
1545
|
+
* }
|
|
1546
|
+
* ```
|
|
1156
1547
|
*/
|
|
1157
1548
|
async redeemCreditBalance(pathParams, body) {
|
|
1158
1549
|
return this.executeRequest(() => this.client.POST("/pos/carts/{id}/credit-balance", {
|
|
@@ -1164,35 +1555,41 @@ var PosClient = class extends PosAPIClient {
|
|
|
1164
1555
|
* Remove credit balance from cart
|
|
1165
1556
|
* @param pathParams - Cart ID
|
|
1166
1557
|
* @returns Promise with updated cart
|
|
1558
|
+
* @example
|
|
1559
|
+
* ```typescript
|
|
1560
|
+
* const { data, error } = await pos.removeCreditBalance({
|
|
1561
|
+
* id: "01H9CART12345ABCDE"
|
|
1562
|
+
* });
|
|
1563
|
+
*
|
|
1564
|
+
* if (error) {
|
|
1565
|
+
* console.error("Failed to remove credit balance:", error.message);
|
|
1566
|
+
* } else {
|
|
1567
|
+
* console.log("Credit balance removed, new total:", data.cart.grand_total);
|
|
1568
|
+
* }
|
|
1569
|
+
* ```
|
|
1167
1570
|
*/
|
|
1168
1571
|
async removeCreditBalance(pathParams) {
|
|
1169
1572
|
return this.executeRequest(() => this.client.DELETE("/pos/carts/{id}/credit-balance", { params: { path: pathParams } }));
|
|
1170
1573
|
}
|
|
1171
1574
|
/**
|
|
1172
|
-
* Redeem gift card for cart
|
|
1173
|
-
* @param pathParams - Cart ID
|
|
1174
|
-
* @param body - Gift card code
|
|
1175
|
-
* @returns Promise with updated cart
|
|
1176
|
-
*/
|
|
1177
|
-
async redeemGiftCard(pathParams, body) {
|
|
1178
|
-
return this.executeRequest(() => this.client.POST("/pos/carts/{id}/gift-card", {
|
|
1179
|
-
params: { path: pathParams },
|
|
1180
|
-
body
|
|
1181
|
-
}));
|
|
1182
|
-
}
|
|
1183
|
-
/**
|
|
1184
|
-
* Remove gift card from cart
|
|
1185
|
-
* @param pathParams - Cart ID
|
|
1186
|
-
* @returns Promise with updated cart
|
|
1187
|
-
*/
|
|
1188
|
-
async removeGiftCard(pathParams) {
|
|
1189
|
-
return this.executeRequest(() => this.client.DELETE("/pos/carts/{id}/gift-card", { params: { path: pathParams } }));
|
|
1190
|
-
}
|
|
1191
|
-
/**
|
|
1192
1575
|
* Redeem loyalty points for cart
|
|
1193
1576
|
* @param pathParams - Cart ID
|
|
1194
1577
|
* @param body - Loyalty points to redeem
|
|
1195
1578
|
* @returns Promise with updated cart
|
|
1579
|
+
* @example
|
|
1580
|
+
* ```typescript
|
|
1581
|
+
* const { data, error } = await pos.redeemLoyaltyPoints(
|
|
1582
|
+
* { id: "01H9CART12345ABCDE" },
|
|
1583
|
+
* { loyalty_point_redeemed: 500 }
|
|
1584
|
+
* );
|
|
1585
|
+
*
|
|
1586
|
+
* if (error) {
|
|
1587
|
+
* console.error("Failed to redeem loyalty points:", error.message);
|
|
1588
|
+
* } else {
|
|
1589
|
+
* console.log("Points redeemed, new total:", data.cart.grand_total);
|
|
1590
|
+
* console.log("Points redeemed:", data.cart.loyalty_points_redeemed);
|
|
1591
|
+
* }
|
|
1592
|
+
* ```
|
|
1196
1593
|
*/
|
|
1197
1594
|
async redeemLoyaltyPoints(pathParams, body) {
|
|
1198
1595
|
return this.executeRequest(() => this.client.POST("/pos/carts/{id}/loyalty-points", {
|
|
@@ -1204,6 +1601,18 @@ var PosClient = class extends PosAPIClient {
|
|
|
1204
1601
|
* Remove loyalty points from cart
|
|
1205
1602
|
* @param pathParams - Cart ID
|
|
1206
1603
|
* @returns Promise with updated cart
|
|
1604
|
+
* @example
|
|
1605
|
+
* ```typescript
|
|
1606
|
+
* const { data, error } = await pos.removeLoyaltyPoints({
|
|
1607
|
+
* id: "01H9CART12345ABCDE"
|
|
1608
|
+
* });
|
|
1609
|
+
*
|
|
1610
|
+
* if (error) {
|
|
1611
|
+
* console.error("Failed to remove loyalty points:", error.message);
|
|
1612
|
+
* } else {
|
|
1613
|
+
* console.log("Loyalty points removed, new total:", data.cart.grand_total);
|
|
1614
|
+
* }
|
|
1615
|
+
* ```
|
|
1207
1616
|
*/
|
|
1208
1617
|
async removeLoyaltyPoints(pathParams) {
|
|
1209
1618
|
return this.executeRequest(() => this.client.DELETE("/pos/carts/{id}/loyalty-points", { params: { path: pathParams } }));
|
|
@@ -1213,6 +1622,23 @@ var PosClient = class extends PosAPIClient {
|
|
|
1213
1622
|
* @param pathParams - Cart ID
|
|
1214
1623
|
* @param body - Fulfillment preference data
|
|
1215
1624
|
* @returns Promise with confirmation
|
|
1625
|
+
* @example
|
|
1626
|
+
* ```typescript
|
|
1627
|
+
* const { data, error } = await pos.updateFulfillmentPreference(
|
|
1628
|
+
* { id: "01H9CART12345ABCDE" },
|
|
1629
|
+
* {
|
|
1630
|
+
* fulfillment_type: "delivery",
|
|
1631
|
+
* delivery_address_id: "01H9ADDR12345ABCDE"
|
|
1632
|
+
* }
|
|
1633
|
+
* );
|
|
1634
|
+
*
|
|
1635
|
+
* if (error) {
|
|
1636
|
+
* console.error("Failed to update fulfillment preference:", error.message);
|
|
1637
|
+
* } else {
|
|
1638
|
+
* console.log("Fulfillment preference updated:", data.message);
|
|
1639
|
+
* console.log("Success:", data.success);
|
|
1640
|
+
* }
|
|
1641
|
+
* ```
|
|
1216
1642
|
*/
|
|
1217
1643
|
async updateFulfillmentPreference(pathParams, body) {
|
|
1218
1644
|
return this.executeRequest(() => this.client.POST("/pos/carts/{id}/fulfillment-preference", {
|
|
@@ -1224,6 +1650,28 @@ var PosClient = class extends PosAPIClient {
|
|
|
1224
1650
|
* Get fulfillment options for cart
|
|
1225
1651
|
* @param body - Cart data for fulfillment calculation
|
|
1226
1652
|
* @returns Promise with fulfillment options
|
|
1653
|
+
* @example
|
|
1654
|
+
* ```typescript
|
|
1655
|
+
* const { data, error } = await pos.getFulfillmentOptions({
|
|
1656
|
+
* cart_id: "01H9CART12345ABCDE",
|
|
1657
|
+
* delivery_address: {
|
|
1658
|
+
* street: "123 Main St",
|
|
1659
|
+
* city: "New York",
|
|
1660
|
+
* state: "NY",
|
|
1661
|
+
* zip_code: "10001",
|
|
1662
|
+
* country: "US"
|
|
1663
|
+
* }
|
|
1664
|
+
* });
|
|
1665
|
+
*
|
|
1666
|
+
* if (error) {
|
|
1667
|
+
* console.error("Failed to get fulfillment options:", error.message);
|
|
1668
|
+
* } else {
|
|
1669
|
+
* console.log("Available fulfillment options:", data.options.length);
|
|
1670
|
+
* data.options.forEach(option => {
|
|
1671
|
+
* console.log(`${option.type}: ${option.name} - $${option.cost}`);
|
|
1672
|
+
* });
|
|
1673
|
+
* }
|
|
1674
|
+
* ```
|
|
1227
1675
|
*/
|
|
1228
1676
|
async getFulfillmentOptions(body) {
|
|
1229
1677
|
return this.executeRequest(() => this.client.POST("/pos/fulfillment-options", { body }));
|
|
@@ -1233,6 +1681,24 @@ var PosClient = class extends PosAPIClient {
|
|
|
1233
1681
|
* @param pathParams - Cart ID
|
|
1234
1682
|
* @param body - Customer update data
|
|
1235
1683
|
* @returns Promise with updated cart
|
|
1684
|
+
* @example
|
|
1685
|
+
* ```typescript
|
|
1686
|
+
* const { data, error } = await pos.updateCartCustomer(
|
|
1687
|
+
* { id: "01H9CART12345ABCDE" },
|
|
1688
|
+
* {
|
|
1689
|
+
* customer_id: "01H9CUST12345ABCDE",
|
|
1690
|
+
* customer_group_id: "01H9GROUP12345ABCDE"
|
|
1691
|
+
* }
|
|
1692
|
+
* );
|
|
1693
|
+
*
|
|
1694
|
+
* if (error) {
|
|
1695
|
+
* console.error("Failed to update cart customer:", error.message);
|
|
1696
|
+
* } else {
|
|
1697
|
+
* console.log("Cart customer updated:", data.cart.id);
|
|
1698
|
+
* console.log("Customer ID:", data.cart.customer_id);
|
|
1699
|
+
* console.log("Customer group:", data.cart.customer_group_id);
|
|
1700
|
+
* }
|
|
1701
|
+
* ```
|
|
1236
1702
|
*/
|
|
1237
1703
|
async updateCartCustomer(pathParams, body) {
|
|
1238
1704
|
return this.executeRequest(() => this.client.POST("/pos/carts/{id}/update-customer", {
|
|
@@ -1244,14 +1710,85 @@ var PosClient = class extends PosAPIClient {
|
|
|
1244
1710
|
* Create order from cart
|
|
1245
1711
|
* @param body - Order creation data
|
|
1246
1712
|
* @returns Promise with created order
|
|
1713
|
+
* @example
|
|
1714
|
+
* ```typescript
|
|
1715
|
+
* const { data, error } = await pos.createOrder({
|
|
1716
|
+
* cart_id: "01H9CART12345ABCDE"
|
|
1717
|
+
* });
|
|
1718
|
+
*
|
|
1719
|
+
* if (error) {
|
|
1720
|
+
* console.error("Failed to create order:", error.message);
|
|
1721
|
+
* } else {
|
|
1722
|
+
* console.log("Order created:", data.order.id);
|
|
1723
|
+
* console.log("Payment required:", data.payment_required);
|
|
1724
|
+
* }
|
|
1725
|
+
* ```
|
|
1247
1726
|
*/
|
|
1248
1727
|
async createOrder(body) {
|
|
1249
|
-
return this.executeRequest(() => this.
|
|
1728
|
+
return this.executeRequest(() => this.storefrontClient.POST("/pos/orders", { body }));
|
|
1729
|
+
}
|
|
1730
|
+
/**
|
|
1731
|
+
* List payment options
|
|
1732
|
+
* @returns Promise with list of payment options
|
|
1733
|
+
* @example
|
|
1734
|
+
* ```typescript
|
|
1735
|
+
* const { data, error } = await pos.listPaymentOptions();
|
|
1736
|
+
*
|
|
1737
|
+
* if (error) {
|
|
1738
|
+
* console.error("Failed to list payment options:", error.message);
|
|
1739
|
+
* } else {
|
|
1740
|
+
* console.log("Payment options:", data.payment_options);
|
|
1741
|
+
* }
|
|
1742
|
+
* ```
|
|
1743
|
+
*/
|
|
1744
|
+
async listPaymentOptions() {
|
|
1745
|
+
return this.executeRequest(() => this.client.GET("/pos/payments/payment-options"));
|
|
1746
|
+
}
|
|
1747
|
+
/**
|
|
1748
|
+
* Get payment status
|
|
1749
|
+
* @param pathParams - Order number
|
|
1750
|
+
* @returns Promise with payment status
|
|
1751
|
+
* @example
|
|
1752
|
+
* ```typescript
|
|
1753
|
+
* const { data, error } = await pos.getPaymentStatus({ order_number: "1234567890" });
|
|
1754
|
+
*
|
|
1755
|
+
* if (error) {
|
|
1756
|
+
* console.error("Failed to get payment status:", error.message);
|
|
1757
|
+
* } else {
|
|
1758
|
+
* console.log("Payment status:", data.status);
|
|
1759
|
+
* console.log("Amount paid:", data.amount_paid);
|
|
1760
|
+
* console.log("Amount unpaid:", data.amount_unpaid);
|
|
1761
|
+
* console.log("Retry available:", data.is_retry_available);
|
|
1762
|
+
* }
|
|
1763
|
+
* ```
|
|
1764
|
+
*/
|
|
1765
|
+
async getPaymentStatus(pathParams) {
|
|
1766
|
+
return this.executeRequest(() => this.client.GET("/pos/orders/{order_number}/payment-status", { params: { path: pathParams } }));
|
|
1250
1767
|
}
|
|
1251
1768
|
/**
|
|
1252
1769
|
* List all categories
|
|
1253
1770
|
* @param query - Optional query parameters for filtering categories
|
|
1254
1771
|
* @returns Promise with list of categories
|
|
1772
|
+
* @example
|
|
1773
|
+
* ```typescript
|
|
1774
|
+
* // Basic category listing
|
|
1775
|
+
* const { data, error } = await pos.listCategories();
|
|
1776
|
+
*
|
|
1777
|
+
* if (error) {
|
|
1778
|
+
* console.error("Failed to list categories:", error.message);
|
|
1779
|
+
* } else {
|
|
1780
|
+
* console.log("Categories found:", data.categories?.length || 0);
|
|
1781
|
+
* data.categories?.forEach(category => {
|
|
1782
|
+
* console.log(`Category: ${category.name} - ${category.description}`);
|
|
1783
|
+
* });
|
|
1784
|
+
* }
|
|
1785
|
+
*
|
|
1786
|
+
* // With pagination
|
|
1787
|
+
* const { data: catData, error: catError } = await pos.listCategories({
|
|
1788
|
+
* page: 1,
|
|
1789
|
+
* limit: 10
|
|
1790
|
+
* });
|
|
1791
|
+
* ```
|
|
1255
1792
|
*/
|
|
1256
1793
|
async listCategories(query) {
|
|
1257
1794
|
return this.executeRequest(() => this.client.GET("/pos/catalog/categories", { params: { query } }));
|
|
@@ -1261,6 +1798,42 @@ var PosClient = class extends PosAPIClient {
|
|
|
1261
1798
|
* @param query - Optional query parameters for filtering products
|
|
1262
1799
|
* @param headers - Optional header parameters
|
|
1263
1800
|
* @returns Promise with list of products
|
|
1801
|
+
* @example
|
|
1802
|
+
* ```typescript
|
|
1803
|
+
* // Basic product listing
|
|
1804
|
+
* const { data, error } = await pos.listProducts();
|
|
1805
|
+
*
|
|
1806
|
+
* if (error) {
|
|
1807
|
+
* console.error("Failed to list products:", error.message);
|
|
1808
|
+
* } else {
|
|
1809
|
+
* console.log("Products found:", data.products?.length || 0);
|
|
1810
|
+
* console.log("Pagination:", data.pagination);
|
|
1811
|
+
* data.products?.forEach(product => {
|
|
1812
|
+
* console.log(`Product: ${product.name} - $${product.price}`);
|
|
1813
|
+
* });
|
|
1814
|
+
* }
|
|
1815
|
+
*
|
|
1816
|
+
* // With filtering and pagination
|
|
1817
|
+
* const { data: filteredData, error: filteredError } = await pos.listProducts({
|
|
1818
|
+
* page: 1,
|
|
1819
|
+
* limit: 20,
|
|
1820
|
+
* sort_by: JSON.stringify({ "created_at": "desc" }),
|
|
1821
|
+
* category_slug: ["electronics", "smartphones"]
|
|
1822
|
+
* });
|
|
1823
|
+
*
|
|
1824
|
+
* // Override customer group ID for this specific request
|
|
1825
|
+
* const { data: overrideData, error: overrideError } = await pos.listProducts(
|
|
1826
|
+
* {
|
|
1827
|
+
* page: 1,
|
|
1828
|
+
* limit: 20,
|
|
1829
|
+
* sort_by: JSON.stringify({ "created_at": "desc" }),
|
|
1830
|
+
* category_slug: ["electronics", "smartphones"]
|
|
1831
|
+
* },
|
|
1832
|
+
* {
|
|
1833
|
+
* "x-customer-group-id": "01H9XYZ12345USERID" // Override default SDK config
|
|
1834
|
+
* }
|
|
1835
|
+
* );
|
|
1836
|
+
* ```
|
|
1264
1837
|
*/
|
|
1265
1838
|
async listProducts(query, headers) {
|
|
1266
1839
|
const mergedHeaders = this.mergeHeaders(headers);
|
|
@@ -1274,6 +1847,43 @@ var PosClient = class extends PosAPIClient {
|
|
|
1274
1847
|
* @param query - Query parameters with product IDs for cross-sell recommendations
|
|
1275
1848
|
* @param headers - Optional header parameters
|
|
1276
1849
|
* @returns Promise with cross-sell products
|
|
1850
|
+
* @example
|
|
1851
|
+
* ```typescript
|
|
1852
|
+
* // Basic usage - get cross-sell products for cart items
|
|
1853
|
+
* const { data, error } = await pos.listCrosssellProducts({
|
|
1854
|
+
* product_ids: ["prod_01H9XYZ12345ABCDE", "prod_01H9ABC67890FGHIJ"]
|
|
1855
|
+
* });
|
|
1856
|
+
*
|
|
1857
|
+
* // Advanced usage with pagination and custom sorting
|
|
1858
|
+
* const { data, error } = await pos.listCrosssellProducts({
|
|
1859
|
+
* product_ids: ["prod_01H9XYZ12345ABCDE"],
|
|
1860
|
+
* page: 1,
|
|
1861
|
+
* limit: 10,
|
|
1862
|
+
* sort_by: '{"price":"asc"}'
|
|
1863
|
+
* });
|
|
1864
|
+
*
|
|
1865
|
+
* // Override customer group ID for this specific request
|
|
1866
|
+
* const { data, error } = await pos.listCrosssellProducts(
|
|
1867
|
+
* {
|
|
1868
|
+
* product_ids: ["prod_01H9XYZ12345ABCDE"],
|
|
1869
|
+
* page: 1,
|
|
1870
|
+
* limit: 10
|
|
1871
|
+
* },
|
|
1872
|
+
* {
|
|
1873
|
+
* "x-customer-group-id": "01H9XYZ12345USERID" // Override default SDK config
|
|
1874
|
+
* }
|
|
1875
|
+
* );
|
|
1876
|
+
*
|
|
1877
|
+
* if (error) {
|
|
1878
|
+
* console.error("Failed to get cross-sell products:", error.message);
|
|
1879
|
+
* } else {
|
|
1880
|
+
* console.log("Cross-sell products found:", data.products.length);
|
|
1881
|
+
* console.log("Pagination:", data.pagination);
|
|
1882
|
+
* data.products.forEach(product => {
|
|
1883
|
+
* console.log(`Product: ${product.name} - ${product.price}`);
|
|
1884
|
+
* });
|
|
1885
|
+
* }
|
|
1886
|
+
* ```
|
|
1277
1887
|
*/
|
|
1278
1888
|
async listCrosssellProducts(query, headers) {
|
|
1279
1889
|
const mergedHeaders = this.mergeHeaders(headers);
|
|
@@ -1287,6 +1897,41 @@ var PosClient = class extends PosAPIClient {
|
|
|
1287
1897
|
* @param body - Search criteria and parameters
|
|
1288
1898
|
* @param headers - Optional header parameters
|
|
1289
1899
|
* @returns Promise with search results
|
|
1900
|
+
* @example
|
|
1901
|
+
* ```typescript
|
|
1902
|
+
* const { data, error } = await pos.searchProducts({
|
|
1903
|
+
* query: "smartphone",
|
|
1904
|
+
* filters: {
|
|
1905
|
+
* category: ["electronics", "mobile"],
|
|
1906
|
+
* price_range: { min: 100, max: 1000 },
|
|
1907
|
+
* brand: ["Apple", "Samsung"] // facet names depend on product configuration
|
|
1908
|
+
* },
|
|
1909
|
+
* page: 1,
|
|
1910
|
+
* limit: 20
|
|
1911
|
+
* });
|
|
1912
|
+
*
|
|
1913
|
+
* if (error) {
|
|
1914
|
+
* console.error("Failed to search products:", error.message);
|
|
1915
|
+
* } else {
|
|
1916
|
+
* console.log("Search results:", data.skus?.length || 0, "products found");
|
|
1917
|
+
* console.log("Facet distribution:", data.facet_distribution);
|
|
1918
|
+
* console.log("Price range:", data.facet_stats.price_range);
|
|
1919
|
+
* data.skus?.forEach(sku => {
|
|
1920
|
+
* console.log(`Found: ${sku.name} - ${sku.price}`);
|
|
1921
|
+
* });
|
|
1922
|
+
* }
|
|
1923
|
+
*
|
|
1924
|
+
* // Override customer group ID for this specific request
|
|
1925
|
+
* const { data: overrideData, error: overrideError } = await pos.searchProducts(
|
|
1926
|
+
* {
|
|
1927
|
+
* query: "laptop",
|
|
1928
|
+
* filters: { category: ["computers"] }
|
|
1929
|
+
* },
|
|
1930
|
+
* {
|
|
1931
|
+
* "x-customer-group-id": "01H9XYZ12345USERID" // Override default SDK config
|
|
1932
|
+
* }
|
|
1933
|
+
* );
|
|
1934
|
+
* ```
|
|
1290
1935
|
*/
|
|
1291
1936
|
async searchProducts(body, headers) {
|
|
1292
1937
|
const mergedHeaders = this.mergeHeaders(headers);
|
|
@@ -1300,6 +1945,43 @@ var PosClient = class extends PosAPIClient {
|
|
|
1300
1945
|
* @param query - Query parameters with product ID for similarity recommendations
|
|
1301
1946
|
* @param headers - Optional header parameters
|
|
1302
1947
|
* @returns Promise with similar products
|
|
1948
|
+
* @example
|
|
1949
|
+
* ```typescript
|
|
1950
|
+
* // Basic usage - get similar products for a specific product
|
|
1951
|
+
* const { data, error } = await pos.listSimilarProducts({
|
|
1952
|
+
* product_id: "prod_01H9XYZ12345ABCDE"
|
|
1953
|
+
* });
|
|
1954
|
+
*
|
|
1955
|
+
* // Advanced usage with pagination and custom sorting
|
|
1956
|
+
* const { data, error } = await pos.listSimilarProducts({
|
|
1957
|
+
* product_id: "prod_01H9XYZ12345ABCDE",
|
|
1958
|
+
* page: 1,
|
|
1959
|
+
* limit: 20,
|
|
1960
|
+
* sort_by: '{"relevance":"desc"}'
|
|
1961
|
+
* });
|
|
1962
|
+
*
|
|
1963
|
+
* // Override customer group ID for this specific request
|
|
1964
|
+
* const { data, error } = await pos.listSimilarProducts(
|
|
1965
|
+
* {
|
|
1966
|
+
* product_id: "prod_01H9XYZ12345ABCDE",
|
|
1967
|
+
* page: 1,
|
|
1968
|
+
* limit: 20
|
|
1969
|
+
* },
|
|
1970
|
+
* {
|
|
1971
|
+
* "x-customer-group-id": "01H9XYZ12345USERID" // Override default SDK config
|
|
1972
|
+
* }
|
|
1973
|
+
* );
|
|
1974
|
+
*
|
|
1975
|
+
* if (error) {
|
|
1976
|
+
* console.error("Failed to get similar products:", error.message);
|
|
1977
|
+
* } else {
|
|
1978
|
+
* console.log("Similar products found:", data.products.length);
|
|
1979
|
+
* console.log("Pagination:", data.pagination);
|
|
1980
|
+
* data.products.forEach(product => {
|
|
1981
|
+
* console.log(`Similar: ${product.name} - ${product.price}`);
|
|
1982
|
+
* });
|
|
1983
|
+
* }
|
|
1984
|
+
* ```
|
|
1303
1985
|
*/
|
|
1304
1986
|
async listSimilarProducts(query, headers) {
|
|
1305
1987
|
const mergedHeaders = this.mergeHeaders(headers);
|
|
@@ -1313,6 +1995,43 @@ var PosClient = class extends PosAPIClient {
|
|
|
1313
1995
|
* @param query - Query parameters with product IDs for up-sell recommendations
|
|
1314
1996
|
* @param headers - Optional header parameters
|
|
1315
1997
|
* @returns Promise with up-sell products
|
|
1998
|
+
* @example
|
|
1999
|
+
* ```typescript
|
|
2000
|
+
* // Basic usage - get up-sell products for cart items
|
|
2001
|
+
* const { data, error } = await pos.listUpsellProducts({
|
|
2002
|
+
* product_ids: ["prod_01H9XYZ12345ABCDE"]
|
|
2003
|
+
* });
|
|
2004
|
+
*
|
|
2005
|
+
* // Advanced usage with pagination and custom sorting
|
|
2006
|
+
* const { data, error } = await pos.listUpsellProducts({
|
|
2007
|
+
* product_ids: ["prod_01H9XYZ12345ABCDE"],
|
|
2008
|
+
* page: 1,
|
|
2009
|
+
* limit: 15,
|
|
2010
|
+
* sort_by: '{"relevance":"desc"}'
|
|
2011
|
+
* });
|
|
2012
|
+
*
|
|
2013
|
+
* // Override customer group ID for this specific request
|
|
2014
|
+
* const { data, error } = await pos.listUpsellProducts(
|
|
2015
|
+
* {
|
|
2016
|
+
* product_ids: ["prod_01H9XYZ12345ABCDE"],
|
|
2017
|
+
* page: 1,
|
|
2018
|
+
* limit: 15
|
|
2019
|
+
* },
|
|
2020
|
+
* {
|
|
2021
|
+
* "x-customer-group-id": "01H9XYZ12345USERID" // Override default SDK config
|
|
2022
|
+
* }
|
|
2023
|
+
* );
|
|
2024
|
+
*
|
|
2025
|
+
* if (error) {
|
|
2026
|
+
* console.error("Failed to get up-sell products:", error.message);
|
|
2027
|
+
* } else {
|
|
2028
|
+
* console.log("Up-sell products found:", data.products.length);
|
|
2029
|
+
* console.log("Pagination:", data.pagination);
|
|
2030
|
+
* data.products.forEach(product => {
|
|
2031
|
+
* console.log(`Up-sell: ${product.name} - ${product.price}`);
|
|
2032
|
+
* });
|
|
2033
|
+
* }
|
|
2034
|
+
* ```
|
|
1316
2035
|
*/
|
|
1317
2036
|
async listUpsellProducts(query, headers) {
|
|
1318
2037
|
const mergedHeaders = this.mergeHeaders(headers);
|
|
@@ -1326,6 +2045,34 @@ var PosClient = class extends PosAPIClient {
|
|
|
1326
2045
|
* @param pathParams - Product ID or slug
|
|
1327
2046
|
* @param headers - Optional header parameters
|
|
1328
2047
|
* @returns Promise with product details
|
|
2048
|
+
* @example
|
|
2049
|
+
* ```typescript
|
|
2050
|
+
* // Get product by ID
|
|
2051
|
+
* const { data, error } = await pos.getProductDetail(
|
|
2052
|
+
* { product_id_or_slug: "prod_123" }
|
|
2053
|
+
* );
|
|
2054
|
+
*
|
|
2055
|
+
* if (error) {
|
|
2056
|
+
* console.error("Failed to get product details:", error.message);
|
|
2057
|
+
* } else {
|
|
2058
|
+
* console.log("Product:", data.product.name);
|
|
2059
|
+
* console.log("Price:", data.product.price);
|
|
2060
|
+
* console.log("Description:", data.product.description);
|
|
2061
|
+
* }
|
|
2062
|
+
*
|
|
2063
|
+
* // Get product by slug
|
|
2064
|
+
* const { data: slugData, error: slugError } = await pos.getProductDetail({
|
|
2065
|
+
* product_id_or_slug: "detox-candy"
|
|
2066
|
+
* });
|
|
2067
|
+
*
|
|
2068
|
+
* // Override customer group ID for this specific request
|
|
2069
|
+
* const { data: overrideData, error: overrideError } = await pos.getProductDetail(
|
|
2070
|
+
* { product_id_or_slug: "detox-candy" },
|
|
2071
|
+
* {
|
|
2072
|
+
* "x-customer-group-id": "premium_customers" // Override default SDK config
|
|
2073
|
+
* }
|
|
2074
|
+
* );
|
|
2075
|
+
* ```
|
|
1329
2076
|
*/
|
|
1330
2077
|
async getProductDetail(pathParams, headers) {
|
|
1331
2078
|
const mergedHeaders = this.mergeHeaders(headers);
|
|
@@ -1339,6 +2086,31 @@ var PosClient = class extends PosAPIClient {
|
|
|
1339
2086
|
* @param pathParams - Product ID
|
|
1340
2087
|
* @param query - Optional query parameters for filtering reviews
|
|
1341
2088
|
* @returns Promise with product reviews
|
|
2089
|
+
* @example
|
|
2090
|
+
* ```typescript
|
|
2091
|
+
* const { data, error } = await pos.listProductReviews(
|
|
2092
|
+
* { product_id: "prod_123" }
|
|
2093
|
+
* );
|
|
2094
|
+
*
|
|
2095
|
+
* if (error) {
|
|
2096
|
+
* console.error("Failed to list product reviews:", error.message);
|
|
2097
|
+
* } else {
|
|
2098
|
+
* console.log("Reviews found:", data.reviews?.length || 0);
|
|
2099
|
+
* data.reviews?.forEach(review => {
|
|
2100
|
+
* console.log(`Review by ${review.customer_name}: ${review.rating}/5`);
|
|
2101
|
+
* console.log("Comment:", review.comment);
|
|
2102
|
+
* });
|
|
2103
|
+
* }
|
|
2104
|
+
*
|
|
2105
|
+
* // With pagination
|
|
2106
|
+
* const { data: reviewData, error: reviewError } = await pos.listProductReviews(
|
|
2107
|
+
* { product_id: "prod_123" },
|
|
2108
|
+
* {
|
|
2109
|
+
* page: 1,
|
|
2110
|
+
* limit: 5
|
|
2111
|
+
* }
|
|
2112
|
+
* );
|
|
2113
|
+
* ```
|
|
1342
2114
|
*/
|
|
1343
2115
|
async listProductReviews(pathParams, query) {
|
|
1344
2116
|
return this.executeRequest(() => this.client.GET("/pos/catalog/products/{product_id}/reviews", { params: {
|
|
@@ -1351,6 +2123,29 @@ var PosClient = class extends PosAPIClient {
|
|
|
1351
2123
|
* @param pathParams - Product ID
|
|
1352
2124
|
* @param headers - Optional header parameters
|
|
1353
2125
|
* @returns Promise with product variants
|
|
2126
|
+
* @example
|
|
2127
|
+
* ```typescript
|
|
2128
|
+
* const { data, error } = await pos.listProductVariants(
|
|
2129
|
+
* { product_id: "prod_123" }
|
|
2130
|
+
* );
|
|
2131
|
+
*
|
|
2132
|
+
* if (error) {
|
|
2133
|
+
* console.error("Failed to list product variants:", error.message);
|
|
2134
|
+
* } else {
|
|
2135
|
+
* console.log("Variants found:", data.variants?.length || 0);
|
|
2136
|
+
* data.variants?.forEach(variant => {
|
|
2137
|
+
* console.log(`Variant: ${variant.name} - SKU: ${variant.sku} - Price: ${variant.price}`);
|
|
2138
|
+
* });
|
|
2139
|
+
* }
|
|
2140
|
+
*
|
|
2141
|
+
* // Override customer group ID for this specific request
|
|
2142
|
+
* const { data: overrideData, error: overrideError } = await pos.listProductVariants(
|
|
2143
|
+
* { product_id: "prod_123" },
|
|
2144
|
+
* {
|
|
2145
|
+
* "x-customer-group-id": "wholesale_customers" // Override default SDK config
|
|
2146
|
+
* }
|
|
2147
|
+
* );
|
|
2148
|
+
* ```
|
|
1354
2149
|
*/
|
|
1355
2150
|
async listProductVariants(pathParams, headers) {
|
|
1356
2151
|
const mergedHeaders = this.mergeHeaders(headers);
|
|
@@ -1364,6 +2159,35 @@ var PosClient = class extends PosAPIClient {
|
|
|
1364
2159
|
* @param pathParams - Product ID and variant ID
|
|
1365
2160
|
* @param headers - Optional header parameters
|
|
1366
2161
|
* @returns Promise with variant details
|
|
2162
|
+
* @example
|
|
2163
|
+
* ```typescript
|
|
2164
|
+
* const { data, error } = await pos.getVariantDetail(
|
|
2165
|
+
* {
|
|
2166
|
+
* product_id: "prod_123",
|
|
2167
|
+
* variant_id: "var_456"
|
|
2168
|
+
* }
|
|
2169
|
+
* );
|
|
2170
|
+
*
|
|
2171
|
+
* if (error) {
|
|
2172
|
+
* console.error("Failed to get variant details:", error.message);
|
|
2173
|
+
* } else {
|
|
2174
|
+
* console.log("Variant:", data.variant.name);
|
|
2175
|
+
* console.log("SKU:", data.variant.sku);
|
|
2176
|
+
* console.log("Price:", data.variant.price);
|
|
2177
|
+
* console.log("Stock:", data.variant.stock);
|
|
2178
|
+
* }
|
|
2179
|
+
*
|
|
2180
|
+
* // Override customer group ID for this specific request
|
|
2181
|
+
* const { data: overrideData, error: overrideError } = await pos.getVariantDetail(
|
|
2182
|
+
* {
|
|
2183
|
+
* product_id: "prod_123",
|
|
2184
|
+
* variant_id: "var_456"
|
|
2185
|
+
* },
|
|
2186
|
+
* {
|
|
2187
|
+
* "x-customer-group-id": "wholesale_customers" // Override default SDK config
|
|
2188
|
+
* }
|
|
2189
|
+
* );
|
|
2190
|
+
* ```
|
|
1367
2191
|
*/
|
|
1368
2192
|
async getVariantDetail(pathParams, headers) {
|
|
1369
2193
|
const mergedHeaders = this.mergeHeaders(headers);
|
|
@@ -1377,6 +2201,38 @@ var PosClient = class extends PosAPIClient {
|
|
|
1377
2201
|
* @param query - Optional query parameters for filtering SKUs
|
|
1378
2202
|
* @param headers - Optional header parameters
|
|
1379
2203
|
* @returns Promise with list of SKUs
|
|
2204
|
+
* @example
|
|
2205
|
+
* ```typescript
|
|
2206
|
+
* // Basic SKU listing
|
|
2207
|
+
* const { data, error } = await pos.listSkus();
|
|
2208
|
+
*
|
|
2209
|
+
* if (error) {
|
|
2210
|
+
* console.error("Failed to list SKUs:", error.message);
|
|
2211
|
+
* } else {
|
|
2212
|
+
* console.log("SKUs found:", data.skus?.length || 0);
|
|
2213
|
+
* console.log("Pagination:", data.pagination);
|
|
2214
|
+
* data.skus?.forEach(sku => {
|
|
2215
|
+
* console.log(`SKU: ${sku.sku} - Price: ${sku.price}`);
|
|
2216
|
+
* });
|
|
2217
|
+
* }
|
|
2218
|
+
*
|
|
2219
|
+
* // With pagination
|
|
2220
|
+
* const { data: skuData, error: skuError } = await pos.listSkus({
|
|
2221
|
+
* page: 1,
|
|
2222
|
+
* limit: 50
|
|
2223
|
+
* });
|
|
2224
|
+
*
|
|
2225
|
+
* // Override customer group ID for this specific request
|
|
2226
|
+
* const { data: overrideData, error: overrideError } = await pos.listSkus(
|
|
2227
|
+
* {
|
|
2228
|
+
* page: 1,
|
|
2229
|
+
* limit: 50
|
|
2230
|
+
* },
|
|
2231
|
+
* {
|
|
2232
|
+
* "x-customer-group-id": "01H9XYZ12345USERID" // Override default SDK config
|
|
2233
|
+
* }
|
|
2234
|
+
* );
|
|
2235
|
+
* ```
|
|
1380
2236
|
*/
|
|
1381
2237
|
async listSkus(query, headers) {
|
|
1382
2238
|
const mergedHeaders = this.mergeHeaders(headers);
|
|
@@ -1385,6 +2241,551 @@ var PosClient = class extends PosAPIClient {
|
|
|
1385
2241
|
header: mergedHeaders
|
|
1386
2242
|
} }));
|
|
1387
2243
|
}
|
|
2244
|
+
/**
|
|
2245
|
+
* List all inventories (Admin)
|
|
2246
|
+
* @param query - Optional query parameters for filtering inventories
|
|
2247
|
+
* @returns Promise with list of inventories
|
|
2248
|
+
* @example
|
|
2249
|
+
* ```typescript
|
|
2250
|
+
* // Basic inventory listing
|
|
2251
|
+
* const { data, error } = await pos.listInventories();
|
|
2252
|
+
*
|
|
2253
|
+
* if (error) {
|
|
2254
|
+
* console.error("Failed to list inventories:", error.message);
|
|
2255
|
+
* } else {
|
|
2256
|
+
* console.log("Inventories found:", data.content?.inventories?.length || 0);
|
|
2257
|
+
* data.content?.inventories?.forEach(inventory => {
|
|
2258
|
+
* console.log(`Product: ${inventory.product_name} - Stock: ${inventory.stock_quantity}`);
|
|
2259
|
+
* });
|
|
2260
|
+
* }
|
|
2261
|
+
*
|
|
2262
|
+
* // With pagination and filters
|
|
2263
|
+
* const { data: filteredData, error: filteredError } = await pos.listInventories({
|
|
2264
|
+
* page: 1,
|
|
2265
|
+
* limit: 20,
|
|
2266
|
+
* sort_by: JSON.stringify({ "stock_quantity": "desc" }),
|
|
2267
|
+
* filters: JSON.stringify({ "product_name": "smartphone" })
|
|
2268
|
+
* });
|
|
2269
|
+
* ```
|
|
2270
|
+
*/
|
|
2271
|
+
async listInventories(query) {
|
|
2272
|
+
return this.executeRequest(() => this.client.GET("/pos/catalog/inventories", { params: { query } }));
|
|
2273
|
+
}
|
|
2274
|
+
/**
|
|
2275
|
+
* List all inventory activities (Admin)
|
|
2276
|
+
* @param query - Optional query parameters for filtering inventory activities
|
|
2277
|
+
* @returns Promise with list of inventory activities
|
|
2278
|
+
* @example
|
|
2279
|
+
* ```typescript
|
|
2280
|
+
* // Basic inventory activities listing
|
|
2281
|
+
* const { data, error } = await pos.listInventoryActivities();
|
|
2282
|
+
*
|
|
2283
|
+
* if (error) {
|
|
2284
|
+
* console.error("Failed to list inventory activities:", error.message);
|
|
2285
|
+
* } else {
|
|
2286
|
+
* console.log("Activities found:", data.content?.activities?.length || 0);
|
|
2287
|
+
* data.content?.activities?.forEach(activity => {
|
|
2288
|
+
* console.log(`Activity: ${activity.activity_type} - Product: ${activity.product_name} - Quantity: ${activity.quantity}`);
|
|
2289
|
+
* });
|
|
2290
|
+
* }
|
|
2291
|
+
*
|
|
2292
|
+
* // With pagination and filters
|
|
2293
|
+
* const { data: filteredData, error: filteredError } = await pos.listInventoryActivities({
|
|
2294
|
+
* page: 1,
|
|
2295
|
+
* limit: 50,
|
|
2296
|
+
* sort_by: JSON.stringify({ "created_at": "desc" }),
|
|
2297
|
+
* filters: JSON.stringify({ "activity_type": "add" })
|
|
2298
|
+
* });
|
|
2299
|
+
* ```
|
|
2300
|
+
*/
|
|
2301
|
+
async listInventoryActivities(query) {
|
|
2302
|
+
return this.executeRequest(() => this.client.GET("/pos/catalog/inventories/activites", { params: { query } }));
|
|
2303
|
+
}
|
|
2304
|
+
/**
|
|
2305
|
+
* Get inventory detail (Admin)
|
|
2306
|
+
* @param query - Query parameters with product/variant information
|
|
2307
|
+
* @returns Promise with inventory details
|
|
2308
|
+
* @example
|
|
2309
|
+
* ```typescript
|
|
2310
|
+
* // Get inventory detail for a product
|
|
2311
|
+
* const { data, error } = await pos.getInventoryDetail({
|
|
2312
|
+
* product_id: "01H9XYZ12345ABCDE"
|
|
2313
|
+
* });
|
|
2314
|
+
*
|
|
2315
|
+
* if (error) {
|
|
2316
|
+
* console.error("Failed to get inventory detail:", error.message);
|
|
2317
|
+
* } else {
|
|
2318
|
+
* const inventory = data.content?.inventory;
|
|
2319
|
+
* console.log(`Product: ${inventory?.product_name}`);
|
|
2320
|
+
* console.log(`Stock: ${inventory?.stock_quantity}`);
|
|
2321
|
+
* console.log(`Warehouse details:`, inventory?.details);
|
|
2322
|
+
* }
|
|
2323
|
+
*
|
|
2324
|
+
* // Get inventory detail for a product variant
|
|
2325
|
+
* const { data: variantData, error: variantError } = await pos.getInventoryDetail({
|
|
2326
|
+
* product_id: "01H9XYZ12345ABCDE",
|
|
2327
|
+
* variant_id: "01H9ABC67890FGHIJ"
|
|
2328
|
+
* });
|
|
2329
|
+
*
|
|
2330
|
+
* // Get inventory detail for a specific lot/batch
|
|
2331
|
+
* const { data: batchData, error: batchError } = await pos.getInventoryDetail({
|
|
2332
|
+
* product_id: "01H9XYZ12345ABCDE",
|
|
2333
|
+
* lot_batch: "BATCH001"
|
|
2334
|
+
* });
|
|
2335
|
+
* ```
|
|
2336
|
+
*/
|
|
2337
|
+
async getInventoryDetail(query) {
|
|
2338
|
+
return this.executeRequest(() => this.client.GET("/pos/catalog/inventories/detail", { params: { query } }));
|
|
2339
|
+
}
|
|
2340
|
+
/**
|
|
2341
|
+
* List all customers (Admin)
|
|
2342
|
+
* @param query - Optional query parameters for filtering customers
|
|
2343
|
+
* @returns Promise with list of customers
|
|
2344
|
+
* @example
|
|
2345
|
+
* ```typescript
|
|
2346
|
+
* // Basic customer listing
|
|
2347
|
+
* const { data, error } = await pos.getCustomers();
|
|
2348
|
+
*
|
|
2349
|
+
* if (error) {
|
|
2350
|
+
* console.error("Failed to list customers:", error.message);
|
|
2351
|
+
* } else {
|
|
2352
|
+
* console.log("Customers found:", data.content?.customers?.length || 0);
|
|
2353
|
+
* console.log("Pagination:", data.content?.pagination);
|
|
2354
|
+
* data.content?.customers?.forEach(customer => {
|
|
2355
|
+
* console.log(`Customer: ${customer.full_name} - Email: ${customer.email}`);
|
|
2356
|
+
* });
|
|
2357
|
+
* }
|
|
2358
|
+
*
|
|
2359
|
+
* // With search and pagination
|
|
2360
|
+
* const { data: searchData, error: searchError } = await pos.getCustomers({
|
|
2361
|
+
* page: 1,
|
|
2362
|
+
* limit: 20,
|
|
2363
|
+
* search: "john@example.com",
|
|
2364
|
+
* sort_by: JSON.stringify({ "created_at": "desc" })
|
|
2365
|
+
* });
|
|
2366
|
+
* ```
|
|
2367
|
+
*/
|
|
2368
|
+
async getCustomers(query) {
|
|
2369
|
+
return this.executeRequest(() => this.client.GET("/pos/customers", { params: { query } }));
|
|
2370
|
+
}
|
|
2371
|
+
/**
|
|
2372
|
+
* Get customer details (Admin)
|
|
2373
|
+
* @param pathParams - Customer ID
|
|
2374
|
+
* @returns Promise with customer details
|
|
2375
|
+
* @example
|
|
2376
|
+
* ```typescript
|
|
2377
|
+
* const { data, error } = await pos.getCustomer({
|
|
2378
|
+
* id: "01H9CUST12345ABCDE"
|
|
2379
|
+
* });
|
|
2380
|
+
*
|
|
2381
|
+
* if (error) {
|
|
2382
|
+
* console.error("Failed to get customer:", error.message);
|
|
2383
|
+
* } else {
|
|
2384
|
+
* const customer = data.content?.customer;
|
|
2385
|
+
* console.log(`Customer: ${customer?.full_name}`);
|
|
2386
|
+
* console.log(`Email: ${customer?.email}`);
|
|
2387
|
+
* console.log(`Phone: ${customer?.phone}`);
|
|
2388
|
+
* console.log(`Loyalty points: ${customer?.loyalty?.points_balance}`);
|
|
2389
|
+
* console.log(`Total spent: ${customer?.loyalty?.lifetime_spent}`);
|
|
2390
|
+
* }
|
|
2391
|
+
* ```
|
|
2392
|
+
*/
|
|
2393
|
+
async getCustomer(pathParams) {
|
|
2394
|
+
return this.executeRequest(() => this.client.GET("/pos/customers/{id}", { params: { path: pathParams } }));
|
|
2395
|
+
}
|
|
2396
|
+
/**
|
|
2397
|
+
* List all orders (Admin)
|
|
2398
|
+
* @param query - Optional query parameters for filtering orders
|
|
2399
|
+
* @returns Promise with list of orders
|
|
2400
|
+
* @example
|
|
2401
|
+
* ```typescript
|
|
2402
|
+
* // Basic order listing
|
|
2403
|
+
* const { data, error } = await pos.listOrders();
|
|
2404
|
+
*
|
|
2405
|
+
* if (error) {
|
|
2406
|
+
* console.error("Failed to list orders:", error.message);
|
|
2407
|
+
* } else {
|
|
2408
|
+
* console.log("Orders found:", data.content?.orders?.length || 0);
|
|
2409
|
+
* console.log("Pagination:", data.content?.pagination);
|
|
2410
|
+
* data.content?.orders?.forEach(order => {
|
|
2411
|
+
* console.log(`Order: ${order.order_number} - Status: ${order.status} - Total: ${order.grand_total}`);
|
|
2412
|
+
* });
|
|
2413
|
+
* }
|
|
2414
|
+
*
|
|
2415
|
+
* // With filters and pagination
|
|
2416
|
+
* const { data: filteredData, error: filteredError } = await pos.listOrders({
|
|
2417
|
+
* page: 1,
|
|
2418
|
+
* limit: 50,
|
|
2419
|
+
* search: "ORD-2024",
|
|
2420
|
+
* filters: JSON.stringify({ "status": "delivered", "payment_status": "success" }),
|
|
2421
|
+
* sort_by: JSON.stringify({ "order_date": "desc" })
|
|
2422
|
+
* });
|
|
2423
|
+
* ```
|
|
2424
|
+
*/
|
|
2425
|
+
async listOrders(query) {
|
|
2426
|
+
return this.executeRequest(() => this.adminClient.GET("/pos/orders", { params: { query } }));
|
|
2427
|
+
}
|
|
2428
|
+
/**
|
|
2429
|
+
* Get order details (Admin)
|
|
2430
|
+
* @param pathParams - Order number
|
|
2431
|
+
* @returns Promise with order details
|
|
2432
|
+
* @example
|
|
2433
|
+
* ```typescript
|
|
2434
|
+
* const { data, error } = await pos.getOrderDetail({
|
|
2435
|
+
* order_number: "ORD-2024-001234"
|
|
2436
|
+
* });
|
|
2437
|
+
*
|
|
2438
|
+
* if (error) {
|
|
2439
|
+
* console.error("Failed to get order:", error.message);
|
|
2440
|
+
* } else {
|
|
2441
|
+
* const order = data.content?.order;
|
|
2442
|
+
* console.log(`Order: ${order?.order_number}`);
|
|
2443
|
+
* console.log(`Status: ${order?.status}`);
|
|
2444
|
+
* console.log(`Payment Status: ${order?.payment_status}`);
|
|
2445
|
+
* console.log(`Total: ${order?.grand_total}`);
|
|
2446
|
+
* console.log(`Items:`, order?.order_items);
|
|
2447
|
+
* console.log(`Billing Address:`, order?.billing_address);
|
|
2448
|
+
* console.log(`Payments:`, order?.payments);
|
|
2449
|
+
* }
|
|
2450
|
+
* ```
|
|
2451
|
+
*/
|
|
2452
|
+
async getOrderDetail(pathParams) {
|
|
2453
|
+
return this.executeRequest(() => this.client.GET("/pos/orders/{order_number}", { params: { path: pathParams } }));
|
|
2454
|
+
}
|
|
2455
|
+
/**
|
|
2456
|
+
* List order activity (Admin)
|
|
2457
|
+
* @param pathParams - Order number
|
|
2458
|
+
* @returns Promise with order activities
|
|
2459
|
+
* @example
|
|
2460
|
+
* ```typescript
|
|
2461
|
+
* const { data, error } = await pos.listOrderActivity({
|
|
2462
|
+
* order_number: "ORD-2024-001234"
|
|
2463
|
+
* });
|
|
2464
|
+
*
|
|
2465
|
+
* if (error) {
|
|
2466
|
+
* console.error("Failed to get order activity:", error.message);
|
|
2467
|
+
* } else {
|
|
2468
|
+
* console.log("Activities found:", data.content?.activity?.length || 0);
|
|
2469
|
+
* data.content?.activity?.forEach(activity => {
|
|
2470
|
+
* console.log(`${activity.created_at}: ${activity.activity_type} - ${activity.comment}`);
|
|
2471
|
+
* console.log(`By: ${activity.user_name} (${activity.user_type})`);
|
|
2472
|
+
* });
|
|
2473
|
+
* }
|
|
2474
|
+
* ```
|
|
2475
|
+
*/
|
|
2476
|
+
async listOrderActivity(pathParams) {
|
|
2477
|
+
return this.executeRequest(() => this.client.GET("/pos/orders/{order_number}/activity", { params: { path: pathParams } }));
|
|
2478
|
+
}
|
|
2479
|
+
/**
|
|
2480
|
+
* Get order invoice (Admin)
|
|
2481
|
+
* @param pathParams - Order number
|
|
2482
|
+
* @param query - Optional format parameter
|
|
2483
|
+
* @returns Promise with order invoice
|
|
2484
|
+
* @example
|
|
2485
|
+
* ```typescript
|
|
2486
|
+
* // Get invoice as JSON
|
|
2487
|
+
* const { data, error } = await pos.getOrderInvoice(
|
|
2488
|
+
* { order_number: "ORD-2024-001234" },
|
|
2489
|
+
* { format: "json" }
|
|
2490
|
+
* );
|
|
2491
|
+
*
|
|
2492
|
+
* if (error) {
|
|
2493
|
+
* console.error("Failed to get order invoice:", error.message);
|
|
2494
|
+
* } else {
|
|
2495
|
+
* data.content?.invoices?.forEach(invoice => {
|
|
2496
|
+
* console.log(`Invoice: ${invoice.invoice_number}`);
|
|
2497
|
+
* console.log(`Date: ${invoice.invoice_date}`);
|
|
2498
|
+
* console.log(`Total: ${invoice.grand_total}`);
|
|
2499
|
+
* console.log(`Items:`, invoice.items);
|
|
2500
|
+
* });
|
|
2501
|
+
* }
|
|
2502
|
+
*
|
|
2503
|
+
* // Get invoice as PDF
|
|
2504
|
+
* const { data: pdfData, error: pdfError } = await pos.getOrderInvoice(
|
|
2505
|
+
* { order_number: "ORD-2024-001234" },
|
|
2506
|
+
* { format: "pdf" }
|
|
2507
|
+
* );
|
|
2508
|
+
* ```
|
|
2509
|
+
*/
|
|
2510
|
+
async getOrderInvoice(pathParams, query) {
|
|
2511
|
+
return this.executeRequest(() => this.client.GET("/pos/orders/{order_number}/invoice", { params: {
|
|
2512
|
+
path: pathParams,
|
|
2513
|
+
query
|
|
2514
|
+
} }));
|
|
2515
|
+
}
|
|
2516
|
+
/**
|
|
2517
|
+
* Get order receipt (Admin)
|
|
2518
|
+
* @param pathParams - Order number
|
|
2519
|
+
* @param query - Optional format parameter
|
|
2520
|
+
* @returns Promise with order receipt
|
|
2521
|
+
* @example
|
|
2522
|
+
* ```typescript
|
|
2523
|
+
* // Get receipt as JSON
|
|
2524
|
+
* const { data, error } = await pos.getOrderReceipt(
|
|
2525
|
+
* { order_number: "ORD-2024-001234" },
|
|
2526
|
+
* { format: "json" }
|
|
2527
|
+
* );
|
|
2528
|
+
*
|
|
2529
|
+
* if (error) {
|
|
2530
|
+
* console.error("Failed to get order receipt:", error.message);
|
|
2531
|
+
* } else {
|
|
2532
|
+
* const receipt = data.content?.order_receipt;
|
|
2533
|
+
* console.log(`Order: ${receipt?.order_number}`);
|
|
2534
|
+
* console.log(`Date: ${receipt?.order_date}`);
|
|
2535
|
+
* console.log(`Total: ${receipt?.grand_total}`);
|
|
2536
|
+
* console.log(`Items:`, receipt?.order_items);
|
|
2537
|
+
* console.log(`Payments:`, receipt?.payments);
|
|
2538
|
+
* }
|
|
2539
|
+
*
|
|
2540
|
+
* // Get receipt as PDF
|
|
2541
|
+
* const { data: pdfData, error: pdfError } = await pos.getOrderReceipt(
|
|
2542
|
+
* { order_number: "ORD-2024-001234" },
|
|
2543
|
+
* { format: "pdf" }
|
|
2544
|
+
* );
|
|
2545
|
+
* ```
|
|
2546
|
+
*/
|
|
2547
|
+
async getOrderReceipt(pathParams, query) {
|
|
2548
|
+
return this.executeRequest(() => this.client.GET("/pos/orders/{order_number}/receipt", { params: {
|
|
2549
|
+
path: pathParams,
|
|
2550
|
+
query
|
|
2551
|
+
} }));
|
|
2552
|
+
}
|
|
2553
|
+
/**
|
|
2554
|
+
* Get order shipments (Admin)
|
|
2555
|
+
* @param pathParams - Order number
|
|
2556
|
+
* @returns Promise with order shipments
|
|
2557
|
+
* @example
|
|
2558
|
+
* ```typescript
|
|
2559
|
+
* const { data, error } = await pos.getOrderShipments({
|
|
2560
|
+
* order_number: "ORD-2024-001234"
|
|
2561
|
+
* });
|
|
2562
|
+
*
|
|
2563
|
+
* if (error) {
|
|
2564
|
+
* console.error("Failed to get order shipments:", error.message);
|
|
2565
|
+
* } else {
|
|
2566
|
+
* const shipment = data.content?.shipment;
|
|
2567
|
+
* console.log(`Order: ${shipment?.order_number}`);
|
|
2568
|
+
* console.log(`Order Status: ${shipment?.order_status}`);
|
|
2569
|
+
* console.log(`Payment Status: ${shipment?.payment_status}`);
|
|
2570
|
+
* console.log(`Customer: ${shipment?.customer_name}`);
|
|
2571
|
+
* console.log(`Shipments:`, shipment?.shipments);
|
|
2572
|
+
* console.log(`Allowed Actions:`, shipment?.allowed_actions);
|
|
2573
|
+
* }
|
|
2574
|
+
* ```
|
|
2575
|
+
*/
|
|
2576
|
+
async getOrderShipments(pathParams) {
|
|
2577
|
+
return this.executeRequest(() => this.client.GET("/pos/orders/{order_number}/shipments", { params: { path: pathParams } }));
|
|
2578
|
+
}
|
|
2579
|
+
/**
|
|
2580
|
+
* List all shipments (Admin)
|
|
2581
|
+
* @param query - Optional query parameters for filtering shipments
|
|
2582
|
+
* @returns Promise with list of shipments
|
|
2583
|
+
* @example
|
|
2584
|
+
* ```typescript
|
|
2585
|
+
* // Basic shipment listing
|
|
2586
|
+
* const { data, error } = await pos.listShipments();
|
|
2587
|
+
*
|
|
2588
|
+
* if (error) {
|
|
2589
|
+
* console.error("Failed to list shipments:", error.message);
|
|
2590
|
+
* } else {
|
|
2591
|
+
* console.log("Shipments found:", data.content?.shipments?.length || 0);
|
|
2592
|
+
* console.log("Pagination:", data.content?.pagination);
|
|
2593
|
+
* data.content?.shipments?.forEach(shipment => {
|
|
2594
|
+
* console.log(`Shipment: ${shipment.shipment_number} - Status: ${shipment.status}`);
|
|
2595
|
+
* console.log(`Order: ${shipment.order_number} - AWB: ${shipment.awb_no}`);
|
|
2596
|
+
* });
|
|
2597
|
+
* }
|
|
2598
|
+
*
|
|
2599
|
+
* // With filters and search
|
|
2600
|
+
* const { data: filteredData, error: filteredError } = await pos.listShipments({
|
|
2601
|
+
* page: 1,
|
|
2602
|
+
* limit: 25,
|
|
2603
|
+
* search: "SHIP-2024",
|
|
2604
|
+
* filters: JSON.stringify({ "status": "shipped" }),
|
|
2605
|
+
* sort_by: JSON.stringify({ "shipped_date": "desc" })
|
|
2606
|
+
* });
|
|
2607
|
+
* ```
|
|
2608
|
+
*/
|
|
2609
|
+
async listShipments(query) {
|
|
2610
|
+
return this.executeRequest(() => this.client.GET("/pos/shipping/shipments", { params: { query } }));
|
|
2611
|
+
}
|
|
2612
|
+
/**
|
|
2613
|
+
* Check inventory for order (Admin)
|
|
2614
|
+
* @param pathParams - Order number
|
|
2615
|
+
* @returns Promise with inventory check results
|
|
2616
|
+
* @example
|
|
2617
|
+
* ```typescript
|
|
2618
|
+
* const { data, error } = await pos.checkInventory({
|
|
2619
|
+
* order_number: "ORD-2024-001234"
|
|
2620
|
+
* });
|
|
2621
|
+
*
|
|
2622
|
+
* if (error) {
|
|
2623
|
+
* console.error("Failed to check inventory:", error.message);
|
|
2624
|
+
* } else {
|
|
2625
|
+
* const inventory = data.content;
|
|
2626
|
+
* console.log(`Inventory Status: ${inventory?.inventory_status}`);
|
|
2627
|
+
* console.log(`Shipment Items:`, inventory?.shipment_items);
|
|
2628
|
+
* console.log(`Recommended Warehouses:`, inventory?.recommended_warehouses);
|
|
2629
|
+
* console.log(`Inventory Detail:`, inventory?.inventory_detail);
|
|
2630
|
+
* console.log(`Allowed Actions:`, inventory?.allowed_action);
|
|
2631
|
+
* }
|
|
2632
|
+
* ```
|
|
2633
|
+
*/
|
|
2634
|
+
async checkInventory(pathParams) {
|
|
2635
|
+
return this.executeRequest(() => this.client.GET("/pos/shipping/shipments/{order_number}/check-inventory", { params: { path: pathParams } }));
|
|
2636
|
+
}
|
|
2637
|
+
/**
|
|
2638
|
+
* Refund shortfall for order (Admin)
|
|
2639
|
+
* @param pathParams - Order number
|
|
2640
|
+
* @param body - Refund details
|
|
2641
|
+
* @returns Promise with refund confirmation
|
|
2642
|
+
* @example
|
|
2643
|
+
* ```typescript
|
|
2644
|
+
* const { data, error } = await pos.refundShortfall(
|
|
2645
|
+
* { order_number: "ORD-2024-001234" },
|
|
2646
|
+
* {
|
|
2647
|
+
* items: [
|
|
2648
|
+
* {
|
|
2649
|
+
* sku: "SKU-123",
|
|
2650
|
+
* quantity: 2,
|
|
2651
|
+
* free_quantity: 0
|
|
2652
|
+
* }
|
|
2653
|
+
* ],
|
|
2654
|
+
* payment_method: "original-payment-mode"
|
|
2655
|
+
* }
|
|
2656
|
+
* );
|
|
2657
|
+
*
|
|
2658
|
+
* if (error) {
|
|
2659
|
+
* console.error("Failed to process refund:", error.message);
|
|
2660
|
+
* } else {
|
|
2661
|
+
* console.log("Refund processed:", data.message);
|
|
2662
|
+
* console.log("Success:", data.success);
|
|
2663
|
+
* }
|
|
2664
|
+
*
|
|
2665
|
+
* // Refund to bank transfer
|
|
2666
|
+
* const { data: bankData, error: bankError } = await pos.refundShortfall(
|
|
2667
|
+
* { order_number: "ORD-2024-001234" },
|
|
2668
|
+
* {
|
|
2669
|
+
* items: [{ sku: "SKU-123", quantity: 1 }],
|
|
2670
|
+
* payment_method: "bank-transfer",
|
|
2671
|
+
* bank_account_id: "BANK_ACC_123"
|
|
2672
|
+
* }
|
|
2673
|
+
* );
|
|
2674
|
+
* ```
|
|
2675
|
+
*/
|
|
2676
|
+
async refundShortfall(pathParams, body) {
|
|
2677
|
+
return this.executeRequest(() => this.client.POST("/pos/shipping/shipments/{order_number}/refund-shortfall", {
|
|
2678
|
+
params: { path: pathParams },
|
|
2679
|
+
body
|
|
2680
|
+
}));
|
|
2681
|
+
}
|
|
2682
|
+
/**
|
|
2683
|
+
* Get shipment details (Admin)
|
|
2684
|
+
* @param pathParams - Shipment reference number
|
|
2685
|
+
* @returns Promise with shipment details
|
|
2686
|
+
* @example
|
|
2687
|
+
* ```typescript
|
|
2688
|
+
* const { data, error } = await pos.getShipment({
|
|
2689
|
+
* reference_number: "SHIP-2024-001234"
|
|
2690
|
+
* });
|
|
2691
|
+
*
|
|
2692
|
+
* if (error) {
|
|
2693
|
+
* console.error("Failed to get shipment:", error.message);
|
|
2694
|
+
* } else {
|
|
2695
|
+
* const shipment = data.content?.shipment;
|
|
2696
|
+
* console.log(`Order: ${shipment?.order_number}`);
|
|
2697
|
+
* console.log(`Shipments:`, shipment?.shipments);
|
|
2698
|
+
* shipment?.shipments?.forEach(s => {
|
|
2699
|
+
* console.log(` Shipment: ${s.shipment_number} - Status: ${s.status}`);
|
|
2700
|
+
* console.log(` AWB: ${s.awb_no} - Courier: ${s.courier_company_name}`);
|
|
2701
|
+
* console.log(` Items:`, s.shipment_items);
|
|
2702
|
+
* });
|
|
2703
|
+
* }
|
|
2704
|
+
* ```
|
|
2705
|
+
*/
|
|
2706
|
+
async getShipment(pathParams) {
|
|
2707
|
+
return this.executeRequest(() => this.client.GET("/pos/shipping/shipments/{reference_number}", { params: { path: pathParams } }));
|
|
2708
|
+
}
|
|
2709
|
+
/**
|
|
2710
|
+
* Get shipment invoice (Admin)
|
|
2711
|
+
* @param pathParams - Shipment reference number
|
|
2712
|
+
* @param query - Optional format parameter
|
|
2713
|
+
* @returns Promise with shipment invoice
|
|
2714
|
+
* @example
|
|
2715
|
+
* ```typescript
|
|
2716
|
+
* // Get shipment invoice as JSON
|
|
2717
|
+
* const { data, error } = await pos.getShipmentInvoice(
|
|
2718
|
+
* { reference_number: "SHIP-2024-001234" },
|
|
2719
|
+
* { format: "json" }
|
|
2720
|
+
* );
|
|
2721
|
+
*
|
|
2722
|
+
* if (error) {
|
|
2723
|
+
* console.error("Failed to get shipment invoice:", error.message);
|
|
2724
|
+
* } else {
|
|
2725
|
+
* const invoice = data.content?.invoice;
|
|
2726
|
+
* console.log(`Invoice: ${invoice?.invoice_number}`);
|
|
2727
|
+
* console.log(`Date: ${invoice?.invoice_date}`);
|
|
2728
|
+
* console.log(`Total: ${invoice?.grand_total}`);
|
|
2729
|
+
* console.log(`Items:`, invoice?.items);
|
|
2730
|
+
* }
|
|
2731
|
+
*
|
|
2732
|
+
* // Get shipment invoice as PDF
|
|
2733
|
+
* const { data: pdfData, error: pdfError } = await pos.getShipmentInvoice(
|
|
2734
|
+
* { reference_number: "SHIP-2024-001234" },
|
|
2735
|
+
* { format: "pdf" }
|
|
2736
|
+
* );
|
|
2737
|
+
* ```
|
|
2738
|
+
*/
|
|
2739
|
+
async getShipmentInvoice(pathParams, query) {
|
|
2740
|
+
return this.executeRequest(() => this.client.GET("/pos/shipping/shipments/{reference_number}/invoice", { params: {
|
|
2741
|
+
path: pathParams,
|
|
2742
|
+
query
|
|
2743
|
+
} }));
|
|
2744
|
+
}
|
|
2745
|
+
/**
|
|
2746
|
+
* Update shipment details (Admin)
|
|
2747
|
+
* @param pathParams - Shipment reference number
|
|
2748
|
+
* @param body - Shipment update data
|
|
2749
|
+
* @returns Promise with updated shipment
|
|
2750
|
+
* @example
|
|
2751
|
+
* ```typescript
|
|
2752
|
+
* const { data, error } = await pos.updateShipment(
|
|
2753
|
+
* { reference_number: "SHIP-2024-001234" },
|
|
2754
|
+
* {
|
|
2755
|
+
* status: "shipped",
|
|
2756
|
+
* awb_no: "AWB123456789",
|
|
2757
|
+
* courier_company_name: "BlueDart",
|
|
2758
|
+
* shipping_label_url: "https://example.com/label.pdf",
|
|
2759
|
+
* tracking_url: "https://tracking.example.com/AWB123456789",
|
|
2760
|
+
* eta_delivery: "2024-01-15T10:00:00Z",
|
|
2761
|
+
* shipped_date: "2024-01-10T14:30:00Z"
|
|
2762
|
+
* }
|
|
2763
|
+
* );
|
|
2764
|
+
*
|
|
2765
|
+
* if (error) {
|
|
2766
|
+
* console.error("Failed to update shipment:", error.message);
|
|
2767
|
+
* } else {
|
|
2768
|
+
* console.log("Shipment updated successfully:", data.message);
|
|
2769
|
+
* const shipment = data.content?.shipment;
|
|
2770
|
+
* console.log(`Updated shipment status:`, shipment?.shipments?.[0]?.status);
|
|
2771
|
+
* }
|
|
2772
|
+
*
|
|
2773
|
+
* // Update delivery status
|
|
2774
|
+
* const { data: deliveryData, error: deliveryError } = await pos.updateShipment(
|
|
2775
|
+
* { reference_number: "SHIP-2024-001234" },
|
|
2776
|
+
* {
|
|
2777
|
+
* status: "delivered",
|
|
2778
|
+
* delivered_date: "2024-01-15T16:45:00Z"
|
|
2779
|
+
* }
|
|
2780
|
+
* );
|
|
2781
|
+
* ```
|
|
2782
|
+
*/
|
|
2783
|
+
async updateShipment(pathParams, body) {
|
|
2784
|
+
return this.executeRequest(() => this.client.PUT("/pos/shipping/shipments/{reference_number}/manual-update", {
|
|
2785
|
+
params: { path: pathParams },
|
|
2786
|
+
body
|
|
2787
|
+
}));
|
|
2788
|
+
}
|
|
1388
2789
|
};
|
|
1389
2790
|
|
|
1390
2791
|
//#endregion
|