@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.
@@ -4892,14 +4892,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
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
@@ -4929,7 +4922,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
4929
4922
  obj.DeviceID = this.deviceId;
4930
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;
@@ -5051,12 +5044,6 @@ 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 = {
@@ -5064,12 +5051,12 @@ var RJMapperBuilderClass = /** @class */ (function () {
5064
5051
  LineNumber: (/** @type {?} */ (_this)).generateLineNumber(),
5065
5052
  NetValue: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
5066
5053
  EffectiveNetValue: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
5067
- Description: (/** @type {?} */ (_this)).getDescription(value[0].name, element),
5054
+ Description: (/** @type {?} */ (_this)).getDescription(element),
5068
5055
  DeviceID: (/** @type {?} */ (_this)).deviceId,
5069
5056
  UserID: (/** @type {?} */ (_this)).transactionDocument.userName,
5070
5057
  DateTimeCreated: (/** @type {?} */ (_this)).updatedAt,
5071
- TenderType: value[0].tenderType,
5072
- TenderSubType: value[0].tenderSubType,
5058
+ TenderType: element.externalTenderType ? element.externalTenderType : '',
5059
+ TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',
5073
5060
  TenderAmount: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
5074
5061
  CurrencyID: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
5075
5062
  CurrencyDescription: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
@@ -5089,12 +5076,12 @@ var RJMapperBuilderClass = /** @class */ (function () {
5089
5076
  //todo
5090
5077
  NetValue: JSON.stringify(-1 * (Math.round(element.amount))),
5091
5078
  EffectiveNetValue: JSON.stringify(-1 * (Math.round(element.amount))),
5092
- Description: (/** @type {?} */ (_this)).getDescription(value[0].name, element),
5079
+ Description: (/** @type {?} */ (_this)).getDescription(element),
5093
5080
  DeviceID: (/** @type {?} */ (_this)).deviceId,
5094
5081
  UserID: (/** @type {?} */ (_this)).transactionDocument.userName,
5095
5082
  DateTimeCreated: (/** @type {?} */ (_this)).updatedAt,
5096
- TenderType: value[0].tenderType,
5097
- TenderSubType: value[0].tenderSubType,
5083
+ TenderType: element.externalTenderType ? element.externalTenderType : '',
5084
+ TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',
5098
5085
  TenderAmount: JSON.stringify(-1 * (Math.round(element.amount))),
5099
5086
  CurrencyID: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
5100
5087
  CurrencyDescription: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
@@ -5161,21 +5148,19 @@ var RJMapperBuilderClass = /** @class */ (function () {
5161
5148
  return this.rjObject;
5162
5149
  };
5163
5150
  /**
5164
- * @param {?} paymentType
5165
5151
  * @param {?} element
5166
5152
  * @return {?}
5167
5153
  */
5168
5154
  RJMapperBuilderClass.prototype.getDescription = /**
5169
- * @param {?} paymentType
5170
5155
  * @param {?} element
5171
5156
  * @return {?}
5172
5157
  */
5173
- function (paymentType, element) {
5174
- if (paymentType.toUpperCase() === 'CARD') {
5158
+ function (element) {
5159
+ if (element.paymentType.toUpperCase() === 'CARD') {
5175
5160
  return element.cardType;
5176
5161
  }
5177
5162
  else {
5178
- return paymentType;
5163
+ return element.paymentType;
5179
5164
  }
5180
5165
  };
5181
5166
  /**
@@ -5194,22 +5179,6 @@ var RJMapperBuilderClass = /** @class */ (function () {
5194
5179
  (/** @type {?} */ (this)).deviceId = id;
5195
5180
  return (/** @type {?} */ (this));
5196
5181
  };
5197
- /**
5198
- * @template THIS
5199
- * @this {THIS}
5200
- * @param {?} id
5201
- * @return {THIS}
5202
- */
5203
- RJMapperBuilderClass.prototype.setUserInfo = /**
5204
- * @template THIS
5205
- * @this {THIS}
5206
- * @param {?} id
5207
- * @return {THIS}
5208
- */
5209
- function (id) {
5210
- (/** @type {?} */ (this)).userId = id;
5211
- return (/** @type {?} */ (this));
5212
- };
5213
5182
  /**
5214
5183
  * @param {?} value
5215
5184
  * @return {?}
@@ -5493,22 +5462,6 @@ var RJMapperBuilderClass = /** @class */ (function () {
5493
5462
  (/** @type {?} */ (this)).branchId = value;
5494
5463
  return (/** @type {?} */ (this));
5495
5464
  };
5496
- /**
5497
- * @template THIS
5498
- * @this {THIS}
5499
- * @param {?} value
5500
- * @return {THIS}
5501
- */
5502
- RJMapperBuilderClass.prototype.setPaymentDetails = /**
5503
- * @template THIS
5504
- * @this {THIS}
5505
- * @param {?} value
5506
- * @return {THIS}
5507
- */
5508
- function (value) {
5509
- (/** @type {?} */ (this)).paymentTypes = value;
5510
- return (/** @type {?} */ (this));
5511
- };
5512
5465
  /**
5513
5466
  * @param {?} date
5514
5467
  * @return {?}
@@ -5587,7 +5540,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
5587
5540
  obj['EffectiveNetValue'] = this.removeDecimal(element['refundedTotal']);
5588
5541
  obj['Description'] = element['description'];
5589
5542
  obj['DeviceID'] = this.transactionDocument['terminalId'];
5590
- obj['UserID'] = this.userId;
5543
+ obj['UserID'] = this.transactionDocument.userName;
5591
5544
  obj['DateTimeCreated'] = this.createdAt;
5592
5545
  obj['ExtendedValue'] = this.removeDecimal(element['totalLinePrice'] * -1);
5593
5546
  obj['UnitPrice'] = this.removeDecimal(element['price']);
@@ -5621,7 +5574,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
5621
5574
  obj['Discount'].ModifierDateTime = obj.DateTimeCreated;
5622
5575
  obj['Discount'].ModifierReasonID = lineDiscount.percentageDiscountReasonCode;
5623
5576
  obj['Discount'].ModifierDescription = lineDiscount.percentageDiscountReasonName;
5624
- obj['Discount'].AuthorisingUserID = this.userId;
5577
+ obj['Discount'].AuthorisingUserID = this.transactionDocument.userName;
5625
5578
  obj['Discount'].DiscountType = lineDiscount.discountType;
5626
5579
  obj['Discount'].XMLSchemaVersion = 1;
5627
5580
  obj['Discount'].OriginalPrice = this.removeDecimal(lineDiscount.discountAmount + (lineDiscount.discountedLinePrice || 0));
@@ -5636,7 +5589,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
5636
5589
  obj['PriceOverride'].ModifierDateTime = obj.DateTimeCreated;
5637
5590
  obj['PriceOverride'].ModifierReasonID = lineDiscount.priceOverrideReasonCode;
5638
5591
  obj['PriceOverride'].ModifierReasonDescription = lineDiscount.priceOverrideReasonName;
5639
- obj['PriceOverride'].AuthorisingUserID = this.userId;
5592
+ obj['PriceOverride'].AuthorisingUserID = this.transactionDocument.userName;
5640
5593
  obj['PriceOverride'].XMLSchemaVersion = 1;
5641
5594
  obj['PriceOverride'].NewPrice = this.removeDecimal(lineDiscount.unitPrice);
5642
5595
  obj['PriceOverride'].OriginalPrice = this.removeDecimal(lineDiscount.discountedLinePrice || 0 + lineDiscount.discountAmount);
@@ -5708,7 +5661,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
5708
5661
  obj['Discount'].ModifierDateTime = obj.DateTimeCreated;
5709
5662
  obj['Discount'].ModifierReasonID = lineDiscount.percentageDiscountReasonCode;
5710
5663
  obj['Discount'].ModifierDescription = lineDiscount.percentageDiscountReasonName;
5711
- obj['Discount'].AuthorisingUserID = this.userId;
5664
+ obj['Discount'].AuthorisingUserID = this.transactionDocument.userName;
5712
5665
  obj['Discount'].DiscountType = lineDiscount.discountType;
5713
5666
  obj['Discount'].XMLSchemaVersion = 1;
5714
5667
  obj['Discount'].OriginalPrice = this.removeDecimal(lineDiscount.discountAmount + (lineDiscount.discountedLinePrice || 0));
@@ -5723,7 +5676,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
5723
5676
  obj['PriceOverride'].ModifierDateTime = obj.DateTimeCreated;
5724
5677
  obj['PriceOverride'].ModifierReasonID = lineDiscount.priceOverrideReasonCode;
5725
5678
  obj['PriceOverride'].ModifierReasonDescription = lineDiscount.priceOverrideReasonName;
5726
- obj['PriceOverride'].AuthorisingUserID = this.userId;
5679
+ obj['PriceOverride'].AuthorisingUserID = this.transactionDocument.userName;
5727
5680
  obj['PriceOverride'].XMLSchemaVersion = 1;
5728
5681
  obj['PriceOverride'].NewPrice = this.removeDecimal(lineDiscount.unitPrice);
5729
5682
  obj['PriceOverride'].OriginalPrice = this.removeDecimal(lineDiscount.discountedLinePrice || 0 + lineDiscount.discountAmount);
@@ -5853,11 +5806,6 @@ if (false) {
5853
5806
  * @private
5854
5807
  */
5855
5808
  RJMapperBuilderClass.prototype.transactionDocument;
5856
- /**
5857
- * @type {?}
5858
- * @private
5859
- */
5860
- RJMapperBuilderClass.prototype.userId;
5861
5809
  /**
5862
5810
  * @type {?}
5863
5811
  * @private