@pmcretail/mapper-library 0.0.10 → 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.
@@ -5112,14 +5112,7 @@
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
@@ -5149,7 +5142,7 @@
5149
5142
  obj.DeviceID = this.deviceId;
5150
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;
@@ -5271,12 +5264,6 @@
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 = {
@@ -5284,12 +5271,12 @@
5284
5271
  LineNumber: (/** @type {?} */ (_this)).generateLineNumber(),
5285
5272
  NetValue: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
5286
5273
  EffectiveNetValue: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
5287
- Description: (/** @type {?} */ (_this)).getDescription(value[0].name, element),
5274
+ Description: (/** @type {?} */ (_this)).getDescription(element),
5288
5275
  DeviceID: (/** @type {?} */ (_this)).deviceId,
5289
5276
  UserID: (/** @type {?} */ (_this)).transactionDocument.userName,
5290
5277
  DateTimeCreated: (/** @type {?} */ (_this)).updatedAt,
5291
- TenderType: value[0].tenderType,
5292
- TenderSubType: value[0].tenderSubType,
5278
+ TenderType: element.externalTenderType ? element.externalTenderType : '',
5279
+ TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',
5293
5280
  TenderAmount: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
5294
5281
  CurrencyID: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
5295
5282
  CurrencyDescription: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
@@ -5309,12 +5296,12 @@
5309
5296
  //todo
5310
5297
  NetValue: JSON.stringify(-1 * (Math.round(element.amount))),
5311
5298
  EffectiveNetValue: JSON.stringify(-1 * (Math.round(element.amount))),
5312
- Description: (/** @type {?} */ (_this)).getDescription(value[0].name, element),
5299
+ Description: (/** @type {?} */ (_this)).getDescription(element),
5313
5300
  DeviceID: (/** @type {?} */ (_this)).deviceId,
5314
5301
  UserID: (/** @type {?} */ (_this)).transactionDocument.userName,
5315
5302
  DateTimeCreated: (/** @type {?} */ (_this)).updatedAt,
5316
- TenderType: value[0].tenderType,
5317
- TenderSubType: value[0].tenderSubType,
5303
+ TenderType: element.externalTenderType ? element.externalTenderType : '',
5304
+ TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',
5318
5305
  TenderAmount: JSON.stringify(-1 * (Math.round(element.amount))),
5319
5306
  CurrencyID: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
5320
5307
  CurrencyDescription: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
@@ -5381,21 +5368,19 @@
5381
5368
  return this.rjObject;
5382
5369
  };
5383
5370
  /**
5384
- * @param {?} paymentType
5385
5371
  * @param {?} element
5386
5372
  * @return {?}
5387
5373
  */
5388
5374
  RJMapperBuilderClass.prototype.getDescription = /**
5389
- * @param {?} paymentType
5390
5375
  * @param {?} element
5391
5376
  * @return {?}
5392
5377
  */
5393
- function (paymentType, element) {
5394
- if (paymentType.toUpperCase() === 'CARD') {
5378
+ function (element) {
5379
+ if (element.paymentType.toUpperCase() === 'CARD') {
5395
5380
  return element.cardType;
5396
5381
  }
5397
5382
  else {
5398
- return paymentType;
5383
+ return element.paymentType;
5399
5384
  }
5400
5385
  };
5401
5386
  /**
@@ -5414,22 +5399,6 @@
5414
5399
  (/** @type {?} */ (this)).deviceId = id;
5415
5400
  return (/** @type {?} */ (this));
5416
5401
  };
5417
- /**
5418
- * @template THIS
5419
- * @this {THIS}
5420
- * @param {?} id
5421
- * @return {THIS}
5422
- */
5423
- RJMapperBuilderClass.prototype.setUserInfo = /**
5424
- * @template THIS
5425
- * @this {THIS}
5426
- * @param {?} id
5427
- * @return {THIS}
5428
- */
5429
- function (id) {
5430
- (/** @type {?} */ (this)).userId = id;
5431
- return (/** @type {?} */ (this));
5432
- };
5433
5402
  /**
5434
5403
  * @param {?} value
5435
5404
  * @return {?}
@@ -5713,22 +5682,6 @@
5713
5682
  (/** @type {?} */ (this)).branchId = value;
5714
5683
  return (/** @type {?} */ (this));
5715
5684
  };
