@pmcretail/mapper-library 0.0.3 → 0.0.5

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.
@@ -3481,7 +3481,6 @@ class RJMapperBuilderClass {
3481
3481
  * @param {?=} transactionDoc
3482
3482
  */
3483
3483
  constructor(transactionDoc) {
3484
- this.productQuantity = 0;
3485
3484
  this.itemCount = 0;
3486
3485
  this.largestNumber = 0;
3487
3486
  this.rjObject = {};
@@ -3577,7 +3576,7 @@ class RJMapperBuilderClass {
3577
3576
  (/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.CashierID = (/** @type {?} */ (this)).cashierId;
3578
3577
  (/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.CompanyID = (/** @type {?} */ (this)).companyId;
3579
3578
  (/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.StoreID = (/** @type {?} */ (this)).transactionDocument.storeId;
3580
- (/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.BranchID = (/** @type {?} */ (this)).transactionDocument.storeId;
3579
+ (/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.BranchID = (/** @type {?} */ (this)).branchId;
3581
3580
  (/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.TerminalNumber = (/** @type {?} */ (this)).terminalNumber;
3582
3581
  (/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.TransactionNumber = (/** @type {?} */ (this)).transactionNumber;
3583
3582
  (/** @type {?} */ (this)).rjObject['Header'].TaxMethodID = (/** @type {?} */ (this)).taxMethodId;
@@ -3653,6 +3652,15 @@ class RJMapperBuilderClass {
3653
3652
  (element) => {
3654
3653
  /** @type {?} */
3655
3654
  let data = (/** @type {?} */ (this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
3655
+ /** @type {?} */
3656
+ let obj = {
3657
+ "OriginalReceiptSupplied": 0,
3658
+ "OriginalBranchID": 0,
3659
+ "OriginalTerminalNumber": 0,
3660
+ "OriginalTransactionNumber": 0,
3661
+ "OriginalCashierNumber": 0
3662
+ };
3663
+ data['Return'] = Object.assign({}, data['Return'], obj);
3656
3664
  (/** @type {?} */ (this)).rjObject['ProductReturn'].push(data);
3657
3665
  (/** @type {?} */ (this)).getModifierItem(element.lineDiscount, element.itemLineId);
3658
3666
  }));
@@ -3671,6 +3679,15 @@ class RJMapperBuilderClass {
3671
3679
  if (element.refundedQuantity > 0) {
3672
3680
  /** @type {?} */
3673
3681
  let returnProduct = (/** @type {?} */ (this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
3682
+ /** @type {?} */
3683
+ let obj = {
3684
+ "OriginalReceiptSupplied": 0,
3685
+ "OriginalBranchID": 0,
3686
+ "OriginalTerminalNumber": 0,
3687
+ "OriginalTransactionNumber": 0,
3688
+ "OriginalCashierNumber": 0
3689
+ };
3690
+ returnProduct['Return'] = Object.assign({}, returnProduct['Return'], obj);
3674
3691
  (/** @type {?} */ (this)).rjObject['ProductReturn'].push(returnProduct);
3675
3692
  }
3676
3693
  else {
@@ -4152,6 +4169,16 @@ class RJMapperBuilderClass {
4152
4169
  (/** @type {?} */ (this)).basketCurrencyId = value;
4153
4170
  return (/** @type {?} */ (this));
4154
4171
  }
4172
+ /**
4173
+ * @template THIS
4174
+ * @this {THIS}
4175
+ * @param {?} value
4176
+ * @return {THIS}
4177
+ */
4178
+ setBranchID(value) {
4179
+ (/** @type {?} */ (this)).branchId = value;
4180
+ return (/** @type {?} */ (this));
4181
+ }
4155
4182
  /**
4156
4183
  * @param {?} date
4157
4184
  * @return {?}
@@ -4280,6 +4307,12 @@ class RJMapperBuilderClass {
4280
4307
  * @return {?}
4281
4308
  */
4282
4309
  addProduct(element, lineDiscount) {
4310
+ /** @type {?} */
4311
+ let taxTotal = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
4312
+ * @param {?} item
4313
+ * @return {?}
4314
+ */
4315
+ (item) => item.itemLineId == element['itemLineId']));
4283
4316
  /** @type {?} */
4284
4317
  let obj = {
4285
4318
  XMLSchemaVersion: this.xmlSchemaVersion,
@@ -4299,14 +4332,15 @@ class RJMapperBuilderClass {
4299
4332
  Quantity: element.quantity.toFixed(1),
4300
4333
  SalespersonID: this.transactionDocument.userId,
4301
4334
  SalespersonName: this.transactionDocument.userName,
4302
- TaxCode: 0,
4303
- //todo
4335
+ TaxCode: this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
4336
+ * @param {?} item
4337
+ * @return {?}
4338
+ */
4339
+ (item) => item.itemLineId == element['itemLineId'])).VATCode,
4304
4340
  TaxModifiable: 1,
4305
4341
  //todo
4306
- TaxAmount: 0,
4307
- //todo
4308
- OriginalTaxAmount: 0,
4309
- //todo
4342
+ OriginalTaxAmount: taxTotal.taxLineTotal < 0 ? this.removeDecimal(taxTotal.taxLineTotal) : this.removeDecimal(-taxTotal.taxLineTotal),
4343
+ TaxAmount: taxTotal.taxLineTotal < 0 ? this.removeDecimal(taxTotal.taxLineTotal) : this.removeDecimal(-taxTotal.taxLineTotal),
4310
4344
  OriginalTaxAmountSet: 1,
4311
4345
  //todo
4312
4346
  ProductID: element.SKU,
@@ -4414,11 +4448,6 @@ if (false) {
4414
4448
  * @private
4415
4449
  */
4416
4450
  RJMapperBuilderClass.prototype.transactionDocument;
4417
- /**
4418
- * @type {?}
4419
- * @private
4420
- */
4421
- RJMapperBuilderClass.prototype.productQuantity;
4422
4451
  /**
4423
4452
  * @type {?}
4424
4453
  * @private
@@ -4519,6 +4548,11 @@ if (false) {
4519
4548
  * @private
4520
4549
  */
4521
4550
  RJMapperBuilderClass.prototype.largestNumber;
4551
+ /**
4552
+ * @type {?}
4553
+ * @private
4554
+ */
4555
+ RJMapperBuilderClass.prototype.branchId;
4522
4556
  /**
4523
4557
  * @type {?}
4524
4558
  * @private