@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
|
@@ -6597,6 +6597,7 @@
|
|
|
6597
6597
|
* @return {THIS}
|
|
6598
6598
|
*/
|
|
6599
6599
|
function () {
|
|
6600
|
+
var _this = this;
|
|
6600
6601
|
(/** @type {?} */ (this)).webReturnObject['type'] = 'WEB_RETURNS';
|
|
6601
6602
|
(/** @type {?} */ (this)).webReturnObject['datetime'] = (/** @type {?} */ (this)).getUTCDateTime((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.updated_at));
|
|
6602
6603
|
(/** @type {?} */ (this)).webReturnObject.baseCurrency = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_currency_code);
|
|
@@ -6626,39 +6627,62 @@
|
|
|
6626
6627
|
(/** @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) : '';
|
|
6627
6628
|
(/** @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) : '';
|
|
6628
6629
|
// basketSummary
|
|
6629
|
-
(/** @type {?} */ (this)).webReturnObject.basketSummary['discountTotal'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.discount_amount);
|
|
6630
|
-
(/** @type {?} */ (this)).webReturnObject.basketSummary['VATTotal'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_paid);
|
|
6631
|
-
(/** @type {?} */ (this)).webReturnObject.basketSummary['saleTotal'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_invoiced);
|
|
6632
|
-
(/** @type {?} */ (this)).webReturnObject.basketSummary['basketTotal'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_paid);
|
|
6633
|
-
(/** @type {?} */ (this)).webReturnObject.basketSummary['totalItems'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.total_qty_ordered);
|
|
6634
|
-
(/** @type {?} */ (this)).webReturnObject.basketSummary['refundTotal'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_refunded)
|
|
6630
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['discountTotal'] = Number((/** @type {?} */ (this)).document.discount_amount ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.discount_amount) : 0);
|
|
6631
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['VATTotal'] = Number((/** @type {?} */ (this)).document.base_total_paid ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_paid) : 0);
|
|
6632
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['saleTotal'] = Number((/** @type {?} */ (this)).document.base_total_invoiced ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_invoiced) : 0);
|
|
6633
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['basketTotal'] = Number((/** @type {?} */ (this)).document.base_total_paid ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_paid) : 0);
|
|
6634
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['totalItems'] = Number((/** @type {?} */ (this)).document.total_qty_ordered ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.total_qty_ordered) : 0);
|
|
6635
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['refundTotal'] = Number((/** @type {?} */ (this)).document.base_total_refunded ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_refunded) : 0);
|
|
6635
6636
|
// basket line discount
|
|
6636
6637
|
(/** @type {?} */ (this)).webReturnObject.basket['lineDiscount'] = [];
|
|
6637
6638
|
/** @type {?} */
|
|
6638
6639
|
var lineDiscount = {
|
|
6639
|
-
itemLineId: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.item_id) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items
|
|
6640
|
-
discountAmount: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.discount_amount) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items
|
|
6640
|
+
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,
|
|
6641
|
+
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
|
|
6641
6642
|
};
|
|
6642
6643
|
(/** @type {?} */ (this)).webReturnObject.basket['lineDiscount'].push(lineDiscount);
|
|
6643
6644
|
// basket transaction discount
|
|
6644
6645
|
(/** @type {?} */ (this)).webReturnObject.basket['transactionDiscount'] = [];
|
|
6645
6646
|
/** @type {?} */
|
|
6646
6647
|
var transactionDiscount = {
|
|
6647
|
-
discountAmount: (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.discount_amount)
|
|
6648
|
+
discountAmount: ((/** @type {?} */ (this)).document && (/** @type {?} */ (this)).document.discount_amount) ? Number((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.discount_amount)) : 0
|
|
6648
6649
|
};
|
|
6649
6650
|
(/** @type {?} */ (this)).webReturnObject.basket['transactionDiscount'].push(transactionDiscount);
|
|
6650
6651
|
// basket products
|
|
6651
6652
|
(/** @type {?} */ (this)).webReturnObject.basket['products'] = [];
|
|
6652
6653
|
/** @type {?} */
|
|
6653
|
-
var product = {
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6654
|
+
var product = {};
|
|
6655
|
+
if ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item) {
|
|
6656
|
+
if ((/** @type {?} */ (this)).document.items.item instanceof Array) {
|
|
6657
|
+
(/** @type {?} */ (this)).document.items.item.forEach((/**
|
|
6658
|
+
* @param {?} element
|
|
6659
|
+
* @return {?}
|
|
6660
|
+
*/
|
|
6661
|
+
function (element) {
|
|
6662
|
+
product = {
|
|
6663
|
+
description: (element.name) ? (/** @type {?} */ (_this)).getText(element.name) : '',
|
|
6664
|
+
SKU: (element.sku) ? (/** @type {?} */ (_this)).getText(element.sku) : '',
|
|
6665
|
+
quantity: (element.qty_ordered) ? Number((/** @type {?} */ (_this)).getText(element.qty_ordered)) : 0,
|
|
6666
|
+
refundedQuantity: (element.qty_refunded) ? Number((/** @type {?} */ (_this)).getText((/** @type {?} */ (_this)).document.items.item.qty_refunded)) : 0,
|
|
6667
|
+
price: (element.original_price) ? Number((/** @type {?} */ (_this)).getText(element.original_price)) : 0,
|
|
6668
|
+
itemLineId: (element.item_id) ? Number((/** @type {?} */ (_this)).getText(element.item_id)) : 0,
|
|
6669
|
+
totalLinePrice: (element.row_invoiced) ? Number((/** @type {?} */ (_this)).getText(element.row_invoiced)) : 0,
|
|
6670
|
+
};
|
|
6671
|
+
(/** @type {?} */ (_this)).webReturnObject.basket['products'].push(product);
|
|
6672
|
+
}));
|
|
6673
|
+
}
|
|
6674
|
+
else {
|
|
6675
|
+
product = {
|
|
6676
|
+
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) : '',
|
|
6677
|
+
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) : '',
|
|
6678
|
+
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,
|
|
6679
|
+
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,
|
|
6680
|
+
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,
|
|
6681
|
+
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,
|
|
6682
|
+
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,
|
|
6683
|
+
};
|
|
6684
|
+
}
|
|
6685
|
+
}
|
|
6662
6686
|
(/** @type {?} */ (this)).webReturnObject.basket['products'].push(product);
|
|
6663
6687
|
return (/** @type {?} */ (this));
|
|
6664
6688
|
};
|
|
@@ -6824,9 +6848,12 @@
|
|
|
6824
6848
|
* @return {?}
|
|
6825
6849
|
*/
|
|
6826
6850
|
function (obj) {
|
|
6827
|
-
if (obj) {
|
|
6851
|
+
if (obj && obj.text) {
|
|
6828
6852
|
return obj.text;
|
|
6829
6853
|
}
|
|
6854
|
+
else {
|
|
6855
|
+
return obj;
|
|
6856
|
+
}
|
|
6830
6857
|
};
|
|
6831
6858
|
/**
|
|
6832
6859
|
* @param {?} date
|