@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.
@@ -855,6 +855,8 @@ if (false) {
855
855
  TProduct.prototype.leadTime;
856
856
  /** @type {?|undefined} */
857
857
  TProduct.prototype.lineDiscount;
858
+ /** @type {?|undefined} */
859
+ TProduct.prototype.attributes;
858
860
  }
859
861
  /**
860
862
  * @record
@@ -3704,6 +3706,8 @@ class RJMapperBuilderClass {
3704
3706
  /** @type {?} */
3705
3707
  let obj = {};
3706
3708
  obj['XMLSchemaVersion'] = (/** @type {?} */ (this)).xmlSchemaVersion;
3709
+ obj['DeviceID'] = (/** @type {?} */ (this)).deviceId;
3710
+ obj['DateTimeCreated'] = (/** @type {?} */ (this)).updatedAt;
3707
3711
  obj['NetValue'] = (/** @type {?} */ (this)).convertToString(element.discountAmount * -1);
3708
3712
  obj['EffectiveNetValue'] = (/** @type {?} */ (this)).convertToString(element.discountAmount * -1);
3709
3713
  obj['Description'] = element.reasonDisplayText;
@@ -3762,12 +3766,13 @@ class RJMapperBuilderClass {
3762
3766
  (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.CashierID = (/** @type {?} */ (this)).cashierId;
3763
3767
  (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.StoreID = (/** @type {?} */ (this)).transactionDocument.storeId;
3764
3768
  (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.BranchID = (/** @type {?} */ (this)).branchId;
3765
- (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.TerminalNumber = (/** @type {?} */ (this)).transactionDocument.terminalId;
3769
+ (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.TerminalNumber = (/** @type {?} */ (this)).terminalNumber;
3770
+ (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.TransactionNumber = (/** @type {?} */ (this)).transactionNumber;
3766
3771
  (/** @type {?} */ (this)).rjObject.Trailer.Total = (/** @type {?} */ (this)).convertToString((/** @type {?} */ (this)).transactionDocument.basketSummary.basketTotal * 100);
3767
3772
  (/** @type {?} */ (this)).rjObject.Trailer.ItemCount = (/** @type {?} */ (this)).itemCount; //gives total count for product
3768
3773
  (/** @type {?} */ (this)).rjObject.Trailer.ItemQuantity = (/** @type {?} */ (this)).convertToString((/** @type {?} */ (this)).transactionDocument.basketSummary.totalItems);
3769
3774
  (/** @type {?} */ (this)).rjObject.Trailer.NetItemQuantity = (/** @type {?} */ (this)).convertToString((/** @type {?} */ (this)).transactionDocument.basketSummary.totalItems);
3770
- (/** @type {?} */ (this)).rjObject.Trailer.TaxTotal = (/** @type {?} */ (this)).convertToString((/** @type {?} */ (this)).transactionDocument.basketSummary.VATTotal);
3775
+ (/** @type {?} */ (this)).rjObject.Trailer.TaxTotal = (/** @type {?} */ (this)).convertToString((/** @type {?} */ (this)).removeDecimal((/** @type {?} */ (this)).transactionDocument.basketSummary.VATTotal));
3771
3776
  (/** @type {?} */ (this)).rjObject.Trailer.SequenceDeviceID = (/** @type {?} */ (this)).deviceId;
3772
3777
  (/** @type {?} */ (this)).rjObject.Trailer.SequenceNumber = 'snsn'; //static for now
3773
3778
  (/** @type {?} */ (this)).rjObject['Trailer']['TaxItem'] = [];
@@ -3779,12 +3784,12 @@ class RJMapperBuilderClass {
3779
3784
  /** @type {?} */
3780
3785
  let obj = {};
3781
3786
  obj['XMLSchemaVersion'] = (/** @type {?} */ (this)).xmlSchemaVersion;
3782
- obj['TaxRate'] = element.VAT;
3783
- obj['TaxableTotal'] = (/** @type {?} */ (this)).convertToString(element.taxableAmount);
3784
- obj['TaxTotal'] = (/** @type {?} */ (this)).convertToString(element.taxLineTotal);
3787
+ obj['TaxRate'] = (/** @type {?} */ (this)).convertToString(element.VATCode);
3788
+ obj['TaxableTotal'] = (/** @type {?} */ (this)).convertToString((/** @type {?} */ (this)).removeDecimal(element.taxableAmount));
3789
+ obj['TaxTotal'] = (/** @type {?} */ (this)).convertToString((/** @type {?} */ (this)).removeDecimal((/** @type {?} */ (this)).removeDecimal(element.taxLineTotal)));
3785
3790
  obj['TaxDescription'] = (/** @type {?} */ (this)).convertToString(element.VATCode);
3786
3791
  obj['TaxIncluded'] = '1';
3787
- obj['TaxPercentage'] = element.VAT.toFixed(2); // todo
3792
+ obj['TaxPercentage'] = (/** @type {?} */ (this)).addDecimal(element.VAT.toFixed(2)).toFixed(2);
3788
3793
  (/** @type {?} */ (this)).rjObject['Trailer']['TaxItem'].push(obj);
3789
3794
  }));
3790
3795
  if ((/** @type {?} */ (this)).transactionDocument.basket.linePromotion.length > 0 || (/** @type {?} */ (this)).transactionDocument.basket.linePromotion.length > 0) {
@@ -3822,7 +3827,7 @@ class RJMapperBuilderClass {
3822
3827
  * @param {?} item
3823
3828
  * @return {?}
3824
3829
  */
3825
- (item) => item.itemLineId == element.itemLineId)).VATCode; // todo
3830
+ (item) => item.itemLineId == element.itemLineId)).VATCode;
3826
3831
  (/** @type {?} */ (this)).rjObject['Trailer']['PromotionItem'].push(obj);
3827
3832
  }));
