@pmcretail/mapper-library 0.0.3 → 0.0.5

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 = {};
@@ -4757,7 +4756,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
4757
4756
  (/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.CashierID = (/** @type {?} */ (this)).cashierId;
4758
4757
  (/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.CompanyID = (/** @type {?} */ (this)).companyId;
4759
4758
  (/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.StoreID = (/** @type {?} */ (this)).transactionDocument.storeId;
4760
- (/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.BranchID = (/** @type {?} */ (this)).transactionDocument.storeId;
4759
+ (/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.BranchID = (/** @type {?} */ (this)).branchId;
4761
4760
  (/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.TerminalNumber = (/** @type {?} */ (this)).terminalNumber;
4762
4761
  (/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.TransactionNumber = (/** @type {?} */ (this)).transactionNumber;
4763
4762
  (/** @type {?} */ (this)).rjObject['Header'].TaxMethodID = (/** @type {?} */ (this)).taxMethodId;
@@ -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 {
@@ -5490,6 +5507,22 @@ var RJMapperBuilderClass = /** @class */ (function () {
5490
5507
  (/** @type {?} */ (this)).basketCurrencyId = value;
5491
5508
  return (/** @type {?} */ (this));
5492
5509
  };
5510
+ /**
5511
+ * @template THIS
5512
+ * @this {THIS}
5513
+ * @param {?} value
5514
+ * @return {THIS}
5515
+ */
5516
+ RJMapperBuilderClass.prototype.setBranchID = /**
5517
+ * @template THIS
5518
+ * @this {THIS}
5519
+ * @param {?} value
5520
+ * @return {THIS}
5521
+ */
5522
+ function (value) {
5523
+ (/** @type {?} */ (this)).branchId = value;
5524
+ return (/** @type {?} */ (this));
5525
+ };
5493
5526
  /**
5494
5527
  * @param {?} date
5495
5528
  * @return {?}
@@ -5642,6 +5675,12 @@ var RJMapperBuilderClass = /** @class */ (function () {
5642
5675
  * @return {?}
5643
5676
  */
5644
5677
  function (element, lineDiscount) {
5678
+ /** @type {?} */
5679
+ var taxTotal = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
5680
+ * @param {?} item
5681
+ * @return {?}
5682
+ */
5683
+ function (item) { return item.itemLineId == element['itemLineId']; }));
5645
5684
  /** @type {?} */
5646
5685
  var obj = {
5647
5686
  XMLSchemaVersion: this.xmlSchemaVersion,
@@ -5661,14 +5700,15 @@ var RJMapperBuilderClass = /** @class */ (function () {
5661
5700
  Quantity: element.quantity.toFixed(1),
5662
5701
  SalespersonID: this.transactionDocument.userId,
5663
5702
  SalespersonName: this.transactionDocument.userName,
5664
- TaxCode: 0,
5665
- //todo
5703
+ TaxCode: this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
5704
+ * @param {?} item
5705
+ * @return {?}
5706
+ */
5707
+ function (item) { return item.itemLineId == element['itemLineId']; })).VATCode,
5666
5708
  TaxModifiable: 1,
5667
5709
  //todo
5668
- TaxAmount: 0,
5669
- //todo
5670
- OriginalTaxAmount: 0,
5671
- //todo
5710
+ OriginalTaxAmount: taxTotal.taxLineTotal < 0 ? this.removeDecimal(taxTotal.taxLineTotal) : this.removeDecimal(-taxTotal.taxLineTotal),
5711
+ TaxAmount: taxTotal.taxLineTotal < 0 ? this.removeDecimal(taxTotal.taxLineTotal) : this.removeDecimal(-taxTotal.taxLineTotal),
5672
5712
  OriginalTaxAmountSet: 1,
5673
5713
  //todo
5674
5714
  ProductID: element.SKU,
@@ -5787,11 +5827,6 @@ if (false) {
5787
5827
  * @private
5788
5828
  */
5789
5829
  RJMapperBuilderClass.prototype.transactionDocument;
5790
- /**
5791
- * @type {?}
5792
- * @private
5793
- */
5794
- RJMapperBuilderClass.prototype.productQuantity;
5795
5830
  /**
5796
5831
  * @type {?}
5797
5832
  * @private
@@ -5892,6 +5927,11 @@ if (false) {
5892
5927
  * @private
5893
5928
  */
5894
5929
  RJMapperBuilderClass.prototype.largestNumber;
5930
+ /**
5931
+ * @type {?}
5932
+ * @private
5933
+ */
5934
+ RJMapperBuilderClass.prototype.branchId;
5895
5935
  /**
5896
5936
  * @type {?}
5897
5937
  * @private