@pmcretail/mapper-library 0.0.36 → 0.0.38

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.
@@ -7104,6 +7104,7 @@
7104
7104
  terminalId: "",
7105
7105
  initiatingModule: "",
7106
7106
  export: false,
7107
+ isInStoreOrder: false,
7107
7108
  basket: {},
7108
7109
  basketSummary: {},
7109
7110
  baseCurrency: "",
@@ -7169,14 +7170,13 @@
7169
7170
  (/** @type {?} */ (this)).webReturnObject.basketSummary['basketTotal'] = Number((/** @type {?} */ (this)).document.base_total_paid ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_paid) : 0);
7170
7171
  (/** @type {?} */ (this)).webReturnObject.basketSummary['totalItems'] = Number((/** @type {?} */ (this)).document.total_qty_ordered ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.total_qty_ordered) : 0);
7171
7172
  (/** @type {?} */ (this)).webReturnObject.basketSummary['refundTotal'] = Number((/** @type {?} */ (this)).document.base_total_refunded ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_refunded) : 0);
7172
- // basket line discount
7173
- (/** @type {?} */ (this)).webReturnObject.basket['lineDiscount'] = [];
7174
- /** @type {?} */
7175
- var lineDiscount = {
7176
- 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,
7177
- 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
7178
- };
7179
- (/** @type {?} */ (this)).webReturnObject.basket['lineDiscount'].push(lineDiscount);
7173
+ // // basket line discount
7174
+ // this.webReturnObject.basket['lineDiscount'] = [];
7175
+ // let lineDiscount = {
7176
+ // itemLineId: (this.document.items && this.document.items.item && this.document.items.item.item_id) ? this.getText(this.document.items.item.item_id) : 0,
7177
+ // discountAmount: (this.document.items && this.document.items.item && this.document.items.item.discount_amount) ? Number(this.getText(this.document.items.item.discount_amount)) : 0
7178
+ // }
7179
+ // this.webReturnObject.basket['lineDiscount'].push(lineDiscount);
7180
7180
  // basket transaction discount
7181
7181
  (/** @type {?} */ (this)).webReturnObject.basket['transactionDiscount'] = [];
7182
7182
  /** @type {?} */
@@ -7200,13 +7200,14 @@
7200
7200
  /** @type {?} */
7201
7201
  var refundQty = (/** @type {?} */ (_this)).getText(element.qty_refunded) ? Number((/** @type {?} */ (_this)).getText(element.qty_refunded)) : 0;
7202
7202
  /** @type {?} */
7203
- var price = (/** @type {?} */ (_this)).getText(element.base_original_price) ? Number((/** @type {?} */ (_this)).getText(element.base_original_price)) : 0;
7203
+ var price = (/** @type {?} */ (_this)).getText(element.price_incl_tax) ? Number((/** @type {?} */ (_this)).getText(element.price_incl_tax)) : 0;
7204
7204
  product = {
7205
7205
  description: (element.name) ? (/** @type {?} */ (_this)).getText(element.name) : '',
7206
7206
  SKU: (element.sku) ? (/** @type {?} */ (_this)).getText(element.sku) : '',
7207
7207
  quantity: (element.qty_ordered) ? Number((/** @type {?} */ (_this)).getText(element.qty_ordered)) : 0,
7208
7208
  refundedQuantity: (element.qty_refunded) ? Number((/** @type {?} */ (_this)).getText(element.qty_refunded)) : 0,
7209
- price: (element.original_price) ? Number((/** @type {?} */ (_this)).getText(element.original_price)) : 0,
7209
+ //price: (element.original_price) ? Number(this.getText(element.original_price)) : 0,
7210
+ price: price,
7210
7211
  itemLineId: (element.item_id) ? Number((/** @type {?} */ (_this)).getText(element.item_id)) : 0,
7211
7212
  // totalLinePrice: (element.row_invoiced) ? Number(this.getText(element.row_invoiced)) : 0,
7212
7213
  totalLinePrice: ((qty - refundQty) * price),
@@ -7222,13 +7223,14 @@
7222
7223
  /** @type {?} */
7223
7224
  var refundQty = ((/** @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;
7224
7225
  /** @type {?} */
7225
- var 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;
7226
+ var price = ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.price_incl_tax) ? Number((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.price_incl_tax)) : 0;
7226
7227
  product = {
7227
7228
  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) : '',
7228
7229
  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) : '',
7229
7230
  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,
7230
7231
  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,
7231
- 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,
7232
+ // price: (this.document.items && this.document.items.item && this.document.items.item.original_price) ? Number(this.getText(this.document.items.item.original_price)) : 0,
7233
+ price: price,
7232
7234
  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,
7233
7235
  // totalLinePrice: (this.document.items && this.document.items.item && this.document.items.item.row_invoiced) ? Number(this.getText(this.document.items.item.row_invoiced)) : 0,
7234
7236
  totalLinePrice: ((qty - refundQty) * price),
@@ -7422,6 +7424,24 @@
7422
7424
  return new Date(date).toISOString();
7423
7425
  }
7424
7426
  };
7427
+ /**
7428
+ * @template THIS
7429
+ * @this {THIS}
7430
+ * @return {THIS}
7431
+ */
7432
+ WebReturnMapperBuilderClass.prototype.isInStoreOrder = /**
7433
+ * @template THIS
7434
+ * @this {THIS}
7435
+ * @return {THIS}
7436
+ */
7437
+ function () {
7438
+ console.log("Mapper library: WebReturnMapperBuilderClass: isInStoreOrder mapping started...");
7439
+ if ((/** @type {?} */ (this)).document.payment && (/** @type {?} */ (this)).document.payment.method && (/** @type {?} */ (this)).document.payment.method === 'pos_order') {
7440
+ (/** @type {?} */ (this)).webReturnObject.isInStoreOrder = true;
7441
+ }
7442
+ console.log("Mapper library: WebReturnMapperBuilderClass: isInStoreOrder mapping ended...");
7443
+ return (/** @type {?} */ (this));
7444
+ };
7425
7445
  return WebReturnMapperBuilderClass;
7426
7446
  }());
7427
7447
  if (false) {