@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.
@@ -6884,6 +6884,7 @@ var WebReturnMapperBuilderClass = /** @class */ (function () {
6884
6884
  terminalId: "",
6885
6885
  initiatingModule: "",
6886
6886
  export: false,
6887
+ isInStoreOrder: false,
6887
6888
  basket: {},
6888
6889
  basketSummary: {},
6889
6890
  baseCurrency: "",
@@ -6949,14 +6950,13 @@ var WebReturnMapperBuilderClass = /** @class */ (function () {
6949
6950
  (/** @type {?} */ (this)).webReturnObject.basketSummary['basketTotal'] = Number((/** @type {?} */ (this)).document.base_total_paid ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_paid) : 0);
6950
6951
  (/** @type {?} */ (this)).webReturnObject.basketSummary['totalItems'] = Number((/** @type {?} */ (this)).document.total_qty_ordered ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.total_qty_ordered) : 0);
6951
6952
  (/** @type {?} */ (this)).webReturnObject.basketSummary['refundTotal'] = Number((/** @type {?} */ (this)).document.base_total_refunded ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_refunded) : 0);
6952
- // basket line discount
6953
- (/** @type {?} */ (this)).webReturnObject.basket['lineDiscount'] = [];
6954
- /** @type {?} */
6955
- var lineDiscount = {
6956
- 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,
6957
- 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
6958
- };
6959
- (/** @type {?} */ (this)).webReturnObject.basket['lineDiscount'].push(lineDiscount);
6953
+ // // basket line discount
6954
+ // this.webReturnObject.basket['lineDiscount'] = [];
6955
+ // let lineDiscount = {
6956
+ // itemLineId: (this.document.items && this.document.items.item && this.document.items.item.item_id) ? this.getText(this.document.items.item.item_id) : 0,
6957
+ // discountAmount: (this.document.items && this.document.items.item && this.document.items.item.discount_amount) ? Number(this.getText(this.document.items.item.discount_amount)) : 0
6958
+ // }
6959
+ // this.webReturnObject.basket['lineDiscount'].push(lineDiscount);
6960
6960
  // basket transaction discount
6961
6961
  (/** @type {?} */ (this)).webReturnObject.basket['transactionDiscount'] = [];
6962
6962
  /** @type {?} */
@@ -6980,13 +6980,14 @@ var WebReturnMapperBuilderClass = /** @class */ (function () {
6980
6980
  /** @type {?} */
6981
6981
  var refundQty = (/** @type {?} */ (_this)).getText(element.qty_refunded) ? Number((/** @type {?} */ (_this)).getText(element.qty_refunded)) : 0;
6982
6982
  /** @type {?} */
6983
- var price = (/** @type {?} */ (_this)).getText(element.base_original_price) ? Number((/** @type {?} */ (_this)).getText(element.base_original_price)) : 0;
6983
+ var price = (/** @type {?} */ (_this)).getText(element.price_incl_tax) ? Number((/** @type {?} */ (_this)).getText(element.price_incl_tax)) : 0;
6984
6984
  product = {
6985
6985
  description: (element.name) ? (/** @type {?} */ (_this)).getText(element.name) : '',
6986
6986
  SKU: (element.sku) ? (/** @type {?} */ (_this)).getText(element.sku) : '',
6987
6987
  quantity: (element.qty_ordered) ? Number((/** @type {?} */ (_this)).getText(element.qty_ordered)) : 0,
6988
6988
  refundedQuantity: (element.qty_refunded) ? Number((/** @type {?} */ (_this)).getText(element.qty_refunded)) : 0,
6989
- price: (element.original_price) ? Number((/** @type {?} */ (_this)).getText(element.original_price)) : 0,
6989
+ //price: (element.original_price) ? Number(this.getText(element.original_price)) : 0,
6990
+ price: price,
6990
6991
  itemLineId: (element.item_id) ? Number((/** @type {?} */ (_this)).getText(element.item_id)) : 0,
6991
6992
  // totalLinePrice: (element.row_invoiced) ? Number(this.getText(element.row_invoiced)) : 0,
6992
6993
  totalLinePrice: ((qty - refundQty) * price),
@@ -7002,13 +7003,14 @@ var WebReturnMapperBuilderClass = /** @class */ (function () {
7002
7003
  /** @type {?} */
7003
7004
  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;
7004
7005
  /** @type {?} */
7005
- 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;
7006
+ 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;
7006
7007
  product = {
7007
7008
  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) : '',
7008
7009
  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) : '',
7009
7010
  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,
7010
7011
  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,
7011
- 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,
7012
+ // price: (this.document.items && this.document.items.item && this.document.items.item.original_price) ? Number(this.getText(this.document.items.item.original_price)) : 0,
7013
+ price: price,
7012
7014
  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,
7013
7015
  // totalLinePrice: (this.document.items && this.document.items.item && this.document.items.item.row_invoiced) ? Number(this.getText(this.document.items.item.row_invoiced)) : 0,
7014
7016
  totalLinePrice: ((qty - refundQty) * price),
@@ -7202,6 +7204,24 @@ var WebReturnMapperBuilderClass = /** @class */ (function () {
7202
7204
  return new Date(date).toISOString();
7203
7205
  }
7204
7206
  };
7207
+ /**
7208
+ * @template THIS
7209
+ * @this {THIS}
7210
+ * @return {THIS}
7211
+ */
7212
+ WebReturnMapperBuilderClass.prototype.isInStoreOrder = /**
7213
+ * @template THIS
7214
+ * @this {THIS}
7215
+ * @return {THIS}
7216
+ */
7217
+ function () {
7218
+ console.log("Mapper library: WebReturnMapperBuilderClass: isInStoreOrder mapping started...");
7219
+ if ((/** @type {?} */ (this)).document.payment && (/** @type {?} */ (this)).document.payment.method && (/** @type {?} */ (this)).document.payment.method === 'pos_order') {
7220
+ (/** @type {?} */ (this)).webReturnObject.isInStoreOrder = true;
7221
+ }
7222
+ console.log("Mapper library: WebReturnMapperBuilderClass: isInStoreOrder mapping ended...");
7223
+ return (/** @type {?} */ (this));
7224
+ };
7205
7225
  return WebReturnMapperBuilderClass;
7206
7226
  }());
7207
7227
  if (false) {