@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
|
@@ -4989,39 +4989,62 @@ class WebReturnMapperBuilderClass {
|
|
|
4989
4989
|
(/** @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) : '';
|
|
4990
4990
|
(/** @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) : '';
|
|
4991
4991
|
// basketSummary
|
|
4992
|
-
(/** @type {?} */ (this)).webReturnObject.basketSummary['discountTotal'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.discount_amount);
|
|
4993
|
-
(/** @type {?} */ (this)).webReturnObject.basketSummary['VATTotal'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_paid);
|
|
4994
|
-
(/** @type {?} */ (this)).webReturnObject.basketSummary['saleTotal'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_invoiced);
|
|
4995
|
-
(/** @type {?} */ (this)).webReturnObject.basketSummary['basketTotal'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_paid);
|
|
4996
|
-
(/** @type {?} */ (this)).webReturnObject.basketSummary['totalItems'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.total_qty_ordered);
|
|
4997
|
-
(/** @type {?} */ (this)).webReturnObject.basketSummary['refundTotal'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_refunded)
|
|
4992
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['discountTotal'] = Number((/** @type {?} */ (this)).document.discount_amount ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.discount_amount) : 0);
|
|
4993
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['VATTotal'] = Number((/** @type {?} */ (this)).document.base_total_paid ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_paid) : 0);
|
|
4994
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['saleTotal'] = Number((/** @type {?} */ (this)).document.base_total_invoiced ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_invoiced) : 0);
|
|
4995
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['basketTotal'] = Number((/** @type {?} */ (this)).document.base_total_paid ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_paid) : 0);
|
|
4996
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['totalItems'] = Number((/** @type {?} */ (this)).document.total_qty_ordered ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.total_qty_ordered) : 0);
|
|
4997
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['refundTotal'] = Number((/** @type {?} */ (this)).document.base_total_refunded ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_refunded) : 0);
|
|
4998
4998
|
// basket line discount
|
|
4999
4999
|
(/** @type {?} */ (this)).webReturnObject.basket['lineDiscount'] = [];
|
|
5000
5000
|
/** @type {?} */
|
|
5001
5001
|
let lineDiscount = {
|
|
5002
|
-
itemLineId: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.item_id) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items
|
|
5003
|
-
discountAmount: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.discount_amount) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items
|
|
5002
|
+
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,
|
|
5003
|
+
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
|
|
5004
5004
|
};
|
|
5005
5005
|
(/** @type {?} */ (this)).webReturnObject.basket['lineDiscount'].push(lineDiscount);
|
|
5006
5006
|
// basket transaction discount
|
|
5007
5007
|
(/** @type {?} */ (this)).webReturnObject.basket['transactionDiscount'] = [];
|
|
5008
5008
|
/** @type {?} */
|
|
5009
5009
|
let transactionDiscount = {
|
|
5010
|
-
discountAmount: (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.discount_amount)
|
|
5010
|
+
discountAmount: ((/** @type {?} */ (this)).document && (/** @type {?} */ (this)).document.discount_amount) ? Number((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.discount_amount)) : 0
|
|
5011
5011
|
};
|
|
5012
5012
|
(/** @type {?} */ (this)).webReturnObject.basket['transactionDiscount'].push(transactionDiscount);
|
|
5013
5013
|
// basket products
|
|
5014
5014
|
(/** @type {?} */ (this)).webReturnObject.basket['products'] = [];
|
|
5015
5015
|
/** @type {?} */
|
|
5016
|
-
let product = {
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5016
|
+
let product = {};
|
|
5017
|
+
if ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item) {
|
|
5018
|
+
if ((/** @type {?} */ (this)).document.items.item instanceof Array) {
|
|
5019
|
+
(/** @type {?} */ (this)).document.items.item.forEach((/**
|
|
5020
|
+
* @param {?} element
|
|
5021
|
+
* @return {?}
|
|
5022
|
+
*/
|
|
5023
|
+
element => {
|
|
5024
|
+
product = {
|
|
5025
|
+
description: (element.name) ? (/** @type {?} */ (this)).getText(element.name) : '',
|
|
5026
|
+
SKU: (element.sku) ? (/** @type {?} */ (this)).getText(element.sku) : '',
|
|
5027
|
+
quantity: (element.qty_ordered) ? Number((/** @type {?} */ (this)).getText(element.qty_ordered)) : 0,
|
|
5028
|
+
refundedQuantity: (element.qty_refunded) ? Number((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.qty_refunded)) : 0,
|
|
5029
|
+
price: (element.original_price) ? Number((/** @type {?} */ (this)).getText(element.original_price)) : 0,
|
|
5030
|
+
itemLineId: (element.item_id) ? Number((/** @type {?} */ (this)).getText(element.item_id)) : 0,
|
|
5031
|
+
totalLinePrice: (element.row_invoiced) ? Number((/** @type {?} */ (this)).getText(element.row_invoiced)) : 0,
|
|
5032
|
+
};
|
|
5033
|
+
(/** @type {?} */ (this)).webReturnObject.basket['products'].push(product);
|
|
5034
|
+
}));
|
|
5035
|
+
}
|
|
5036
|
+
else {
|
|
5037
|
+
product = {
|
|
5038
|
+
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) : '',
|
|
5039
|
+
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) : '',
|
|
5040
|
+
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,
|
|
5041
|
+
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,
|
|
5042
|
+
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,
|
|
5043
|
+
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,
|
|
5044
|
+
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,
|
|
5045
|
+
};
|
|
5046
|
+
}
|
|
5047
|
+
}
|
|
5025
5048
|
(/** @type {?} */ (this)).webReturnObject.basket['products'].push(product);
|
|
5026
5049
|
return (/** @type {?} */ (this));
|
|
5027
5050
|
}
|
|
@@ -5126,9 +5149,12 @@ class WebReturnMapperBuilderClass {
|
|
|
5126
5149
|
* @return {?}
|
|
5127
5150
|
*/
|
|
5128
5151
|
getText(obj) {
|
|
5129
|
-
if (obj) {
|
|
5152
|
+
if (obj && obj.text) {
|
|
5130
5153
|
return obj.text;
|
|
5131
5154
|
}
|
|
5155
|
+
else {
|
|
5156
|
+
return obj;
|
|
5157
|
+
}
|
|
5132
5158
|
}
|
|
5133
5159
|
/**
|
|
5134
5160
|
* @param {?} date
|