@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.
@@ -4963,7 +4963,7 @@
4963
4963
  (/** @type {?} */ (this)).rjObject['Header'].TradingRegionID = (/** @type {?} */ (this)).tradingRegionId;
4964
4964
  (/** @type {?} */ (this)).rjObject['Header'].Eurozone = " "; //unknown
4965
4965
  (/** @type {?} */ (this)).rjObject['Header'].EuroBaseExchangeRate = ""; //unknown
4966
- (/** @type {?} */ (this)).rjObject['Header'].PrintableName = ""; //unknown
4966
+ (/** @type {?} */ (this)).rjObject['Header'].PrintableName = (/** @type {?} */ (this)).transactionDocument.userName; //unknown
4967
4967
  return (/** @type {?} */ (this));
4968
4968
  };
4969
4969
  /**
@@ -5108,18 +5108,11 @@
5108
5108
  obj['NetValue'] = element.discountAmount < 0 ? element.discountAmount : -element.discountAmount;
5109
5109
  obj['EffectiveNetValue'] = element.discountAmount < 0 ? element.discountAmount : -element.discountAmount;
5110
5110
  obj['Description'] = element.reasonCode;
5111
- obj['UserID'] = (/** @type {?} */ (_this)).transactionDocument.basket.userId;
5111
+ obj['UserID'] = (/** @type {?} */ (_this)).transactionDocument.userName;
5112
5112
  obj['ReasonCodeID'] = element.reasonCode;
5113
5113
  obj['DiscountType'] = element.discountType.toUpperCase() == DISCOUNTTYPE.PERCENT.toUpperCase() ? 0 : 1; // todo - compare values
5114
5114
  obj['RoundingRule'] = 2;
5115
- obj['ModifiedLineNumber '] = [];
5116
- element.itemLineIds.forEach((/**
5117
- * @param {?} element
5118
- * @return {?}
5119
- */
5120
- function (element) {
5121
- obj['ModifiedLineNumber'].push(element);
5122
- }));
5115
+ obj['ModifiedLineNumber '] = element.itemLineIds;
5123
5116
  obj['LineNumber'] = (/** @type {?} */ (_this)).generateLineNumber();
5124
5117
  // obj['DiscountedValue'] = obj['discountAmount'] // todo - confirm value before discount;
5125
5118
  // obj['DiscountPercentage'] = obj['discountAmount'] / 100 ; // todo - optional
@@ -5147,9 +5140,9 @@
5147
5140
  obj.EffectiveNetValue = 0;
5148
5141
  obj.Description = data.percentageDiscountReasonName ? data.percentageDiscountReasonName : data.priceOverrideReasonName;
5149
5142
  obj.DeviceID = this.deviceId;
5150
- obj.UserID = this.userId;
5143
+ obj.UserID = this.transactionDocument.userName;
5151
5144
  obj.DateTimeCreated = this.updatedAt;
5152
- obj.AuthorisingUserID = this.userId;
5145
+ obj.AuthorisingUserID = this.transactionDocument.userName;
5153
5146
  obj.ReasonCodeID = data.percentageDiscountReasonCode ? data.percentageDiscountReasonCode : data.priceOverrideReasonCode;
5154
5147
  obj.ModifiedLineNumber = lineNo;
5155
5148
  obj.ModifiedIndex = 1;
@@ -5171,8 +5164,8 @@
5171
5164
  (/** @type {?} */ (this)).rjObject['Trailer'] = {};
5172
5165
  (/** @type {?} */ (this)).rjObject.Trailer.DateTimeCompleted = (/** @type {?} */ (this)).updatedAt;
