@pmcretail/mapper-library 0.0.11 → 0.0.12
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.
- package/bundles/pmcretail-mapper-library.umd.js +42 -14
- package/bundles/pmcretail-mapper-library.umd.js.map +1 -1
- package/bundles/pmcretail-mapper-library.umd.min.js +1 -1
- package/bundles/pmcretail-mapper-library.umd.min.js.map +1 -1
- package/esm2015/lib/RJ-mapper.class.js +39 -15
- package/esm5/lib/RJ-mapper.class.js +43 -15
- package/fesm2015/pmcretail-mapper-library.js +38 -14
- package/fesm2015/pmcretail-mapper-library.js.map +1 -1
- package/fesm5/pmcretail-mapper-library.js +42 -14
- package/fesm5/pmcretail-mapper-library.js.map +1 -1
- package/lib/RJ-mapper.class.d.ts +3 -3
- package/package.json +1 -1
- package/pmcretail-mapper-library.metadata.json +1 -1
|
@@ -3516,8 +3516,8 @@ class RJMapperBuilderClass {
|
|
|
3516
3516
|
}
|
|
3517
3517
|
this.initilizeItemCount();
|
|
3518
3518
|
this.setLineNumberForProducts();
|
|
3519
|
-
this.createdAt = this.
|
|
3520
|
-
this.updatedAt = this.
|
|
3519
|
+
this.createdAt = this.getDate(this.transactionDocument.createdAt);
|
|
3520
|
+
this.updatedAt = this.getDate(this.transactionDocument.updatedAt);
|
|
3521
3521
|
}
|
|
3522
3522
|
/**
|
|
3523
3523
|
* @template THIS
|
|
@@ -3601,6 +3601,12 @@ class RJMapperBuilderClass {
|
|
|
3601
3601
|
(/** @type {?} */ (this)).rjObject['ProductSale'].push(data);
|
|
3602
3602
|
(/** @type {?} */ (this)).getModifierItem(lineDiscount.length > 0 ? lineDiscount[0] : null, element.itemLineId);
|
|
3603
3603
|
}));
|
|
3604
|
+
/** @type {?} */
|
|
3605
|
+
let transactionPromotion = [];
|
|
3606
|
+
if ((/** @type {?} */ (this)).transactionDocument.basket.transactionPromotion && (/** @type {?} */ (this)).transactionDocument.basket.transactionPromotion.length > 0) {
|
|
3607
|
+
transactionPromotion = (/** @type {?} */ (this)).transactionDocument.basket.transactionPromotion;
|
|
3608
|
+
(/** @type {?} */ (this)).getTransactionPromotion(transactionPromotion);
|
|
3609
|
+
}
|
|
3604
3610
|
}
|
|
3605
3611
|
else if ((/** @type {?} */ (this)).transactionDocument.type === TRANSACTION_TYPE.REFUND) {
|
|
3606
3612
|
(/** @type {?} */ (this)).rjObject['ProductReturn'] = [];
|
|
@@ -3682,9 +3688,9 @@ class RJMapperBuilderClass {
|
|
|
3682
3688
|
* @return {THIS}
|
|
3683
3689
|
*/
|
|
3684
3690
|
getBasketDiscount() {
|
|
3685
|
-
(/** @type {?} */ (this)).rjObject['BasketDiscount'] = [];
|
|
3686
3691
|
if (!(/** @type {?} */ (this)).transactionDocument.basket.transactionDiscount)
|
|
3687
3692
|
return (/** @type {?} */ (this));
|
|
3693
|
+
(/** @type {?} */ (this)).rjObject['BasketDiscount'] = [];
|
|
3688
3694
|
(/** @type {?} */ (this)).transactionDocument.basket.transactionDiscount.forEach((/**
|
|
3689
3695
|
* @param {?} element
|
|
3690
3696
|
* @return {?}
|
|
@@ -4188,7 +4194,7 @@ class RJMapperBuilderClass {
|
|
|
4188
4194
|
obj['DateTimeCreated'] = this.createdAt;
|
|
4189
4195
|
obj['ExtendedValue'] = this.removeDecimal(element['totalLinePrice'] * -1);
|
|
4190
4196
|
obj['UnitPrice'] = this.removeDecimal(element['price']);
|
|
4191
|
-
obj['Quantity'] = element['refundedQuantity'] < 0 ? element['refundedQuantity'].toFixed(1) : -element['refundedQuantity'].toFixed(1);
|
|
4197
|
+
obj['Quantity'] = element['refundedQuantity'] < 0 ? element['refundedQuantity'].toFixed(1) : (-element['refundedQuantity']).toFixed(1);
|
|
4192
4198
|
obj['OriginalTaxAmountSet'] = 1;
|
|
4193
4199
|
obj['ProductID'] = element['SKU'];
|
|
4194
4200
|
obj['HandKeyed'] = 1;
|
|
@@ -4208,7 +4214,7 @@ class RJMapperBuilderClass {
|
|
|
4208
4214
|
obj['MMGroupID'] = this.getAttributes();
|
|
4209
4215
|
obj['CustomerDetails'] = ""; // todo - blank
|
|
4210
4216
|
obj['TotalPromotionSaving'] = element['promotionAmount'] || -1; // TODO
|
|
4211
|
-
obj['OriginalTaxAmount'] = this.convertToString(this.
|
|
4217
|
+
obj['OriginalTaxAmount'] = this.convertToString(this.getOriginalTax(element, taxTotal.VAT) * -1);
|
|
4212
4218
|
obj['taxAmount'] = taxTotal.taxLineTotal < 0 ? (taxTotal.taxLineTotal) : (-taxTotal.taxLineTotal);
|
|
4213
4219
|
if (lineDiscount) {
|
|
4214
4220
|
if (lineDiscount.percentageDiscountReasonName && lineDiscount.percentageDiscountReasonCode) {
|
|
@@ -4282,7 +4288,7 @@ class RJMapperBuilderClass {
|
|
|
4282
4288
|
(item) => item.itemLineId == element['itemLineId'])).VATCode,
|
|
4283
4289
|
TaxModifiable: 1,
|
|
4284
4290
|
//todo
|
|
4285
|
-
OriginalTaxAmount: this.convertToString(this.
|
|
4291
|
+
OriginalTaxAmount: this.convertToString(this.getOriginalTax(element, taxTotal.VAT)),
|
|
4286
4292
|
TaxAmount: this.convertToString(taxTotal.taxLineTotal),
|
|
4287
4293
|
OriginalTaxAmountSet: 1,
|
|
4288
4294
|
//todo
|
|
@@ -4333,7 +4339,7 @@ class RJMapperBuilderClass {
|
|
|
4333
4339
|
* @param {?} VAT
|
|
4334
4340
|
* @return {?}
|
|
4335
4341
|
*/
|
|
4336
|
-
|
|
4342
|
+
getOriginalTax(element, VAT) {
|
|
4337
4343
|
/** @type {?} */
|
|
4338
4344
|
let pricebeforetax = (element.price * 100) / (100 + VAT);
|
|
4339
4345
|
/** @type {?} */
|
|
@@ -4400,7 +4406,7 @@ class RJMapperBuilderClass {
|
|
|
4400
4406
|
* @param {?} date
|
|
4401
4407
|
* @return {?}
|
|
4402
4408
|
*/
|
|
4403
|
-
|
|
4409
|
+
getDate(date) {
|
|
4404
4410
|
/** @type {?} */
|
|
4405
4411
|
let offset = this.generateTimezoneoffset(date) * -1;
|
|
4406
4412
|
/** @type {?} */
|
|
@@ -4415,9 +4421,32 @@ class RJMapperBuilderClass {
|
|
|
4415
4421
|
/** @type {?} */
|
|
4416
4422
|
let newdate = date.substring(0, 19);
|
|
4417
4423
|
/** @type {?} */
|
|
4418
|
-
|
|
4424
|
+
const x = (newdate + offsetSign + String(offsetHours).padStart(2, '0') + ':' + String(offsetMinutes).padStart(2, '0')).toString();
|
|
4419
4425
|
return x;
|
|
4420
4426
|
}
|
|
4427
|
+
/**
|
|
4428
|
+
* @param {?} transactionPromotion
|
|
4429
|
+
* @return {?}
|
|
4430
|
+
*/
|
|
4431
|
+
getTransactionPromotion(transactionPromotion) {
|
|
4432
|
+
if (transactionPromotion && transactionPromotion.length > 0) {
|
|
4433
|
+
this.rjObject['BasketDiscount'] = {};
|
|
4434
|
+
this.rjObject['BasketDiscount']['XMLSchemaVersion'] = 1;
|
|
4435
|
+
this.rjObject['BasketDiscount']['LineNumber'] = this.generateLineNumber();
|
|
4436
|
+
this.rjObject['BasketDiscount']['NetValue'] = this.removeDecimal(transactionPromotion[0].promotionLinePrice) * -1;
|
|
4437
|
+
this.rjObject['BasketDiscount']['EffectiveNetValue'] = this.removeDecimal(transactionPromotion[0].promotionLinePrice) * -1;
|
|
4438
|
+
this.rjObject['BasketDiscount']['Description'] = transactionPromotion[0].promotionInfo;
|
|
4439
|
+
this.rjObject['BasketDiscount']['DeviceID'] = this.deviceId;
|
|
4440
|
+
this.rjObject['BasketDiscount']['UserID'] = this.transactionDocument.userName;
|
|
4441
|
+
this.rjObject['BasketDiscount']['DateTimeCreated'] = this.createdAt;
|
|
4442
|
+
this.rjObject['BasketDiscount']['ModifiedLineNumber'] = transactionPromotion[0].itemLineIds;
|
|
4443
|
+
this.rjObject['BasketDiscount']['ReasonCodeID'] = 0;
|
|
4444
|
+
this.rjObject['BasketDiscount']['DiscountType'] = transactionPromotion[0].promotionType == 'TRANSACTION_OFF' ? 1 : 0;
|
|
4445
|
+
this.rjObject['BasketDiscount']['DiscountPercentage'] = 0; //todo
|
|
4446
|
+
this.rjObject['BasketDiscount']['DiscountedValue'] = 0; //todo
|
|
4447
|
+
this.rjObject['BasketDiscount']['RoundingRule'] = 2;
|
|
4448
|
+
}
|
|
4449
|
+
}
|
|
4421
4450
|
}
|
|
4422
4451
|
if (false) {
|
|
4423
4452
|
/**
|
|
@@ -4540,11 +4569,6 @@ if (false) {
|
|
|
4540
4569
|
* @private
|
|
4541
4570
|
*/
|
|
4542
4571
|
RJMapperBuilderClass.prototype.rjObject;
|
|
4543
|
-
/**
|
|
4544
|
-
* @type {?}
|
|
4545
|
-
* @private
|
|
4546
|
-
*/
|
|
4547
|
-
RJMapperBuilderClass.prototype.paymentTypes;
|
|
4548
4572
|
}
|
|
4549
4573
|
|
|
4550
4574
|
/**
|