@pmcretail/mapper-library 0.0.17 → 0.0.19

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.
@@ -860,6 +860,8 @@ if (false) {
860
860
  TProduct.prototype.leadTime;
861
861
  /** @type {?|undefined} */
862
862
  TProduct.prototype.lineDiscount;
863
+ /** @type {?|undefined} */
864
+ TProduct.prototype.attributes;
863
865
  }
864
866
  /**
865
867
  * @record
@@ -4896,6 +4898,8 @@ var RJMapperBuilderClass = /** @class */ (function () {
4896
4898
  /** @type {?} */
4897
4899
  var obj = {};
4898
4900
  obj['XMLSchemaVersion'] = (/** @type {?} */ (_this)).xmlSchemaVersion;
4901
+ obj['DeviceID'] = (/** @type {?} */ (_this)).deviceId;
4902
+ obj['DateTimeCreated'] = (/** @type {?} */ (_this)).updatedAt;
4899
4903
  obj['NetValue'] = (/** @type {?} */ (_this)).convertToString(element.discountAmount * -1);
4900
4904
  obj['EffectiveNetValue'] = (/** @type {?} */ (_this)).convertToString(element.discountAmount * -1);
4901
4905
  obj['Description'] = element.reasonDisplayText;
@@ -4965,12 +4969,13 @@ var RJMapperBuilderClass = /** @class */ (function () {
4965
4969
  (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.CashierID = (/** @type {?} */ (this)).cashierId;
4966
4970
  (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.StoreID = (/** @type {?} */ (this)).transactionDocument.storeId;
4967
4971
  (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.BranchID = (/** @type {?} */ (this)).branchId;
4968
- (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.TerminalNumber = (/** @type {?} */ (this)).transactionDocument.terminalId;
4972
+ (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.TerminalNumber = (/** @type {?} */ (this)).terminalNumber;
4973
+ (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.TransactionNumber = (/** @type {?} */ (this)).transactionNumber;
4969
4974
  (/** @type {?} */ (this)).rjObject.Trailer.Total = (/** @type {?} */ (this)).convertToString((/** @type {?} */ (this)).transactionDocument.basketSummary.basketTotal * 100);
4970
4975
  (/** @type {?} */ (this)).rjObject.Trailer.ItemCount = (/** @type {?} */ (this)).itemCount; //gives total count for product
4971
4976
  (/** @type {?} */ (this)).rjObject.Trailer.ItemQuantity = (/** @type {?} */ (this)).convertToString((/** @type {?} */ (this)).transactionDocument.basketSummary.totalItems);
4972
4977
  (/** @type {?} */ (this)).rjObject.Trailer.NetItemQuantity = (/** @type {?} */ (this)).convertToString((/** @type {?} */ (this)).transactionDocument.basketSummary.totalItems);
4973
- (/** @type {?} */ (this)).rjObject.Trailer.TaxTotal = (/** @type {?} */ (this)).convertToString((/** @type {?} */ (this)).transactionDocument.basketSummary.VATTotal);
4978
+ (/** @type {?} */ (this)).rjObject.Trailer.TaxTotal = (/** @type {?} */ (this)).convertToString((/** @type {?} */ (this)).removeDecimal((/** @type {?} */ (this)).transactionDocument.basketSummary.VATTotal));
4974
4979
  (/** @type {?} */ (this)).rjObject.Trailer.SequenceDeviceID = (/** @type {?} */ (this)).deviceId;
4975
4980
  (/** @type {?} */ (this)).rjObject.Trailer.SequenceNumber = 'snsn'; //static for now
4976
4981
  (/** @type {?} */ (this)).rjObject['Trailer']['TaxItem'] = [];
@@ -4982,12 +4987,12 @@ var RJMapperBuilderClass = /** @class */ (function () {
4982
4987
  /** @type {?} */
4983
4988
  var obj = {};
4984
4989
  obj['XMLSchemaVersion'] = (/** @type {?} */ (_this)).xmlSchemaVersion;
4985
- obj['TaxRate'] = element.VAT;
4986
- obj['TaxableTotal'] = (/** @type {?} */ (_this)).convertToString(element.taxableAmount);
4987
- obj['TaxTotal'] = (/** @type {?} */ (_this)).convertToString(element.taxLineTotal);
4990
+ obj['TaxRate'] = (/** @type {?} */ (_this)).convertToString(element.VATCode);
4991
+ obj['TaxableTotal'] = (/** @type {?} */ (_this)).convertToString((/** @type {?} */ (_this)).removeDecimal(element.taxableAmount));
4992
+ obj['TaxTotal'] = (/** @type {?} */ (_this)).convertToString((/** @type {?} */ (_this)).removeDecimal((/** @type {?} */ (_this)).removeDecimal(element.taxLineTotal)));
4988
4993
  obj['TaxDescription'] = (/** @type {?} */ (_this)).convertToString(element.VATCode);
4989
4994
  obj['TaxIncluded'] = '1';
4990
- obj['TaxPercentage'] = element.VAT.toFixed(2); // todo
4995
+ obj['TaxPercentage'] = (/** @type {?} */ (_this)).addDecimal(element.VAT.toFixed(2)).toFixed(2);
4991
4996
  (/** @type {?} */ (_this)).rjObject['Trailer']['TaxItem'].push(obj);
4992
4997
  }));
4993
4998
  if ((/** @type {?} */ (this)).transactionDocument.basket.linePromotion.length > 0 || (/** @type {?} */ (this)).transactionDocument.basket.linePromotion.length > 0) {
@@ -5025,7 +5030,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
5025
5030
  * @param {?} item
5026
5031
  * @return {?}
5027
5032
  */
5028
- function (item) { return item.itemLineId == element.itemLineId; })).VATCode; // todo
5033
+ function (item) { return item.itemLineId == element.itemLineId; })).VATCode;
5029
5034
  (/** @type {?} */ (_this)).rjObject['Trailer']['PromotionItem'].push(obj);
5030
5035
  }));
5031
5036
  }
@@ -5037,7 +5042,6 @@ var RJMapperBuilderClass = /** @class */ (function () {
5037
5042
  function (element) {
5038
5043
  /** @type {?} */
5039
5044
  var obj = {};
5040
- console.log('element');
5041
5045
  obj['PromotionID'] = element.promotionId;
5042
5046
  obj['PromotionSaving'] = element.promotionAmount < 0 ? element.promotionAmount : -element.promotionAmount;
5043
5047
  obj['PromotionQuantity'] = "1";
@@ -5126,20 +5130,21 @@ var RJMapperBuilderClass = /** @class */ (function () {
5126
5130
  (/** @type {?} */ (_this)).rjObject[element.externalTenderKey].push(obj);
5127
5131
  }
5128
5132
  else {
5133
+ debugger;
5129
5134
  /** @type {?} */
5130
5135
  var obj1 = {
5131
5136
  XMLSchemaVersion: "1",
5132
5137
  LineNumber: (/** @type {?} */ (_this)).generateLineNumber(),
5133
5138
  //todo
5134
- NetValue: JSON.stringify(-1 * (Math.round(element.amount))),
5135
- EffectiveNetValue: JSON.stringify(-1 * (Math.round(element.amount))),
5139
+ NetValue: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal(Math.round(element.amount))),
5140
+ EffectiveNetValue: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal(Math.round(element.amount))),
5136
5141
  Description: (/** @type {?} */ (_this)).getDescription(element),
5137
5142
  DeviceID: (/** @type {?} */ (_this)).deviceId,
5138
5143
  UserID: (/** @type {?} */ (_this)).transactionDocument.userName,
5139
5144
  DateTimeCreated: (/** @type {?} */ (_this)).updatedAt,
5140
5145
  TenderType: element.externalTenderType ? element.externalTenderType : '',
5141
5146
  TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',
5142
- TenderAmount: JSON.stringify(-1 * (Math.round(element.amount))),
5147
+ TenderAmount: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal(Math.round(element.amount))),
5143
5148
  CurrencyID: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
5144
5149
  CurrencyDescription: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
5145
5150
  IncludeInTransactionTotalCheck: "1",
@@ -5156,15 +5161,15 @@ var RJMapperBuilderClass = /** @class */ (function () {
5156
5161
  var obj = {
5157
5162
  XMLSchemaVersion: (/** @type {?} */ (_this)).xmlSchemaVersion,
5158
5163
  LineNumber: (/** @type {?} */ (_this)).generateLineNumber(),
5159
- NetValue: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
5160
- EffectiveNetValue: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
5164
+ NetValue: JSON.stringify(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
5165
+ EffectiveNetValue: JSON.stringify(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
5161
5166
  Description: (/** @type {?} */ (_this)).getDescription(element),
5162
5167
  DeviceID: (/** @type {?} */ (_this)).deviceId,
5163
5168
  UserID: (/** @type {?} */ (_this)).transactionDocument.userName,
5164
5169
  DateTimeCreated: (/** @type {?} */ (_this)).updatedAt,
5165
5170
  TenderType: element.externalTenderType ? element.externalTenderType : '',
5166
5171
  TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',
5167
- TenderAmount: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
5172
+ TenderAmount: JSON.stringify(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
5168
5173
  CurrencyID: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
5169
5174
  CurrencyDescription: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
5170
5175
  GiftVoucherSalesAllowed: '',
@@ -5180,15 +5185,15 @@ var RJMapperBuilderClass = /** @class */ (function () {
5180
5185
  var obj1 = {
5181
5186
  XMLSchemaVersion: "1",
5182
5187
  LineNumber: (/** @type {?} */ (_this)).generateLineNumber(),
5183
- NetValue: JSON.stringify(-1 * (Math.round(element.amount))),
5184
- EffectiveNetValue: JSON.stringify(-1 * (Math.round(element.amount))),
5188
+ NetValue: JSON.stringify(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
5189
+ EffectiveNetValue: JSON.stringify(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
5185
5190
  Description: (/** @type {?} */ (_this)).getDescription(element),
5186
5191
  DeviceID: (/** @type {?} */ (_this)).deviceId,
5187
5192
  UserID: (/** @type {?} */ (_this)).transactionDocument.userName,
5188
5193
  DateTimeCreated: (/** @type {?} */ (_this)).updatedAt,
5189
5194
  TenderType: element.externalTenderType ? element.externalTenderType : '',
5190
5195
  TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',
5191
- TenderAmount: JSON.stringify(-1 * (Math.round(element.amount))),
5196
+ TenderAmount: JSON.stringify(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
5192
5197
  CurrencyID: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
5193
5198
  CurrencyDescription: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
5194
5199
  IncludeInTransactionTotalCheck: "1",
@@ -5291,6 +5296,27 @@ var RJMapperBuilderClass = /** @class */ (function () {
5291
5296
  return element.paymentType;
5292
5297
  }
5293
5298
  };
5299
+ /**
5300
+ * @param {?} attributes
5301
+ * @return {?}
5302
+ */
5303
+ RJMapperBuilderClass.prototype.getMMGROUPID = /**
5304
+ * @param {?} attributes
5305
+ * @return {?}
5306
+ */
5307
+ function (attributes) {
5308
+ if (attributes && attributes.length > 0) {
5309
+ /** @type {?} */
5310
+ var filterValue = attributes.filter((/**
5311
+ * @param {?} attribute
5312
+ * @return {?}
5313
+ */
5314
+ function (attribute) { return attribute.name === "MMGROUPID"; }));
5315
+ if (filterValue && filterValue.length > 0) {
5316
+ return filterValue[0].value;
5317
+ }
5318
+ }
5319
+ };
5294
5320
  /**
5295
5321
  * @template THIS
5296
5322
  * @this {THIS}
@@ -5318,6 +5344,17 @@ var RJMapperBuilderClass = /** @class */ (function () {
5318
5344
  function (value) {
5319
5345
  return value * 100;
5320
5346
  };
5347
+ /**
5348
+ * @param {?} value
5349
+ * @return {?}
5350
+ */
5351
+ RJMapperBuilderClass.prototype.addDecimal = /**
5352
+ * @param {?} value
5353
+ * @return {?}
5354
+ */
5355
+ function (value) {
5356
+ return value / 100;
5357
+ };
5321
5358
  /**
5322
5359
  * @template THIS
5323
5360
  * @this {THIS}
@@ -5588,6 +5625,22 @@ var RJMapperBuilderClass = /** @class */ (function () {
5588
5625
  (/** @type {?} */ (this)).branchId = value;
5589
5626
  return (/** @type {?} */ (this));
5590
5627
  };
5628
+ /**
5629
+ * @template THIS
5630
+ * @this {THIS}
5631
+ * @param {?} value
5632
+ * @return {THIS}
5633
+ */
5634
+ RJMapperBuilderClass.prototype.setSalesPersonName = /**
5635
+ * @template THIS
5636
+ * @this {THIS}
5637
+ * @param {?} value
5638
+ * @return {THIS}
5639
+ */
5640
+ function (value) {
5641
+ (/** @type {?} */ (this)).salesPersonName = value;
5642
+ return (/** @type {?} */ (this));
5643
+ };
5591
5644
  /**
5592
5645
  * @param {?} date
5593
5646
  * @return {?}
@@ -5689,17 +5742,18 @@ var RJMapperBuilderClass = /** @class */ (function () {
5689
5742
  function (item) { return item.itemLineId == element['itemLineId']; })).VATCode;
5690
5743
  obj['DisplayTaxCode'] = ''; // todo
5691
5744
  obj['ProductAttributes'] = ''; //todo - not required
5692
- obj['Perishable'] = this.getAttributes();
5693
- obj['MMGroupID'] = this.getCaregories(element);
5745
+ obj['Perishable'] = this.getMMGROUPID(element.attributes);
5746
+ //obj['MMGroupID'] = this.getCaregories(element);
5747
+ obj['MMGroupID'] = this.getMMGROUPID(element.attributes);
5694
5748
  obj['CustomerDetails'] = ""; // todo - blank
5695
5749
  obj['TotalPromotionSaving'] = element['promotionAmount'] || -1; // TODO
5696
- obj['OriginalTaxAmount'] = this.convertToString(this.getOriginalTax(element, taxTotal.VAT) * -1);
5697
- obj['taxAmount'] = taxTotal.taxLineTotal < 0 ? (taxTotal.taxLineTotal) : (-taxTotal.taxLineTotal);
5750
+ obj['OriginalTaxAmount'] = this.convertToString((this.removeDecimal(this.getOriginalTax(element, taxTotal.VAT) * -1)).toFixed(2));
5751
+ obj['taxAmount'] = this.removeDecimal(taxTotal.taxLineTotal < 0 ? (taxTotal.taxLineTotal) : (-taxTotal.taxLineTotal));
5698
5752
  if (lineDiscount) {
5699
5753
  if (lineDiscount.percentageDiscountReasonName && lineDiscount.percentageDiscountReasonCode) {
5700
5754
  // line discount
5701
5755
  obj['Discount'] = {};
5702
- obj['Discount'].ModifierValue = this.removeDecimal(lineDiscount.unitPrice) * -1;
5756
+ obj['Discount'].ModifierValue = this.removeDecimal(lineDiscount.discountAmount) * -1;
5703
5757
  obj['Discount'].ModifierDateTime = obj.DateTimeCreated;
5704
5758
  obj['Discount'].ModifierReasonID = lineDiscount.percentageDiscountReasonCode;
5705
5759
  obj['Discount'].ModifierDescription = lineDiscount.percentageDiscountReasonName;
@@ -5828,10 +5882,10 @@ var RJMapperBuilderClass = /** @class */ (function () {
5828
5882
  DateTimeCreated: this.createdAt,
5829
5883
  ExtendedValue: this.removeDecimal(element.price),
5830
5884
  UnitPrice: this.removeDecimal(element.price),
5831
- MMGroupID: this.getCaregories(element),
5832
- Quantity: element.quantity.toFixed(1),
5833
- SalespersonID: this.transactionDocument.userId,
5834
- SalespersonName: this.transactionDocument.userName,
5885
+ //MMGroupID: this.getCaregories(element),
5886
+ Quantity: element.quantity,
5887
+ SalespersonID: this.transactionDocument.userName,
5888
+ SalespersonName: this.salesPersonName,
5835
5889
  TaxCode: this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
5836
5890
  * @param {?} item
5837
5891
  * @return {?}
@@ -5839,21 +5893,22 @@ var RJMapperBuilderClass = /** @class */ (function () {
5839
5893
  function (item) { return item.itemLineId == element['itemLineId']; })).VATCode,
5840
5894
  TaxModifiable: "1",
5841
5895
  //todo
5842
- OriginalTaxAmount: this.convertToString(this.getOriginalTax(element, taxTotal.VAT)),
5843
- TaxAmount: this.convertToString(taxTotal.taxLineTotal),
5896
+ OriginalTaxAmount: this.convertToString((this.removeDecimal(this.getOriginalTax(element, taxTotal.VAT)).toFixed(2))),
5897
+ TaxAmount: this.convertToString(this.removeDecimal(taxTotal.taxLineTotal)),
5844
5898
  OriginalTaxAmountSet: "1",
5845
5899
  //todo
5846
5900
  ProductID: element.SKU,
5847
5901
  HandKeyed: "1",
5848
5902
  //todo
5849
5903
  CustomerDetails: "",
5850
- Perishable: this.getAttributes()
5904
+ Perishable: this.getMMGROUPID(element.attributes),
5905
+ MMGroupID: this.getMMGROUPID(element.attributes)
5851
5906
  };
5852
5907
  if (lineDiscount) {
5853
5908
  if (lineDiscount.percentageDiscountReasonName && lineDiscount.percentageDiscountReasonCode) {
5854
5909
  // line discount
5855
5910
  obj['Discount'] = {};
5856
- obj['Discount'].ModifierValue = this.removeDecimal(lineDiscount.unitPrice) * -1;
5911
+ obj['Discount'].ModifierValue = this.removeDecimal(lineDiscount.discountAmount) * -1;
5857
5912
  obj['Discount'].ModifierDateTime = obj.DateTimeCreated;
5858
5913
  obj['Discount'].ModifierReasonID = lineDiscount.percentageDiscountReasonCode;
5859
5914
  obj['Discount'].ModifierDescription = lineDiscount.percentageDiscountReasonName;
@@ -5901,7 +5956,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
5901
5956
  /** @type {?} */
5902
5957
  var discountAmount = _this.convertToString(e.discountAmount * -1);
5903
5958
  discountObj.XMLSchemaVersion = _this.xmlSchemaVersion;
5904
- discountObj.DiscountedValue = -(_this.getDiscountedValue(element.totalLinePrice, e.discountAmount).toFixed(0));
5959
+ discountObj.DiscountedValue = -(_this.getDiscountedValue(element.totalLinePrice, e.discountAmount));
5905
5960
  discountObj.BasketDiscountLineNumber = _this.getLineNumber(e, discountAmount);
5906
5961
  obj['BasketDiscountModifier'].push(discountObj);
5907
5962
  }
@@ -6024,7 +6079,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
6024
6079
  */
6025
6080
  function (price, discountAmount) {
6026
6081
  /** @type {?} */
6027
- var DiscountedValue = (price * discountAmount) / this.transactionDocument.basketSummary.saleTotal;
6082
+ var DiscountedValue = ((price * discountAmount) / this.transactionDocument.basketSummary.saleTotal) * 100;
6028
6083
  return DiscountedValue;
6029
6084
  };
6030
6085
  /**
@@ -6081,68 +6136,81 @@ var RJMapperBuilderClass = /** @class */ (function () {
6081
6136
  }));
6082
6137
  return x;
6083
6138
  };
6084
- /**
6085
- * @return {?}
6086
- */
6087
- RJMapperBuilderClass.prototype.getAttributes = /**
6088
- * @return {?}
6089
- */
6090
- function () {
6091
- /** @type {?} */
6092
- var name = [];
6093
- this.transactionDocument.basket.products.forEach((/**
6094
- * @param {?} element
6095
- * @return {?}
6096
- */
6097
- function (element) {
6098
- if (element.attributes && element.attributes.length > 0) {
6099
- name = element.attributes.filter((/**
6100
- * @param {?} x
6101
- * @return {?}
6102
- */
6103
- function (x) { return x.name.toUpperCase() === element.name.toUpperCase(); }));
6104
- }
6105
- }));
6106
- if (name.length > 0) {
6107
- return name[0].value;
6108
- }
6109
- else {
6110
- return "";
6111
- }
6112
- };
6113
- /**
6114
- * @param {?} element
6115
- * @return {?}
6116
- */
6117
- RJMapperBuilderClass.prototype.getCaregories = /**
6118
- * @param {?} element
6119
- * @return {?}
6120
- */
6121
- function (element) {
6122
- /** @type {?} */
6123
- var MMGroupId = " ";
6124
- if (element.categories && element.categories.length > 0) {
6125
- /** @type {?} */
6126
- var categories = element.categories.filter((/**
6127
- * @param {?} x
6128
- * @return {?}
6129
- */
6130
- function (x) { return x.parentId != ''; }));
6131
- /** @type {?} */
6132
- var value = categories.filter((/**
6133
- * @param {?} x
6134
- * @return {?}
6135
- */
6136
- function (x) { return x.id != x.parentId; }));
6137
- MMGroupId = value[0].name;
6138
- }
6139
- return MMGroupId;
6140
- };
6139
+ // getAttributes(){
6140
+ // let name: string | any[] = []
6141
+ // this.transactionDocument.basket.products.forEach((element: any) => {
6142
+ // if (element && element.attributes && element.attributes.length > 0) {
6143
+ // name = element.attributes.filter((x: any) => x.name.toUpperCase() === element.name.toUpperCase());
6144
+ // }
6145
+ // });
6146
+ // if (name.length > 0) {
6147
+ // return name[0].value
6148
+ // }
6149
+ // else{
6150
+ // return ""
6151
+ // }
6152
+ // }
6153
+ // getCaregories(element) {
6154
+ // let MMGroupId = " ";
6155
+ // if (element.categories && element.categories.length > 0) {
6156
+ // let categories = element.categories.filter((x) => x.parentId != '');
6157
+ // let value = categories.filter((x) => x.id != x.parentId);
6158
+ // MMGroupId = value[0].name;
6159
+ // }
6160
+ // return MMGroupId;
6161
+ // }
6162
+ // getAttributes(){
6163
+ // let name: string | any[] = []
6164
+ // this.transactionDocument.basket.products.forEach((element: any) => {
6165
+ // if (element && element.attributes && element.attributes.length > 0) {
6166
+ // name = element.attributes.filter((x: any) => x.name.toUpperCase() === element.name.toUpperCase());
6167
+ // }
6168
+ // });
6169
+ // if (name.length > 0) {
6170
+ // return name[0].value
6171
+ // }
6172
+ // else{
6173
+ // return ""
6174
+ // }
6175
+ // }
6176
+ // getCaregories(element) {
6177
+ // let MMGroupId = " ";
6178
+ // if (element.categories && element.categories.length > 0) {
6179
+ // let categories = element.categories.filter((x) => x.parentId != '');
6180
+ // let value = categories.filter((x) => x.id != x.parentId);
6181
+ // MMGroupId = value[0].name;
6182
+ // }
6183
+ // return MMGroupId;
6184
+ // }
6141
6185
  /**
6142
6186
  * @param {?} date
6143
6187
  * @return {?}
6144
6188
  */
6145
- RJMapperBuilderClass.prototype.getDate = /**
6189
+ RJMapperBuilderClass.prototype.getDate =
6190
+ // getAttributes(){
6191
+ // let name: string | any[] = []
6192
+ // this.transactionDocument.basket.products.forEach((element: any) => {
6193
+ // if (element && element.attributes && element.attributes.length > 0) {
6194
+ // name = element.attributes.filter((x: any) => x.name.toUpperCase() === element.name.toUpperCase());
6195
+ // }
6196
+ // });
6197
+ // if (name.length > 0) {
6198
+ // return name[0].value
6199
+ // }
6200
+ // else{
6201
+ // return ""
6202
+ // }
6203
+ // }
6204
+ // getCaregories(element) {
6205
+ // let MMGroupId = " ";
6206
+ // if (element.categories && element.categories.length > 0) {
6207
+ // let categories = element.categories.filter((x) => x.parentId != '');
6208
+ // let value = categories.filter((x) => x.id != x.parentId);
6209
+ // MMGroupId = value[0].name;
6210
+ // }
6211
+ // return MMGroupId;
6212
+ // }
6213
+ /**
6146
6214
  * @param {?} date
6147
6215
  * @return {?}
6148
6216
  */
@@ -6200,10 +6268,10 @@ var RJMapperBuilderClass = /** @class */ (function () {
6200
6268
  /** @type {?} */
6201
6269
  var quantity;
6202
6270
  if (this.transactionDocument.unreferencedRefund) {
6203
- quantity = element['quantity'] < 0 ? element['quantity'].toFixed(1) : (-element['quantity']).toFixed(1);
6271
+ quantity = element['quantity'] < 0 ? element['quantity'] : (-element['quantity']);
6204
6272
  }
6205
6273
  else {
6206
- quantity = element['refundedQuantity'] < 0 ? element['refundedQuantity'].toFixed(1) : (-element['refundedQuantity']).toFixed(1);
6274
+ quantity = element['refundedQuantity'] < 0 ? element['refundedQuantity'] : (-element['refundedQuantity']);
6207
6275
  }
6208
6276
  return quantity;
6209
6277
  };
@@ -6325,6 +6393,11 @@ if (false) {
6325
6393
  * @private
6326
6394
  */
6327
6395
  RJMapperBuilderClass.prototype.updatedAt;
6396
+ /**
6397
+ * @type {?}
6398
+ * @private
6399
+ */
6400
+ RJMapperBuilderClass.prototype.salesPersonName;
6328
6401
  /**
6329
6402
  * @type {?}
6330
6403
  * @private
@@ -6377,6 +6450,7 @@ var WebReturnMapperBuilderClass = /** @class */ (function () {
6377
6450
  * @return {THIS}
6378
6451
  */
6379
6452
  function () {
6453
+ var _this = this;
6380
6454
  (/** @type {?} */ (this)).webReturnObject['type'] = 'WEB_RETURNS';
6381
6455
  (/** @type {?} */ (this)).webReturnObject['datetime'] = (/** @type {?} */ (this)).getUTCDateTime((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.updated_at));
6382
6456
  (/** @type {?} */ (this)).webReturnObject.baseCurrency = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_currency_code);
@@ -6430,15 +6504,38 @@ var WebReturnMapperBuilderClass = /** @class */ (function () {
6430
6504
  // basket products
6431
6505
  (/** @type {?} */ (this)).webReturnObject.basket['products'] = [];
6432
6506
  /** @type {?} */
6433
- var product = {
6434
- 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) : '',
6435
- 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) : '',
6436
- 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,
6437
- 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,
6438
- 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,
6439
- 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,
6440
- totalLinePrice: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.row_invoiced) ? Number((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.row_invoiced)) : 0,
6441
- };
6507
+ var product = {};
6508
+ if ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item) {
6509
+ if ((/** @type {?} */ (this)).document.items.item instanceof Array) {
6510
+ (/** @type {?} */ (this)).document.items.item.forEach((/**
6511
+ * @param {?} element
6512
+ * @return {?}
6513
+ */
6514
+ function (element) {
6515
+ product = {
6516
+ description: (element.name) ? (/** @type {?} */ (_this)).getText(element.name) : '',
6517
+ SKU: (element.sku) ? (/** @type {?} */ (_this)).getText(element.sku) : '',
6518
+ quantity: (element.qty_ordered) ? Number((/** @type {?} */ (_this)).getText(element.qty_ordered)) : 0,
6519
+ refundedQuantity: (element.qty_refunded) ? Number((/** @type {?} */ (_this)).getText((/** @type {?} */ (_this)).document.items.item.qty_refunded)) : 0,
6520
+ price: (element.original_price) ? Number((/** @type {?} */ (_this)).getText(element.original_price)) : 0,
6521
+ itemLineId: (element.item_id) ? Number((/** @type {?} */ (_this)).getText(element.item_id)) : 0,
6522
+ totalLinePrice: (element.row_invoiced) ? Number((/** @type {?} */ (_this)).getText(element.row_invoiced)) : 0,
6523
+ };
6524
+ (/** @type {?} */ (_this)).webReturnObject.basket['products'].push(product);
6525
+ }));
6526
+ }
6527
+ else {
6528
+ product = {
6529
+ 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) : '',
6530
+ 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) : '',
6531
+ 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,
6532
+ 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,
6533
+ 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,
6534
+ 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,
6535
+ totalLinePrice: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.row_invoiced) ? Number((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.row_invoiced)) : 0,
6536
+ };
6537
+ }
6538
+ }
6442
6539
  (/** @type {?} */ (this)).webReturnObject.basket['products'].push(product);
6443
6540
  return (/** @type {?} */ (this));
6444
6541
  };
@@ -6604,9 +6701,12 @@ var WebReturnMapperBuilderClass = /** @class */ (function () {
6604
6701
  * @return {?}
6605
6702
  */
6606
6703
  function (obj) {
6607
- if (obj) {
6704
+ if (obj && obj.text) {
6608
6705
  return obj.text;
6609
6706
  }
6707
+ else {
6708
+ return obj;
6709
+ }
6610
6710
  };
6611
6711
  /**
6612
6712
  * @param {?} date