@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.
@@ -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);
@@ -6650,15 +6651,38 @@
6650
6651
  // basket products
6651
6652
  (/** @type {?} */ (this)).webReturnObject.basket['products'] = [];
6652
6653
  /** @type {?} */
6653
- var product = {
6654
- 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) : '',
6655
- 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) : '',
6656
- 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,
6657
- 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,
6658
- 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,
6659
- 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,
6660
- 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,
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