@pmcretail/mapper-library 0.0.16 → 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 +46 -19
- 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 +46 -20
- package/esm5/lib/WebReturn-mapper.class.js +47 -20
- package/fesm2015/pmcretail-mapper-library.js +45 -19
- package/fesm2015/pmcretail-mapper-library.js.map +1 -1
- package/fesm5/pmcretail-mapper-library.js +46 -19
- 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);
|
|
@@ -6406,39 +6407,62 @@ var WebReturnMapperBuilderClass = /** @class */ (function () {
|
|
|
6406
6407
|
(/** @type {?} */ (this)).webReturnObject['customer']['shippingAddress']['postCode'] = ((/** @type {?} */ (this)).document.shipping_address && (/** @type {?} */ (this)).document.shipping_address.postcode) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.shipping_address.postcode) : '';
|
|
6407
6408
|
(/** @type {?} */ (this)).webReturnObject['customer']['shippingAddress']['country'] = ((/** @type {?} */ (this)).document.shipping_address && (/** @type {?} */ (this)).document.shipping_address.country) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.shipping_address.country) : '';
|
|
6408
6409
|
// basketSummary
|
|
6409
|
-
(/** @type {?} */ (this)).webReturnObject.basketSummary['discountTotal'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.discount_amount);
|
|
6410
|
-
(/** @type {?} */ (this)).webReturnObject.basketSummary['VATTotal'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_paid);
|
|
6411
|
-
(/** @type {?} */ (this)).webReturnObject.basketSummary['saleTotal'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_invoiced);
|
|
6412
|
-
(/** @type {?} */ (this)).webReturnObject.basketSummary['basketTotal'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_paid);
|
|
6413
|
-
(/** @type {?} */ (this)).webReturnObject.basketSummary['totalItems'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.total_qty_ordered);
|
|
6414
|
-
(/** @type {?} */ (this)).webReturnObject.basketSummary['refundTotal'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_refunded)
|
|
6410
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['discountTotal'] = Number((/** @type {?} */ (this)).document.discount_amount ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.discount_amount) : 0);
|
|
6411
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['VATTotal'] = Number((/** @type {?} */ (this)).document.base_total_paid ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_paid) : 0);
|
|
6412
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['saleTotal'] = Number((/** @type {?} */ (this)).document.base_total_invoiced ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_invoiced) : 0);
|
|
6413
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['basketTotal'] = Number((/** @type {?} */ (this)).document.base_total_paid ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_paid) : 0);
|
|
6414
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['totalItems'] = Number((/** @type {?} */ (this)).document.total_qty_ordered ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.total_qty_ordered) : 0);
|
|
6415
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['refundTotal'] = Number((/** @type {?} */ (this)).document.base_total_refunded ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_refunded) : 0);
|
|
6415
6416
|
// basket line discount
|
|
6416
6417
|
(/** @type {?} */ (this)).webReturnObject.basket['lineDiscount'] = [];
|
|
6417
6418
|
/** @type {?} */
|
|
6418
6419
|
var lineDiscount = {
|
|
6419
|
-
itemLineId: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.item_id) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items
|
|
6420
|
-
discountAmount: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.discount_amount) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items
|
|
6420
|
+
itemLineId: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.item_id) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.item_id) : 0,
|
|
6421
|
+
discountAmount: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.discount_amount) ? Number((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.discount_amount)) : 0
|
|
6421
6422
|
};
|
|
6422
6423
|
(/** @type {?} */ (this)).webReturnObject.basket['lineDiscount'].push(lineDiscount);
|
|
6423
6424
|
// basket transaction discount
|
|
6424
6425
|
(/** @type {?} */ (this)).webReturnObject.basket['transactionDiscount'] = [];
|
|
6425
6426
|
/** @type {?} */
|
|
6426
6427
|
var transactionDiscount = {
|
|
6427
|
-
discountAmount: (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.discount_amount)
|
|
6428
|
+
discountAmount: ((/** @type {?} */ (this)).document && (/** @type {?} */ (this)).document.discount_amount) ? Number((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.discount_amount)) : 0
|
|
6428
6429
|
};
|
|
6429
6430
|
(/** @type {?} */ (this)).webReturnObject.basket['transactionDiscount'].push(transactionDiscount);
|
|
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
|