@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.
@@ -3700,14 +3700,7 @@ class RJMapperBuilderClass {
3700
3700
  obj['ReasonCodeID'] = element.reasonCode;
3701
3701
  obj['DiscountType'] = element.discountType.toUpperCase() == DISCOUNTTYPE.PERCENT.toUpperCase() ? 0 : 1; // todo - compare values
3702
3702
  obj['RoundingRule'] = 2;
3703
- obj['ModifiedLineNumber '] = [];
3704
- element.itemLineIds.forEach((/**
3705
- * @param {?} element
3706
- * @return {?}
3707
- */
3708
- (element) => {
3709
- obj['ModifiedLineNumber'].push(element);
3710
- }));
3703
+ obj['ModifiedLineNumber '] = element.itemLineIds;
3711
3704
  obj['LineNumber'] = (/** @type {?} */ (this)).generateLineNumber();
3712
3705
  // obj['DiscountedValue'] = obj['discountAmount'] // todo - confirm value before discount;
3713
3706
  // obj['DiscountPercentage'] = obj['discountAmount'] / 100 ; // todo - optional
@@ -3732,7 +3725,7 @@ class RJMapperBuilderClass {
3732
3725
  obj.DeviceID = this.deviceId;
3733
3726
  obj.UserID = this.transactionDocument.userName;
3734
3727
  obj.DateTimeCreated = this.updatedAt;
3735
- obj.AuthorisingUserID = this.userId;
3728
+ obj.AuthorisingUserID = this.transactionDocument.userName;
3736
3729
  obj.ReasonCodeID = data.percentageDiscountReasonCode ? data.percentageDiscountReasonCode : data.priceOverrideReasonCode;
3737
3730
  obj.ModifiedLineNumber = lineNo;
3738
3731
  obj.ModifiedIndex = 1;
@@ -3842,12 +3835,6 @@ class RJMapperBuilderClass {
3842
3835
  * @return {?}
3843
3836
  */
3844
3837
  (element) => {
3845
- /** @type {?} */
3846
- let value = (/** @type {?} */ (this)).paymentTypes.filter((/**
3847
- * @param {?} x
3848
- * @return {?}
3849
- */
3850
- x => x.name.toUpperCase() === element.paymentType.toUpperCase()));
3851
3838
  if (element.paymentType.toUpperCase() === 'GIFT CARD') {
3852
3839
  /** @type {?} */
3853
3840
  let obj = {
@@ -3855,12 +3842,12 @@ class RJMapperBuilderClass {
3855
3842
  LineNumber: (/** @type {?} */ (this)).generateLineNumber(),
3856
3843
  NetValue: (/** @type {?} */ (this)).convertToString(-1 * (/** @type {?} */ (this)).removeDecimal((Math.round(element.amount)))),
3857
3844
  EffectiveNetValue: (/** @type {?} */ (this)).convertToString(-1 * (/** @type {?} */ (this)).removeDecimal((Math.round(element.amount)))),
3858
- Description: (/** @type {?} */ (this)).getDescription(value[0].name, element),
3845
+ Description: (/** @type {?} */ (this)).getDescription(element),
3859
3846
  DeviceID: (/** @type {?} */ (this)).deviceId,
3860
3847
  UserID: (/** @type {?} */ (this)).transactionDocument.userName,
3861
3848
  DateTimeCreated: (/** @type {?} */ (this)).updatedAt,
3862
- TenderType: value[0].tenderType,
3863
- TenderSubType: value[0].tenderSubType,
3849
+ TenderType: element.externalTenderType ? element.externalTenderType : '',
3850
+ TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',
3864
3851
  TenderAmount: (/** @type {?} */ (this)).convertToString(-1 * (/** @type {?} */ (this)).removeDecimal((Math.round(element.amount)))),
3865
3852
  CurrencyID: (/** @type {?} */ (this)).transactionDocument.baseCurrency,
3866
3853
  CurrencyDescription: (/** @type {?} */ (this)).transactionDocument.baseCurrency,
@@ -3880,12 +3867,12 @@ class RJMapperBuilderClass {
3880
3867
  //todo
3881
3868
  NetValue: JSON.stringify(-1 * (Math.round(element.amount))),
3882
3869
  EffectiveNetValue: JSON.stringify(-1 * (Math.round(element.amount))),
3883
- Description: (/** @type {?} */ (this)).getDescription(value[0].name, element),
3870
+ Description: (/** @type {?} */ (this)).getDescription(element),
3884
3871
  DeviceID: (/** @type {?} */ (this)).deviceId,
3885
3872
  UserID: (/** @type {?} */ (this)).transactionDocument.userName,
3886
3873
  DateTimeCreated: (/** @type {?} */ (this)).updatedAt,
3887
- TenderType: value[0].tenderType,
3888
- TenderSubType: value[0].tenderSubType,
3874
+ TenderType: element.externalTenderType ? element.externalTenderType : '',
3875
+ TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',
3889
3876
  TenderAmount: JSON.stringify(-1 * (Math.round(element.amount))),
3890
3877
  CurrencyID: (/** @type {?} */ (this)).transactionDocument.baseCurrency,
3891
3878
  CurrencyDescription: (/** @type {?} */ (this)).transactionDocument.baseCurrency,
@@ -3940,16 +3927,15 @@ class RJMapperBuilderClass {
3940
3927
  return this.rjObject;
3941
3928
  }
3942
3929
  /**
3943
- * @param {?} paymentType
3944
3930
  * @param {?} element
3945
3931
  * @return {?}
3946
3932
  */
3947
- getDescription(paymentType, element) {
3948
- if (paymentType.toUpperCase() === 'CARD') {
3933
+ getDescription(element) {
3934
+ if (element.paymentType.toUpperCase() === 'CARD') {
3949
3935
  return element.cardType;
3950
3936
  }
3951
3937
  else {
3952
- return paymentType;
3938
+ return element.paymentType;
3953
3939
  }
3954
3940
  }
3955
3941
  /**
@@ -3962,16 +3948,6 @@ class RJMapperBuilderClass {
3962
3948
  (/** @type {?} */ (this)).deviceId = id;
3963
3949
  return (/** @type {?} */ (this));
3964
3950
  }
3965
- /**
3966
- * @template THIS
3967
- * @this {THIS}
3968
- * @param {?} id
3969
- * @return {THIS}
3970
- */
3971
- setUserInfo(id) {
3972
- (/** @type {?} */ (this)).userId = id;
3973
- return (/** @type {?} */ (this));
3974
- }
3975
3951
  /**
3976
3952
  * @param {?} value
3977
3953
  * @return {?}
@@ -4149,16 +4125,6 @@ class RJMapperBuilderClass {
4149
4125
  (/** @type {?} */ (this)).branchId = value;
4150
4126
  return (/** @type {?} */ (this));
4151
4127
  }
4152
- /**
4153
- * @template THIS
4154
- * @this {THIS}
4155
- * @param {?} value
4156
- * @return {THIS}
4157
- */
4158
- setPaymentDetails(value) {
4159
- (/** @type {?} */ (this)).paymentTypes = value;
4160
- return (/** @type {?} */ (this));
4161
- }
4162
4128
  /**
4163
4129
  * @param {?} date
4164
4130
  * @return {?}
@@ -4218,7 +4184,7 @@ class RJMapperBuilderClass {
4218
4184
  obj['EffectiveNetValue'] = this.removeDecimal(element['refundedTotal']);
4219
4185
  obj['Description'] = element['description'];
4220
4186
  obj['DeviceID'] = this.transactionDocument['terminalId'];
4221
- obj['UserID'] = this.userId;
4187
+ obj['UserID'] = this.transactionDocument.userName;
4222
4188
  obj['DateTimeCreated'] = this.createdAt;
4223
4189
  obj['ExtendedValue'] = this.removeDecimal(element['totalLinePrice'] * -1);
4224
4190
  obj['UnitPrice'] = this.removeDecimal(element['price']);
@@ -4252,7 +4218,7 @@ class RJMapperBuilderClass {
4252
4218
  obj['Discount'].ModifierDateTime = obj.DateTimeCreated;
4253
4219
  obj['Discount'].ModifierReasonID = lineDiscount.percentageDiscountReasonCode;
4254
4220
  obj['Discount'].ModifierDescription = lineDiscount.percentageDiscountReasonName;
4255
- obj['Discount'].AuthorisingUserID = this.userId;
4221
+ obj['Discount'].AuthorisingUserID = this.transactionDocument.userName;
4256
4222
  obj['Discount'].DiscountType = lineDiscount.discountType;
4257
4223
  obj['Discount'].XMLSchemaVersion = 1;
4258
4224
  obj['Discount'].OriginalPrice = this.removeDecimal(lineDiscount.discountAmount + (lineDiscount.discountedLinePrice || 0));
@@ -4267,7 +4233,7 @@ class RJMapperBuilderClass {
4267
4233
  obj['PriceOverride'].ModifierDateTime = obj.DateTimeCreated;
4268
4234
  obj['PriceOverride'].ModifierReasonID = lineDiscount.priceOverrideReasonCode;
4269
4235
  obj['PriceOverride'].ModifierReasonDescription = lineDiscount.priceOverrideReasonName;
4270
- obj['PriceOverride'].AuthorisingUserID = this.userId;
4236
+ obj['PriceOverride'].AuthorisingUserID = this.transactionDocument.userName;
4271
4237
  obj['PriceOverride'].XMLSchemaVersion = 1;
4272
4238
  obj['PriceOverride'].NewPrice = this.removeDecimal(lineDiscount.unitPrice);
4273
4239
  obj['PriceOverride'].OriginalPrice = this.removeDecimal(lineDiscount.discountedLinePrice || 0 + lineDiscount.discountAmount);
@@ -4334,7 +4300,7 @@ class RJMapperBuilderClass {
4334
4300
  obj['Discount'].ModifierDateTime = obj.DateTimeCreated;
4335
4301
  obj['Discount'].ModifierReasonID = lineDiscount.percentageDiscountReasonCode;
4336
4302
  obj['Discount'].ModifierDescription = lineDiscount.percentageDiscountReasonName;
4337
- obj['Discount'].AuthorisingUserID = this.userId;
4303
+ obj['Discount'].AuthorisingUserID = this.transactionDocument.userName;
4338
4304
  obj['Discount'].DiscountType = lineDiscount.discountType;
4339
4305
  obj['Discount'].XMLSchemaVersion = 1;
4340
4306
  obj['Discount'].OriginalPrice = this.removeDecimal(lineDiscount.discountAmount + (lineDiscount.discountedLinePrice || 0));
@@ -4349,7 +4315,7 @@ class RJMapperBuilderClass {
4349
4315
  obj['PriceOverride'].ModifierDateTime = obj.DateTimeCreated;
4350
4316
  obj['PriceOverride'].ModifierReasonID = lineDiscount.priceOverrideReasonCode;
4351
4317
  obj['PriceOverride'].ModifierReasonDescription = lineDiscount.priceOverrideReasonName;
4352
- obj['PriceOverride'].AuthorisingUserID = this.userId;
4318
+ obj['PriceOverride'].AuthorisingUserID = this.transactionDocument.userName;
4353
4319
  obj['PriceOverride'].XMLSchemaVersion = 1;
4354
4320
  obj['PriceOverride'].NewPrice = this.removeDecimal(lineDiscount.unitPrice);
4355
4321
  obj['PriceOverride'].OriginalPrice = this.removeDecimal(lineDiscount.discountedLinePrice || 0 + lineDiscount.discountAmount);
@@ -4459,11 +4425,6 @@ if (false) {
4459
4425
  * @private
4460
4426
  */
4461
4427
  RJMapperBuilderClass.prototype.transactionDocument;
4462
- /**
4463
- * @type {?}
4464
- * @private
4465
- */
4466
- RJMapperBuilderClass.prototype.userId;
4467
4428
  /**
4468
4429
  * @type {?}
4469
4430
  * @private