@pmcretail/mapper-library 0.0.3 → 0.0.4

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.
@@ -1,5 +1,5 @@
1
1
  import { Component, NgModule, Injectable, ɵɵdefineInjectable, ɵɵinject } from '@angular/core';
2
- import { __values, __spread } from 'tslib';
2
+ import { __values, __spread, __assign } from 'tslib';
3
3
  import { BehaviorSubject } from 'rxjs';
4
4
  import { CurrencyPipe } from '@angular/common';
5
5
 
@@ -4651,7 +4651,6 @@ if (false) {
4651
4651
  */
4652
4652
  var RJMapperBuilderClass = /** @class */ (function () {
4653
4653
  function RJMapperBuilderClass(transactionDoc) {
4654
- this.productQuantity = 0;
4655
4654
  this.itemCount = 0;
4656
4655
  this.largestNumber = 0;
4657
4656
  this.rjObject = {};
@@ -4839,6 +4838,15 @@ var RJMapperBuilderClass = /** @class */ (function () {
4839
4838
  function (element) {
4840
4839
  /** @type {?} */
4841
4840
  var data = (/** @type {?} */ (_this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
4841
+ /** @type {?} */
4842
+ var obj = {
4843
+ "OriginalReceiptSupplied": 0,
4844
+ "OriginalBranchID": 0,
4845
+ "OriginalTerminalNumber": 0,
4846
+ "OriginalTransactionNumber": 0,
4847
+ "OriginalCashierNumber": 0
4848
+ };
4849
+ data['Return'] = __assign({}, data['Return'], obj);
4842
4850
  (/** @type {?} */ (_this)).rjObject['ProductReturn'].push(data);
4843
4851
  (/** @type {?} */ (_this)).getModifierItem(element.lineDiscount, element.itemLineId);
4844
4852
  }));
@@ -4857,6 +4865,15 @@ var RJMapperBuilderClass = /** @class */ (function () {
4857
4865
  if (element.refundedQuantity > 0) {
4858
4866
  /** @type {?} */
4859
4867
  var returnProduct = (/** @type {?} */ (_this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
4868
+ /** @type {?} */
4869
+ var obj = {
4870
+ "OriginalReceiptSupplied": 0,
4871
+ "OriginalBranchID": 0,
4872
+ "OriginalTerminalNumber": 0,
4873
+ "OriginalTransactionNumber": 0,
4874
+ "OriginalCashierNumber": 0
4875
+ };
4876
+ returnProduct['Return'] = __assign({}, returnProduct['Return'], obj);
4860
4877
  (/** @type {?} */ (_this)).rjObject['ProductReturn'].push(returnProduct);
4861
4878
  }
4862
4879
  else {
@@ -5642,6 +5659,12 @@ var RJMapperBuilderClass = /** @class */ (function () {
5642
5659
  * @return {?}
5643
5660
  */
5644
5661
  function (element, lineDiscount) {
5662
+ /** @type {?} */
5663
+ var taxTotal = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
5664
+ * @param {?} item
5665
+ * @return {?}
5666
+ */
5667
+ function (item) { return item.itemLineId == element['itemLineId']; }));
5645
5668
  /** @type {?} */
5646
5669
  var obj = {
5647
5670
  XMLSchemaVersion: this.xmlSchemaVersion,
@@ -5661,14 +5684,15 @@ var RJMapperBuilderClass = /** @class */ (function () {
5661
5684
  Quantity: element.quantity.toFixed(1),
5662
5685
  SalespersonID: this.transactionDocument.userId,
5663
5686
  SalespersonName: this.transactionDocument.userName,
5664
- TaxCode: 0,
5665
- //todo
5687
+ TaxCode: this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
5688
+ * @param {?} item
5689
+ * @return {?}
5690
+ */
5691
+ function (item) { return item.itemLineId == element['itemLineId']; })).VATCode,
5666
5692
  TaxModifiable: 1,
5667
5693
  //todo
5668
- TaxAmount: 0,
5669
- //todo
5670
- OriginalTaxAmount: 0,
5671
- //todo
5694
+ OriginalTaxAmount: taxTotal.taxLineTotal < 0 ? this.removeDecimal(taxTotal.taxLineTotal) : this.removeDecimal(-taxTotal.taxLineTotal),
5695
+ TaxAmount: taxTotal.taxLineTotal < 0 ? this.removeDecimal(taxTotal.taxLineTotal) : this.removeDecimal(-taxTotal.taxLineTotal),
5672
5696
  OriginalTaxAmountSet: 1,
5673
5697
  //todo
5674
5698
  ProductID: element.SKU,
@@ -5787,11 +5811,6 @@ if (false) {
5787
5811
  * @private
5788
5812
  */
5789
5813
  RJMapperBuilderClass.prototype.transactionDocument;
5790
- /**
5791
- * @type {?}
5792
- * @private
5793
- */
5794
- RJMapperBuilderClass.prototype.productQuantity;
5795
5814
  /**
5796
5815
  * @type {?}
5797
5816
  * @private