@pmcretail/mapper-library 0.0.9 → 0.0.11

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.
@@ -4743,7 +4743,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
4743
4743
  (/** @type {?} */ (this)).rjObject['Header'].TradingRegionID = (/** @type {?} */ (this)).tradingRegionId;
4744
4744
  (/** @type {?} */ (this)).rjObject['Header'].Eurozone = " "; //unknown
4745
4745
  (/** @type {?} */ (this)).rjObject['Header'].EuroBaseExchangeRate = ""; //unknown
4746
- (/** @type {?} */ (this)).rjObject['Header'].PrintableName = ""; //unknown
4746
+ (/** @type {?} */ (this)).rjObject['Header'].PrintableName = (/** @type {?} */ (this)).transactionDocument.userName; //unknown
4747
4747
  return (/** @type {?} */ (this));
4748
4748
  };
4749
4749
  /**
@@ -4888,18 +4888,11 @@ var RJMapperBuilderClass = /** @class */ (function () {
4888
4888
  obj['NetValue'] = element.discountAmount < 0 ? element.discountAmount : -element.discountAmount;
4889
4889
  obj['EffectiveNetValue'] = element.discountAmount < 0 ? element.discountAmount : -element.discountAmount;
4890
4890
  obj['Description'] = element.reasonCode;
4891
- obj['UserID'] = (/** @type {?} */ (_this)).transactionDocument.basket.userId;
4891
+ obj['UserID'] = (/** @type {?} */ (_this)).transactionDocument.userName;
4892
4892
  obj['ReasonCodeID'] = element.reasonCode;
4893
4893
  obj['DiscountType'] = element.discountType.toUpperCase() == DISCOUNTTYPE.PERCENT.toUpperCase() ? 0 : 1; // todo - compare values
4894
4894
  obj['RoundingRule'] = 2;
4895
- obj['ModifiedLineNumber '] = [];
4896
- element.itemLineIds.forEach((/**
4897
- * @param {?} element
4898
- * @return {?}
4899
- */
4900
- function (element) {
4901
- obj['ModifiedLineNumber'].push(element);
4902
- }));
4895
+ obj['ModifiedLineNumber '] = element.itemLineIds;
4903
4896
  obj['LineNumber'] = (/** @type {?} */ (_this)).generateLineNumber();
4904
4897
  // obj['DiscountedValue'] = obj['discountAmount'] // todo - confirm value before discount;
4905
4898
  // obj['DiscountPercentage'] = obj['discountAmount'] / 100 ; // todo - optional
@@ -4927,9 +4920,9 @@ var RJMapperBuilderClass = /** @class */ (function () {
4927
4920
  obj.EffectiveNetValue = 0;
4928
4921
  obj.Description = data.percentageDiscountReasonName ? data.percentageDiscountReasonName : data.priceOverrideReasonName;
4929
4922
  obj.DeviceID = this.deviceId;
4930
- obj.UserID = this.userId;
4923
+ obj.UserID = this.transactionDocument.userName;
4931
4924
  obj.DateTimeCreated = this.updatedAt;
4932
- obj.AuthorisingUserID = this.userId;
4925
+ obj.AuthorisingUserID = this.transactionDocument.userName;
4933
4926
  obj.ReasonCodeID = data.percentageDiscountReasonCode ? data.percentageDiscountReasonCode : data.priceOverrideReasonCode;
4934
4927
  obj.ModifiedLineNumber = lineNo;
4935
4928
  obj.ModifiedIndex = 1;
@@ -4951,8 +4944,8 @@ var RJMapperBuilderClass = /** @class */ (function () {
4951
4944
  (/** @type {?} */ (this)).rjObject['Trailer'] = {};
4952
4945
  (/** @type {?} */ (this)).rjObject.Trailer.DateTimeCompleted = (/** @type {?} */ (this)).updatedAt;
4953
4946
  (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy = {};
4954
- (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.DeviceID = (/** @type {?} */ (this)).deviceId; //todo
4955
- (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.CashierID = (/** @type {?} */ (this)).cashierId; //todo
4947
+ (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.DeviceID = (/** @type {?} */ (this)).deviceId;
4948
+ (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.CashierID = (/** @type {?} */ (this)).cashierId;
4956
4949
  (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.StoreID = (/** @type {?} */ (this)).transactionDocument.storeId;
4957
4950
  (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.BranchID = (/** @type {?} */ (this)).branchId;
4958
4951
  (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.TerminalNumber = (/** @type {?} */ (this)).transactionDocument.terminalId;
@@ -5051,28 +5044,20 @@ var RJMapperBuilderClass = /** @class */ (function () {
5051
5044
  * @return {?}
5052
5045
  */
5053
5046
  function (element) {
5054
- /** @type {?} */
5055
- var value = (/** @type {?} */ (_this)).paymentTypes.filter((/**
5056
- * @param {?} x
5057
- * @return {?}
5058
- */
5059
- function (x) { return x.name.toUpperCase() === element.paymentType.toUpperCase(); }));
5060
5047
  if (element.paymentType.toUpperCase() === 'GIFT CARD') {
5061
5048
  /** @type {?} */
5062
5049
  var obj = {
5063
5050
  XMLSchemaVersion: (/** @type {?} */ (_this)).xmlSchemaVersion,
5064
5051
  LineNumber: (/** @type {?} */ (_this)).generateLineNumber(),
5065
- NetValue: (/** @type {?} */ (_this)).convertToString(-1 * (Math.round(element.amount))),
5066
- EffectiveNetValue: (/** @type {?} */ (_this)).convertToString(-1 * (Math.round(element.amount))),
5067
- Description: (/** @type {?} */ (_this)).getDescription(value[0].name, element),
5052
+ NetValue: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
5053
+ EffectiveNetValue: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
5054
+ Description: (/** @type {?} */ (_this)).getDescription(element),
5068
5055
  DeviceID: (/** @type {?} */ (_this)).deviceId,
5069
- //todo
5070
- UserID: (/** @type {?} */ (_this)).userId,
5071
- //todo
5056
+ UserID: (/** @type {?} */ (_this)).transactionDocument.userName,
5072
5057
  DateTimeCreated: (/** @type {?} */ (_this)).updatedAt,
5073
- TenderType: value[0].tenderType,
5074
- TenderSubType: value[0].tenderSubType,
5075
- TenderAmount: (/** @type {?} */ (_this)).convertToString(-1 * (Math.round(element.amount))),
5058
+ TenderType: element.externalTenderType ? element.externalTenderType : '',
5059
+ TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',
5060
+ TenderAmount: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
5076
5061
  CurrencyID: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
5077
5062
  CurrencyDescription: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
5078
5063
  GiftVoucherSalesAllowed: '',
@@ -5091,14 +5076,12 @@ var RJMapperBuilderClass = /** @class */ (function () {
5091
5076
  //todo
5092
5077
  NetValue: JSON.stringify(-1 * (Math.round(element.amount))),
5093
5078
  EffectiveNetValue: JSON.stringify(-1 * (Math.round(element.amount))),
5094
- Description: (/** @type {?} */ (_this)).getDescription(value[0].name, element),
5079
+ Description: (/** @type {?} */ (_this)).getDescription(element),
5095
5080
  DeviceID: (/** @type {?} */ (_this)).deviceId,
5096
- //todo
5097
- UserID: (/** @type {?} */ (_this)).userId,
5098
- //todo
5081
+ UserID: (/** @type {?} */ (_this)).transactionDocument.userName,
5099
5082
  DateTimeCreated: (/** @type {?} */ (_this)).updatedAt,
5100
- TenderType: value[0].tenderType,
5101
- TenderSubType: value[0].tenderSubType,
5083
+ TenderType: element.externalTenderType ? element.externalTenderType : '',
5084
+ TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',
5102
5085
  TenderAmount: JSON.stringify(-1 * (Math.round(element.amount))),
5103
5086
  CurrencyID: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
5104
5087
  CurrencyDescription: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
@@ -5165,21 +5148,19 @@ var RJMapperBuilderClass = /** @class */ (function () {
5165
5148
  return this.rjObject;
5166
5149
  };
5167
5150
  /**
5168
- * @param {?} paymentType
5169
5151
  * @param {?} element
5170
5152
  * @return {?}
5171
5153
  */
5172
5154
  RJMapperBuilderClass.prototype.getDescription = /**
5173
- * @param {?} paymentType
5174
5155
  * @param {?} element
5175
5156
  * @return {?}
5176
5157
  */
5177
- function (paymentType, element) {
5178
- if (paymentType.toUpperCase() === 'CARD') {
5158
+ function (element) {
5159
+ if (element.paymentType.toUpperCase() === 'CARD') {
5179
5160
  return element.cardType;
5180
5161
  }
5181
5162
  else {
5182
- return paymentType;
5163
+ return element.paymentType;
5183
5164
  }
5184
5165
  };
5185
5166
  /**
@@ -5198,22 +5179,6 @@ var RJMapperBuilderClass = /** @class */ (function () {
5198
5179
  (/** @type {?} */ (this)).deviceId = id;
5199
5180
  return (/** @type {?} */ (this));
5200
5181
  };
5201
- /**
5202
- * @template THIS
5203
- * @this {THIS}
5204
- * @param {?} id
5205
- * @return {THIS}
5206
- */
5207
- RJMapperBuilderClass.prototype.setUserInfo = /**
5208
- * @template THIS
5209
- * @this {THIS}
5210
- * @param {?} id
5211
- * @return {THIS}
5212
- */
5213
- function (id) {
5214
- (/** @type {?} */ (this)).userId = id;
5215
- return (/** @type {?} */ (this));
5216
- };
5217
5182
  /**
5218
5183
  * @param {?} value
5219
5184
  * @return {?}
@@ -5414,7 +5379,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
5414
5379
  * @return {THIS}
5415
5380
  */
5416
5381
  function (value) {
5417
- (/** @type {?} */ (this)).cashierId = value;
5382
+ (/** @type {?} */ (this)).cashierId = ((/** @type {?} */ (this)).transactionDocument && (/** @type {?} */ (this)).transactionDocument.userName) ? (/** @type {?} */ (this)).transactionDocument.userName : '';
5418
5383
  return (/** @type {?} */ (this));
5419
5384
  };
5420
5385
  /**
@@ -5497,22 +5462,6 @@ var RJMapperBuilderClass = /** @class */ (function () {
5497
5462
  (/** @type {?} */ (this)).branchId = value;
5498
5463
  return (/** @type {?} */ (this));
5499
5464
  };
5500
- /**
5501
- * @template THIS
5502
- * @this {THIS}
5503
- * @param {?} value
5504
- * @return {THIS}
5505
- */
5506
- RJMapperBuilderClass.prototype.setPaymentDetails = /**
5507
- * @template THIS
5508
- * @this {THIS}
5509
- * @param {?} value
5510
- * @return {THIS}
5511
- */
5512
- function (value) {
5513
- (/** @type {?} */ (this)).paymentTypes = value;
5514
- return (/** @type {?} */ (this));
5515
- };
5516
5465
  /**
5517
5466
  * @param {?} date
5518
5467
  * @return {?}
@@ -5591,7 +5540,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
5591
5540
  obj['EffectiveNetValue'] = this.removeDecimal(element['refundedTotal']);
5592
5541
  obj['Description'] = element['description'];
5593
5542
  obj['DeviceID'] = this.transactionDocument['terminalId'];
5594
- obj['UserID'] = this.userId;
5543
+ obj['UserID'] = this.transactionDocument.userName;
5595
5544
  obj['DateTimeCreated'] = this.createdAt;
5596
5545
  obj['ExtendedValue'] = this.removeDecimal(element['totalLinePrice'] * -1);
5597
5546
  obj['UnitPrice'] = this.removeDecimal(element['price']);
@@ -5625,7 +5574,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
5625
5574
  obj['Discount'].ModifierDateTime = obj.DateTimeCreated;
5626
5575
  obj['Discount'].ModifierReasonID = lineDiscount.percentageDiscountReasonCode;
5627
5576
  obj['Discount'].ModifierDescription = lineDiscount.percentageDiscountReasonName;
5628
- obj['Discount'].AuthorisingUserID = this.userId;
5577
+ obj['Discount'].AuthorisingUserID = this.transactionDocument.userName;
5629
5578
  obj['Discount'].DiscountType = lineDiscount.discountType;
5630
5579
  obj['Discount'].XMLSchemaVersion = 1;
5631
5580
  obj['Discount'].OriginalPrice = this.removeDecimal(lineDiscount.discountAmount + (lineDiscount.discountedLinePrice || 0));
@@ -5640,7 +5589,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
5640
5589
  obj['PriceOverride'].ModifierDateTime = obj.DateTimeCreated;
5641
5590
  obj['PriceOverride'].ModifierReasonID = lineDiscount.priceOverrideReasonCode;
5642
5591
  obj['PriceOverride'].ModifierReasonDescription = lineDiscount.priceOverrideReasonName;
5643
- obj['PriceOverride'].AuthorisingUserID = this.userId;
5592
+ obj['PriceOverride'].AuthorisingUserID = this.transactionDocument.userName;
5644
5593
  obj['PriceOverride'].XMLSchemaVersion = 1;
5645
5594
  obj['PriceOverride'].NewPrice = this.removeDecimal(lineDiscount.unitPrice);
5646
5595
  obj['PriceOverride'].OriginalPrice = this.removeDecimal(lineDiscount.discountedLinePrice || 0 + lineDiscount.discountAmount);
@@ -5678,9 +5627,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
5678
5627
  EffectiveNetValue: this.removeDecimal(element.totalLinePrice),
5679
5628
  Description: element.description,
5680
5629
  DeviceID: this.deviceId,
5681
- //to do
5682
- UserID: this.userId,
5683
- //to do,
5630
+ UserID: this.transactionDocument.userName,
5684
5631
  DateTimeCreated: this.createdAt,
5685
5632
  ExtendedValue: this.removeDecimal(element.price),
5686
5633
  UnitPrice: this.removeDecimal(element.price),
@@ -5714,7 +5661,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
5714
5661
  obj['Discount'].ModifierDateTime = obj.DateTimeCreated;
5715
5662
  obj['Discount'].ModifierReasonID = lineDiscount.percentageDiscountReasonCode;
5716
5663
  obj['Discount'].ModifierDescription = lineDiscount.percentageDiscountReasonName;
5717
- obj['Discount'].AuthorisingUserID = this.userId;
5664
+ obj['Discount'].AuthorisingUserID = this.transactionDocument.userName;
5718
5665
  obj['Discount'].DiscountType = lineDiscount.discountType;
5719
5666
  obj['Discount'].XMLSchemaVersion = 1;
5720
5667
  obj['Discount'].OriginalPrice = this.removeDecimal(lineDiscount.discountAmount + (lineDiscount.discountedLinePrice || 0));
@@ -5729,7 +5676,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
5729
5676
  obj['PriceOverride'].ModifierDateTime = obj.DateTimeCreated;
5730
5677
  obj['PriceOverride'].ModifierReasonID = lineDiscount.priceOverrideReasonCode;
5731
5678
  obj['PriceOverride'].ModifierReasonDescription = lineDiscount.priceOverrideReasonName;
5732
- obj['PriceOverride'].AuthorisingUserID = this.userId;
5679
+ obj['PriceOverride'].AuthorisingUserID = this.transactionDocument.userName;
5733
5680
  obj['PriceOverride'].XMLSchemaVersion = 1;
5734
5681
  obj['PriceOverride'].NewPrice = this.removeDecimal(lineDiscount.unitPrice);
5735
5682
  obj['PriceOverride'].OriginalPrice = this.removeDecimal(lineDiscount.discountedLinePrice || 0 + lineDiscount.discountAmount);
@@ -5859,11 +5806,6 @@ if (false) {
5859
5806
  * @private
5860
5807
  */
5861
5808
  RJMapperBuilderClass.prototype.transactionDocument;
5862
- /**
5863
- * @type {?}
5864
- * @private
5865
- */
5866
- RJMapperBuilderClass.prototype.userId;
5867
5809
  /**
5868
5810
  * @type {?}
5869
5811
  * @private