5173
5166
  (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy = {};
5174
- (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.DeviceID = (/** @type {?} */ (this)).deviceId; //todo
5175
- (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.CashierID = (/** @type {?} */ (this)).cashierId; //todo
5167
+ (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.DeviceID = (/** @type {?} */ (this)).deviceId;
5168
+ (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.CashierID = (/** @type {?} */ (this)).cashierId;
5176
5169
  (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.StoreID = (/** @type {?} */ (this)).transactionDocument.storeId;
5177
5170
  (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.BranchID = (/** @type {?} */ (this)).branchId;
5178
5171
  (/** @type {?} */ (this)).rjObject.Trailer.CompletedBy.TerminalNumber = (/** @type {?} */ (this)).transactionDocument.terminalId;
@@ -5271,28 +5264,20 @@
5271
5264
  * @return {?}
5272
5265
  */
5273
5266
  function (element) {
5274
- /** @type {?} */
5275
- var value = (/** @type {?} */ (_this)).paymentTypes.filter((/**
5276
- * @param {?} x
5277
- * @return {?}
5278
- */
5279
- function (x) { return x.name.toUpperCase() === element.paymentType.toUpperCase(); }));
5280
5267
  if (element.paymentType.toUpperCase() === 'GIFT CARD') {
5281
5268
  /** @type {?} */
5282
5269
  var obj = {
5283
5270
  XMLSchemaVersion: (/** @type {?} */ (_this)).xmlSchemaVersion,
5284
5271
  LineNumber: (/** @type {?} */ (_this)).generateLineNumber(),
5285
- NetValue: (/** @type {?} */ (_this)).convertToString(-1 * (Math.round(element.amount))),
5286
- EffectiveNetValue: (/** @type {?} */ (_this)).convertToString(-1 * (Math.round(element.amount))),
5287
- Description: (/** @type {?} */ (_this)).getDescription(value[0].name, element),
5272
+ NetValue: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
5273
+ EffectiveNetValue: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
5274
+ Description: (/** @type {?} */ (_this)).getDescription(element),
5288
5275
  DeviceID: (/** @type {?} */ (_this)).deviceId,
5289
- //todo
5290
- UserID: (/** @type {?} */ (_this)).userId,
5291
- //todo
5276
+ UserID: (/** @type {?} */ (_this)).transactionDocument.userName,
5292
5277
  DateTimeCreated: (/** @type {?} */ (_this)).updatedAt,
5293
- TenderType: value[0].tenderType,
5294
- TenderSubType: value[0].tenderSubType,
5295
- TenderAmount: (/** @type {?} */ (_this)).convertToString(-1 * (Math.round(element.amount))),
5278
+ TenderType: element.externalTenderType ? element.externalTenderType : '',
5279
+ TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',
5280
+ TenderAmount: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
5296
5281
  CurrencyID: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
5297
5282
  CurrencyDescription: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
5298
5283
  GiftVoucherSalesAllowed: '',
@@ -5311,14 +5296,12 @@
5311
5296
  //todo
5312
5297
  NetValue: JSON.stringify(-1 * (Math.round(element.amount))),
5313
5298
  EffectiveNetValue: JSON.stringify(-1 * (Math.round(element.amount))),
5314
- Description: (/** @type {?} */ (_this)).getDescription(value[0].name, element),
5299
+ Description: (/** @type {?} */ (_this)).getDescription(element),
5315
5300
  DeviceID: (/** @type {?} */ (_this)).deviceId,
5316
- //todo
5317
- UserID: (/** @type {?} */ (_this)).userId,
5318
- //todo
5301
+ UserID: (/** @type {?} */ (_this)).transactionDocument.userName,
5319
5302
  DateTimeCreated: (/** @type {?} */ (_this)).updatedAt,
5320
- TenderType: value[0].tenderType,
5321
- TenderSubType: value[0].tenderSubType,
5303
+ TenderType: element.externalTenderType ? element.externalTenderType : '',
5304
+ TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',
5322
5305
  TenderAmount: JSON.stringify(-1 * (Math.round(element.amount))),
5323
5306
  CurrencyID: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
5324
5307
  CurrencyDescription: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
@@ -5385,21 +5368,19 @@
5385
5368
  return this.rjObject;
5386
5369
  };
5387
5370
  /**
5388
- * @param {?} paymentType
5389
5371
  * @param {?} element
5390
5372
  * @return {?}
5391
5373
  */
5392
5374
  RJMapperBuilderClass.prototype.getDescription = /**
5393
- * @param {?} paymentType
5394
5375
  * @param {?} element
5395
5376
  * @return {?}
5396
5377
  */
5397
- function (paymentType, element) {
5398
- if (paymentType.toUpperCase() === 'CARD') {
5378
+ function (element) {
5379
+ if (element.paymentType.toUpperCase() === 'CARD') {
5399
5380
  return element.cardType;
5400
5381
  }
5401
5382
  else {
5402
- return paymentType;
5383
+ return element.paymentType;
5403
5384
  }
5404
5385
  };
5405
5386
  /**
@@ -5418,22 +5399,6 @@
5418
5399
  (/** @type {?} */ (this)).deviceId = id;
5419
5400
  return (/** @type {?} */ (this));
5420
5401
  };
5421
- /**
5422
- * @template THIS
5423
- * @this {THIS}
5424
- * @param {?} id
5425
- * @return {THIS}
5426
- */
5427
- RJMapperBuilderClass.prototype.setUserInfo = /**
5428
- * @template THIS
5429
- * @this {THIS}
5430
- * @param {?} id
5431
- * @return {THIS}
5432
- */
5433
- function (id) {
5434
- (/** @type {?} */ (this)).userId = id;
5435
- return (/** @type {?} */ (this));
5436
- };
5437
5402
  /**
5438
5403
  * @param {?} value
5439
5404
  * @return {?}
@@ -5634,7 +5599,7 @@
5634
5599
  * @return {THIS}
5635
5600
  */
5636
5601
  function (value) {
5637
- (/** @type {?} */ (this)).cashierId = value;
5602
+ (/** @type {?} */ (this)).cashierId = ((/** @type {?} */ (this)).transactionDocument && (/** @type {?} */ (this)).transactionDocument.userName) ? (/** @type {?} */ (this)).transactionDocument.userName : '';
5638
5603
  return (/** @type {?} */ (this));
5639
5604
  };
5640
5605
  /**
@@ -5717,22 +5682,6 @@
5717
5682
  (/** @type {?} */ (this)).branchId = value;
5718
5683
  return (/** @type {?} */ (this));
5719
5684
  };
5720
- /**
5721
- * @template THIS
5722
- * @this {THIS}
5723
- * @param {?} value
5724
- * @return {THIS}
5725
- */
5726
- RJMapperBuilderClass.prototype.setPaymentDetails = /**
5727
- * @template THIS
5728
- * @this {THIS}
5729
- * @param {?} value
5730
- * @return {THIS}
5731
- */
5732
- function (value) {
5733
- (/** @type {?} */ (this)).paymentTypes = value;
5734
- return (/** @type {?} */ (this));
5735
- };
5736
5685
  /**
5737
5686
  * @param {?} date
5738
5687
  * @return {?}
@@ -5811,7 +5760,7 @@
5811
5760
  obj['EffectiveNetValue'] = this.removeDecimal(element['refundedTotal']);
5812
5761
  obj['Description'] = element['description'];
5813
5762
  obj['DeviceID'] = this.transactionDocument['terminalId'];
5814
- obj['UserID'] = this.userId;
5763
+ obj['UserID'] = this.transactionDocument.userName;
5815
5764
  obj['DateTimeCreated'] = this.createdAt;
5816
5765
  obj['ExtendedValue'] = this.removeDecimal(element['totalLinePrice'] * -1);
5817
5766
  obj['UnitPrice'] = this.removeDecimal(element['price']);
@@ -5845,7 +5794,7 @@
5845
5794
  obj['Discount'].ModifierDateTime = obj.DateTimeCreated;
5846
5795
  obj['Discount'].ModifierReasonID = lineDiscount.percentageDiscountReasonCode;
5847
5796
  obj['Discount'].ModifierDescription = lineDiscount.percentageDiscountReasonName;
5848
- obj['Discount'].AuthorisingUserID = this.userId;
5797
+ obj['Discount'].AuthorisingUserID = this.transactionDocument.userName;
5849
5798
  obj['Discount'].DiscountType = lineDiscount.discountType;
5850
5799
  obj['Discount'].XMLSchemaVersion = 1;
5851
5800
  obj['Discount'].OriginalPrice = this.removeDecimal(lineDiscount.discountAmount + (lineDiscount.discountedLinePrice || 0));
@@ -5860,7 +5809,7 @@
5860
5809
  obj['PriceOverride'].ModifierDateTime = obj.DateTimeCreated;
5861
5810
  obj['PriceOverride'].ModifierReasonID = lineDiscount.priceOverrideReasonCode;
5862
5811
  obj['PriceOverride'].ModifierReasonDescription = lineDiscount.priceOverrideReasonName;
5863
- obj['PriceOverride'].AuthorisingUserID = this.userId;
5812
+ obj['PriceOverride'].AuthorisingUserID = this.transactionDocument.userName;
5864
5813
  obj['PriceOverride'].XMLSchemaVersion = 1;
5865
5814
  obj['PriceOverride'].NewPrice = this.removeDecimal(lineDiscount.unitPrice);
5866
5815
  obj['PriceOverride'].OriginalPrice = this.removeDecimal(lineDiscount.discountedLinePrice || 0 + lineDiscount.discountAmount);
@@ -5898,9 +5847,7 @@
5898
5847
  EffectiveNetValue: this.removeDecimal(element.totalLinePrice),
5899
5848
  Description: element.description,
5900
5849
  DeviceID: this.deviceId,
5901
- //to do
5902
- UserID: this.userId,
5903
- //to do,
5850
+ UserID: this.transactionDocument.userName,
5904
5851
  DateTimeCreated: this.createdAt,
5905
5852
  ExtendedValue: this.removeDecimal(element.price),
5906
5853
  UnitPrice: this.removeDecimal(element.price),
@@ -5934,7 +5881,7 @@
5934
5881
  obj['Discount'].ModifierDateTime = obj.DateTimeCreated;
5935
5882
  obj['Discount'].ModifierReasonID = lineDiscount.percentageDiscountReasonCode;
5936
5883
  obj['Discount'].ModifierDescription = lineDiscount.percentageDiscountReasonName;
5937
- obj['Discount'].AuthorisingUserID = this.userId;
5884
+ obj['Discount'].AuthorisingUserID = this.transactionDocument.userName;
5938
5885
  obj['Discount'].DiscountType = lineDiscount.discountType;
5939
5886
  obj['Discount'].XMLSchemaVersion = 1;
5940
5887
  obj['Discount'].OriginalPrice = this.removeDecimal(lineDiscount.discountAmount + (lineDiscount.discountedLinePrice || 0));
@@ -5949,7 +5896,7 @@
5949
5896
  obj['PriceOverride'].ModifierDateTime = obj.DateTimeCreated;
5950
5897
  obj['PriceOverride'].ModifierReasonID = lineDiscount.priceOverrideReasonCode;
5951
5898
  obj['PriceOverride'].ModifierReasonDescription = lineDiscount.priceOverrideReasonName;
5952
- obj['PriceOverride'].AuthorisingUserID = this.userId;
5899
+ obj['PriceOverride'].AuthorisingUserID = this.transactionDocument.userName;
5953
5900
  obj['PriceOverride'].XMLSchemaVersion = 1;
5954
5901
  obj['PriceOverride'].NewPrice = this.removeDecimal(lineDiscount.unitPrice);
5955
5902
  obj['PriceOverride'].OriginalPrice = this.removeDecimal(lineDiscount.discountedLinePrice || 0 + lineDiscount.discountAmount);
@@ -6079,11 +6026,6 @@
6079
6026
  * @private
6080
6027
  */
6081
6028
  RJMapperBuilderClass.prototype.transactionDocument;
6082
- /**
6083
- * @type {?}
6084
- * @private
6085
- */
6086
- RJMapperBuilderClass.prototype.userId;
6087
6029
  /**
6088
6030
  * @type {?}
6089
6031
  * @private