@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
|
@@ -4686,8 +4686,8 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
4686
4686
|
}
|
|
4687
4687
|
this.initilizeItemCount();
|
|
4688
4688
|
this.setLineNumberForProducts();
|
|
4689
|
-
this.createdAt = this.
|
|
4690
|
-
this.updatedAt = this.
|
|
4689
|
+
this.createdAt = this.getDate(this.transactionDocument.createdAt);
|
|
4690
|
+
this.updatedAt = this.getDate(this.transactionDocument.updatedAt);
|
|
4691
4691
|
}
|
|
4692
4692
|
/**
|
|
4693
4693
|
* @template THIS
|
|
@@ -4787,6 +4787,12 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
4787
4787
|
(/** @type {?} */ (_this)).rjObject['ProductSale'].push(data);
|
|
4788
4788
|
(/** @type {?} */ (_this)).getModifierItem(lineDiscount.length > 0 ? lineDiscount[0] : null, element.itemLineId);
|
|
4789
4789
|
}));
|
|
4790
|
+
/** @type {?} */
|
|
4791
|
+
var transactionPromotion = [];
|
|
4792
|
+
if ((/** @type {?} */ (this)).transactionDocument.basket.transactionPromotion && (/** @type {?} */ (this)).transactionDocument.basket.transactionPromotion.length > 0) {
|
|
4793
|
+
transactionPromotion = (/** @type {?} */ (this)).transactionDocument.basket.transactionPromotion;
|
|
4794
|
+
(/** @type {?} */ (this)).getTransactionPromotion(transactionPromotion);
|
|
4795
|
+
}
|
|
4790
4796
|
}
|
|
4791
4797
|
else if ((/** @type {?} */ (this)).transactionDocument.type === TRANSACTION_TYPE.REFUND) {
|
|
4792
4798
|
(/** @type {?} */ (this)).rjObject['ProductReturn'] = [];
|
|
@@ -4874,9 +4880,9 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
4874
4880
|
*/
|
|
4875
4881
|
function () {
|
|
4876
4882
|
var _this = this;
|
|
4877
|
-
(/** @type {?} */ (this)).rjObject['BasketDiscount'] = [];
|
|
4878
4883
|
if (!(/** @type {?} */ (this)).transactionDocument.basket.transactionDiscount)
|
|
4879
4884
|
return (/** @type {?} */ (this));
|
|
4885
|
+
(/** @type {?} */ (this)).rjObject['BasketDiscount'] = [];
|
|
4880
4886
|
(/** @type {?} */ (this)).transactionDocument.basket.transactionDiscount.forEach((/**
|
|
4881
4887
|
* @param {?} element
|
|
4882
4888
|
* @return {?}
|
|
@@ -5544,7 +5550,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5544
5550
|
obj['DateTimeCreated'] = this.createdAt;
|
|
5545
5551
|
obj['ExtendedValue'] = this.removeDecimal(element['totalLinePrice'] * -1);
|
|
5546
5552
|
obj['UnitPrice'] = this.removeDecimal(element['price']);
|
|
5547
|
-
obj['Quantity'] = element['refundedQuantity'] < 0 ? element['refundedQuantity'].toFixed(1) : -element['refundedQuantity'].toFixed(1);
|
|
5553
|
+
obj['Quantity'] = element['refundedQuantity'] < 0 ? element['refundedQuantity'].toFixed(1) : (-element['refundedQuantity']).toFixed(1);
|
|
5548
5554
|
obj['OriginalTaxAmountSet'] = 1;
|
|
5549
5555
|
obj['ProductID'] = element['SKU'];
|
|
5550
5556
|
obj['HandKeyed'] = 1;
|
|
@@ -5564,7 +5570,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5564
5570
|
obj['MMGroupID'] = this.getAttributes();
|
|
5565
5571
|
obj['CustomerDetails'] = ""; // todo - blank
|
|
5566
5572
|
obj['TotalPromotionSaving'] = element['promotionAmount'] || -1; // TODO
|
|
5567
|
-
obj['OriginalTaxAmount'] = this.convertToString(this.
|
|
5573
|
+
obj['OriginalTaxAmount'] = this.convertToString(this.getOriginalTax(element, taxTotal.VAT) * -1);
|
|
5568
5574
|
obj['taxAmount'] = taxTotal.taxLineTotal < 0 ? (taxTotal.taxLineTotal) : (-taxTotal.taxLineTotal);
|
|
5569
5575
|
if (lineDiscount) {
|
|
5570
5576
|
if (lineDiscount.percentageDiscountReasonName && lineDiscount.percentageDiscountReasonCode) {
|
|
@@ -5643,7 +5649,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5643
5649
|
function (item) { return item.itemLineId == element['itemLineId']; })).VATCode,
|
|
5644
5650
|
TaxModifiable: 1,
|
|
5645
5651
|
//todo
|
|
5646
|
-
OriginalTaxAmount: this.convertToString(this.
|
|
5652
|
+
OriginalTaxAmount: this.convertToString(this.getOriginalTax(element, taxTotal.VAT)),
|
|
5647
5653
|
TaxAmount: this.convertToString(taxTotal.taxLineTotal),
|
|
5648
5654
|
OriginalTaxAmountSet: 1,
|
|
5649
5655
|
//todo
|
|
@@ -5694,7 +5700,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5694
5700
|
* @param {?} VAT
|
|
5695
5701
|
* @return {?}
|
|
5696
5702
|
*/
|
|
5697
|
-
RJMapperBuilderClass.prototype.
|
|
5703
|
+
RJMapperBuilderClass.prototype.getOriginalTax = /**
|
|
5698
5704
|
* @param {?} element
|
|
5699
5705
|
* @param {?} VAT
|
|
5700
5706
|
* @return {?}
|
|
@@ -5776,7 +5782,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5776
5782
|
* @param {?} date
|
|
5777
5783
|
* @return {?}
|
|
5778
5784
|
*/
|
|
5779
|
-
RJMapperBuilderClass.prototype.
|
|
5785
|
+
RJMapperBuilderClass.prototype.getDate = /**
|
|
5780
5786
|
* @param {?} date
|
|
5781
5787
|
* @return {?}
|
|
5782
5788
|
*/
|
|
@@ -5795,9 +5801,36 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5795
5801
|
/** @type {?} */
|
|
5796
5802
|
var newdate = date.substring(0, 19);
|
|
5797
5803
|
/** @type {?} */
|
|
5798
|
-
var x = (newdate + offsetSign + offsetHours + ':' + offsetMinutes).toString();
|
|
5804
|
+
var x = (newdate + offsetSign + String(offsetHours).padStart(2, '0') + ':' + String(offsetMinutes).padStart(2, '0')).toString();
|
|
5799
5805
|
return x;
|
|
5800
5806
|
};
|
|
5807
|
+
/**
|
|
5808
|
+
* @param {?} transactionPromotion
|
|
5809
|
+
* @return {?}
|
|
5810
|
+
*/
|
|
5811
|
+
RJMapperBuilderClass.prototype.getTransactionPromotion = /**
|
|
5812
|
+
* @param {?} transactionPromotion
|
|
5813
|
+
* @return {?}
|
|
5814
|
+
*/
|
|
5815
|
+
function (transactionPromotion) {
|
|
5816
|
+
if (transactionPromotion && transactionPromotion.length > 0) {
|
|
5817
|
+
this.rjObject['BasketDiscount'] = {};
|
|
5818
|
+
this.rjObject['BasketDiscount']['XMLSchemaVersion'] = 1;
|
|
5819
|
+
this.rjObject['BasketDiscount']['LineNumber'] = this.generateLineNumber();
|
|
5820
|
+
this.rjObject['BasketDiscount']['NetValue'] = this.removeDecimal(transactionPromotion[0].promotionLinePrice) * -1;
|
|
5821
|
+
this.rjObject['BasketDiscount']['EffectiveNetValue'] = this.removeDecimal(transactionPromotion[0].promotionLinePrice) * -1;
|
|
5822
|
+
this.rjObject['BasketDiscount']['Description'] = transactionPromotion[0].promotionInfo;
|
|
5823
|
+
this.rjObject['BasketDiscount']['DeviceID'] = this.deviceId;
|
|
5824
|
+
this.rjObject['BasketDiscount']['UserID'] = this.transactionDocument.userName;
|
|
5825
|
+
this.rjObject['BasketDiscount']['DateTimeCreated'] = this.createdAt;
|
|
5826
|
+
this.rjObject['BasketDiscount']['ModifiedLineNumber'] = transactionPromotion[0].itemLineIds;
|
|
5827
|
+
this.rjObject['BasketDiscount']['ReasonCodeID'] = 0;
|
|
5828
|
+
this.rjObject['BasketDiscount']['DiscountType'] = transactionPromotion[0].promotionType == 'TRANSACTION_OFF' ? 1 : 0;
|
|
5829
|
+
this.rjObject['BasketDiscount']['DiscountPercentage'] = 0; //todo
|
|
5830
|
+
this.rjObject['BasketDiscount']['DiscountedValue'] = 0; //todo
|
|
5831
|
+
this.rjObject['BasketDiscount']['RoundingRule'] = 2;
|
|
5832
|
+
}
|
|
5833
|
+
};
|
|
5801
5834
|
return RJMapperBuilderClass;
|
|
5802
5835
|
}());
|
|
5803
5836
|
if (false) {
|
|
@@ -5921,11 +5954,6 @@ if (false) {
|
|
|
5921
5954
|
* @private
|
|
5922
5955
|
*/
|
|
5923
5956
|
RJMapperBuilderClass.prototype.rjObject;
|
|
5924
|
-
/**
|
|
5925
|
-
* @type {?}
|
|
5926
|
-
* @private
|
|
5927
|
-
*/
|
|
5928
|
-
RJMapperBuilderClass.prototype.paymentTypes;
|
|
5929
5957
|
}
|
|
5930
5958
|
|
|
5931
5959
|
/**
|