@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.
@@ -18,10 +18,10 @@ class MapperLibraryComponent {
18
18
  MapperLibraryComponent.decorators = [
19
19
  { type: Component, args: [{
20
20
  selector: 'lib-mapper-library',
21
- template: `
22
- <p>
23
- mapper-library works!
24
- </p>
21
+ template: `
22
+ <p>
23
+ mapper-library works!
24
+ </p>
25
25
  `
26
26
  }] }
27
27
  ];
@@ -5418,6 +5418,7 @@ class WebReturnMapperBuilderClass {
5418
5418
  terminalId: "",
5419
5419
  initiatingModule: "",
5420
5420
  export: false,
5421
+ isInStoreOrder: false,
5421
5422
  basket: {},
5422
5423
  basketSummary: {},
5423
5424
  baseCurrency: "",
@@ -5477,14 +5478,13 @@ class WebReturnMapperBuilderClass {
5477
5478
  (/** @type {?} */ (this)).webReturnObject.basketSummary['basketTotal'] = Number((/** @type {?} */ (this)).document.base_total_paid ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_paid) : 0);
5478
5479
  (/** @type {?} */ (this)).webReturnObject.basketSummary['totalItems'] = Number((/** @type {?} */ (this)).document.total_qty_ordered ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.total_qty_ordered) : 0);
5479
5480
  (/** @type {?} */ (this)).webReturnObject.basketSummary['refundTotal'] = Number((/** @type {?} */ (this)).document.base_total_refunded ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_refunded) : 0);
5480
- // basket line discount
5481
- (/** @type {?} */ (this)).webReturnObject.basket['lineDiscount'] = [];
5482
- /** @type {?} */
5483
- let lineDiscount = {
5484
- 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,
5485
- 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
5486
- };
5487
- (/** @type {?} */ (this)).webReturnObject.basket['lineDiscount'].push(lineDiscount);
5481
+ // // basket line discount
5482
+ // this.webReturnObject.basket['lineDiscount'] = [];
5483
+ // let lineDiscount = {
5484
+ // itemLineId: (this.document.items && this.document.items.item && this.document.items.item.item_id) ? this.getText(this.document.items.item.item_id) : 0,
5485
+ // discountAmount: (this.document.items && this.document.items.item && this.document.items.item.discount_amount) ? Number(this.getText(this.document.items.item.discount_amount)) : 0
5486
+ // }
5487
+ // this.webReturnObject.basket['lineDiscount'].push(lineDiscount);
5488
5488
  // basket transaction discount
5489
5489
  (/** @type {?} */ (this)).webReturnObject.basket['transactionDiscount'] = [];
5490
5490
  /** @type {?} */
@@ -5508,13 +5508,14 @@ class WebReturnMapperBuilderClass {
5508
5508
  /** @type {?} */
5509
5509
  let refundQty = (/** @type {?} */ (this)).getText(element.qty_refunded) ? Number((/** @type {?} */ (this)).getText(element.qty_refunded)) : 0;
5510
5510
  /** @type {?} */
5511
- let price = (/** @type {?} */ (this)).getText(element.base_original_price) ? Number((/** @type {?} */ (this)).getText(element.base_original_price)) : 0;
5511
+ let price = (/** @type {?} */ (this)).getText(element.price_incl_tax) ? Number((/** @type {?} */ (this)).getText(element.price_incl_tax)) : 0;
5512
5512
  product = {
5513
5513
  description: (element.name) ? (/** @type {?} */ (this)).getText(element.name) : '',
5514
5514
  SKU: (element.sku) ? (/** @type {?} */ (this)).getText(element.sku) : '',
5515
5515
  quantity: (element.qty_ordered) ? Number((/** @type {?} */ (this)).getText(element.qty_ordered)) : 0,
5516
5516
  refundedQuantity: (element.qty_refunded) ? Number((/** @type {?} */ (this)).getText(element.qty_refunded)) : 0,
5517
- price: (element.original_price) ? Number((/** @type {?} */ (this)).getText(element.original_price)) : 0,
5517
+ //price: (element.original_price) ? Number(this.getText(element.original_price)) : 0,
5518
+ price: price,
5518
5519
  itemLineId: (element.item_id) ? Number((/** @type {?} */ (this)).getText(element.item_id)) : 0,
5519
5520
  // totalLinePrice: (element.row_invoiced) ? Number(this.getText(element.row_invoiced)) : 0,
5520
5521
  totalLinePrice: ((qty - refundQty) * price),
@@ -5530,13 +5531,14 @@ class WebReturnMapperBuilderClass {
5530
5531
  /** @type {?} */
5531
5532
  let 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;
5532
5533
  /** @type {?} */
5533
- let 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;
5534
+ let 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;
5534
5535
  product = {
5535
5536
  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) : '',
5536
5537
  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) : '',
5537
5538
  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,
5538
5539
  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,
5539
- 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,
5540
+ // price: (this.document.items && this.document.items.item && this.document.items.item.original_price) ? Number(this.getText(this.document.items.item.original_price)) : 0,
5541
+ price: price,
5540
5542
  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,
5541
5543
  // totalLinePrice: (this.document.items && this.document.items.item && this.document.items.item.row_invoiced) ? Number(this.getText(this.document.items.item.row_invoiced)) : 0,
5542
5544
  totalLinePrice: ((qty - refundQty) * price),
@@ -5665,6 +5667,19 @@ class WebReturnMapperBuilderClass {
5665
5667
  return new Date(date).toISOString();
5666
5668
  }
5667
5669
  }
5670
+ /**
5671
+ * @template THIS
5672
+ * @this {THIS}
5673
+ * @return {THIS}
5674
+ */
5675
+ isInStoreOrder() {
5676
+ console.log("Mapper library: WebReturnMapperBuilderClass: isInStoreOrder mapping started...");
5677
+ if ((/** @type {?} */ (this)).document.payment && (/** @type {?} */ (this)).document.payment.method && (/** @type {?} */ (this)).document.payment.method === 'pos_order') {
5678
+ (/** @type {?} */ (this)).webReturnObject.isInStoreOrder = true;
5679
+ }
5680
+ console.log("Mapper library: WebReturnMapperBuilderClass: isInStoreOrder mapping ended...");
5681
+ return (/** @type {?} */ (this));
5682
+ }
5668
5683
  }
5669
5684
  if (false) {
5670
5685
  /**