@gofynd/fdk-client-javascript 3.7.0 → 3.9.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 +1 -1
- package/package.json +1 -1
- package/sdk/application/Cart/CartApplicationClient.d.ts +7 -7
- package/sdk/application/Cart/CartApplicationClient.js +8 -8
- package/sdk/application/Payment/PaymentApplicationClient.d.ts +50 -0
- package/sdk/application/Payment/PaymentApplicationClient.js +210 -0
- package/sdk/application/Theme/ThemeApplicationClient.d.ts +2 -2
- package/sdk/application/Theme/ThemeApplicationClient.js +3 -1
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +11 -1
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +96 -1
- package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +37 -1
- package/sdk/platform/Cart/CartPlatformApplicationValidator.js +24 -0
- package/sdk/platform/Cart/CartPlatformModel.d.ts +155 -29
- package/sdk/platform/Cart/CartPlatformModel.js +83 -14
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +124 -6
- package/sdk/platform/Catalog/CatalogPlatformClient.js +1074 -175
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +1072 -45
- package/sdk/platform/Catalog/CatalogPlatformModel.js +714 -5
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +193 -19
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +167 -14
- package/sdk/platform/FileStorage/FileStoragePlatformModel.d.ts +9 -4
- package/sdk/platform/FileStorage/FileStoragePlatformModel.js +4 -4
- package/sdk/platform/Order/OrderPlatformClient.d.ts +1 -1
- package/sdk/platform/Order/OrderPlatformClient.js +1 -1
- package/sdk/platform/Order/OrderPlatformModel.d.ts +55 -3
- package/sdk/platform/Order/OrderPlatformModel.js +31 -1
- package/sdk/platform/Serviceability/ServiceabilityPlatformModel.d.ts +0 -10
- package/sdk/platform/Serviceability/ServiceabilityPlatformModel.js +0 -4
- package/sdk/public/Content/ContentPublicClient.d.ts +2 -2
- package/sdk/public/Content/ContentPublicClient.js +4 -3
- package/sdk/public/Content/ContentPublicModel.d.ts +5 -0
- package/sdk/public/Content/ContentPublicModel.js +2 -0
- package/sdk/public/Content/ContentPublicValidator.d.ts +11 -3
- package/sdk/public/Content/ContentPublicValidator.js +7 -2
|
@@ -494,6 +494,85 @@ class Catalog {
|
|
|
494
494
|
return response;
|
|
495
495
|
}
|
|
496
496
|
|
|
497
|
+
/**
|
|
498
|
+
* @param {CatalogPlatformValidator.CreateHsCodeParam} arg - Arg object
|
|
499
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
500
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
501
|
+
* @returns {Promise<CatalogPlatformModel.HSCodeItem>} - Success response
|
|
502
|
+
* @name createHsCode
|
|
503
|
+
* @summary: Create HS/SAC code
|
|
504
|
+
* @description: Create HS/SAC code. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/platform/catalog/createHsCode/).
|
|
505
|
+
*/
|
|
506
|
+
async createHsCode(
|
|
507
|
+
{ body, requestHeaders } = { requestHeaders: {} },
|
|
508
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
509
|
+
) {
|
|
510
|
+
const { error } = CatalogPlatformValidator.createHsCode().validate(
|
|
511
|
+
{
|
|
512
|
+
body,
|
|
513
|
+
},
|
|
514
|
+
{ abortEarly: false, allowUnknown: true }
|
|
515
|
+
);
|
|
516
|
+
if (error) {
|
|
517
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
// Showing warrnings if extra unknown parameters are found
|
|
521
|
+
const {
|
|
522
|
+
error: warrning,
|
|
523
|
+
} = CatalogPlatformValidator.createHsCode().validate(
|
|
524
|
+
{
|
|
525
|
+
body,
|
|
526
|
+
},
|
|
527
|
+
{ abortEarly: false, allowUnknown: false }
|
|
528
|
+
);
|
|
529
|
+
if (warrning) {
|
|
530
|
+
Logger({
|
|
531
|
+
level: "WARN",
|
|
532
|
+
message: `Parameter Validation warrnings for platform > Catalog > createHsCode \n ${warrning}`,
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
const query_params = {};
|
|
537
|
+
|
|
538
|
+
const xHeaders = {};
|
|
539
|
+
|
|
540
|
+
const response = await PlatformAPIClient.execute(
|
|
541
|
+
this.config,
|
|
542
|
+
"post",
|
|
543
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/taxes/hscodes`,
|
|
544
|
+
query_params,
|
|
545
|
+
body,
|
|
546
|
+
{ ...xHeaders, ...requestHeaders },
|
|
547
|
+
{ responseHeaders }
|
|
548
|
+
);
|
|
549
|
+
|
|
550
|
+
let responseData = response;
|
|
551
|
+
if (responseHeaders) {
|
|
552
|
+
responseData = response[0];
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
const {
|
|
556
|
+
error: res_error,
|
|
557
|
+
} = CatalogPlatformModel.HSCodeItem().validate(responseData, {
|
|
558
|
+
abortEarly: false,
|
|
559
|
+
allowUnknown: true,
|
|
560
|
+
});
|
|
561
|
+
|
|
562
|
+
if (res_error) {
|
|
563
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
564
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
565
|
+
} else {
|
|
566
|
+
Logger({
|
|
567
|
+
level: "WARN",
|
|
568
|
+
message: `Response Validation Warnings for platform > Catalog > createHsCode \n ${res_error}`,
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
return response;
|
|
574
|
+
}
|
|
575
|
+
|
|
497
576
|
/**
|
|
498
577
|
* @param {CatalogPlatformValidator.CreateInventoryExportParam} arg - Arg object
|
|
499
578
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
@@ -787,7 +866,7 @@ class Catalog {
|
|
|
787
866
|
const response = await PlatformAPIClient.execute(
|
|
788
867
|
this.config,
|
|
789
868
|
"post",
|
|
790
|
-
`/service/platform/catalog/
|
|
869
|
+
`/service/platform/catalog/v3.0/company/${this.config.companyId}/products/`,
|
|
791
870
|
query_params,
|
|
792
871
|
body,
|
|
793
872
|
{ ...xHeaders, ...requestHeaders },
|
|
@@ -1032,7 +1111,7 @@ class Catalog {
|
|
|
1032
1111
|
const response = await PlatformAPIClient.execute(
|
|
1033
1112
|
this.config,
|
|
1034
1113
|
"post",
|
|
1035
|
-
`/service/platform/catalog/
|
|
1114
|
+
`/service/platform/catalog/v3.0/company/${this.config.companyId}/products/downloads/`,
|
|
1036
1115
|
query_params,
|
|
1037
1116
|
body,
|
|
1038
1117
|
{ ...xHeaders, ...requestHeaders },
|
|
@@ -1226,23 +1305,21 @@ class Catalog {
|
|
|
1226
1305
|
}
|
|
1227
1306
|
|
|
1228
1307
|
/**
|
|
1229
|
-
* @param {CatalogPlatformValidator.
|
|
1308
|
+
* @param {CatalogPlatformValidator.CreateTaxParam} arg - Arg object
|
|
1230
1309
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1231
1310
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
1232
|
-
* @returns {Promise<CatalogPlatformModel.
|
|
1233
|
-
* @name
|
|
1234
|
-
* @summary:
|
|
1235
|
-
* @description:
|
|
1311
|
+
* @returns {Promise<CatalogPlatformModel.CreateTax>} - Success response
|
|
1312
|
+
* @name createTax
|
|
1313
|
+
* @summary: Create Tax Rule
|
|
1314
|
+
* @description: Create a tax rule and its version for under a specific company. This also creates a live version of the rule - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/platform/catalog/createTax/).
|
|
1236
1315
|
*/
|
|
1237
|
-
async
|
|
1238
|
-
{
|
|
1316
|
+
async createTax(
|
|
1317
|
+
{ body, requestHeaders } = { requestHeaders: {} },
|
|
1239
1318
|
{ responseHeaders } = { responseHeaders: false }
|
|
1240
1319
|
) {
|
|
1241
|
-
const {
|
|
1242
|
-
error,
|
|
1243
|
-
} = CatalogPlatformValidator.deleteBulkInventoryJob().validate(
|
|
1320
|
+
const { error } = CatalogPlatformValidator.createTax().validate(
|
|
1244
1321
|
{
|
|
1245
|
-
|
|
1322
|
+
body,
|
|
1246
1323
|
},
|
|
1247
1324
|
{ abortEarly: false, allowUnknown: true }
|
|
1248
1325
|
);
|
|
@@ -1251,18 +1328,16 @@ class Catalog {
|
|
|
1251
1328
|
}
|
|
1252
1329
|
|
|
1253
1330
|
// Showing warrnings if extra unknown parameters are found
|
|
1254
|
-
const {
|
|
1255
|
-
error: warrning,
|
|
1256
|
-
} = CatalogPlatformValidator.deleteBulkInventoryJob().validate(
|
|
1331
|
+
const { error: warrning } = CatalogPlatformValidator.createTax().validate(
|
|
1257
1332
|
{
|
|
1258
|
-
|
|
1333
|
+
body,
|
|
1259
1334
|
},
|
|
1260
1335
|
{ abortEarly: false, allowUnknown: false }
|
|
1261
1336
|
);
|
|
1262
1337
|
if (warrning) {
|
|
1263
1338
|
Logger({
|
|
1264
1339
|
level: "WARN",
|
|
1265
|
-
message: `Parameter Validation warrnings for platform > Catalog >
|
|
1340
|
+
message: `Parameter Validation warrnings for platform > Catalog > createTax \n ${warrning}`,
|
|
1266
1341
|
});
|
|
1267
1342
|
}
|
|
1268
1343
|
|
|
@@ -1272,10 +1347,10 @@ class Catalog {
|
|
|
1272
1347
|
|
|
1273
1348
|
const response = await PlatformAPIClient.execute(
|
|
1274
1349
|
this.config,
|
|
1275
|
-
"
|
|
1276
|
-
`/service/platform/catalog/v1.0/company/${this.config.companyId}/
|
|
1350
|
+
"post",
|
|
1351
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/taxes/rules/versions`,
|
|
1277
1352
|
query_params,
|
|
1278
|
-
|
|
1353
|
+
body,
|
|
1279
1354
|
{ ...xHeaders, ...requestHeaders },
|
|
1280
1355
|
{ responseHeaders }
|
|
1281
1356
|
);
|
|
@@ -1287,7 +1362,7 @@ class Catalog {
|
|
|
1287
1362
|
|
|
1288
1363
|
const {
|
|
1289
1364
|
error: res_error,
|
|
1290
|
-
} = CatalogPlatformModel.
|
|
1365
|
+
} = CatalogPlatformModel.CreateTax().validate(responseData, {
|
|
1291
1366
|
abortEarly: false,
|
|
1292
1367
|
allowUnknown: true,
|
|
1293
1368
|
});
|
|
@@ -1298,7 +1373,7 @@ class Catalog {
|
|
|
1298
1373
|
} else {
|
|
1299
1374
|
Logger({
|
|
1300
1375
|
level: "WARN",
|
|
1301
|
-
message: `Response Validation Warnings for platform > Catalog >
|
|
1376
|
+
message: `Response Validation Warnings for platform > Catalog > createTax \n ${res_error}`,
|
|
1302
1377
|
});
|
|
1303
1378
|
}
|
|
1304
1379
|
}
|
|
@@ -1307,21 +1382,27 @@ class Catalog {
|
|
|
1307
1382
|
}
|
|
1308
1383
|
|
|
1309
1384
|
/**
|
|
1310
|
-
* @param {CatalogPlatformValidator.
|
|
1385
|
+
* @param {CatalogPlatformValidator.CreateTaxComponentNameParam} arg - Arg object
|
|
1311
1386
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1312
1387
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
1313
|
-
* @returns {Promise<CatalogPlatformModel.
|
|
1314
|
-
* @name
|
|
1315
|
-
* @summary:
|
|
1316
|
-
* @description:
|
|
1388
|
+
* @returns {Promise<CatalogPlatformModel.TaxComponentName>} - Success response
|
|
1389
|
+
* @name createTaxComponentName
|
|
1390
|
+
* @summary: Create tax component name
|
|
1391
|
+
* @description: Tax components represent different types of taxes that may be applied to products or transactions,
|
|
1392
|
+
* such as sales tax, value-added tax (VAT), goods and services tax, consumption tax,
|
|
1393
|
+
* or other region-specific taxation systems. This endpoint allows companies to define and
|
|
1394
|
+
* customize the names of tax components according to their local tax regulations and business requirements.
|
|
1395
|
+
* - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/platform/catalog/createTaxComponentName/).
|
|
1317
1396
|
*/
|
|
1318
|
-
async
|
|
1319
|
-
{
|
|
1397
|
+
async createTaxComponentName(
|
|
1398
|
+
{ body, requestHeaders } = { requestHeaders: {} },
|
|
1320
1399
|
{ responseHeaders } = { responseHeaders: false }
|
|
1321
1400
|
) {
|
|
1322
|
-
const {
|
|
1401
|
+
const {
|
|
1402
|
+
error,
|
|
1403
|
+
} = CatalogPlatformValidator.createTaxComponentName().validate(
|
|
1323
1404
|
{
|
|
1324
|
-
|
|
1405
|
+
body,
|
|
1325
1406
|
},
|
|
1326
1407
|
{ abortEarly: false, allowUnknown: true }
|
|
1327
1408
|
);
|
|
@@ -1332,16 +1413,16 @@ class Catalog {
|
|
|
1332
1413
|
// Showing warrnings if extra unknown parameters are found
|
|
1333
1414
|
const {
|
|
1334
1415
|
error: warrning,
|
|
1335
|
-
} = CatalogPlatformValidator.
|
|
1416
|
+
} = CatalogPlatformValidator.createTaxComponentName().validate(
|
|
1336
1417
|
{
|
|
1337
|
-
|
|
1418
|
+
body,
|
|
1338
1419
|
},
|
|
1339
1420
|
{ abortEarly: false, allowUnknown: false }
|
|
1340
1421
|
);
|
|
1341
1422
|
if (warrning) {
|
|
1342
1423
|
Logger({
|
|
1343
1424
|
level: "WARN",
|
|
1344
|
-
message: `Parameter Validation warrnings for platform > Catalog >
|
|
1425
|
+
message: `Parameter Validation warrnings for platform > Catalog > createTaxComponentName \n ${warrning}`,
|
|
1345
1426
|
});
|
|
1346
1427
|
}
|
|
1347
1428
|
|
|
@@ -1351,10 +1432,10 @@ class Catalog {
|
|
|
1351
1432
|
|
|
1352
1433
|
const response = await PlatformAPIClient.execute(
|
|
1353
1434
|
this.config,
|
|
1354
|
-
"
|
|
1355
|
-
`/service/platform/catalog/
|
|
1435
|
+
"post",
|
|
1436
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/taxes/component-names`,
|
|
1356
1437
|
query_params,
|
|
1357
|
-
|
|
1438
|
+
body,
|
|
1358
1439
|
{ ...xHeaders, ...requestHeaders },
|
|
1359
1440
|
{ responseHeaders }
|
|
1360
1441
|
);
|
|
@@ -1366,7 +1447,7 @@ class Catalog {
|
|
|
1366
1447
|
|
|
1367
1448
|
const {
|
|
1368
1449
|
error: res_error,
|
|
1369
|
-
} = CatalogPlatformModel.
|
|
1450
|
+
} = CatalogPlatformModel.TaxComponentName().validate(responseData, {
|
|
1370
1451
|
abortEarly: false,
|
|
1371
1452
|
allowUnknown: true,
|
|
1372
1453
|
});
|
|
@@ -1377,7 +1458,7 @@ class Catalog {
|
|
|
1377
1458
|
} else {
|
|
1378
1459
|
Logger({
|
|
1379
1460
|
level: "WARN",
|
|
1380
|
-
message: `Response Validation Warnings for platform > Catalog >
|
|
1461
|
+
message: `Response Validation Warnings for platform > Catalog > createTaxComponentName \n ${res_error}`,
|
|
1381
1462
|
});
|
|
1382
1463
|
}
|
|
1383
1464
|
}
|
|
@@ -1386,21 +1467,22 @@ class Catalog {
|
|
|
1386
1467
|
}
|
|
1387
1468
|
|
|
1388
1469
|
/**
|
|
1389
|
-
* @param {CatalogPlatformValidator.
|
|
1470
|
+
* @param {CatalogPlatformValidator.CreateTaxVersionParam} arg - Arg object
|
|
1390
1471
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1391
1472
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
1392
|
-
* @returns {Promise<CatalogPlatformModel.
|
|
1393
|
-
* @name
|
|
1394
|
-
* @summary:
|
|
1395
|
-
* @description:
|
|
1473
|
+
* @returns {Promise<CatalogPlatformModel.TaxVersion>} - Success response
|
|
1474
|
+
* @name createTaxVersion
|
|
1475
|
+
* @summary: Create a tax version
|
|
1476
|
+
* @description: Creates a tax rule using the provided rule_id. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/platform/catalog/createTaxVersion/).
|
|
1396
1477
|
*/
|
|
1397
|
-
async
|
|
1398
|
-
{
|
|
1478
|
+
async createTaxVersion(
|
|
1479
|
+
{ ruleId, body, requestHeaders } = { requestHeaders: {} },
|
|
1399
1480
|
{ responseHeaders } = { responseHeaders: false }
|
|
1400
1481
|
) {
|
|
1401
|
-
const { error } = CatalogPlatformValidator.
|
|
1482
|
+
const { error } = CatalogPlatformValidator.createTaxVersion().validate(
|
|
1402
1483
|
{
|
|
1403
|
-
|
|
1484
|
+
ruleId,
|
|
1485
|
+
body,
|
|
1404
1486
|
},
|
|
1405
1487
|
{ abortEarly: false, allowUnknown: true }
|
|
1406
1488
|
);
|
|
@@ -1411,16 +1493,17 @@ class Catalog {
|
|
|
1411
1493
|
// Showing warrnings if extra unknown parameters are found
|
|
1412
1494
|
const {
|
|
1413
1495
|
error: warrning,
|
|
1414
|
-
} = CatalogPlatformValidator.
|
|
1496
|
+
} = CatalogPlatformValidator.createTaxVersion().validate(
|
|
1415
1497
|
{
|
|
1416
|
-
|
|
1498
|
+
ruleId,
|
|
1499
|
+
body,
|
|
1417
1500
|
},
|
|
1418
1501
|
{ abortEarly: false, allowUnknown: false }
|
|
1419
1502
|
);
|
|
1420
1503
|
if (warrning) {
|
|
1421
1504
|
Logger({
|
|
1422
1505
|
level: "WARN",
|
|
1423
|
-
message: `Parameter Validation warrnings for platform > Catalog >
|
|
1506
|
+
message: `Parameter Validation warrnings for platform > Catalog > createTaxVersion \n ${warrning}`,
|
|
1424
1507
|
});
|
|
1425
1508
|
}
|
|
1426
1509
|
|
|
@@ -1430,10 +1513,10 @@ class Catalog {
|
|
|
1430
1513
|
|
|
1431
1514
|
const response = await PlatformAPIClient.execute(
|
|
1432
1515
|
this.config,
|
|
1433
|
-
"
|
|
1434
|
-
`/service/platform/catalog/v1.0/company/${this.config.companyId}/
|
|
1516
|
+
"post",
|
|
1517
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/taxes/rules/${ruleId}/versions`,
|
|
1435
1518
|
query_params,
|
|
1436
|
-
|
|
1519
|
+
body,
|
|
1437
1520
|
{ ...xHeaders, ...requestHeaders },
|
|
1438
1521
|
{ responseHeaders }
|
|
1439
1522
|
);
|
|
@@ -1445,7 +1528,7 @@ class Catalog {
|
|
|
1445
1528
|
|
|
1446
1529
|
const {
|
|
1447
1530
|
error: res_error,
|
|
1448
|
-
} = CatalogPlatformModel.
|
|
1531
|
+
} = CatalogPlatformModel.TaxVersion().validate(responseData, {
|
|
1449
1532
|
abortEarly: false,
|
|
1450
1533
|
allowUnknown: true,
|
|
1451
1534
|
});
|
|
@@ -1456,7 +1539,7 @@ class Catalog {
|
|
|
1456
1539
|
} else {
|
|
1457
1540
|
Logger({
|
|
1458
1541
|
level: "WARN",
|
|
1459
|
-
message: `Response Validation Warnings for platform > Catalog >
|
|
1542
|
+
message: `Response Validation Warnings for platform > Catalog > createTaxVersion \n ${res_error}`,
|
|
1460
1543
|
});
|
|
1461
1544
|
}
|
|
1462
1545
|
}
|
|
@@ -1465,26 +1548,23 @@ class Catalog {
|
|
|
1465
1548
|
}
|
|
1466
1549
|
|
|
1467
1550
|
/**
|
|
1468
|
-
* @param {CatalogPlatformValidator.
|
|
1551
|
+
* @param {CatalogPlatformValidator.DeleteBulkInventoryJobParam} arg - Arg object
|
|
1469
1552
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1470
1553
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
1471
|
-
* @returns {Promise<CatalogPlatformModel.
|
|
1472
|
-
*
|
|
1473
|
-
* @
|
|
1474
|
-
* @
|
|
1475
|
-
* @description: You can use this API to delete inventory linked to a particular product size. When you make the API call, the inventory associated with that size will be removed as part of api process. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/platform/catalog/deleteRealtimeInventory/).
|
|
1554
|
+
* @returns {Promise<CatalogPlatformModel.SuccessResponseSchema>} - Success response
|
|
1555
|
+
* @name deleteBulkInventoryJob
|
|
1556
|
+
* @summary: Delete inventory bulk upload job
|
|
1557
|
+
* @description: Allows to delete bulk Inventory job associated with company. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/platform/catalog/deleteBulkInventoryJob/).
|
|
1476
1558
|
*/
|
|
1477
|
-
async
|
|
1478
|
-
{
|
|
1559
|
+
async deleteBulkInventoryJob(
|
|
1560
|
+
{ batchId, requestHeaders } = { requestHeaders: {} },
|
|
1479
1561
|
{ responseHeaders } = { responseHeaders: false }
|
|
1480
1562
|
) {
|
|
1481
1563
|
const {
|
|
1482
1564
|
error,
|
|
1483
|
-
} = CatalogPlatformValidator.
|
|
1565
|
+
} = CatalogPlatformValidator.deleteBulkInventoryJob().validate(
|
|
1484
1566
|
{
|
|
1485
|
-
|
|
1486
|
-
sellerIdentifier,
|
|
1487
|
-
body,
|
|
1567
|
+
batchId,
|
|
1488
1568
|
},
|
|
1489
1569
|
{ abortEarly: false, allowUnknown: true }
|
|
1490
1570
|
);
|
|
@@ -1495,18 +1575,16 @@ class Catalog {
|
|
|
1495
1575
|
// Showing warrnings if extra unknown parameters are found
|
|
1496
1576
|
const {
|
|
1497
1577
|
error: warrning,
|
|
1498
|
-
} = CatalogPlatformValidator.
|
|
1578
|
+
} = CatalogPlatformValidator.deleteBulkInventoryJob().validate(
|
|
1499
1579
|
{
|
|
1500
|
-
|
|
1501
|
-
sellerIdentifier,
|
|
1502
|
-
body,
|
|
1580
|
+
batchId,
|
|
1503
1581
|
},
|
|
1504
1582
|
{ abortEarly: false, allowUnknown: false }
|
|
1505
1583
|
);
|
|
1506
1584
|
if (warrning) {
|
|
1507
1585
|
Logger({
|
|
1508
1586
|
level: "WARN",
|
|
1509
|
-
message: `Parameter Validation warrnings for platform > Catalog >
|
|
1587
|
+
message: `Parameter Validation warrnings for platform > Catalog > deleteBulkInventoryJob \n ${warrning}`,
|
|
1510
1588
|
});
|
|
1511
1589
|
}
|
|
1512
1590
|
|
|
@@ -1517,9 +1595,9 @@ class Catalog {
|
|
|
1517
1595
|
const response = await PlatformAPIClient.execute(
|
|
1518
1596
|
this.config,
|
|
1519
1597
|
"delete",
|
|
1520
|
-
`/service/platform/catalog/
|
|
1598
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/inventory/bulk/${batchId}/`,
|
|
1521
1599
|
query_params,
|
|
1522
|
-
|
|
1600
|
+
undefined,
|
|
1523
1601
|
{ ...xHeaders, ...requestHeaders },
|
|
1524
1602
|
{ responseHeaders }
|
|
1525
1603
|
);
|
|
@@ -1531,10 +1609,10 @@ class Catalog {
|
|
|
1531
1609
|
|
|
1532
1610
|
const {
|
|
1533
1611
|
error: res_error,
|
|
1534
|
-
} = CatalogPlatformModel.
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
);
|
|
1612
|
+
} = CatalogPlatformModel.SuccessResponseSchema().validate(responseData, {
|
|
1613
|
+
abortEarly: false,
|
|
1614
|
+
allowUnknown: true,
|
|
1615
|
+
});
|
|
1538
1616
|
|
|
1539
1617
|
if (res_error) {
|
|
1540
1618
|
if (this.config.options.strictResponseCheck === true) {
|
|
@@ -1542,7 +1620,7 @@ class Catalog {
|
|
|
1542
1620
|
} else {
|
|
1543
1621
|
Logger({
|
|
1544
1622
|
level: "WARN",
|
|
1545
|
-
message: `Response Validation Warnings for platform > Catalog >
|
|
1623
|
+
message: `Response Validation Warnings for platform > Catalog > deleteBulkInventoryJob \n ${res_error}`,
|
|
1546
1624
|
});
|
|
1547
1625
|
}
|
|
1548
1626
|
}
|
|
@@ -1551,24 +1629,21 @@ class Catalog {
|
|
|
1551
1629
|
}
|
|
1552
1630
|
|
|
1553
1631
|
/**
|
|
1554
|
-
* @param {CatalogPlatformValidator.
|
|
1632
|
+
* @param {CatalogPlatformValidator.DeleteProductParam} arg - Arg object
|
|
1555
1633
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1556
1634
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
1557
|
-
* @returns {Promise<CatalogPlatformModel.
|
|
1558
|
-
*
|
|
1559
|
-
*
|
|
1560
|
-
* @
|
|
1561
|
-
* @summary: Delete product size
|
|
1562
|
-
* @description: Allows to delete size associated with product. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/platform/catalog/deleteSize/).
|
|
1635
|
+
* @returns {Promise<CatalogPlatformModel.SuccessResponseSchema>} - Success response
|
|
1636
|
+
* @name deleteProduct
|
|
1637
|
+
* @summary: Delete product
|
|
1638
|
+
* @description: Users can delete a product by providing the item_id and company_id. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/platform/catalog/deleteProduct/).
|
|
1563
1639
|
*/
|
|
1564
|
-
async
|
|
1565
|
-
{ itemId,
|
|
1640
|
+
async deleteProduct(
|
|
1641
|
+
{ itemId, requestHeaders } = { requestHeaders: {} },
|
|
1566
1642
|
{ responseHeaders } = { responseHeaders: false }
|
|
1567
1643
|
) {
|
|
1568
|
-
const { error } = CatalogPlatformValidator.
|
|
1644
|
+
const { error } = CatalogPlatformValidator.deleteProduct().validate(
|
|
1569
1645
|
{
|
|
1570
1646
|
itemId,
|
|
1571
|
-
size,
|
|
1572
1647
|
},
|
|
1573
1648
|
{ abortEarly: false, allowUnknown: true }
|
|
1574
1649
|
);
|
|
@@ -1577,17 +1652,18 @@ class Catalog {
|
|
|
1577
1652
|
}
|
|
1578
1653
|
|
|
1579
1654
|
// Showing warrnings if extra unknown parameters are found
|
|
1580
|
-
const {
|
|
1655
|
+
const {
|
|
1656
|
+
error: warrning,
|
|
1657
|
+
} = CatalogPlatformValidator.deleteProduct().validate(
|
|
1581
1658
|
{
|
|
1582
1659
|
itemId,
|
|
1583
|
-
size,
|
|
1584
1660
|
},
|
|
1585
1661
|
{ abortEarly: false, allowUnknown: false }
|
|
1586
1662
|
);
|
|
1587
1663
|
if (warrning) {
|
|
1588
1664
|
Logger({
|
|
1589
1665
|
level: "WARN",
|
|
1590
|
-
message: `Parameter Validation warrnings for platform > Catalog >
|
|
1666
|
+
message: `Parameter Validation warrnings for platform > Catalog > deleteProduct \n ${warrning}`,
|
|
1591
1667
|
});
|
|
1592
1668
|
}
|
|
1593
1669
|
|
|
@@ -1598,7 +1674,7 @@ class Catalog {
|
|
|
1598
1674
|
const response = await PlatformAPIClient.execute(
|
|
1599
1675
|
this.config,
|
|
1600
1676
|
"delete",
|
|
1601
|
-
`/service/platform/catalog/
|
|
1677
|
+
`/service/platform/catalog/v2.0/company/${this.config.companyId}/products/${itemId}/`,
|
|
1602
1678
|
query_params,
|
|
1603
1679
|
undefined,
|
|
1604
1680
|
{ ...xHeaders, ...requestHeaders },
|
|
@@ -1612,10 +1688,10 @@ class Catalog {
|
|
|
1612
1688
|
|
|
1613
1689
|
const {
|
|
1614
1690
|
error: res_error,
|
|
1615
|
-
} = CatalogPlatformModel.
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
);
|
|
1691
|
+
} = CatalogPlatformModel.SuccessResponseSchema().validate(responseData, {
|
|
1692
|
+
abortEarly: false,
|
|
1693
|
+
allowUnknown: true,
|
|
1694
|
+
});
|
|
1619
1695
|
|
|
1620
1696
|
if (res_error) {
|
|
1621
1697
|
if (this.config.options.strictResponseCheck === true) {
|
|
@@ -1623,7 +1699,7 @@ class Catalog {
|
|
|
1623
1699
|
} else {
|
|
1624
1700
|
Logger({
|
|
1625
1701
|
level: "WARN",
|
|
1626
|
-
message: `Response Validation Warnings for platform > Catalog >
|
|
1702
|
+
message: `Response Validation Warnings for platform > Catalog > deleteProduct \n ${res_error}`,
|
|
1627
1703
|
});
|
|
1628
1704
|
}
|
|
1629
1705
|
}
|
|
@@ -1632,26 +1708,21 @@ class Catalog {
|
|
|
1632
1708
|
}
|
|
1633
1709
|
|
|
1634
1710
|
/**
|
|
1635
|
-
* @param {CatalogPlatformValidator.
|
|
1636
|
-
* - Arg object
|
|
1637
|
-
*
|
|
1711
|
+
* @param {CatalogPlatformValidator.DeleteProductBulkJobParam} arg - Arg object
|
|
1638
1712
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1639
1713
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
1640
|
-
* @returns {Promise<
|
|
1641
|
-
* @name
|
|
1642
|
-
* @summary:
|
|
1643
|
-
* @description: Allows
|
|
1714
|
+
* @returns {Promise<CatalogPlatformModel.SuccessResponseSchema>} - Success response
|
|
1715
|
+
* @name deleteProductBulkJob
|
|
1716
|
+
* @summary: Delete product bulk-upload job
|
|
1717
|
+
* @description: Allows to delete bulk product job associated with company. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/platform/catalog/deleteProductBulkJob/).
|
|
1644
1718
|
*/
|
|
1645
|
-
async
|
|
1646
|
-
{
|
|
1719
|
+
async deleteProductBulkJob(
|
|
1720
|
+
{ batchId, requestHeaders } = { requestHeaders: {} },
|
|
1647
1721
|
{ responseHeaders } = { responseHeaders: false }
|
|
1648
1722
|
) {
|
|
1649
|
-
const {
|
|
1650
|
-
error,
|
|
1651
|
-
} = CatalogPlatformValidator.downloadInventoryTemplateView().validate(
|
|
1723
|
+
const { error } = CatalogPlatformValidator.deleteProductBulkJob().validate(
|
|
1652
1724
|
{
|
|
1653
|
-
|
|
1654
|
-
type,
|
|
1725
|
+
batchId,
|
|
1655
1726
|
},
|
|
1656
1727
|
{ abortEarly: false, allowUnknown: true }
|
|
1657
1728
|
);
|
|
@@ -1662,31 +1733,429 @@ class Catalog {
|
|
|
1662
1733
|
// Showing warrnings if extra unknown parameters are found
|
|
1663
1734
|
const {
|
|
1664
1735
|
error: warrning,
|
|
1665
|
-
} = CatalogPlatformValidator.
|
|
1736
|
+
} = CatalogPlatformValidator.deleteProductBulkJob().validate(
|
|
1666
1737
|
{
|
|
1667
|
-
|
|
1668
|
-
type,
|
|
1738
|
+
batchId,
|
|
1669
1739
|
},
|
|
1670
1740
|
{ abortEarly: false, allowUnknown: false }
|
|
1671
1741
|
);
|
|
1672
1742
|
if (warrning) {
|
|
1673
1743
|
Logger({
|
|
1674
1744
|
level: "WARN",
|
|
1675
|
-
message: `Parameter Validation warrnings for platform > Catalog >
|
|
1745
|
+
message: `Parameter Validation warrnings for platform > Catalog > deleteProductBulkJob \n ${warrning}`,
|
|
1676
1746
|
});
|
|
1677
1747
|
}
|
|
1678
1748
|
|
|
1679
1749
|
const query_params = {};
|
|
1680
|
-
query_params["schema_type"] = schemaType;
|
|
1681
|
-
query_params["type"] = type;
|
|
1682
1750
|
|
|
1683
1751
|
const xHeaders = {};
|
|
1684
1752
|
|
|
1685
1753
|
const response = await PlatformAPIClient.execute(
|
|
1686
1754
|
this.config,
|
|
1687
|
-
"
|
|
1688
|
-
`/service/platform/catalog/v1.0/company/${this.config.companyId}/
|
|
1689
|
-
query_params,
|
|
1755
|
+
"delete",
|
|
1756
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/products/bulk/${batchId}`,
|
|
1757
|
+
query_params,
|
|
1758
|
+
undefined,
|
|
1759
|
+
{ ...xHeaders, ...requestHeaders },
|
|
1760
|
+
{ responseHeaders }
|
|
1761
|
+
);
|
|
1762
|
+
|
|
1763
|
+
let responseData = response;
|
|
1764
|
+
if (responseHeaders) {
|
|
1765
|
+
responseData = response[0];
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
const {
|
|
1769
|
+
error: res_error,
|
|
1770
|
+
} = CatalogPlatformModel.SuccessResponseSchema().validate(responseData, {
|
|
1771
|
+
abortEarly: false,
|
|
1772
|
+
allowUnknown: true,
|
|
1773
|
+
});
|
|
1774
|
+
|
|
1775
|
+
if (res_error) {
|
|
1776
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
1777
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1778
|
+
} else {
|
|
1779
|
+
Logger({
|
|
1780
|
+
level: "WARN",
|
|
1781
|
+
message: `Response Validation Warnings for platform > Catalog > deleteProductBulkJob \n ${res_error}`,
|
|
1782
|
+
});
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
return response;
|
|
1787
|
+
}
|
|
1788
|
+
|
|
1789
|
+
/**
|
|
1790
|
+
* @param {CatalogPlatformValidator.DeleteRealtimeInventoryParam} arg - Arg object
|
|
1791
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1792
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
1793
|
+
* @returns {Promise<CatalogPlatformModel.InventoryUpdateResponseSchema>} -
|
|
1794
|
+
* Success response
|
|
1795
|
+
* @name deleteRealtimeInventory
|
|
1796
|
+
* @summary: Delete an inventory
|
|
1797
|
+
* @description: You can use this API to delete inventory linked to a particular product size. When you make the API call, the inventory associated with that size will be removed as part of api process. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/platform/catalog/deleteRealtimeInventory/).
|
|
1798
|
+
*/
|
|
1799
|
+
async deleteRealtimeInventory(
|
|
1800
|
+
{ itemId, sellerIdentifier, body, requestHeaders } = { requestHeaders: {} },
|
|
1801
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
1802
|
+
) {
|
|
1803
|
+
const {
|
|
1804
|
+
error,
|
|
1805
|
+
} = CatalogPlatformValidator.deleteRealtimeInventory().validate(
|
|
1806
|
+
{
|
|
1807
|
+
itemId,
|
|
1808
|
+
sellerIdentifier,
|
|
1809
|
+
body,
|
|
1810
|
+
},
|
|
1811
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1812
|
+
);
|
|
1813
|
+
if (error) {
|
|
1814
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1815
|
+
}
|
|
1816
|
+
|
|
1817
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1818
|
+
const {
|
|
1819
|
+
error: warrning,
|
|
1820
|
+
} = CatalogPlatformValidator.deleteRealtimeInventory().validate(
|
|
1821
|
+
{
|
|
1822
|
+
itemId,
|
|
1823
|
+
sellerIdentifier,
|
|
1824
|
+
body,
|
|
1825
|
+
},
|
|
1826
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1827
|
+
);
|
|
1828
|
+
if (warrning) {
|
|
1829
|
+
Logger({
|
|
1830
|
+
level: "WARN",
|
|
1831
|
+
message: `Parameter Validation warrnings for platform > Catalog > deleteRealtimeInventory \n ${warrning}`,
|
|
1832
|
+
});
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
const query_params = {};
|
|
1836
|
+
|
|
1837
|
+
const xHeaders = {};
|
|
1838
|
+
|
|
1839
|
+
const response = await PlatformAPIClient.execute(
|
|
1840
|
+
this.config,
|
|
1841
|
+
"delete",
|
|
1842
|
+
`/service/platform/catalog/v2.0/company/${this.config.companyId}/products/${itemId}/inventory/${sellerIdentifier}`,
|
|
1843
|
+
query_params,
|
|
1844
|
+
body,
|
|
1845
|
+
{ ...xHeaders, ...requestHeaders },
|
|
1846
|
+
{ responseHeaders }
|
|
1847
|
+
);
|
|
1848
|
+
|
|
1849
|
+
let responseData = response;
|
|
1850
|
+
if (responseHeaders) {
|
|
1851
|
+
responseData = response[0];
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
const {
|
|
1855
|
+
error: res_error,
|
|
1856
|
+
} = CatalogPlatformModel.InventoryUpdateResponseSchema().validate(
|
|
1857
|
+
responseData,
|
|
1858
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1859
|
+
);
|
|
1860
|
+
|
|
1861
|
+
if (res_error) {
|
|
1862
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
1863
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1864
|
+
} else {
|
|
1865
|
+
Logger({
|
|
1866
|
+
level: "WARN",
|
|
1867
|
+
message: `Response Validation Warnings for platform > Catalog > deleteRealtimeInventory \n ${res_error}`,
|
|
1868
|
+
});
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1872
|
+
return response;
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
/**
|
|
1876
|
+
* @param {CatalogPlatformValidator.DeleteSizeParam} arg - Arg object
|
|
1877
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1878
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
1879
|
+
* @returns {Promise<CatalogPlatformModel.ProductSizeDeleteResponseSchema>}
|
|
1880
|
+
* - Success response
|
|
1881
|
+
*
|
|
1882
|
+
* @name deleteSize
|
|
1883
|
+
* @summary: Delete product size
|
|
1884
|
+
* @description: Allows to delete size associated with product. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/platform/catalog/deleteSize/).
|
|
1885
|
+
*/
|
|
1886
|
+
async deleteSize(
|
|
1887
|
+
{ itemId, size, requestHeaders } = { requestHeaders: {} },
|
|
1888
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
1889
|
+
) {
|
|
1890
|
+
const { error } = CatalogPlatformValidator.deleteSize().validate(
|
|
1891
|
+
{
|
|
1892
|
+
itemId,
|
|
1893
|
+
size,
|
|
1894
|
+
},
|
|
1895
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1896
|
+
);
|
|
1897
|
+
if (error) {
|
|
1898
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1902
|
+
const { error: warrning } = CatalogPlatformValidator.deleteSize().validate(
|
|
1903
|
+
{
|
|
1904
|
+
itemId,
|
|
1905
|
+
size,
|
|
1906
|
+
},
|
|
1907
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1908
|
+
);
|
|
1909
|
+
if (warrning) {
|
|
1910
|
+
Logger({
|
|
1911
|
+
level: "WARN",
|
|
1912
|
+
message: `Parameter Validation warrnings for platform > Catalog > deleteSize \n ${warrning}`,
|
|
1913
|
+
});
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
const query_params = {};
|
|
1917
|
+
|
|
1918
|
+
const xHeaders = {};
|
|
1919
|
+
|
|
1920
|
+
const response = await PlatformAPIClient.execute(
|
|
1921
|
+
this.config,
|
|
1922
|
+
"delete",
|
|
1923
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/products/${itemId}/sizes/${size}`,
|
|
1924
|
+
query_params,
|
|
1925
|
+
undefined,
|
|
1926
|
+
{ ...xHeaders, ...requestHeaders },
|
|
1927
|
+
{ responseHeaders }
|
|
1928
|
+
);
|
|
1929
|
+
|
|
1930
|
+
let responseData = response;
|
|
1931
|
+
if (responseHeaders) {
|
|
1932
|
+
responseData = response[0];
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1935
|
+
const {
|
|
1936
|
+
error: res_error,
|
|
1937
|
+
} = CatalogPlatformModel.ProductSizeDeleteResponseSchema().validate(
|
|
1938
|
+
responseData,
|
|
1939
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1940
|
+
);
|
|
1941
|
+
|
|
1942
|
+
if (res_error) {
|
|
1943
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
1944
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1945
|
+
} else {
|
|
1946
|
+
Logger({
|
|
1947
|
+
level: "WARN",
|
|
1948
|
+
message: `Response Validation Warnings for platform > Catalog > deleteSize \n ${res_error}`,
|
|
1949
|
+
});
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1953
|
+
return response;
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1956
|
+
/**
|
|
1957
|
+
* @param {CatalogPlatformValidator.DeleteTaxRuleParam} arg - Arg object
|
|
1958
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1959
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
1960
|
+
* @returns {Promise<Object>} - Success response
|
|
1961
|
+
* @name deleteTaxRule
|
|
1962
|
+
* @summary: Delete a tax rule
|
|
1963
|
+
* @description: Deletes a tax rule along with all its versions using the provided rule_id. You can not delete a rule if 1. it is the default tax rule 2. it is applied to any product. You will need to set any other tax rule as default or will need to attach a different tax rule to the products, then only you can delete the rule.
|
|
1964
|
+
* - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/platform/catalog/deleteTaxRule/).
|
|
1965
|
+
*/
|
|
1966
|
+
async deleteTaxRule(
|
|
1967
|
+
{ ruleId, requestHeaders } = { requestHeaders: {} },
|
|
1968
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
1969
|
+
) {
|
|
1970
|
+
const { error } = CatalogPlatformValidator.deleteTaxRule().validate(
|
|
1971
|
+
{ ruleId },
|
|
1972
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1973
|
+
);
|
|
1974
|
+
if (error) {
|
|
1975
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1978
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1979
|
+
const {
|
|
1980
|
+
error: warrning,
|
|
1981
|
+
} = CatalogPlatformValidator.deleteTaxRule().validate(
|
|
1982
|
+
{ ruleId },
|
|
1983
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1984
|
+
);
|
|
1985
|
+
if (warrning) {
|
|
1986
|
+
Logger({
|
|
1987
|
+
level: "WARN",
|
|
1988
|
+
message: `Parameter Validation warrnings for platform > Catalog > deleteTaxRule \n ${warrning}`,
|
|
1989
|
+
});
|
|
1990
|
+
}
|
|
1991
|
+
|
|
1992
|
+
const query_params = {};
|
|
1993
|
+
|
|
1994
|
+
const xHeaders = {};
|
|
1995
|
+
|
|
1996
|
+
const response = await PlatformAPIClient.execute(
|
|
1997
|
+
this.config,
|
|
1998
|
+
"delete",
|
|
1999
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/taxes/rules/${ruleId}`,
|
|
2000
|
+
query_params,
|
|
2001
|
+
undefined,
|
|
2002
|
+
{ ...xHeaders, ...requestHeaders },
|
|
2003
|
+
{ responseHeaders }
|
|
2004
|
+
);
|
|
2005
|
+
|
|
2006
|
+
let responseData = response;
|
|
2007
|
+
if (responseHeaders) {
|
|
2008
|
+
responseData = response[0];
|
|
2009
|
+
}
|
|
2010
|
+
|
|
2011
|
+
const { error: res_error } = Joi.any().validate(responseData, {
|
|
2012
|
+
abortEarly: false,
|
|
2013
|
+
allowUnknown: true,
|
|
2014
|
+
});
|
|
2015
|
+
|
|
2016
|
+
if (res_error) {
|
|
2017
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
2018
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
2019
|
+
} else {
|
|
2020
|
+
Logger({
|
|
2021
|
+
level: "WARN",
|
|
2022
|
+
message: `Response Validation Warnings for platform > Catalog > deleteTaxRule \n ${res_error}`,
|
|
2023
|
+
});
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
|
|
2027
|
+
return response;
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
/**
|
|
2031
|
+
* @param {CatalogPlatformValidator.DeleteTaxVersionParam} arg - Arg object
|
|
2032
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2033
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2034
|
+
* @returns {Promise<Object>} - Success response
|
|
2035
|
+
* @name deleteTaxVersion
|
|
2036
|
+
* @summary: Delete a tax version
|
|
2037
|
+
* @description: Deletes a tax rule using the provided rule_id. On future/scheduled version can be deleted. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/platform/catalog/deleteTaxVersion/).
|
|
2038
|
+
*/
|
|
2039
|
+
async deleteTaxVersion(
|
|
2040
|
+
{ ruleId, versionId, requestHeaders } = { requestHeaders: {} },
|
|
2041
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
2042
|
+
) {
|
|
2043
|
+
const { error } = CatalogPlatformValidator.deleteTaxVersion().validate(
|
|
2044
|
+
{ ruleId, versionId },
|
|
2045
|
+
{ abortEarly: false, allowUnknown: true }
|
|
2046
|
+
);
|
|
2047
|
+
if (error) {
|
|
2048
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2049
|
+
}
|
|
2050
|
+
|
|
2051
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2052
|
+
const {
|
|
2053
|
+
error: warrning,
|
|
2054
|
+
} = CatalogPlatformValidator.deleteTaxVersion().validate(
|
|
2055
|
+
{ ruleId, versionId },
|
|
2056
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2057
|
+
);
|
|
2058
|
+
if (warrning) {
|
|
2059
|
+
Logger({
|
|
2060
|
+
level: "WARN",
|
|
2061
|
+
message: `Parameter Validation warrnings for platform > Catalog > deleteTaxVersion \n ${warrning}`,
|
|
2062
|
+
});
|
|
2063
|
+
}
|
|
2064
|
+
|
|
2065
|
+
const query_params = {};
|
|
2066
|
+
|
|
2067
|
+
const xHeaders = {};
|
|
2068
|
+
|
|
2069
|
+
const response = await PlatformAPIClient.execute(
|
|
2070
|
+
this.config,
|
|
2071
|
+
"delete",
|
|
2072
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/taxes/rules/${ruleId}/versions/${versionId}`,
|
|
2073
|
+
query_params,
|
|
2074
|
+
undefined,
|
|
2075
|
+
{ ...xHeaders, ...requestHeaders },
|
|
2076
|
+
{ responseHeaders }
|
|
2077
|
+
);
|
|
2078
|
+
|
|
2079
|
+
let responseData = response;
|
|
2080
|
+
if (responseHeaders) {
|
|
2081
|
+
responseData = response[0];
|
|
2082
|
+
}
|
|
2083
|
+
|
|
2084
|
+
const { error: res_error } = Joi.any().validate(responseData, {
|
|
2085
|
+
abortEarly: false,
|
|
2086
|
+
allowUnknown: true,
|
|
2087
|
+
});
|
|
2088
|
+
|
|
2089
|
+
if (res_error) {
|
|
2090
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
2091
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
2092
|
+
} else {
|
|
2093
|
+
Logger({
|
|
2094
|
+
level: "WARN",
|
|
2095
|
+
message: `Response Validation Warnings for platform > Catalog > deleteTaxVersion \n ${res_error}`,
|
|
2096
|
+
});
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
|
|
2100
|
+
return response;
|
|
2101
|
+
}
|
|
2102
|
+
|
|
2103
|
+
/**
|
|
2104
|
+
* @param {CatalogPlatformValidator.DownloadInventoryTemplateViewParam} arg
|
|
2105
|
+
* - Arg object
|
|
2106
|
+
*
|
|
2107
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2108
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2109
|
+
* @returns {Promise<string>} - Success response
|
|
2110
|
+
* @name downloadInventoryTemplateView
|
|
2111
|
+
* @summary: Download inventory template data
|
|
2112
|
+
* @description: Allows you to download inventory product template data for a specific company in formats like csv and excel. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/platform/catalog/downloadInventoryTemplateView/).
|
|
2113
|
+
*/
|
|
2114
|
+
async downloadInventoryTemplateView(
|
|
2115
|
+
{ schemaType, type, requestHeaders } = { requestHeaders: {} },
|
|
2116
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
2117
|
+
) {
|
|
2118
|
+
const {
|
|
2119
|
+
error,
|
|
2120
|
+
} = CatalogPlatformValidator.downloadInventoryTemplateView().validate(
|
|
2121
|
+
{
|
|
2122
|
+
schemaType,
|
|
2123
|
+
type,
|
|
2124
|
+
},
|
|
2125
|
+
{ abortEarly: false, allowUnknown: true }
|
|
2126
|
+
);
|
|
2127
|
+
if (error) {
|
|
2128
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2129
|
+
}
|
|
2130
|
+
|
|
2131
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2132
|
+
const {
|
|
2133
|
+
error: warrning,
|
|
2134
|
+
} = CatalogPlatformValidator.downloadInventoryTemplateView().validate(
|
|
2135
|
+
{
|
|
2136
|
+
schemaType,
|
|
2137
|
+
type,
|
|
2138
|
+
},
|
|
2139
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2140
|
+
);
|
|
2141
|
+
if (warrning) {
|
|
2142
|
+
Logger({
|
|
2143
|
+
level: "WARN",
|
|
2144
|
+
message: `Parameter Validation warrnings for platform > Catalog > downloadInventoryTemplateView \n ${warrning}`,
|
|
2145
|
+
});
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
const query_params = {};
|
|
2149
|
+
query_params["schema_type"] = schemaType;
|
|
2150
|
+
query_params["type"] = type;
|
|
2151
|
+
|
|
2152
|
+
const xHeaders = {};
|
|
2153
|
+
|
|
2154
|
+
const response = await PlatformAPIClient.execute(
|
|
2155
|
+
this.config,
|
|
2156
|
+
"get",
|
|
2157
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/inventory/templates/download/`,
|
|
2158
|
+
query_params,
|
|
1690
2159
|
undefined,
|
|
1691
2160
|
{ ...xHeaders, ...requestHeaders },
|
|
1692
2161
|
{ responseHeaders }
|
|
@@ -1847,7 +2316,7 @@ class Catalog {
|
|
|
1847
2316
|
const response = await PlatformAPIClient.execute(
|
|
1848
2317
|
this.config,
|
|
1849
2318
|
"put",
|
|
1850
|
-
`/service/platform/catalog/
|
|
2319
|
+
`/service/platform/catalog/v3.0/company/${this.config.companyId}/products/${itemId}/`,
|
|
1851
2320
|
query_params,
|
|
1852
2321
|
body,
|
|
1853
2322
|
{ ...xHeaders, ...requestHeaders },
|
|
@@ -2051,6 +2520,100 @@ class Catalog {
|
|
|
2051
2520
|
return response;
|
|
2052
2521
|
}
|
|
2053
2522
|
|
|
2523
|
+
/**
|
|
2524
|
+
* @param {CatalogPlatformValidator.GetAllTaxRulesParam} arg - Arg object
|
|
2525
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2526
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2527
|
+
* @returns {Promise<CatalogPlatformModel.TaxRules>} - Success response
|
|
2528
|
+
* @name getAllTaxRules
|
|
2529
|
+
* @summary: Get all tax rules of a company
|
|
2530
|
+
* @description: Returns array of all tax rules of a company - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/platform/catalog/getAllTaxRules/).
|
|
2531
|
+
*/
|
|
2532
|
+
async getAllTaxRules(
|
|
2533
|
+
{ q, statuses, page, limit, versionStatus, requestHeaders } = {
|
|
2534
|
+
requestHeaders: {},
|
|
2535
|
+
},
|
|
2536
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
2537
|
+
) {
|
|
2538
|
+
const { error } = CatalogPlatformValidator.getAllTaxRules().validate(
|
|
2539
|
+
{
|
|
2540
|
+
q,
|
|
2541
|
+
statuses,
|
|
2542
|
+
page,
|
|
2543
|
+
limit,
|
|
2544
|
+
versionStatus,
|
|
2545
|
+
},
|
|
2546
|
+
{ abortEarly: false, allowUnknown: true }
|
|
2547
|
+
);
|
|
2548
|
+
if (error) {
|
|
2549
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2550
|
+
}
|
|
2551
|
+
|
|
2552
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2553
|
+
const {
|
|
2554
|
+
error: warrning,
|
|
2555
|
+
} = CatalogPlatformValidator.getAllTaxRules().validate(
|
|
2556
|
+
{
|
|
2557
|
+
q,
|
|
2558
|
+
statuses,
|
|
2559
|
+
page,
|
|
2560
|
+
limit,
|
|
2561
|
+
versionStatus,
|
|
2562
|
+
},
|
|
2563
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2564
|
+
);
|
|
2565
|
+
if (warrning) {
|
|
2566
|
+
Logger({
|
|
2567
|
+
level: "WARN",
|
|
2568
|
+
message: `Parameter Validation warrnings for platform > Catalog > getAllTaxRules \n ${warrning}`,
|
|
2569
|
+
});
|
|
2570
|
+
}
|
|
2571
|
+
|
|
2572
|
+
const query_params = {};
|
|
2573
|
+
query_params["q"] = q;
|
|
2574
|
+
query_params["statuses"] = statuses;
|
|
2575
|
+
query_params["page"] = page;
|
|
2576
|
+
query_params["limit"] = limit;
|
|
2577
|
+
query_params["version_status"] = versionStatus;
|
|
2578
|
+
|
|
2579
|
+
const xHeaders = {};
|
|
2580
|
+
|
|
2581
|
+
const response = await PlatformAPIClient.execute(
|
|
2582
|
+
this.config,
|
|
2583
|
+
"get",
|
|
2584
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/taxes/rules`,
|
|
2585
|
+
query_params,
|
|
2586
|
+
undefined,
|
|
2587
|
+
{ ...xHeaders, ...requestHeaders },
|
|
2588
|
+
{ responseHeaders }
|
|
2589
|
+
);
|
|
2590
|
+
|
|
2591
|
+
let responseData = response;
|
|
2592
|
+
if (responseHeaders) {
|
|
2593
|
+
responseData = response[0];
|
|
2594
|
+
}
|
|
2595
|
+
|
|
2596
|
+
const {
|
|
2597
|
+
error: res_error,
|
|
2598
|
+
} = CatalogPlatformModel.TaxRules().validate(responseData, {
|
|
2599
|
+
abortEarly: false,
|
|
2600
|
+
allowUnknown: true,
|
|
2601
|
+
});
|
|
2602
|
+
|
|
2603
|
+
if (res_error) {
|
|
2604
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
2605
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
2606
|
+
} else {
|
|
2607
|
+
Logger({
|
|
2608
|
+
level: "WARN",
|
|
2609
|
+
message: `Response Validation Warnings for platform > Catalog > getAllTaxRules \n ${res_error}`,
|
|
2610
|
+
});
|
|
2611
|
+
}
|
|
2612
|
+
}
|
|
2613
|
+
|
|
2614
|
+
return response;
|
|
2615
|
+
}
|
|
2616
|
+
|
|
2054
2617
|
/**
|
|
2055
2618
|
* @param {CatalogPlatformValidator.GetAttributeParam} arg - Arg object
|
|
2056
2619
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
@@ -2404,14 +2967,94 @@ class Catalog {
|
|
|
2404
2967
|
// Showing warrnings if extra unknown parameters are found
|
|
2405
2968
|
const {
|
|
2406
2969
|
error: warrning,
|
|
2407
|
-
} = CatalogPlatformValidator.getCompanyMetrics().validate(
|
|
2408
|
-
{},
|
|
2970
|
+
} = CatalogPlatformValidator.getCompanyMetrics().validate(
|
|
2971
|
+
{},
|
|
2972
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2973
|
+
);
|
|
2974
|
+
if (warrning) {
|
|
2975
|
+
Logger({
|
|
2976
|
+
level: "WARN",
|
|
2977
|
+
message: `Parameter Validation warrnings for platform > Catalog > getCompanyMetrics \n ${warrning}`,
|
|
2978
|
+
});
|
|
2979
|
+
}
|
|
2980
|
+
|
|
2981
|
+
const query_params = {};
|
|
2982
|
+
|
|
2983
|
+
const xHeaders = {};
|
|
2984
|
+
|
|
2985
|
+
const response = await PlatformAPIClient.execute(
|
|
2986
|
+
this.config,
|
|
2987
|
+
"get",
|
|
2988
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/marketplaces/company-metrics/`,
|
|
2989
|
+
query_params,
|
|
2990
|
+
undefined,
|
|
2991
|
+
{ ...xHeaders, ...requestHeaders },
|
|
2992
|
+
{ responseHeaders }
|
|
2993
|
+
);
|
|
2994
|
+
|
|
2995
|
+
let responseData = response;
|
|
2996
|
+
if (responseHeaders) {
|
|
2997
|
+
responseData = response[0];
|
|
2998
|
+
}
|
|
2999
|
+
|
|
3000
|
+
const {
|
|
3001
|
+
error: res_error,
|
|
3002
|
+
} = CatalogPlatformModel.OptinCompanyMetrics().validate(responseData, {
|
|
3003
|
+
abortEarly: false,
|
|
3004
|
+
allowUnknown: true,
|
|
3005
|
+
});
|
|
3006
|
+
|
|
3007
|
+
if (res_error) {
|
|
3008
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
3009
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
3010
|
+
} else {
|
|
3011
|
+
Logger({
|
|
3012
|
+
level: "WARN",
|
|
3013
|
+
message: `Response Validation Warnings for platform > Catalog > getCompanyMetrics \n ${res_error}`,
|
|
3014
|
+
});
|
|
3015
|
+
}
|
|
3016
|
+
}
|
|
3017
|
+
|
|
3018
|
+
return response;
|
|
3019
|
+
}
|
|
3020
|
+
|
|
3021
|
+
/**
|
|
3022
|
+
* @param {CatalogPlatformValidator.GetDepartmentDataParam} arg - Arg object
|
|
3023
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
3024
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
3025
|
+
* @returns {Promise<CatalogPlatformModel.DepartmentsResponseSchema>} -
|
|
3026
|
+
* Success response
|
|
3027
|
+
* @name getDepartmentData
|
|
3028
|
+
* @summary: Get department by uid
|
|
3029
|
+
* @description: Retrieve detailed information about a specific department for a specific company by uid. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/platform/catalog/getDepartmentData/).
|
|
3030
|
+
*/
|
|
3031
|
+
async getDepartmentData(
|
|
3032
|
+
{ uid, requestHeaders } = { requestHeaders: {} },
|
|
3033
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
3034
|
+
) {
|
|
3035
|
+
const { error } = CatalogPlatformValidator.getDepartmentData().validate(
|
|
3036
|
+
{
|
|
3037
|
+
uid,
|
|
3038
|
+
},
|
|
3039
|
+
{ abortEarly: false, allowUnknown: true }
|
|
3040
|
+
);
|
|
3041
|
+
if (error) {
|
|
3042
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
3043
|
+
}
|
|
3044
|
+
|
|
3045
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3046
|
+
const {
|
|
3047
|
+
error: warrning,
|
|
3048
|
+
} = CatalogPlatformValidator.getDepartmentData().validate(
|
|
3049
|
+
{
|
|
3050
|
+
uid,
|
|
3051
|
+
},
|
|
2409
3052
|
{ abortEarly: false, allowUnknown: false }
|
|
2410
3053
|
);
|
|
2411
3054
|
if (warrning) {
|
|
2412
3055
|
Logger({
|
|
2413
3056
|
level: "WARN",
|
|
2414
|
-
message: `Parameter Validation warrnings for platform > Catalog >
|
|
3057
|
+
message: `Parameter Validation warrnings for platform > Catalog > getDepartmentData \n ${warrning}`,
|
|
2415
3058
|
});
|
|
2416
3059
|
}
|
|
2417
3060
|
|
|
@@ -2422,7 +3065,7 @@ class Catalog {
|
|
|
2422
3065
|
const response = await PlatformAPIClient.execute(
|
|
2423
3066
|
this.config,
|
|
2424
3067
|
"get",
|
|
2425
|
-
`/service/platform/catalog/v1.0/company/${this.config.companyId}/
|
|
3068
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/departments/${uid}/`,
|
|
2426
3069
|
query_params,
|
|
2427
3070
|
undefined,
|
|
2428
3071
|
{ ...xHeaders, ...requestHeaders },
|
|
@@ -2436,10 +3079,10 @@ class Catalog {
|
|
|
2436
3079
|
|
|
2437
3080
|
const {
|
|
2438
3081
|
error: res_error,
|
|
2439
|
-
} = CatalogPlatformModel.
|
|
2440
|
-
|
|
2441
|
-
allowUnknown: true
|
|
2442
|
-
|
|
3082
|
+
} = CatalogPlatformModel.DepartmentsResponseSchema().validate(
|
|
3083
|
+
responseData,
|
|
3084
|
+
{ abortEarly: false, allowUnknown: true }
|
|
3085
|
+
);
|
|
2443
3086
|
|
|
2444
3087
|
if (res_error) {
|
|
2445
3088
|
if (this.config.options.strictResponseCheck === true) {
|
|
@@ -2447,7 +3090,7 @@ class Catalog {
|
|
|
2447
3090
|
} else {
|
|
2448
3091
|
Logger({
|
|
2449
3092
|
level: "WARN",
|
|
2450
|
-
message: `Response Validation Warnings for platform > Catalog >
|
|
3093
|
+
message: `Response Validation Warnings for platform > Catalog > getDepartmentData \n ${res_error}`,
|
|
2451
3094
|
});
|
|
2452
3095
|
}
|
|
2453
3096
|
}
|
|
@@ -2456,22 +3099,27 @@ class Catalog {
|
|
|
2456
3099
|
}
|
|
2457
3100
|
|
|
2458
3101
|
/**
|
|
2459
|
-
* @param {CatalogPlatformValidator.
|
|
3102
|
+
* @param {CatalogPlatformValidator.GetHsCodesParam} arg - Arg object
|
|
2460
3103
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2461
3104
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2462
|
-
* @returns {Promise<CatalogPlatformModel.
|
|
2463
|
-
*
|
|
2464
|
-
* @
|
|
2465
|
-
* @
|
|
2466
|
-
*
|
|
3105
|
+
* @returns {Promise<CatalogPlatformModel.HSCodes>} - Success response
|
|
3106
|
+
* @name getHsCodes
|
|
3107
|
+
* @summary: Get HS/SAC codes
|
|
3108
|
+
* @description: Retrieve a list of HS (Harmonized System) or SAC (Service Accounting Code) codes for a company.
|
|
3109
|
+
* HS codes are used for classifying goods in international trade, while SAC codes are used for classifying services for taxation purposes.
|
|
3110
|
+
* Supports optional filtering and pagination.
|
|
3111
|
+
* - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/platform/catalog/getHsCodes/).
|
|
2467
3112
|
*/
|
|
2468
|
-
async
|
|
2469
|
-
{
|
|
3113
|
+
async getHsCodes(
|
|
3114
|
+
{ page, limit, type, q, requestHeaders } = { requestHeaders: {} },
|
|
2470
3115
|
{ responseHeaders } = { responseHeaders: false }
|
|
2471
3116
|
) {
|
|
2472
|
-
const { error } = CatalogPlatformValidator.
|
|
3117
|
+
const { error } = CatalogPlatformValidator.getHsCodes().validate(
|
|
2473
3118
|
{
|
|
2474
|
-
|
|
3119
|
+
page,
|
|
3120
|
+
limit,
|
|
3121
|
+
type,
|
|
3122
|
+
q,
|
|
2475
3123
|
},
|
|
2476
3124
|
{ abortEarly: false, allowUnknown: true }
|
|
2477
3125
|
);
|
|
@@ -2480,29 +3128,34 @@ class Catalog {
|
|
|
2480
3128
|
}
|
|
2481
3129
|
|
|
2482
3130
|
// Showing warrnings if extra unknown parameters are found
|
|
2483
|
-
const {
|
|
2484
|
-
error: warrning,
|
|
2485
|
-
} = CatalogPlatformValidator.getDepartmentData().validate(
|
|
3131
|
+
const { error: warrning } = CatalogPlatformValidator.getHsCodes().validate(
|
|
2486
3132
|
{
|
|
2487
|
-
|
|
3133
|
+
page,
|
|
3134
|
+
limit,
|
|
3135
|
+
type,
|
|
3136
|
+
q,
|
|
2488
3137
|
},
|
|
2489
3138
|
{ abortEarly: false, allowUnknown: false }
|
|
2490
3139
|
);
|
|
2491
3140
|
if (warrning) {
|
|
2492
3141
|
Logger({
|
|
2493
3142
|
level: "WARN",
|
|
2494
|
-
message: `Parameter Validation warrnings for platform > Catalog >
|
|
3143
|
+
message: `Parameter Validation warrnings for platform > Catalog > getHsCodes \n ${warrning}`,
|
|
2495
3144
|
});
|
|
2496
3145
|
}
|
|
2497
3146
|
|
|
2498
3147
|
const query_params = {};
|
|
3148
|
+
query_params["page"] = page;
|
|
3149
|
+
query_params["limit"] = limit;
|
|
3150
|
+
query_params["type"] = type;
|
|
3151
|
+
query_params["q"] = q;
|
|
2499
3152
|
|
|
2500
3153
|
const xHeaders = {};
|
|
2501
3154
|
|
|
2502
3155
|
const response = await PlatformAPIClient.execute(
|
|
2503
3156
|
this.config,
|
|
2504
3157
|
"get",
|
|
2505
|
-
`/service/platform/catalog/v1.0/company/${this.config.companyId}/
|
|
3158
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/taxes/hscodes`,
|
|
2506
3159
|
query_params,
|
|
2507
3160
|
undefined,
|
|
2508
3161
|
{ ...xHeaders, ...requestHeaders },
|
|
@@ -2516,10 +3169,10 @@ class Catalog {
|
|
|
2516
3169
|
|
|
2517
3170
|
const {
|
|
2518
3171
|
error: res_error,
|
|
2519
|
-
} = CatalogPlatformModel.
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
);
|
|
3172
|
+
} = CatalogPlatformModel.HSCodes().validate(responseData, {
|
|
3173
|
+
abortEarly: false,
|
|
3174
|
+
allowUnknown: true,
|
|
3175
|
+
});
|
|
2523
3176
|
|
|
2524
3177
|
if (res_error) {
|
|
2525
3178
|
if (this.config.options.strictResponseCheck === true) {
|
|
@@ -2527,7 +3180,7 @@ class Catalog {
|
|
|
2527
3180
|
} else {
|
|
2528
3181
|
Logger({
|
|
2529
3182
|
level: "WARN",
|
|
2530
|
-
message: `Response Validation Warnings for platform > Catalog >
|
|
3183
|
+
message: `Response Validation Warnings for platform > Catalog > getHsCodes \n ${res_error}`,
|
|
2531
3184
|
});
|
|
2532
3185
|
}
|
|
2533
3186
|
}
|
|
@@ -5158,6 +5811,171 @@ class Catalog {
|
|
|
5158
5811
|
return paginator;
|
|
5159
5812
|
}
|
|
5160
5813
|
|
|
5814
|
+
/**
|
|
5815
|
+
* @param {CatalogPlatformValidator.GetTaxComponentNamesParam} arg - Arg object
|
|
5816
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
5817
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
5818
|
+
* @returns {Promise<CatalogPlatformModel.GetTaxComponents>} - Success response
|
|
5819
|
+
* @name getTaxComponentNames
|
|
5820
|
+
* @summary: Get component names
|
|
5821
|
+
* @description: Get component names for a company. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/platform/catalog/getTaxComponentNames/).
|
|
5822
|
+
*/
|
|
5823
|
+
async getTaxComponentNames(
|
|
5824
|
+
{ requestHeaders } = { requestHeaders: {} },
|
|
5825
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
5826
|
+
) {
|
|
5827
|
+
const { error } = CatalogPlatformValidator.getTaxComponentNames().validate(
|
|
5828
|
+
{},
|
|
5829
|
+
{ abortEarly: false, allowUnknown: true }
|
|
5830
|
+
);
|
|
5831
|
+
if (error) {
|
|
5832
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
5833
|
+
}
|
|
5834
|
+
|
|
5835
|
+
// Showing warrnings if extra unknown parameters are found
|
|
5836
|
+
const {
|
|
5837
|
+
error: warrning,
|
|
5838
|
+
} = CatalogPlatformValidator.getTaxComponentNames().validate(
|
|
5839
|
+
{},
|
|
5840
|
+
{ abortEarly: false, allowUnknown: false }
|
|
5841
|
+
);
|
|
5842
|
+
if (warrning) {
|
|
5843
|
+
Logger({
|
|
5844
|
+
level: "WARN",
|
|
5845
|
+
message: `Parameter Validation warrnings for platform > Catalog > getTaxComponentNames \n ${warrning}`,
|
|
5846
|
+
});
|
|
5847
|
+
}
|
|
5848
|
+
|
|
5849
|
+
const query_params = {};
|
|
5850
|
+
|
|
5851
|
+
const xHeaders = {};
|
|
5852
|
+
|
|
5853
|
+
const response = await PlatformAPIClient.execute(
|
|
5854
|
+
this.config,
|
|
5855
|
+
"get",
|
|
5856
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/taxes/component-names`,
|
|
5857
|
+
query_params,
|
|
5858
|
+
undefined,
|
|
5859
|
+
{ ...xHeaders, ...requestHeaders },
|
|
5860
|
+
{ responseHeaders }
|
|
5861
|
+
);
|
|
5862
|
+
|
|
5863
|
+
let responseData = response;
|
|
5864
|
+
if (responseHeaders) {
|
|
5865
|
+
responseData = response[0];
|
|
5866
|
+
}
|
|
5867
|
+
|
|
5868
|
+
const {
|
|
5869
|
+
error: res_error,
|
|
5870
|
+
} = CatalogPlatformModel.GetTaxComponents().validate(responseData, {
|
|
5871
|
+
abortEarly: false,
|
|
5872
|
+
allowUnknown: true,
|
|
5873
|
+
});
|
|
5874
|
+
|
|
5875
|
+
if (res_error) {
|
|
5876
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
5877
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
5878
|
+
} else {
|
|
5879
|
+
Logger({
|
|
5880
|
+
level: "WARN",
|
|
5881
|
+
message: `Response Validation Warnings for platform > Catalog > getTaxComponentNames \n ${res_error}`,
|
|
5882
|
+
});
|
|
5883
|
+
}
|
|
5884
|
+
}
|
|
5885
|
+
|
|
5886
|
+
return response;
|
|
5887
|
+
}
|
|
5888
|
+
|
|
5889
|
+
/**
|
|
5890
|
+
* @param {CatalogPlatformValidator.GetTaxVersionDetailsParam} arg - Arg object
|
|
5891
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
5892
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
5893
|
+
* @returns {Promise<CatalogPlatformModel.TaxRuleVersion>} - Success response
|
|
5894
|
+
* @name getTaxVersionDetails
|
|
5895
|
+
* @summary: Get tax versions for a tax rule
|
|
5896
|
+
* @description: Retrieve versions of a tax rule with support for filtering by query parameters (e.g., live, past, all). - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/platform/catalog/getTaxVersionDetails/).
|
|
5897
|
+
*/
|
|
5898
|
+
async getTaxVersionDetails(
|
|
5899
|
+
{ ruleId, versionStatus, limit, page, requestHeaders } = {
|
|
5900
|
+
requestHeaders: {},
|
|
5901
|
+
},
|
|
5902
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
5903
|
+
) {
|
|
5904
|
+
const { error } = CatalogPlatformValidator.getTaxVersionDetails().validate(
|
|
5905
|
+
{
|
|
5906
|
+
ruleId,
|
|
5907
|
+
versionStatus,
|
|
5908
|
+
limit,
|
|
5909
|
+
page,
|
|
5910
|
+
},
|
|
5911
|
+
{ abortEarly: false, allowUnknown: true }
|
|
5912
|
+
);
|
|
5913
|
+
if (error) {
|
|
5914
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
5915
|
+
}
|
|
5916
|
+
|
|
5917
|
+
// Showing warrnings if extra unknown parameters are found
|
|
5918
|
+
const {
|
|
5919
|
+
error: warrning,
|
|
5920
|
+
} = CatalogPlatformValidator.getTaxVersionDetails().validate(
|
|
5921
|
+
{
|
|
5922
|
+
ruleId,
|
|
5923
|
+
versionStatus,
|
|
5924
|
+
limit,
|
|
5925
|
+
page,
|
|
5926
|
+
},
|
|
5927
|
+
{ abortEarly: false, allowUnknown: false }
|
|
5928
|
+
);
|
|
5929
|
+
if (warrning) {
|
|
5930
|
+
Logger({
|
|
5931
|
+
level: "WARN",
|
|
5932
|
+
message: `Parameter Validation warrnings for platform > Catalog > getTaxVersionDetails \n ${warrning}`,
|
|
5933
|
+
});
|
|
5934
|
+
}
|
|
5935
|
+
|
|
5936
|
+
const query_params = {};
|
|
5937
|
+
query_params["version_status"] = versionStatus;
|
|
5938
|
+
query_params["limit"] = limit;
|
|
5939
|
+
query_params["page"] = page;
|
|
5940
|
+
|
|
5941
|
+
const xHeaders = {};
|
|
5942
|
+
|
|
5943
|
+
const response = await PlatformAPIClient.execute(
|
|
5944
|
+
this.config,
|
|
5945
|
+
"get",
|
|
5946
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/taxes/rules/${ruleId}/versions`,
|
|
5947
|
+
query_params,
|
|
5948
|
+
undefined,
|
|
5949
|
+
{ ...xHeaders, ...requestHeaders },
|
|
5950
|
+
{ responseHeaders }
|
|
5951
|
+
);
|
|
5952
|
+
|
|
5953
|
+
let responseData = response;
|
|
5954
|
+
if (responseHeaders) {
|
|
5955
|
+
responseData = response[0];
|
|
5956
|
+
}
|
|
5957
|
+
|
|
5958
|
+
const {
|
|
5959
|
+
error: res_error,
|
|
5960
|
+
} = CatalogPlatformModel.TaxRuleVersion().validate(responseData, {
|
|
5961
|
+
abortEarly: false,
|
|
5962
|
+
allowUnknown: true,
|
|
5963
|
+
});
|
|
5964
|
+
|
|
5965
|
+
if (res_error) {
|
|
5966
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
5967
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
5968
|
+
} else {
|
|
5969
|
+
Logger({
|
|
5970
|
+
level: "WARN",
|
|
5971
|
+
message: `Response Validation Warnings for platform > Catalog > getTaxVersionDetails \n ${res_error}`,
|
|
5972
|
+
});
|
|
5973
|
+
}
|
|
5974
|
+
}
|
|
5975
|
+
|
|
5976
|
+
return response;
|
|
5977
|
+
}
|
|
5978
|
+
|
|
5161
5979
|
/**
|
|
5162
5980
|
* @param {CatalogPlatformValidator.GetVariantsOfProductsParam} arg - Arg object
|
|
5163
5981
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
@@ -6766,22 +7584,21 @@ class Catalog {
|
|
|
6766
7584
|
}
|
|
6767
7585
|
|
|
6768
7586
|
/**
|
|
6769
|
-
* @param {CatalogPlatformValidator.
|
|
7587
|
+
* @param {CatalogPlatformValidator.UpdateTaxRuleParam} arg - Arg object
|
|
6770
7588
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
6771
7589
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
6772
|
-
* @returns {Promise<CatalogPlatformModel.
|
|
6773
|
-
* @name
|
|
6774
|
-
* @summary:
|
|
6775
|
-
* @description:
|
|
7590
|
+
* @returns {Promise<CatalogPlatformModel.TaxRule>} - Success response
|
|
7591
|
+
* @name updateTaxRule
|
|
7592
|
+
* @summary: Update Tax Rule
|
|
7593
|
+
* @description: Update an existing tax rule under a specific company. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/platform/catalog/updateTaxRule/).
|
|
6776
7594
|
*/
|
|
6777
|
-
async
|
|
6778
|
-
{
|
|
7595
|
+
async updateTaxRule(
|
|
7596
|
+
{ ruleId, body, requestHeaders } = { requestHeaders: {} },
|
|
6779
7597
|
{ responseHeaders } = { responseHeaders: false }
|
|
6780
7598
|
) {
|
|
6781
|
-
const { error } = CatalogPlatformValidator.
|
|
7599
|
+
const { error } = CatalogPlatformValidator.updateTaxRule().validate(
|
|
6782
7600
|
{
|
|
6783
|
-
|
|
6784
|
-
productType,
|
|
7601
|
+
ruleId,
|
|
6785
7602
|
body,
|
|
6786
7603
|
},
|
|
6787
7604
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -6793,10 +7610,9 @@ class Catalog {
|
|
|
6793
7610
|
// Showing warrnings if extra unknown parameters are found
|
|
6794
7611
|
const {
|
|
6795
7612
|
error: warrning,
|
|
6796
|
-
} = CatalogPlatformValidator.
|
|
7613
|
+
} = CatalogPlatformValidator.updateTaxRule().validate(
|
|
6797
7614
|
{
|
|
6798
|
-
|
|
6799
|
-
productType,
|
|
7615
|
+
ruleId,
|
|
6800
7616
|
body,
|
|
6801
7617
|
},
|
|
6802
7618
|
{ abortEarly: false, allowUnknown: false }
|
|
@@ -6804,20 +7620,18 @@ class Catalog {
|
|
|
6804
7620
|
if (warrning) {
|
|
6805
7621
|
Logger({
|
|
6806
7622
|
level: "WARN",
|
|
6807
|
-
message: `Parameter Validation warrnings for platform > Catalog >
|
|
7623
|
+
message: `Parameter Validation warrnings for platform > Catalog > updateTaxRule \n ${warrning}`,
|
|
6808
7624
|
});
|
|
6809
7625
|
}
|
|
6810
7626
|
|
|
6811
7627
|
const query_params = {};
|
|
6812
|
-
query_params["department"] = department;
|
|
6813
|
-
query_params["product_type"] = productType;
|
|
6814
7628
|
|
|
6815
7629
|
const xHeaders = {};
|
|
6816
7630
|
|
|
6817
7631
|
const response = await PlatformAPIClient.execute(
|
|
6818
7632
|
this.config,
|
|
6819
|
-
"
|
|
6820
|
-
`/service/platform/catalog/
|
|
7633
|
+
"put",
|
|
7634
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/taxes/rules/${ruleId}`,
|
|
6821
7635
|
query_params,
|
|
6822
7636
|
body,
|
|
6823
7637
|
{ ...xHeaders, ...requestHeaders },
|
|
@@ -6831,7 +7645,92 @@ class Catalog {
|
|
|
6831
7645
|
|
|
6832
7646
|
const {
|
|
6833
7647
|
error: res_error,
|
|
6834
|
-
} = CatalogPlatformModel.
|
|
7648
|
+
} = CatalogPlatformModel.TaxRule().validate(responseData, {
|
|
7649
|
+
abortEarly: false,
|
|
7650
|
+
allowUnknown: true,
|
|
7651
|
+
});
|
|
7652
|
+
|
|
7653
|
+
if (res_error) {
|
|
7654
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
7655
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
7656
|
+
} else {
|
|
7657
|
+
Logger({
|
|
7658
|
+
level: "WARN",
|
|
7659
|
+
message: `Response Validation Warnings for platform > Catalog > updateTaxRule \n ${res_error}`,
|
|
7660
|
+
});
|
|
7661
|
+
}
|
|
7662
|
+
}
|
|
7663
|
+
|
|
7664
|
+
return response;
|
|
7665
|
+
}
|
|
7666
|
+
|
|
7667
|
+
/**
|
|
7668
|
+
* @param {CatalogPlatformValidator.UpdateTaxVersionParam} arg - Arg object
|
|
7669
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
7670
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
7671
|
+
* @returns {Promise<CatalogPlatformModel.TaxVersion>} - Success response
|
|
7672
|
+
* @name updateTaxVersion
|
|
7673
|
+
* @summary: Update a tax version
|
|
7674
|
+
* @description: Updates a tax rule using the provided rule_id. You can update any part of a scheduled version but only tax name of live version can be updated. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/platform/catalog/updateTaxVersion/).
|
|
7675
|
+
*/
|
|
7676
|
+
async updateTaxVersion(
|
|
7677
|
+
{ ruleId, versionId, body, requestHeaders } = { requestHeaders: {} },
|
|
7678
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
7679
|
+
) {
|
|
7680
|
+
const { error } = CatalogPlatformValidator.updateTaxVersion().validate(
|
|
7681
|
+
{
|
|
7682
|
+
ruleId,
|
|
7683
|
+
versionId,
|
|
7684
|
+
|
|
7685
|
+
body,
|
|
7686
|
+
},
|
|
7687
|
+
{ abortEarly: false, allowUnknown: true }
|
|
7688
|
+
);
|
|
7689
|
+
if (error) {
|
|
7690
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
7691
|
+
}
|
|
7692
|
+
|
|
7693
|
+
// Showing warrnings if extra unknown parameters are found
|
|
7694
|
+
const {
|
|
7695
|
+
error: warrning,
|
|
7696
|
+
} = CatalogPlatformValidator.updateTaxVersion().validate(
|
|
7697
|
+
{
|
|
7698
|
+
ruleId,
|
|
7699
|
+
versionId,
|
|
7700
|
+
|
|
7701
|
+
body,
|
|
7702
|
+
},
|
|
7703
|
+
{ abortEarly: false, allowUnknown: false }
|
|
7704
|
+
);
|
|
7705
|
+
if (warrning) {
|
|
7706
|
+
Logger({
|
|
7707
|
+
level: "WARN",
|
|
7708
|
+
message: `Parameter Validation warrnings for platform > Catalog > updateTaxVersion \n ${warrning}`,
|
|
7709
|
+
});
|
|
7710
|
+
}
|
|
7711
|
+
|
|
7712
|
+
const query_params = {};
|
|
7713
|
+
|
|
7714
|
+
const xHeaders = {};
|
|
7715
|
+
|
|
7716
|
+
const response = await PlatformAPIClient.execute(
|
|
7717
|
+
this.config,
|
|
7718
|
+
"put",
|
|
7719
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/taxes/rules/${ruleId}/versions/${versionId}`,
|
|
7720
|
+
query_params,
|
|
7721
|
+
body,
|
|
7722
|
+
{ ...xHeaders, ...requestHeaders },
|
|
7723
|
+
{ responseHeaders }
|
|
7724
|
+
);
|
|
7725
|
+
|
|
7726
|
+
let responseData = response;
|
|
7727
|
+
if (responseHeaders) {
|
|
7728
|
+
responseData = response[0];
|
|
7729
|
+
}
|
|
7730
|
+
|
|
7731
|
+
const {
|
|
7732
|
+
error: res_error,
|
|
7733
|
+
} = CatalogPlatformModel.TaxVersion().validate(responseData, {
|
|
6835
7734
|
abortEarly: false,
|
|
6836
7735
|
allowUnknown: true,
|
|
6837
7736
|
});
|
|
@@ -6842,7 +7741,7 @@ class Catalog {
|
|
|
6842
7741
|
} else {
|
|
6843
7742
|
Logger({
|
|
6844
7743
|
level: "WARN",
|
|
6845
|
-
message: `Response Validation Warnings for platform > Catalog >
|
|
7744
|
+
message: `Response Validation Warnings for platform > Catalog > updateTaxVersion \n ${res_error}`,
|
|
6846
7745
|
});
|
|
6847
7746
|
}
|
|
6848
7747
|
}
|