3828
3833
  }
@@ -3834,7 +3839,6 @@ class RJMapperBuilderClass {
3834
3839
  (element) => {
3835
3840
  /** @type {?} */
3836
3841
  let obj = {};
3837
- console.log('element');
3838
3842
  obj['PromotionID'] = element.promotionId;
3839
3843
  obj['PromotionSaving'] = element.promotionAmount < 0 ? element.promotionAmount : -element.promotionAmount;
3840
3844
  obj['PromotionQuantity'] = "1";
@@ -3917,20 +3921,21 @@ class RJMapperBuilderClass {
3917
3921
  (/** @type {?} */ (this)).rjObject[element.externalTenderKey].push(obj);
3918
3922
  }
3919
3923
  else {
3924
+ debugger;
3920
3925
  /** @type {?} */
3921
3926
  let obj1 = {
3922
3927
  XMLSchemaVersion: "1",
3923
3928
  LineNumber: (/** @type {?} */ (this)).generateLineNumber(),
3924
3929
  //todo
3925
- NetValue: JSON.stringify(-1 * (Math.round(element.amount))),
3926
- EffectiveNetValue: JSON.stringify(-1 * (Math.round(element.amount))),
3930
+ NetValue: (/** @type {?} */ (this)).convertToString(-1 * (/** @type {?} */ (this)).removeDecimal(Math.round(element.amount))),
3931
+ EffectiveNetValue: (/** @type {?} */ (this)).convertToString(-1 * (/** @type {?} */ (this)).removeDecimal(Math.round(element.amount))),
3927
3932
  Description: (/** @type {?} */ (this)).getDescription(element),
3928
3933
  DeviceID: (/** @type {?} */ (this)).deviceId,
3929
3934
  UserID: (/** @type {?} */ (this)).transactionDocument.userName,
3930
3935
  DateTimeCreated: (/** @type {?} */ (this)).updatedAt,
3931
3936
  TenderType: element.externalTenderType ? element.externalTenderType : '',
3932
3937
  TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',
3933
- TenderAmount: JSON.stringify(-1 * (Math.round(element.amount))),
3938
+ TenderAmount: (/** @type {?} */ (this)).convertToString(-1 * (/** @type {?} */ (this)).removeDecimal(Math.round(element.amount))),
3934
3939
  CurrencyID: (/** @type {?} */ (this)).transactionDocument.baseCurrency,
3935
3940
  CurrencyDescription: (/** @type {?} */ (this)).transactionDocument.baseCurrency,
3936
3941
  IncludeInTransactionTotalCheck: "1",
@@ -3947,15 +3952,15 @@ class RJMapperBuilderClass {
3947
3952
  let obj = {
3948
3953
  XMLSchemaVersion: (/** @type {?} */ (this)).xmlSchemaVersion,
3949
3954
  LineNumber: (/** @type {?} */ (this)).generateLineNumber(),
3950
- NetValue: (/** @type {?} */ (this)).convertToString(-1 * (/** @type {?} */ (this)).removeDecimal((Math.round(element.amount)))),
3951
- EffectiveNetValue: (/** @type {?} */ (this)).convertToString(-1 * (/** @type {?} */ (this)).removeDecimal((Math.round(element.amount)))),
3955
+ NetValue: JSON.stringify(-1 * (/** @type {?} */ (this)).removeDecimal((Math.round(element.amount)))),
3956
+ EffectiveNetValue: JSON.stringify(-1 * (/** @type {?} */ (this)).removeDecimal((Math.round(element.amount)))),
3952
3957
  Description: (/** @type {?} */ (this)).getDescription(element),
3953
3958
  DeviceID: (/** @type {?} */ (this)).deviceId,
3954
3959
  UserID: (/** @type {?} */ (this)).transactionDocument.userName,
3955
3960
  DateTimeCreated: (/** @type {?} */ (this)).updatedAt,
3956
3961
  TenderType: element.externalTenderType ? element.externalTenderType : '',
3957
3962
  TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',
3958
- TenderAmount: (/** @type {?} */ (this)).convertToString(-1 * (/** @type {?} */ (this)).removeDecimal((Math.round(element.amount)))),
3963
+ TenderAmount: JSON.stringify(-1 * (/** @type {?} */ (this)).removeDecimal((Math.round(element.amount)))),
3959
3964
  CurrencyID: (/** @type {?} */ (this)).transactionDocument.baseCurrency,
3960
3965
  CurrencyDescription: (/** @type {?} */ (this)).transactionDocument.baseCurrency,
3961
3966
  GiftVoucherSalesAllowed: '',
@@ -3971,15 +3976,15 @@ class RJMapperBuilderClass {
3971
3976
  let obj1 = {
3972
3977
  XMLSchemaVersion: "1",
3973
3978
  LineNumber: (/** @type {?} */ (this)).generateLineNumber(),
3974
- NetValue: JSON.stringify(-1 * (Math.round(element.amount))),
3975
- EffectiveNetValue: JSON.stringify(-1 * (Math.round(element.amount))),
3979
+ NetValue: JSON.stringify(-1 * (/** @type {?} */ (this)).removeDecimal((Math.round(element.amount)))),
3980
+ EffectiveNetValue: JSON.stringify(-1 * (/** @type {?} */ (this)).removeDecimal((Math.round(element.amount)))),
3976
3981
  Description: (/** @type {?} */ (this)).getDescription(element),
3977
3982
  DeviceID: (/** @type {?} */ (this)).deviceId,
3978
3983
  UserID: (/** @type {?} */ (this)).transactionDocument.userName,
3979
3984
  DateTimeCreated: (/** @type {?} */ (this)).updatedAt,
3980
3985
  TenderType: element.externalTenderType ? element.externalTenderType : '',
3981
3986
  TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',
3982
- TenderAmount: JSON.stringify(-1 * (Math.round(element.amount))),
3987
+ TenderAmount: JSON.stringify(-1 * (/** @type {?} */ (this)).removeDecimal((Math.round(element.amount)))),
3983
3988
  CurrencyID: (/** @type {?} */ (this)).transactionDocument.baseCurrency,
3984
3989
  CurrencyDescription: (/** @type {?} */ (this)).transactionDocument.baseCurrency,
3985
3990
  IncludeInTransactionTotalCheck: "1",
@@ -4062,6 +4067,23 @@ class RJMapperBuilderClass {
4062
4067
  return element.paymentType;
4063
4068
  }
4064
4069
  }
4070
+ /**
4071
+ * @param {?} attributes
4072
+ * @return {?}
4073
+ */
4074
+ getMMGROUPID(attributes) {
4075
+ if (attributes && attributes.length > 0) {
4076
+ /** @type {?} */
4077
+ let filterValue = attributes.filter((/**
4078
+ * @param {?} attribute
4079
+ * @return {?}
4080
+ */
4081
+ (attribute) => attribute.name === "MMGROUPID"));
4082
+ if (filterValue && filterValue.length > 0) {
4083
+ return filterValue[0].value;
4084
+ }
4085
+ }
4086
+ }
4065
4087
  /**
4066
4088
  * @template THIS
4067
4089
  * @this {THIS}
@@ -4079,6 +4101,13 @@ class RJMapperBuilderClass {
4079
4101
  removeDecimal(value) {
4080
4102
  return value * 100;
4081
4103
  }
4104
+ /**
4105
+ * @param {?} value
4106
+ * @return {?}
4107
+ */
4108
+ addDecimal(value) {
4109
+ return value / 100;
4110
+ }
4082
4111
  /**
4083
4112
  * @template THIS
4084
4113
  * @this {THIS}
@@ -4248,6 +4277,16 @@ class RJMapperBuilderClass {
4248
4277
  (/** @type {?} */ (this)).branchId = value;
4249
4278
  return (/** @type {?} */ (this));
4250
4279
  }
4280
+ /**
4281
+ * @template THIS
4282
+ * @this {THIS}
4283
+ * @param {?} value
4284
+ * @return {THIS}
4285
+ */
4286
+ setSalesPersonName(value) {
4287
+ (/** @type {?} */ (this)).salesPersonName = value;
4288
+ return (/** @type {?} */ (this));
4289
+ }
4251
4290
  /**
4252
4291
  * @param {?} date
4253
4292
  * @return {?}
@@ -4328,17 +4367,18 @@ class RJMapperBuilderClass {
4328
4367
  (item) => item.itemLineId == element['itemLineId'])).VATCode;
4329
4368
  obj['DisplayTaxCode'] = ''; // todo
4330
4369
  obj['ProductAttributes'] = ''; //todo - not required
4331
- obj['Perishable'] = this.getAttributes();
4332
- obj['MMGroupID'] = this.getCaregories(element);
4370
+ obj['Perishable'] = this.getMMGROUPID(element.attributes);
4371
+ //obj['MMGroupID'] = this.getCaregories(element);
4372
+ obj['MMGroupID'] = this.getMMGROUPID(element.attributes);
4333
4373
  obj['CustomerDetails'] = ""; // todo - blank
4334
4374
  obj['TotalPromotionSaving'] = element['promotionAmount'] || -1; // TODO
4335
- obj['OriginalTaxAmount'] = this.convertToString(this.getOriginalTax(element, taxTotal.VAT) * -1);
4336
- obj['taxAmount'] = taxTotal.taxLineTotal < 0 ? (taxTotal.taxLineTotal) : (-taxTotal.taxLineTotal);
4375
+ obj['OriginalTaxAmount'] = this.convertToString((this.removeDecimal(this.getOriginalTax(element, taxTotal.VAT) * -1)).toFixed(2));
4376
+ obj['taxAmount'] = this.removeDecimal(taxTotal.taxLineTotal < 0 ? (taxTotal.taxLineTotal) : (-taxTotal.taxLineTotal));
4337
4377
  if (lineDiscount) {
4338
4378
  if (lineDiscount.percentageDiscountReasonName && lineDiscount.percentageDiscountReasonCode) {
4339
4379
  // line discount
4340
4380
  obj['Discount'] = {};
4341
- obj['Discount'].ModifierValue = this.removeDecimal(lineDiscount.unitPrice) * -1;
4381
+ obj['Discount'].ModifierValue = this.removeDecimal(lineDiscount.discountAmount) * -1;
4342
4382
  obj['Discount'].ModifierDateTime = obj.DateTimeCreated;
4343
4383
  obj['Discount'].ModifierReasonID = lineDiscount.percentageDiscountReasonCode;
4344
4384
  obj['Discount'].ModifierDescription = lineDiscount.percentageDiscountReasonName;
@@ -4460,10 +4500,10 @@ class RJMapperBuilderClass {
4460
4500
  DateTimeCreated: this.createdAt,
4461
4501
  ExtendedValue: this.removeDecimal(element.price),
4462
4502
  UnitPrice: this.removeDecimal(element.price),
4463
- MMGroupID: this.getCaregories(element),
4464
- Quantity: element.quantity.toFixed(1),
4465
- SalespersonID: this.transactionDocument.userId,
4466
- SalespersonName: this.transactionDocument.userName,
4503
+ //MMGroupID: this.getCaregories(element),
4504
+ Quantity: element.quantity,
4505
+ SalespersonID: this.transactionDocument.userName,
4506
+ SalespersonName: this.salesPersonName,
4467
4507
  TaxCode: this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
4468
4508
  * @param {?} item
4469
4509
  * @return {?}
@@ -4471,21 +4511,22 @@ class RJMapperBuilderClass {
4471
4511
  (item) => item.itemLineId == element['itemLineId'])).VATCode,
4472
4512
  TaxModifiable: "1",
4473
4513
  //todo
4474
- OriginalTaxAmount: this.convertToString(this.getOriginalTax(element, taxTotal.VAT)),
4475
- TaxAmount: this.convertToString(taxTotal.taxLineTotal),
4514
+ OriginalTaxAmount: this.convertToString((this.removeDecimal(this.getOriginalTax(element, taxTotal.VAT)).toFixed(2))),
4515
+ TaxAmount: this.convertToString(this.removeDecimal(taxTotal.taxLineTotal)),
4476
4516
  OriginalTaxAmountSet: "1",
4477
4517
  //todo
4478
4518
  ProductID: element.SKU,
4479
4519
  HandKeyed: "1",
4480
4520
  //todo
4481
4521
  CustomerDetails: "",
4482
- Perishable: this.getAttributes()
4522
+ Perishable: this.getMMGROUPID(element.attributes),
4523
+ MMGroupID: this.getMMGROUPID(element.attributes)
4483
4524
  };
4484
4525
  if (lineDiscount) {
4485
4526
  if (lineDiscount.percentageDiscountReasonName && lineDiscount.percentageDiscountReasonCode) {
4486
4527
  // line discount
4487
4528
  obj['Discount'] = {};
4488
- obj['Discount'].ModifierValue = this.removeDecimal(lineDiscount.unitPrice) * -1;
4529
+ obj['Discount'].ModifierValue = this.removeDecimal(lineDiscount.discountAmount) * -1;
4489
4530
  obj['Discount'].ModifierDateTime = obj.DateTimeCreated;
4490
4531
  obj['Discount'].ModifierReasonID = lineDiscount.percentageDiscountReasonCode;
4491
4532
  obj['Discount'].ModifierDescription = lineDiscount.percentageDiscountReasonName;
@@ -4533,7 +4574,7 @@ class RJMapperBuilderClass {
4533
4574
  /** @type {?} */
4534
4575
  let discountAmount = this.convertToString(e.discountAmount * -1);
4535
4576
  discountObj.XMLSchemaVersion = this.xmlSchemaVersion;
4536
- discountObj.DiscountedValue = -(this.getDiscountedValue(element.totalLinePrice, e.discountAmount).toFixed(0));
4577
+ discountObj.DiscountedValue = -(this.getDiscountedValue(element.totalLinePrice, e.discountAmount));
4537
4578
  discountObj.BasketDiscountLineNumber = this.getLineNumber(e, discountAmount);
4538
4579
  obj['BasketDiscountModifier'].push(discountObj);
4539
4580
  }
@@ -4641,7 +4682,7 @@ class RJMapperBuilderClass {
4641
4682
  */
4642
4683
  getDiscountedValue(price, discountAmount) {
4643
4684
  /** @type {?} */
4644
- let DiscountedValue = (price * discountAmount) / this.transactionDocument.basketSummary.saleTotal;
4685
+ let DiscountedValue = ((price * discountAmount) / this.transactionDocument.basketSummary.saleTotal) * 100;
4645
4686
  return DiscountedValue;
4646
4687
  }
4647
4688
  /**
@@ -4686,56 +4727,29 @@ class RJMapperBuilderClass {
4686
4727
  }));
4687
4728
  return x;
4688
4729
  }
4689
- /**
4690
- * @return {?}
4691
- */
4692
- getAttributes() {
4693
- /** @type {?} */
4694
- let name = [];
4695
- this.transactionDocument.basket.products.forEach((/**
4696
- * @param {?} element
4697
- * @return {?}
4698
- */
4699
- (element) => {
4700
- if (element.attributes && element.attributes.length > 0) {
4701
- name = element.attributes.filter((/**
4702
- * @param {?} x
4703
- * @return {?}
4704
- */
4705
- (x) => x.name.toUpperCase() === element.name.toUpperCase()));
4706
- }
4707
- }));
4708
- if (name.length > 0) {
4709
- return name[0].value;
4710
- }
4711
- else {
4712
- return "";
4713
- }
4714
- }
4715
- /**
4716
- * @param {?} element
4717
- * @return {?}
4718
- */
4719
- getCaregories(element) {
4720
- /** @type {?} */
4721
- let MMGroupId = " ";
4722
- if (element.categories && element.categories.length > 0) {
4723
- /** @type {?} */
4724
- let categories = element.categories.filter((/**
4725
- * @param {?} x
4726
- * @return {?}
4727
- */
4728
- (x) => x.parentId != ''));
4729
- /** @type {?} */
4730
- let value = categories.filter((/**
4731
- * @param {?} x
4732
- * @return {?}
4733
- */
4734
- (x) => x.id != x.parentId));
4735
- MMGroupId = value[0].name;
4736
- }
4737
- return MMGroupId;
4738
- }
4730
+ // getAttributes(){
4731
+ // let name: string | any[] = []
4732
+ // this.transactionDocument.basket.products.forEach((element: any) => {
4733
+ // if (element && element.attributes && element.attributes.length > 0) {
4734
+ // name = element.attributes.filter((x: any) => x.name.toUpperCase() === element.name.toUpperCase());
4735
+ // }
4736
+ // });
4737
+ // if (name.length > 0) {
4738
+ // return name[0].value
4739
+ // }
4740
+ // else{
4741
+ // return ""
4742
+ // }
4743
+ // }
4744
+ // getCaregories(element) {
4745
+ // let MMGroupId = " ";
4746
+ // if (element.categories && element.categories.length > 0) {
4747
+ // let categories = element.categories.filter((x) => x.parentId != '');
4748
+ // let value = categories.filter((x) => x.id != x.parentId);
4749
+ // MMGroupId = value[0].name;
4750
+ // }
4751
+ // return MMGroupId;
4752
+ // }
4739
4753
  /**
4740
4754
  * @param {?} date
4741
4755
  * @return {?}
@@ -4786,10 +4800,10 @@ class RJMapperBuilderClass {
4786
4800
  /** @type {?} */
4787
4801
  let quantity;
4788
4802
  if (this.transactionDocument.unreferencedRefund) {
4789
- quantity = element['quantity'] < 0 ? element['quantity'].toFixed(1) : (-element['quantity']).toFixed(1);
4803
+ quantity = element['quantity'] < 0 ? element['quantity'] : (-element['quantity']);
4790
4804
  }
4791
4805
  else {
4792
- quantity = element['refundedQuantity'] < 0 ? element['refundedQuantity'].toFixed(1) : (-element['refundedQuantity']).toFixed(1);
4806
+ quantity = element['refundedQuantity'] < 0 ? element['refundedQuantity'] : (-element['refundedQuantity']);
4793
4807
  }
4794
4808
  return quantity;
4795
4809
  }
@@ -4910,6 +4924,11 @@ if (false) {
4910
4924
  * @private
4911
4925
  */
4912
4926
  RJMapperBuilderClass.prototype.updatedAt;
4927
+ /**
4928
+ * @type {?}
4929
+ * @private
4930
+ */
4931
+ RJMapperBuilderClass.prototype.salesPersonName;
4913
4932
  /**
4914
4933
  * @type {?}
4915
4934
  * @private
@@ -5013,15 +5032,38 @@ class WebReturnMapperBuilderClass {
5013
5032
  // basket products
5014
5033
  (/** @type {?} */ (this)).webReturnObject.basket['products'] = [];
5015
5034
  /** @type {?} */
5016
- let product = {
5017
- 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) : '',
5018
- 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) : '',
5019
- 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,
5020
- 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,
5021
- 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,
5022
- 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,
5023
- 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,
5024
- };
5035
+ let product = {};
5036
+ if ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item) {
5037
+ if ((/** @type {?} */ (this)).document.items.item instanceof Array) {
5038
+ (/** @type {?} */ (this)).document.items.item.forEach((/**
5039
+ * @param {?} element
5040
+ * @return {?}
5041
+ */
5042
+ element => {
5043
+ product = {
5044
+ description: (element.name) ? (/** @type {?} */ (this)).getText(element.name) : '',
5045
+ SKU: (element.sku) ? (/** @type {?} */ (this)).getText(element.sku) : '',
5046
+ quantity: (element.qty_ordered) ? Number((/** @type {?} */ (this)).getText(element.qty_ordered)) : 0,
5047
+ refundedQuantity: (element.qty_refunded) ? Number((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.qty_refunded)) : 0,
5048
+ price: (element.original_price) ? Number((/** @type {?} */ (this)).getText(element.original_price)) : 0,
5049
+ itemLineId: (element.item_id) ? Number((/** @type {?} */ (this)).getText(element.item_id)) : 0,
5050
+ totalLinePrice: (element.row_invoiced) ? Number((/** @type {?} */ (this)).getText(element.row_invoiced)) : 0,
5051
+ };
5052
+ (/** @type {?} */ (this)).webReturnObject.basket['products'].push(product);
5053
+ }));
5054
+ }
5055
+ else {
5056
+ product = {
5057
+ 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) : '',
5058
+ 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) : '',
5059
+ 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,
5060
+ 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,
5061
+ 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,
5062
+ 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,
5063
+ 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,
5064
+ };
5065
+ }
5066
+ }
5025
5067
  (/** @type {?} */ (this)).webReturnObject.basket['products'].push(product);
5026
5068
  return (/** @type {?} */ (this));
5027
5069
  }
@@ -5126,9 +5168,12 @@ class WebReturnMapperBuilderClass {
5126
5168
  * @return {?}
5127
5169
  */
5128
5170
  getText(obj) {
5129
- if (obj) {
5171
+ if (obj && obj.text) {
5130
5172
  return obj.text;
5131
5173
  }
5174
+ else {
5175
+ return obj;
5176
+ }
5132
5177
  }
5133
5178
  /**
5134
5179
  * @param {?} date