@pmcretail/mapper-library 0.0.12 → 0.0.14
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 +207 -68
- 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 +190 -68
- package/esm5/lib/RJ-mapper.class.js +208 -69
- package/fesm2015/pmcretail-mapper-library.js +189 -67
- package/fesm2015/pmcretail-mapper-library.js.map +1 -1
- package/fesm5/pmcretail-mapper-library.js +207 -68
- package/fesm5/pmcretail-mapper-library.js.map +1 -1
- package/lib/RJ-mapper.class.d.ts +7 -4
- package/package.json +1 -1
- package/pmcretail-mapper-library.metadata.json +1 -1
|
@@ -4978,6 +4978,11 @@
|
|
|
4978
4978
|
*/
|
|
4979
4979
|
function () {
|
|
4980
4980
|
var _this = this;
|
|
4981
|
+
/** @type {?} */
|
|
4982
|
+
var transactionDiscount = [];
|
|
4983
|
+
if ((/** @type {?} */ (this)).transactionDocument.basket.transactionDiscount && (/** @type {?} */ (this)).transactionDocument.basket.transactionDiscount.length > 0) {
|
|
4984
|
+
transactionDiscount = (/** @type {?} */ (this)).transactionDocument.basket.transactionDiscount;
|
|
4985
|
+
}
|
|
4981
4986
|
if ((/** @type {?} */ (this)).transactionDocument.type === TRANSACTION_TYPE.SALE) {
|
|
4982
4987
|
(/** @type {?} */ (this)).rjObject['ProductSale'] = [];
|
|
4983
4988
|
(/** @type {?} */ (this)).rjObject['ModifierItem'] = [];
|
|
@@ -5003,7 +5008,7 @@
|
|
|
5003
5008
|
}
|
|
5004
5009
|
}
|
|
5005
5010
|
/** @type {?} */
|
|
5006
|
-
var data = (/** @type {?} */ (_this)).addProduct(element, (lineDiscount.length > 0 ? lineDiscount[0] : null));
|
|
5011
|
+
var data = (/** @type {?} */ (_this)).addProduct(element, (lineDiscount.length > 0 ? lineDiscount[0] : null), (transactionDiscount.length > 0 ? transactionDiscount : null));
|
|
5007
5012
|
(/** @type {?} */ (_this)).rjObject['ProductSale'].push(data);
|
|
5008
5013
|
(/** @type {?} */ (_this)).getModifierItem(lineDiscount.length > 0 ? lineDiscount[0] : null, element.itemLineId);
|
|
5009
5014
|
}));
|
|
@@ -5023,7 +5028,7 @@
|
|
|
5023
5028
|
*/
|
|
5024
5029
|
function (element) {
|
|
5025
5030
|
/** @type {?} */
|
|
5026
|
-
var data = (/** @type {?} */ (_this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
|
|
5031
|
+
var data = (/** @type {?} */ (_this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null), (transactionDiscount.length > 0 ? transactionDiscount : null));
|
|
5027
5032
|
(/** @type {?} */ (_this)).rjObject['ProductReturn'].push(data);
|
|
5028
5033
|
(/** @type {?} */ (_this)).getModifierItem(element.lineDiscount, element.itemLineId);
|
|
5029
5034
|
}));
|
|
@@ -5039,7 +5044,7 @@
|
|
|
5039
5044
|
*/
|
|
5040
5045
|
function (element) {
|
|
5041
5046
|
/** @type {?} */
|
|
5042
|
-
var data = (/** @type {?} */ (_this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
|
|
5047
|
+
var data = (/** @type {?} */ (_this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null), (transactionDiscount.length > 0 ? transactionDiscount : null));
|
|
5043
5048
|
/** @type {?} */
|
|
5044
5049
|
var obj = {
|
|
5045
5050
|
"OriginalReceiptSupplied": 0,
|
|
@@ -5066,7 +5071,7 @@
|
|
|
5066
5071
|
function (element) {
|
|
5067
5072
|
if (element.refundedQuantity > 0) {
|
|
5068
5073
|
/** @type {?} */
|
|
5069
|
-
var returnProduct = (/** @type {?} */ (_this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
|
|
5074
|
+
var returnProduct = (/** @type {?} */ (_this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null), (transactionDiscount.length > 0 ? transactionDiscount : null));
|
|
5070
5075
|
/** @type {?} */
|
|
5071
5076
|
var obj = {
|
|
5072
5077
|
"OriginalReceiptSupplied": 0,
|
|
@@ -5080,7 +5085,7 @@
|
|
|
5080
5085
|
}
|
|
5081
5086
|
else {
|
|
5082
5087
|
/** @type {?} */
|
|
5083
|
-
var addProduct = (/** @type {?} */ (_this)).addProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
|
|
5088
|
+
var addProduct = (/** @type {?} */ (_this)).addProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null), (transactionDiscount.length > 0 ? transactionDiscount : null));
|
|
5084
5089
|
(/** @type {?} */ (_this)).rjObject['ProductSale'].push(addProduct);
|
|
5085
5090
|
}
|
|
5086
5091
|
(/** @type {?} */ (_this)).getModifierItem(element.lineDiscount, element.itemLineId);
|
|
@@ -5110,18 +5115,24 @@
|
|
|
5110
5115
|
function (element) {
|
|
5111
5116
|
/** @type {?} */
|
|
5112
5117
|
var obj = {};
|
|
5113
|
-
obj['XMLSchemaVersion'] =
|
|
5114
|
-
obj['NetValue'] =
|
|
5115
|
-
obj['EffectiveNetValue'] =
|
|
5116
|
-
obj['Description'] = element.
|
|
5118
|
+
obj['XMLSchemaVersion'] = (/** @type {?} */ (_this)).xmlSchemaVersion;
|
|
5119
|
+
obj['NetValue'] = (/** @type {?} */ (_this)).convertToString(element.discountAmount * -1);
|
|
5120
|
+
obj['EffectiveNetValue'] = (/** @type {?} */ (_this)).convertToString(element.discountAmount * -1);
|
|
5121
|
+
obj['Description'] = element.reasonDisplayText;
|
|
5117
5122
|
obj['UserID'] = (/** @type {?} */ (_this)).transactionDocument.userName;
|
|
5118
5123
|
obj['ReasonCodeID'] = element.reasonCode;
|
|
5119
|
-
obj['DiscountType'] = element.discountType.toUpperCase() == DISCOUNTTYPE.PERCENT.toUpperCase() ? 0 : 1;
|
|
5120
|
-
obj['RoundingRule'] = 2;
|
|
5121
|
-
obj['ModifiedLineNumber
|
|
5122
|
-
obj['LineNumber'] = (/** @type {?} */ (_this)).generateLineNumber();
|
|
5123
|
-
|
|
5124
|
-
|
|
5124
|
+
obj['DiscountType'] = (/** @type {?} */ (_this)).convertToString(element.discountType.toUpperCase() == DISCOUNTTYPE.PERCENT.toUpperCase() ? 0 : 1);
|
|
5125
|
+
obj['RoundingRule'] = (/** @type {?} */ (_this)).convertToString(2);
|
|
5126
|
+
obj['ModifiedLineNumber'] = element.itemLineIds;
|
|
5127
|
+
obj['LineNumber'] = (/** @type {?} */ (_this)).convertToString((/** @type {?} */ (_this)).generateLineNumber());
|
|
5128
|
+
obj['DiscountedValue'] = (/** @type {?} */ (_this)).transactionDocument.basketSummary.basketTotal + (/** @type {?} */ (_this)).transactionDocument.basketSummary.discountTotal;
|
|
5129
|
+
if (element.discountType.toUpperCase() == DISCOUNTTYPE.PERCENT.toUpperCase()) {
|
|
5130
|
+
obj['DiscountPercentage'] = (/** @type {?} */ (_this)).convertToString((element.discountAmount / (/** @type {?} */ (_this)).transactionDocument.basketSummary.basketTotal).toFixed(1));
|
|
5131
|
+
}
|
|
5132
|
+
if ((/** @type {?} */ (_this)).transactionDocument.type === 'REFUND') {
|
|
5133
|
+
obj['NetValue'] = (/** @type {?} */ (_this)).convertToString(element.discountAmount < 0 ? -element.discountAmount : element.discountAmount);
|
|
5134
|
+
obj['EffectiveNetValue'] = (/** @type {?} */ (_this)).convertToString(element.discountAmount < 0 ? -element.discountAmount : element.discountAmount);
|
|
5135
|
+
}
|
|
5125
5136
|
(/** @type {?} */ (_this)).rjObject['BasketDiscount'].push(obj);
|
|
5126
5137
|
}));
|
|
5127
5138
|
return (/** @type {?} */ (this));
|
|
@@ -5199,56 +5210,51 @@
|
|
|
5199
5210
|
obj['TaxPercentage'] = element.VAT.toFixed(2); // todo
|
|
5200
5211
|
(/** @type {?} */ (_this)).rjObject['Trailer']['TaxItem'].push(obj);
|
|
5201
5212
|
}));
|
|
5202
|
-
// TODO: make Trailer object from promotion
|
|
5203
|
-
(/** @type {?} */ (this)).
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
*/
|
|
5208
|
-
function (element) {
|
|
5209
|
-
/** @type {?} */
|
|
5210
|
-
var obj = {};
|
|
5211
|
-
obj['PromotionID'] = element.promotionId;
|
|
5212
|
-
obj['PromotionSaving'] = element.promotionAmount < 0 ? element.promotionAmount : -element.promotionAmount;
|
|
5213
|
-
obj['PromotionQuantity'] = ""; // todo - not avaialble
|
|
5214
|
-
obj['PromotionDescription'] = element.displayText;
|
|
5215
|
-
obj['PromotionHit']['XMLSchemaVersion'] = (/** @type {?} */ (_this)).transactionDocument.storeId;
|
|
5216
|
-
obj['PromotionHit']['HitNumber'] = ""; // todo;
|
|
5217
|
-
obj['PromotionHit']['HitQuantity'] = ""; // todo;
|
|
5218
|
-
obj['PromotionHit']['HitSaving'] = ""; // todo;
|
|
5219
|
-
obj['PromotionHit']['PromotionTrigger'] = [];
|
|
5220
|
-
element.trigger.forEach((/**
|
|
5221
|
-
* @param {?} subElement
|
|
5213
|
+
// TODO: make Trailer object from promotion
|
|
5214
|
+
if ((/** @type {?} */ (this)).transactionDocument.basket.linePromotion.length > 0) {
|
|
5215
|
+
(/** @type {?} */ (this)).rjObject['Trailer']['PromotionItem'] = [];
|
|
5216
|
+
(/** @type {?} */ (this)).transactionDocument.basket.linePromotion.forEach((/**
|
|
5217
|
+
* @param {?} element
|
|
5222
5218
|
* @return {?}
|
|
5223
5219
|
*/
|
|
5224
|
-
function (
|
|
5225
|
-
/** @type {?} */
|
|
5226
|
-
var objSub = {};
|
|
5220
|
+
function (element) {
|
|
5227
5221
|
/** @type {?} */
|
|
5228
|
-
var
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5222
|
+
var obj = {};
|
|
5223
|
+
obj['PromotionID'] = element.promotionId;
|
|
5224
|
+
obj['PromotionSaving'] = element.promotionAmount < 0 ? element.promotionAmount : -element.promotionAmount;
|
|
5225
|
+
obj['PromotionQuantity'] = ""; // todo - not avaialble
|
|
5226
|
+
obj['PromotionDescription'] = element.displayText;
|
|
5227
|
+
obj['PromotionHit'] = {};
|
|
5228
|
+
obj['PromotionHit']['XMLSchemaVersion'] = (/** @type {?} */ (_this)).xmlSchemaVersion;
|
|
5229
|
+
obj['PromotionHit']['HitNumber'] = ""; // todo;
|
|
5230
|
+
obj['PromotionHit']['HitQuantity'] = ""; // todo;
|
|
5231
|
+
obj['PromotionHit']['HitSaving'] = ""; // todo;
|
|
5232
|
+
obj['PromotionHit']['PromotionTrigger'] = {};
|
|
5233
|
+
element.trigger.forEach((/**
|
|
5234
|
+
* @param {?} subElement
|
|
5236
5235
|
* @return {?}
|
|
5237
5236
|
*/
|
|
5238
|
-
function (
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5237
|
+
function (subElement) {
|
|
5238
|
+
/** @type {?} */
|
|
5239
|
+
var product = (/** @type {?} */ (_this)).transactionDocument.basket.products.find((/**
|
|
5240
|
+
* @param {?} item
|
|
5241
|
+
* @return {?}
|
|
5242
|
+
*/
|
|
5243
|
+
function (item) { return item.itemLineId == subElement.itemLineId; }));
|
|
5244
|
+
obj['PromotionHit']['PromotionTrigger']['XMLSchemaVersion'] = (/** @type {?} */ (_this)).xmlSchemaVersion;
|
|
5245
|
+
obj['PromotionHit']['PromotionTrigger']['ProductID'] = product.SKU;
|
|
5246
|
+
obj['PromotionHit']['PromotionTrigger']['UnitValue'] = (/** @type {?} */ (_this)).convertToString(element.promotionLinePrice / product.quantity);
|
|
5247
|
+
obj['PromotionHit']['PromotionTrigger']['LineNumber'] = (/** @type {?} */ (_this)).convertToString(subElement.itemLineId);
|
|
5248
|
+
obj['PromotionHit']['PromotionTrigger']['Quantity'] = (/** @type {?} */ (_this)).convertToString(subElement.quantity.toFixed(1));
|
|
5249
|
+
obj['PromotionHit']['PromotionTrigger']['TaxCode'] = (/** @type {?} */ (_this)).transactionDocument.basket.taxBreakdown.taxLines.find((/**
|
|
5250
|
+
* @param {?} item
|
|
5251
|
+
* @return {?}
|
|
5252
|
+
*/
|
|
5253
|
+
function (item) { return item.itemLineId == element.itemLineId; })).VATCode; // todo
|
|
5254
|
+
}));
|
|
5255
|
+
(/** @type {?} */ (_this)).rjObject['Trailer']['PromotionItem'].push(obj);
|
|
5248
5256
|
}));
|
|
5249
|
-
|
|
5250
|
-
}));
|
|
5251
|
-
//console.log(this.rjObject);
|
|
5257
|
+
}
|
|
5252
5258
|
return (/** @type {?} */ (this));
|
|
5253
5259
|
};
|
|
5254
5260
|
/**
|
|
@@ -5595,16 +5601,14 @@
|
|
|
5595
5601
|
/**
|
|
5596
5602
|
* @template THIS
|
|
5597
5603
|
* @this {THIS}
|
|
5598
|
-
* @param {?} value
|
|
5599
5604
|
* @return {THIS}
|
|
5600
5605
|
*/
|
|
5601
5606
|
RJMapperBuilderClass.prototype.setCashierID = /**
|
|
5602
5607
|
* @template THIS
|
|
5603
5608
|
* @this {THIS}
|
|
5604
|
-
* @param {?} value
|
|
5605
5609
|
* @return {THIS}
|
|
5606
5610
|
*/
|
|
5607
|
-
function (
|
|
5611
|
+
function () {
|
|
5608
5612
|
(/** @type {?} */ (this)).cashierId = ((/** @type {?} */ (this)).transactionDocument && (/** @type {?} */ (this)).transactionDocument.userName) ? (/** @type {?} */ (this)).transactionDocument.userName : '';
|
|
5609
5613
|
return (/** @type {?} */ (this));
|
|
5610
5614
|
};
|
|
@@ -5744,14 +5748,17 @@
|
|
|
5744
5748
|
/**
|
|
5745
5749
|
* @param {?} element
|
|
5746
5750
|
* @param {?} lineDiscount
|
|
5751
|
+
* @param {?} transactionDiscount
|
|
5747
5752
|
* @return {?}
|
|
5748
5753
|
*/
|
|
5749
5754
|
RJMapperBuilderClass.prototype.returnProduct = /**
|
|
5750
5755
|
* @param {?} element
|
|
5751
5756
|
* @param {?} lineDiscount
|
|
5757
|
+
* @param {?} transactionDiscount
|
|
5752
5758
|
* @return {?}
|
|
5753
5759
|
*/
|
|
5754
|
-
function (element, lineDiscount) {
|
|
5760
|
+
function (element, lineDiscount, transactionDiscount) {
|
|
5761
|
+
var _this = this;
|
|
5755
5762
|
/** @type {?} */
|
|
5756
5763
|
var obj = {};
|
|
5757
5764
|
/** @type {?} */
|
|
@@ -5770,7 +5777,7 @@
|
|
|
5770
5777
|
obj['DateTimeCreated'] = this.createdAt;
|
|
5771
5778
|
obj['ExtendedValue'] = this.removeDecimal(element['totalLinePrice'] * -1);
|
|
5772
5779
|
obj['UnitPrice'] = this.removeDecimal(element['price']);
|
|
5773
|
-
obj['Quantity'] =
|
|
5780
|
+
obj['Quantity'] = this.getQuantity(element);
|
|
5774
5781
|
obj['OriginalTaxAmountSet'] = 1;
|
|
5775
5782
|
obj['ProductID'] = element['SKU'];
|
|
5776
5783
|
obj['HandKeyed'] = 1;
|
|
@@ -5778,7 +5785,7 @@
|
|
|
5778
5785
|
obj['Return'] = {};
|
|
5779
5786
|
obj['Return']['ReturnReasonID'] = element['refundedReason'];
|
|
5780
5787
|
obj['Return']['ReturnDescription'] = element['refundedReasonDescription'];
|
|
5781
|
-
obj['Return']['ReturnToStock'] =
|
|
5788
|
+
obj['Return']['ReturnToStock'] = this.getQuantity(element);
|
|
5782
5789
|
obj['TaxCode'] = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
|
|
5783
5790
|
* @param {?} item
|
|
5784
5791
|
* @return {?}
|
|
@@ -5826,19 +5833,58 @@
|
|
|
5826
5833
|
obj.ExtendedValue = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount) * -1;
|
|
5827
5834
|
obj.UnitPrice = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount) * -1;
|
|
5828
5835
|
}
|
|
5836
|
+
if (transactionDiscount) {
|
|
5837
|
+
obj['BasketDiscountModifier'] = [];
|
|
5838
|
+
this.transactionDocument.basket.transactionDiscount.forEach((/**
|
|
5839
|
+
* @param {?} e
|
|
5840
|
+
* @return {?}
|
|
5841
|
+
*/
|
|
5842
|
+
function (e) {
|
|
5843
|
+
/** @type {?} */
|
|
5844
|
+
var obj1 = {};
|
|
5845
|
+
e.itemLineIds.forEach((/**
|
|
5846
|
+
* @param {?} x
|
|
5847
|
+
* @return {?}
|
|
5848
|
+
*/
|
|
5849
|
+
function (x) {
|
|
5850
|
+
if (x == element.itemLineId) {
|
|
5851
|
+
/** @type {?} */
|
|
5852
|
+
var discountAmount = _this.convertToString(e.discountAmount * -1);
|
|
5853
|
+
obj1.BasketDiscountLineNumber = _this.getLineNumber(e, discountAmount);
|
|
5854
|
+
obj1.XMLSchemaVersion = _this.xmlSchemaVersion;
|
|
5855
|
+
obj1.DiscountedValue = _this.getDiscountedValue(element.totalLinePrice, e.discountAmount);
|
|
5856
|
+
obj['BasketDiscountModifier'].push(obj1);
|
|
5857
|
+
}
|
|
5858
|
+
}));
|
|
5859
|
+
}));
|
|
5860
|
+
/** @type {?} */
|
|
5861
|
+
var totaltransactionDiscount = 0;
|
|
5862
|
+
obj['BasketDiscountModifier'].forEach((/**
|
|
5863
|
+
* @param {?} value
|
|
5864
|
+
* @return {?}
|
|
5865
|
+
*/
|
|
5866
|
+
function (value) {
|
|
5867
|
+
totaltransactionDiscount = totaltransactionDiscount + value.DiscountedValue;
|
|
5868
|
+
}));
|
|
5869
|
+
//update the product price
|
|
5870
|
+
obj['EffectiveNetValue'] = obj.EffectiveNetValue + totaltransactionDiscount;
|
|
5871
|
+
}
|
|
5829
5872
|
return obj;
|
|
5830
5873
|
};
|
|
5831
5874
|
/**
|
|
5832
5875
|
* @param {?} element
|
|
5833
5876
|
* @param {?} lineDiscount
|
|
5877
|
+
* @param {?} transactionDiscount
|
|
5834
5878
|
* @return {?}
|
|
5835
5879
|
*/
|
|
5836
5880
|
RJMapperBuilderClass.prototype.addProduct = /**
|
|
5837
5881
|
* @param {?} element
|
|
5838
5882
|
* @param {?} lineDiscount
|
|
5883
|
+
* @param {?} transactionDiscount
|
|
5839
5884
|
* @return {?}
|
|
5840
5885
|
*/
|
|
5841
|
-
function (element, lineDiscount) {
|
|
5886
|
+
function (element, lineDiscount, transactionDiscount) {
|
|
5887
|
+
var _this = this;
|
|
5842
5888
|
/** @type {?} */
|
|
5843
5889
|
var taxTotal = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
|
|
5844
5890
|
* @param {?} item
|
|
@@ -5903,7 +5949,7 @@
|
|
|
5903
5949
|
obj['PriceOverride'].ModifierReasonID = lineDiscount.priceOverrideReasonCode;
|
|
5904
5950
|
obj['PriceOverride'].ModifierReasonDescription = lineDiscount.priceOverrideReasonName;
|
|
5905
5951
|
obj['PriceOverride'].AuthorisingUserID = this.transactionDocument.userName;
|
|
5906
|
-
obj['PriceOverride'].XMLSchemaVersion =
|
|
5952
|
+
obj['PriceOverride'].XMLSchemaVersion = this.xmlSchemaVersion;
|
|
5907
5953
|
obj['PriceOverride'].NewPrice = this.removeDecimal(lineDiscount.unitPrice);
|
|
5908
5954
|
obj['PriceOverride'].OriginalPrice = this.removeDecimal(lineDiscount.discountedLinePrice || 0 + lineDiscount.discountAmount);
|
|
5909
5955
|
}
|
|
@@ -5913,8 +5959,82 @@
|
|
|
5913
5959
|
obj['ExtendedValue'] = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount);
|
|
5914
5960
|
obj['UnitPrice'] = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount);
|
|
5915
5961
|
}
|
|
5962
|
+
if (transactionDiscount) {
|
|
5963
|
+
obj['BasketDiscountModifier'] = [];
|
|
5964
|
+
this.transactionDocument.basket.transactionDiscount.forEach((/**
|
|
5965
|
+
* @param {?} e
|
|
5966
|
+
* @return {?}
|
|
5967
|
+
*/
|
|
5968
|
+
function (e) {
|
|
5969
|
+
/** @type {?} */
|
|
5970
|
+
var obj1 = {};
|
|
5971
|
+
e.itemLineIds.forEach((/**
|
|
5972
|
+
* @param {?} x
|
|
5973
|
+
* @return {?}
|
|
5974
|
+
*/
|
|
5975
|
+
function (x) {
|
|
5976
|
+
if (x == element.itemLineId) {
|
|
5977
|
+
/** @type {?} */
|
|
5978
|
+
var discountAmount = _this.convertToString(e.discountAmount * -1);
|
|
5979
|
+
obj1.XMLSchemaVersion = _this.xmlSchemaVersion;
|
|
5980
|
+
obj1.DiscountedValue = -(_this.getDiscountedValue(element.totalLinePrice, e.discountAmount).toFixed(0));
|
|
5981
|
+
obj1.BasketDiscountLineNumber = _this.getLineNumber(e, discountAmount);
|
|
5982
|
+
obj['BasketDiscountModifier'].push(obj1);
|
|
5983
|
+
}
|
|
5984
|
+
}));
|
|
5985
|
+
}));
|
|
5986
|
+
/** @type {?} */
|
|
5987
|
+
var totaltransactionDiscount = 0;
|
|
5988
|
+
obj['BasketDiscountModifier'].forEach((/**
|
|
5989
|
+
* @param {?} value
|
|
5990
|
+
* @return {?}
|
|
5991
|
+
*/
|
|
5992
|
+
function (value) {
|
|
5993
|
+
totaltransactionDiscount = totaltransactionDiscount + value.DiscountedValue;
|
|
5994
|
+
}));
|
|
5995
|
+
//update the product price
|
|
5996
|
+
obj['EffectiveNetValue'] = obj.EffectiveNetValue + totaltransactionDiscount;
|
|
5997
|
+
}
|
|
5916
5998
|
return obj;
|
|
5917
5999
|
};
|
|
6000
|
+
/**
|
|
6001
|
+
* @param {?} value
|
|
6002
|
+
* @param {?} discountAmount
|
|
6003
|
+
* @return {?}
|
|
6004
|
+
*/
|
|
6005
|
+
RJMapperBuilderClass.prototype.getLineNumber = /**
|
|
6006
|
+
* @param {?} value
|
|
6007
|
+
* @param {?} discountAmount
|
|
6008
|
+
* @return {?}
|
|
6009
|
+
*/
|
|
6010
|
+
function (value, discountAmount) {
|
|
6011
|
+
/** @type {?} */
|
|
6012
|
+
var lineNumber;
|
|
6013
|
+
for (var i = 0; i < this.rjObject['BasketDiscount'].length; i++) {
|
|
6014
|
+
/** @type {?} */
|
|
6015
|
+
var element = this.rjObject['BasketDiscount'][i];
|
|
6016
|
+
if (value.reasonCode === element.ReasonCodeID && discountAmount === element.NetValue) {
|
|
6017
|
+
lineNumber = element.LineNumber;
|
|
6018
|
+
break;
|
|
6019
|
+
}
|
|
6020
|
+
}
|
|
6021
|
+
return lineNumber;
|
|
6022
|
+
};
|
|
6023
|
+
/**
|
|
6024
|
+
* @param {?} price
|
|
6025
|
+
* @param {?} discountAmount
|
|
6026
|
+
* @return {?}
|
|
6027
|
+
*/
|
|
6028
|
+
RJMapperBuilderClass.prototype.getDiscountedValue = /**
|
|
6029
|
+
* @param {?} price
|
|
6030
|
+
* @param {?} discountAmount
|
|
6031
|
+
* @return {?}
|
|
6032
|
+
*/
|
|
6033
|
+
function (price, discountAmount) {
|
|
6034
|
+
/** @type {?} */
|
|
6035
|
+
var DiscountedValue = (price * discountAmount) / this.transactionDocument.basketSummary.saleTotal;
|
|
6036
|
+
return DiscountedValue;
|
|
6037
|
+
};
|
|
5918
6038
|
/**
|
|
5919
6039
|
* @param {?} element
|
|
5920
6040
|
* @param {?} VAT
|
|
@@ -5946,7 +6066,7 @@
|
|
|
5946
6066
|
return value;
|
|
5947
6067
|
}
|
|
5948
6068
|
catch (e) {
|
|
5949
|
-
console.log(value, '
|
|
6069
|
+
console.log(value, 'can not be converted in string', e);
|
|
5950
6070
|
}
|
|
5951
6071
|
};
|
|
5952
6072
|
/**
|
|
@@ -6051,6 +6171,25 @@
|
|
|
6051
6171
|
this.rjObject['BasketDiscount']['RoundingRule'] = 2;
|
|
6052
6172
|
}
|
|
6053
6173
|
};
|
|
6174
|
+
/**
|
|
6175
|
+
* @param {?} element
|
|
6176
|
+
* @return {?}
|
|
6177
|
+
*/
|
|
6178
|
+
RJMapperBuilderClass.prototype.getQuantity = /**
|
|
6179
|
+
* @param {?} element
|
|
6180
|
+
* @return {?}
|
|
6181
|
+
*/
|
|
6182
|
+
function (element) {
|
|
6183
|
+
/** @type {?} */
|
|
6184
|
+
var quantity;
|
|
6185
|
+
if (this.transactionDocument.unreferencedRefund) {
|
|
6186
|
+
quantity = element['quantity'] < 0 ? element['quantity'].toFixed(1) : (-element['quantity']).toFixed(1);
|
|
6187
|
+
}
|
|
6188
|
+
else {
|
|
6189
|
+
quantity = element['refundedQuantity'] < 0 ? element['refundedQuantity'].toFixed(1) : (-element['refundedQuantity']).toFixed(1);
|
|
6190
|
+
}
|
|
6191
|
+
return quantity;
|
|
6192
|
+
};
|
|
6054
6193
|
return RJMapperBuilderClass;
|
|
6055
6194
|
}());
|
|
6056
6195
|
if (false) {
|