@pmcretail/mapper-library 0.0.17 → 0.0.18
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/bundles/pmcretail-mapper-library.umd.js +37 -10
- package/bundles/pmcretail-mapper-library.umd.js.map +1 -1
- package/bundles/pmcretail-mapper-library.umd.min.js +1 -1
- package/bundles/pmcretail-mapper-library.umd.min.js.map +1 -1
- package/esm2015/lib/WebReturn-mapper.class.js +37 -11
- package/esm5/lib/WebReturn-mapper.class.js +38 -11
- package/fesm2015/pmcretail-mapper-library.js +36 -10
- package/fesm2015/pmcretail-mapper-library.js.map +1 -1
- package/fesm5/pmcretail-mapper-library.js +37 -10
- package/fesm5/pmcretail-mapper-library.js.map +1 -1
- package/package.json +1 -1
|
@@ -6377,6 +6377,7 @@ var WebReturnMapperBuilderClass = /** @class */ (function () {
|
|
|
6377
6377
|
* @return {THIS}
|
|
6378
6378
|
*/
|
|
6379
6379
|
function () {
|
|
6380
|
+
var _this = this;
|
|
6380
6381
|
(/** @type {?} */ (this)).webReturnObject['type'] = 'WEB_RETURNS';
|
|
6381
6382
|
(/** @type {?} */ (this)).webReturnObject['datetime'] = (/** @type {?} */ (this)).getUTCDateTime((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.updated_at));
|
|
6382
6383
|
(/** @type {?} */ (this)).webReturnObject.baseCurrency = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_currency_code);
|
|
@@ -6430,15 +6431,38 @@ var WebReturnMapperBuilderClass = /** @class */ (function () {
|
|
|
6430
6431
|
// basket products
|
|
6431
6432
|
(/** @type {?} */ (this)).webReturnObject.basket['products'] = [];
|
|
6432
6433
|
/** @type {?} */
|
|
6433
|
-
var product = {
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6434
|
+
var product = {};
|
|
6435
|
+
if ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item) {
|
|
6436
|
+
if ((/** @type {?} */ (this)).document.items.item instanceof Array) {
|
|
6437
|
+
(/** @type {?} */ (this)).document.items.item.forEach((/**
|
|
6438
|
+
* @param {?} element
|
|
6439
|
+
* @return {?}
|
|
6440
|
+
*/
|
|
6441
|
+
function (element) {
|
|
6442
|
+
product = {
|
|
6443
|
+
description: (element.name) ? (/** @type {?} */ (_this)).getText(element.name) : '',
|
|
6444
|
+
SKU: (element.sku) ? (/** @type {?} */ (_this)).getText(element.sku) : '',
|
|
6445
|
+
quantity: (element.qty_ordered) ? Number((/** @type {?} */ (_this)).getText(element.qty_ordered)) : 0,
|
|
6446
|
+
refundedQuantity: (element.qty_refunded) ? Number((/** @type {?} */ (_this)).getText((/** @type {?} */ (_this)).document.items.item.qty_refunded)) : 0,
|
|
6447
|
+
price: (element.original_price) ? Number((/** @type {?} */ (_this)).getText(element.original_price)) : 0,
|
|
6448
|
+
itemLineId: (element.item_id) ? Number((/** @type {?} */ (_this)).getText(element.item_id)) : 0,
|
|
6449
|
+
totalLinePrice: (element.row_invoiced) ? Number((/** @type {?} */ (_this)).getText(element.row_invoiced)) : 0,
|
|
6450
|
+
};
|
|
6451
|
+
(/** @type {?} */ (_this)).webReturnObject.basket['products'].push(product);
|
|
6452
|
+
}));
|
|
6453
|
+
}
|
|
6454
|
+
else {
|
|
6455
|
+
product = {
|
|
6456
|
+
description: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.name) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.name) : '',
|
|
6457
|
+
SKU: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.sku) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.sku) : '',
|
|
6458
|
+
quantity: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.qty_ordered) ? Number((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.qty_ordered)) : 0,
|
|
6459
|
+
refundedQuantity: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.qty_refunded) ? Number((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.qty_refunded)) : 0,
|
|
6460
|
+
price: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.original_price) ? Number((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.original_price)) : 0,
|
|
6461
|
+
itemLineId: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.item_id) ? Number((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.item_id)) : 0,
|
|
6462
|
+
totalLinePrice: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.row_invoiced) ? Number((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.row_invoiced)) : 0,
|
|
6463
|
+
};
|
|
6464
|
+
}
|
|
6465
|
+
}
|
|
6442
6466
|
(/** @type {?} */ (this)).webReturnObject.basket['products'].push(product);
|
|
6443
6467
|
return (/** @type {?} */ (this));
|
|
6444
6468
|
};
|
|
@@ -6604,9 +6628,12 @@ var WebReturnMapperBuilderClass = /** @class */ (function () {
|
|
|
6604
6628
|
* @return {?}
|
|
6605
6629
|
*/
|
|
6606
6630
|
function (obj) {
|
|
6607
|
-
if (obj) {
|
|
6631
|
+
if (obj && obj.text) {
|
|
6608
6632
|
return obj.text;
|
|
6609
6633
|
}
|
|
6634
|
+
else {
|
|
6635
|
+
return obj;
|
|
6636
|
+
}
|
|
6610
6637
|
};
|
|
6611
6638
|
/**
|
|
6612
6639
|
* @param {?} date
|