5716
- /**
5717
- * @template THIS
5718
- * @this {THIS}
5719
- * @param {?} value
5720
- * @return {THIS}
5721
- */
5722
- RJMapperBuilderClass.prototype.setPaymentDetails = /**
5723
- * @template THIS
5724
- * @this {THIS}
5725
- * @param {?} value
5726
- * @return {THIS}
5727
- */
5728
- function (value) {
5729
- (/** @type {?} */ (this)).paymentTypes = value;
5730
- return (/** @type {?} */ (this));
5731
- };
5732
5685
  /**
5733
5686
  * @param {?} date
5734
5687
  * @return {?}
@@ -5807,7 +5760,7 @@
5807
5760
  obj['EffectiveNetValue'] = this.removeDecimal(element['refundedTotal']);
5808
5761
  obj['Description'] = element['description'];
5809
5762
  obj['DeviceID'] = this.transactionDocument['terminalId'];
5810
- obj['UserID'] = this.userId;
5763
+ obj['UserID'] = this.transactionDocument.userName;
5811
5764
  obj['DateTimeCreated'] = this.createdAt;
5812
5765
  obj['ExtendedValue'] = this.removeDecimal(element['totalLinePrice'] * -1);
5813
5766
  obj['UnitPrice'] = this.removeDecimal(element['price']);
@@ -5841,7 +5794,7 @@
5841
5794
  obj['Discount'].ModifierDateTime = obj.DateTimeCreated;
5842
5795
  obj['Discount'].ModifierReasonID = lineDiscount.percentageDiscountReasonCode;
5843
5796
  obj['Discount'].ModifierDescription = lineDiscount.percentageDiscountReasonName;
5844
- obj['Discount'].AuthorisingUserID = this.userId;
5797
+ obj['Discount'].AuthorisingUserID = this.transactionDocument.userName;
5845
5798
  obj['Discount'].DiscountType = lineDiscount.discountType;
5846
5799
  obj['Discount'].XMLSchemaVersion = 1;
5847
5800
  obj['Discount'].OriginalPrice = this.removeDecimal(lineDiscount.discountAmount + (lineDiscount.discountedLinePrice || 0));
@@ -5856,7 +5809,7 @@
5856
5809
  obj['PriceOverride'].ModifierDateTime = obj.DateTimeCreated;
5857
5810
  obj['PriceOverride'].ModifierReasonID = lineDiscount.priceOverrideReasonCode;
5858
5811
  obj['PriceOverride'].ModifierReasonDescription = lineDiscount.priceOverrideReasonName;
5859
- obj['PriceOverride'].AuthorisingUserID = this.userId;
5812
+ obj['PriceOverride'].AuthorisingUserID = this.transactionDocument.userName;
5860
5813
  obj['PriceOverride'].XMLSchemaVersion = 1;
5861
5814
  obj['PriceOverride'].NewPrice = this.removeDecimal(lineDiscount.unitPrice);
5862
5815
  obj['PriceOverride'].OriginalPrice = this.removeDecimal(lineDiscount.discountedLinePrice || 0 + lineDiscount.discountAmount);
@@ -5928,7 +5881,7 @@
5928
5881
  obj['Discount'].ModifierDateTime = obj.DateTimeCreated;
5929
5882
  obj['Discount'].ModifierReasonID = lineDiscount.percentageDiscountReasonCode;
5930
5883
  obj['Discount'].ModifierDescription = lineDiscount.percentageDiscountReasonName;
5931
- obj['Discount'].AuthorisingUserID = this.userId;
5884
+ obj['Discount'].AuthorisingUserID = this.transactionDocument.userName;
5932
5885
  obj['Discount'].DiscountType = lineDiscount.discountType;
5933
5886
  obj['Discount'].XMLSchemaVersion = 1;
5934
5887
  obj['Discount'].OriginalPrice = this.removeDecimal(lineDiscount.discountAmount + (lineDiscount.discountedLinePrice || 0));
@@ -5943,7 +5896,7 @@
5943
5896
  obj['PriceOverride'].ModifierDateTime = obj.DateTimeCreated;
5944
5897
  obj['PriceOverride'].ModifierReasonID = lineDiscount.priceOverrideReasonCode;
5945
5898
  obj['PriceOverride'].ModifierReasonDescription = lineDiscount.priceOverrideReasonName;
5946
- obj['PriceOverride'].AuthorisingUserID = this.userId;
5899
+ obj['PriceOverride'].AuthorisingUserID = this.transactionDocument.userName;
5947
5900
  obj['PriceOverride'].XMLSchemaVersion = 1;
5948
5901
  obj['PriceOverride'].NewPrice = this.removeDecimal(lineDiscount.unitPrice);
5949
5902
  obj['PriceOverride'].OriginalPrice = this.removeDecimal(lineDiscount.discountedLinePrice || 0 + lineDiscount.discountAmount);
@@ -6073,11 +6026,6 @@
6073
6026
  * @private
6074
6027
  */
6075
6028
  RJMapperBuilderClass.prototype.transactionDocument;
6076
- /**
6077
- * @type {?}
6078
- * @private
6079
- */
6080
- RJMapperBuilderClass.prototype.userId;
6081
6029
  /**
6082
6030
  * @type {?}
6083
6031
  * @private