@pmcretail/mapper-library 0.0.13 → 0.0.15
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 +473 -110
- package/bundles/pmcretail-mapper-library.umd.js.map +1 -1
- package/bundles/pmcretail-mapper-library.umd.min.js +2 -2
- package/bundles/pmcretail-mapper-library.umd.min.js.map +1 -1
- package/esm2015/lib/RJ-mapper.class.js +447 -111
- package/esm5/lib/RJ-mapper.class.js +474 -111
- package/fesm2015/pmcretail-mapper-library.js +446 -110
- package/fesm2015/pmcretail-mapper-library.js.map +1 -1
- package/fesm5/pmcretail-mapper-library.js +473 -110
- package/fesm5/pmcretail-mapper-library.js.map +1 -1
- package/lib/RJ-mapper.class.d.ts +8 -3
- package/package.json +1 -1
- package/pmcretail-mapper-library.metadata.json +1 -1
|
@@ -4736,7 +4736,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
4736
4736
|
(/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.TerminalNumber = (/** @type {?} */ (this)).terminalNumber;
|
|
4737
4737
|
(/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.TransactionNumber = (/** @type {?} */ (this)).transactionNumber;
|
|
4738
4738
|
(/** @type {?} */ (this)).rjObject['Header'].TaxMethodID = (/** @type {?} */ (this)).taxMethodId;
|
|
4739
|
-
(/** @type {?} */ (this)).rjObject['Header'].DynamicStockLookup = (/** @type {?} */ (this)).generateDynamicStockLookUp();
|
|
4739
|
+
(/** @type {?} */ (this)).rjObject['Header'].DynamicStockLookup = (/** @type {?} */ (this)).generateDynamicStockLookUp();
|
|
4740
4740
|
(/** @type {?} */ (this)).rjObject['Header'].BasketLanguageID = (/** @type {?} */ (this)).basketLanguageId; //todo
|
|
4741
4741
|
(/** @type {?} */ (this)).rjObject['Header'].BasketCountryID = (/** @type {?} */ (this)).basketCountryId; //todo
|
|
4742
4742
|
(/** @type {?} */ (this)).rjObject['Header'].BasketCurrencyID = (/** @type {?} */ (this)).transactionDocument.baseCurrency;
|
|
@@ -4758,6 +4758,11 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
4758
4758
|
*/
|
|
4759
4759
|
function () {
|
|
4760
4760
|
var _this = this;
|
|
4761
|
+
/** @type {?} */
|
|
4762
|
+
var transactionDiscount = [];
|
|
4763
|
+
if ((/** @type {?} */ (this)).transactionDocument.basket.transactionDiscount && (/** @type {?} */ (this)).transactionDocument.basket.transactionDiscount.length > 0) {
|
|
4764
|
+
transactionDiscount = (/** @type {?} */ (this)).transactionDocument.basket.transactionDiscount;
|
|
4765
|
+
}
|
|
4761
4766
|
if ((/** @type {?} */ (this)).transactionDocument.type === TRANSACTION_TYPE.SALE) {
|
|
4762
4767
|
(/** @type {?} */ (this)).rjObject['ProductSale'] = [];
|
|
4763
4768
|
(/** @type {?} */ (this)).rjObject['ModifierItem'] = [];
|
|
@@ -4783,7 +4788,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
4783
4788
|
}
|
|
4784
4789
|
}
|
|
4785
4790
|
/** @type {?} */
|
|
4786
|
-
var data = (/** @type {?} */ (_this)).addProduct(element, (lineDiscount.length > 0 ? lineDiscount[0] : null));
|
|
4791
|
+
var data = (/** @type {?} */ (_this)).addProduct(element, (lineDiscount.length > 0 ? lineDiscount[0] : null), (transactionDiscount.length > 0 ? transactionDiscount : null));
|
|
4787
4792
|
(/** @type {?} */ (_this)).rjObject['ProductSale'].push(data);
|
|
4788
4793
|
(/** @type {?} */ (_this)).getModifierItem(lineDiscount.length > 0 ? lineDiscount[0] : null, element.itemLineId);
|
|
4789
4794
|
}));
|
|
@@ -4803,7 +4808,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
4803
4808
|
*/
|
|
4804
4809
|
function (element) {
|
|
4805
4810
|
/** @type {?} */
|
|
4806
|
-
var data = (/** @type {?} */ (_this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
|
|
4811
|
+
var data = (/** @type {?} */ (_this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null), (transactionDiscount.length > 0 ? transactionDiscount : null));
|
|
4807
4812
|
(/** @type {?} */ (_this)).rjObject['ProductReturn'].push(data);
|
|
4808
4813
|
(/** @type {?} */ (_this)).getModifierItem(element.lineDiscount, element.itemLineId);
|
|
4809
4814
|
}));
|
|
@@ -4819,7 +4824,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
4819
4824
|
*/
|
|
4820
4825
|
function (element) {
|
|
4821
4826
|
/** @type {?} */
|
|
4822
|
-
var data = (/** @type {?} */ (_this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
|
|
4827
|
+
var data = (/** @type {?} */ (_this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null), (transactionDiscount.length > 0 ? transactionDiscount : null));
|
|
4823
4828
|
/** @type {?} */
|
|
4824
4829
|
var obj = {
|
|
4825
4830
|
"OriginalReceiptSupplied": 0,
|
|
@@ -4846,7 +4851,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
4846
4851
|
function (element) {
|
|
4847
4852
|
if (element.refundedQuantity > 0) {
|
|
4848
4853
|
/** @type {?} */
|
|
4849
|
-
var returnProduct = (/** @type {?} */ (_this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
|
|
4854
|
+
var returnProduct = (/** @type {?} */ (_this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null), (transactionDiscount.length > 0 ? transactionDiscount : null));
|
|
4850
4855
|
/** @type {?} */
|
|
4851
4856
|
var obj = {
|
|
4852
4857
|
"OriginalReceiptSupplied": 0,
|
|
@@ -4860,7 +4865,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
4860
4865
|
}
|
|
4861
4866
|
else {
|
|
4862
4867
|
/** @type {?} */
|
|
4863
|
-
var addProduct = (/** @type {?} */ (_this)).addProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
|
|
4868
|
+
var addProduct = (/** @type {?} */ (_this)).addProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null), (transactionDiscount.length > 0 ? transactionDiscount : null));
|
|
4864
4869
|
(/** @type {?} */ (_this)).rjObject['ProductSale'].push(addProduct);
|
|
4865
4870
|
}
|
|
4866
4871
|
(/** @type {?} */ (_this)).getModifierItem(element.lineDiscount, element.itemLineId);
|
|
@@ -4890,18 +4895,24 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
4890
4895
|
function (element) {
|
|
4891
4896
|
/** @type {?} */
|
|
4892
4897
|
var obj = {};
|
|
4893
|
-
obj['XMLSchemaVersion'] =
|
|
4894
|
-
obj['NetValue'] = (/** @type {?} */ (_this)).convertToString(element.discountAmount
|
|
4895
|
-
obj['EffectiveNetValue'] = (/** @type {?} */ (_this)).convertToString(element.discountAmount
|
|
4898
|
+
obj['XMLSchemaVersion'] = (/** @type {?} */ (_this)).xmlSchemaVersion;
|
|
4899
|
+
obj['NetValue'] = (/** @type {?} */ (_this)).convertToString(element.discountAmount * -1);
|
|
4900
|
+
obj['EffectiveNetValue'] = (/** @type {?} */ (_this)).convertToString(element.discountAmount * -1);
|
|
4896
4901
|
obj['Description'] = element.reasonDisplayText;
|
|
4897
4902
|
obj['UserID'] = (/** @type {?} */ (_this)).transactionDocument.userName;
|
|
4898
4903
|
obj['ReasonCodeID'] = element.reasonCode;
|
|
4899
|
-
obj['DiscountType'] = (/** @type {?} */ (_this)).convertToString(element.discountType.toUpperCase() == DISCOUNTTYPE.PERCENT.toUpperCase() ? 0 : 1);
|
|
4904
|
+
obj['DiscountType'] = (/** @type {?} */ (_this)).convertToString(element.discountType.toUpperCase() == DISCOUNTTYPE.PERCENT.toUpperCase() ? 0 : 1);
|
|
4900
4905
|
obj['RoundingRule'] = (/** @type {?} */ (_this)).convertToString(2);
|
|
4901
4906
|
obj['ModifiedLineNumber'] = element.itemLineIds;
|
|
4902
4907
|
obj['LineNumber'] = (/** @type {?} */ (_this)).convertToString((/** @type {?} */ (_this)).generateLineNumber());
|
|
4903
|
-
|
|
4904
|
-
|
|
4908
|
+
obj['DiscountedValue'] = (/** @type {?} */ (_this)).transactionDocument.basketSummary.basketTotal + (/** @type {?} */ (_this)).transactionDocument.basketSummary.discountTotal;
|
|
4909
|
+
if (element.discountType.toUpperCase() == DISCOUNTTYPE.PERCENT.toUpperCase()) {
|
|
4910
|
+
obj['DiscountPercentage'] = (/** @type {?} */ (_this)).convertToString((element.discountAmount / (/** @type {?} */ (_this)).transactionDocument.basketSummary.basketTotal).toFixed(1));
|
|
4911
|
+
}
|
|
4912
|
+
if ((/** @type {?} */ (_this)).transactionDocument.type === 'REFUND') {
|
|
4913
|
+
obj['NetValue'] = (/** @type {?} */ (_this)).convertToString(element.discountAmount < 0 ? -element.discountAmount : element.discountAmount);
|
|
4914
|
+
obj['EffectiveNetValue'] = (/** @type {?} */ (_this)).convertToString(element.discountAmount < 0 ? -element.discountAmount : element.discountAmount);
|
|
4915
|
+
}
|
|
4905
4916
|
(/** @type {?} */ (_this)).rjObject['BasketDiscount'].push(obj);
|
|
4906
4917
|
}));
|
|
4907
4918
|
return (/** @type {?} */ (this));
|
|
@@ -4979,51 +4990,94 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
4979
4990
|
obj['TaxPercentage'] = element.VAT.toFixed(2); // todo
|
|
4980
4991
|
(/** @type {?} */ (_this)).rjObject['Trailer']['TaxItem'].push(obj);
|
|
4981
4992
|
}));
|
|
4982
|
-
|
|
4983
|
-
if ((/** @type {?} */ (this)).transactionDocument.basket.linePromotion.length > 0) {
|
|
4993
|
+
if ((/** @type {?} */ (this)).transactionDocument.basket.linePromotion.length > 0 || (/** @type {?} */ (this)).transactionDocument.basket.linePromotion.length > 0) {
|
|
4984
4994
|
(/** @type {?} */ (this)).rjObject['Trailer']['PromotionItem'] = [];
|
|
4985
|
-
(/** @type {?} */ (this)).transactionDocument.basket.linePromotion.
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
*/
|
|
4989
|
-
function (element) {
|
|
4990
|
-
console.log('element', element);
|
|
4991
|
-
/** @type {?} */
|
|
4992
|
-
var obj = {};
|
|
4993
|
-
obj['PromotionID'] = element.promotionId;
|
|
4994
|
-
obj['PromotionSaving'] = element.promotionAmount < 0 ? element.promotionAmount : -element.promotionAmount;
|
|
4995
|
-
obj['PromotionQuantity'] = ""; // todo - not avaialble
|
|
4996
|
-
obj['PromotionDescription'] = element.displayText;
|
|
4997
|
-
obj['PromotionHit'] = {};
|
|
4998
|
-
obj['PromotionHit']['XMLSchemaVersion'] = (/** @type {?} */ (_this)).xmlSchemaVersion;
|
|
4999
|
-
obj['PromotionHit']['HitNumber'] = ""; // todo;
|
|
5000
|
-
obj['PromotionHit']['HitQuantity'] = ""; // todo;
|
|
5001
|
-
obj['PromotionHit']['HitSaving'] = ""; // todo;
|
|
5002
|
-
obj['PromotionHit']['PromotionTrigger'] = {};
|
|
5003
|
-
element.trigger.forEach((/**
|
|
5004
|
-
* @param {?} subElement
|
|
4995
|
+
if ((/** @type {?} */ (this)).transactionDocument.basket.linePromotion.length > 0) {
|
|
4996
|
+
(/** @type {?} */ (this)).transactionDocument.basket.linePromotion.forEach((/**
|
|
4997
|
+
* @param {?} element
|
|
5005
4998
|
* @return {?}
|
|
5006
4999
|
*/
|
|
5007
|
-
function (
|
|
5000
|
+
function (element) {
|
|
5001
|
+
/** @type {?} */
|
|
5002
|
+
var obj = {};
|
|
5003
|
+
obj['PromotionID'] = element.promotionId;
|
|
5004
|
+
obj['PromotionSaving'] = element.promotionAmount < 0 ? element.promotionAmount : -element.promotionAmount;
|
|
5005
|
+
obj['PromotionQuantity'] = "1";
|
|
5006
|
+
obj['PromotionDescription'] = element.displayText;
|
|
5007
|
+
obj['PromotionHit'] = {};
|
|
5008
|
+
obj['PromotionHit']['XMLSchemaVersion'] = (/** @type {?} */ (_this)).xmlSchemaVersion;
|
|
5009
|
+
obj['PromotionHit']['HitNumber'] = "1";
|
|
5010
|
+
obj['PromotionHit']['HitQuantity'] = "1";
|
|
5011
|
+
obj['PromotionHit']['HitSaving'] = element.promotionAmount < 0 ? element.promotionAmount : -element.promotionAmount;
|
|
5012
|
+
obj['PromotionHit']['PromotionTrigger'] = {};
|
|
5008
5013
|
/** @type {?} */
|
|
5009
5014
|
var product = (/** @type {?} */ (_this)).transactionDocument.basket.products.find((/**
|
|
5010
5015
|
* @param {?} item
|
|
5011
5016
|
* @return {?}
|
|
5012
5017
|
*/
|
|
5013
|
-
function (item) { return item.itemLineId ==
|
|
5018
|
+
function (item) { return item.itemLineId == element.itemLineId; }));
|
|
5014
5019
|
obj['PromotionHit']['PromotionTrigger']['XMLSchemaVersion'] = (/** @type {?} */ (_this)).xmlSchemaVersion;
|
|
5015
5020
|
obj['PromotionHit']['PromotionTrigger']['ProductID'] = product.SKU;
|
|
5016
5021
|
obj['PromotionHit']['PromotionTrigger']['UnitValue'] = (/** @type {?} */ (_this)).convertToString(element.promotionLinePrice / product.quantity);
|
|
5017
|
-
obj['PromotionHit']['PromotionTrigger']['LineNumber'] = (/** @type {?} */ (_this)).
|
|
5018
|
-
obj['PromotionHit']['PromotionTrigger']['Quantity'] = (/** @type {?} */ (_this)).convertToString(
|
|
5022
|
+
obj['PromotionHit']['PromotionTrigger']['LineNumber'] = (/** @type {?} */ (_this)).getNumber(product.SKU);
|
|
5023
|
+
obj['PromotionHit']['PromotionTrigger']['Quantity'] = (/** @type {?} */ (_this)).convertToString(product.quantity.toFixed(1));
|
|
5019
5024
|
obj['PromotionHit']['PromotionTrigger']['TaxCode'] = (/** @type {?} */ (_this)).transactionDocument.basket.taxBreakdown.taxLines.find((/**
|
|
5020
5025
|
* @param {?} item
|
|
5021
5026
|
* @return {?}
|
|
5022
5027
|
*/
|
|
5023
5028
|
function (item) { return item.itemLineId == element.itemLineId; })).VATCode; // todo
|
|
5029
|
+
(/** @type {?} */ (_this)).rjObject['Trailer']['PromotionItem'].push(obj);
|
|
5024
5030
|
}));
|
|
5025
|
-
|
|
5026
|
-
}))
|
|
5031
|
+
}
|
|
5032
|
+
if ((/** @type {?} */ (this)).transactionDocument.basket.transactionPromotion.length > 0) {
|
|
5033
|
+
(/** @type {?} */ (this)).transactionDocument.basket.transactionPromotion.forEach((/**
|
|
5034
|
+
* @param {?} element
|
|
5035
|
+
* @return {?}
|
|
5036
|
+
*/
|
|
5037
|
+
function (element) {
|
|
5038
|
+
/** @type {?} */
|
|
5039
|
+
var obj = {};
|
|
5040
|
+
console.log('element');
|
|
5041
|
+
obj['PromotionID'] = element.promotionId;
|
|
5042
|
+
obj['PromotionSaving'] = element.promotionAmount < 0 ? element.promotionAmount : -element.promotionAmount;
|
|
5043
|
+
obj['PromotionQuantity'] = "1";
|
|
5044
|
+
obj['PromotionDescription'] = element.displayText;
|
|
5045
|
+
obj['PromotionHit'] = {};
|
|
5046
|
+
obj['PromotionHit']['XMLSchemaVersion'] = (/** @type {?} */ (_this)).xmlSchemaVersion;
|
|
5047
|
+
obj['PromotionHit']['HitNumber'] = "1";
|
|
5048
|
+
obj['PromotionHit']['HitQuantity'] = "1";
|
|
5049
|
+
obj['PromotionHit']['HitSaving'] = element.promotionAmount < 0 ? element.promotionAmount : -element.promotionAmount;
|
|
5050
|
+
obj['PromotionHit']['PromotionTrigger'] = [];
|
|
5051
|
+
(/** @type {?} */ (_this)).transactionDocument.basket.products.forEach((/**
|
|
5052
|
+
* @param {?} product
|
|
5053
|
+
* @return {?}
|
|
5054
|
+
*/
|
|
5055
|
+
function (product) {
|
|
5056
|
+
/** @type {?} */
|
|
5057
|
+
var promotionTrigger = {};
|
|
5058
|
+
element.itemLineIds.forEach((/**
|
|
5059
|
+
* @param {?} itemLineId
|
|
5060
|
+
* @return {?}
|
|
5061
|
+
*/
|
|
5062
|
+
function (itemLineId) {
|
|
5063
|
+
if (JSON.stringify(itemLineId) === product.itemLineId) {
|
|
5064
|
+
promotionTrigger['XMLSchemaVersion'] = (/** @type {?} */ (_this)).xmlSchemaVersion;
|
|
5065
|
+
promotionTrigger['ProductID'] = product.SKU;
|
|
5066
|
+
promotionTrigger['UnitValue'] = (/** @type {?} */ (_this)).convertToString(element.promotionLinePrice / product.quantity);
|
|
5067
|
+
promotionTrigger['LineNumber'] = (/** @type {?} */ (_this)).getNumber(product.SKU);
|
|
5068
|
+
promotionTrigger['Quantity'] = (/** @type {?} */ (_this)).convertToString(product.quantity);
|
|
5069
|
+
promotionTrigger['TaxCode'] = (/** @type {?} */ (_this)).transactionDocument.basket.taxBreakdown.taxLines.find((/**
|
|
5070
|
+
* @param {?} item
|
|
5071
|
+
* @return {?}
|
|
5072
|
+
*/
|
|
5073
|
+
function (item) { return item.itemLineId == product.itemLineId; })).VATCode;
|
|
5074
|
+
obj['PromotionHit']['PromotionTrigger'].push(promotionTrigger);
|
|
5075
|
+
}
|
|
5076
|
+
}));
|
|
5077
|
+
}));
|
|
5078
|
+
(/** @type {?} */ (_this)).rjObject['Trailer']['PromotionItem'].push(obj);
|
|
5079
|
+
}));
|
|
5080
|
+
}
|
|
5027
5081
|
}
|
|
5028
5082
|
return (/** @type {?} */ (this));
|
|
5029
5083
|
};
|
|
@@ -5039,64 +5093,136 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5039
5093
|
*/
|
|
5040
5094
|
function () {
|
|
5041
5095
|
var _this = this;
|
|
5042
|
-
(/** @type {?} */ (this)).rjObject['CashTender'] = [];
|
|
5043
5096
|
if ((/** @type {?} */ (this)).transactionDocument.paymentDetails && (/** @type {?} */ (this)).transactionDocument.paymentDetails.length > 0) {
|
|
5044
5097
|
(/** @type {?} */ (this)).transactionDocument.paymentDetails.forEach((/**
|
|
5045
5098
|
* @param {?} element
|
|
5046
5099
|
* @return {?}
|
|
5047
5100
|
*/
|
|
5048
5101
|
function (element) {
|
|
5049
|
-
if (element.
|
|
5050
|
-
/** @type {?} */
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5102
|
+
if (element.externalTenderKey) {
|
|
5103
|
+
(/** @type {?} */ (_this)).rjObject[element.externalTenderKey] = [];
|
|
5104
|
+
if (element.paymentType.toUpperCase() === 'GIFT CARD') {
|
|
5105
|
+
/** @type {?} */
|
|
5106
|
+
var obj = {
|
|
5107
|
+
XMLSchemaVersion: (/** @type {?} */ (_this)).xmlSchemaVersion,
|
|
5108
|
+
LineNumber: (/** @type {?} */ (_this)).generateLineNumber(),
|
|
5109
|
+
NetValue: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
|
|
5110
|
+
EffectiveNetValue: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
|
|
5111
|
+
Description: (/** @type {?} */ (_this)).getDescription(element),
|
|
5112
|
+
DeviceID: (/** @type {?} */ (_this)).deviceId,
|
|
5113
|
+
UserID: (/** @type {?} */ (_this)).transactionDocument.userName,
|
|
5114
|
+
DateTimeCreated: (/** @type {?} */ (_this)).updatedAt,
|
|
5115
|
+
TenderType: element.externalTenderType ? element.externalTenderType : '',
|
|
5116
|
+
TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',
|
|
5117
|
+
TenderAmount: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
|
|
5118
|
+
CurrencyID: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
|
|
5119
|
+
CurrencyDescription: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
|
|
5120
|
+
GiftVoucherSalesAllowed: '',
|
|
5121
|
+
//todo
|
|
5122
|
+
AllowRechargeableVoucherSales: '',
|
|
5123
|
+
//todo
|
|
5124
|
+
GiftVoucherID: ''
|
|
5125
|
+
};
|
|
5126
|
+
(/** @type {?} */ (_this)).rjObject[element.externalTenderKey].push(obj);
|
|
5127
|
+
}
|
|
5128
|
+
else {
|
|
5129
|
+
/** @type {?} */
|
|
5130
|
+
var obj1 = {
|
|
5131
|
+
XMLSchemaVersion: "1",
|
|
5132
|
+
LineNumber: (/** @type {?} */ (_this)).generateLineNumber(),
|
|
5133
|
+
//todo
|
|
5134
|
+
NetValue: JSON.stringify(-1 * (Math.round(element.amount))),
|
|
5135
|
+
EffectiveNetValue: JSON.stringify(-1 * (Math.round(element.amount))),
|
|
5136
|
+
Description: (/** @type {?} */ (_this)).getDescription(element),
|
|
5137
|
+
DeviceID: (/** @type {?} */ (_this)).deviceId,
|
|
5138
|
+
UserID: (/** @type {?} */ (_this)).transactionDocument.userName,
|
|
5139
|
+
DateTimeCreated: (/** @type {?} */ (_this)).updatedAt,
|
|
5140
|
+
TenderType: element.externalTenderType ? element.externalTenderType : '',
|
|
5141
|
+
TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',
|
|
5142
|
+
TenderAmount: JSON.stringify(-1 * (Math.round(element.amount))),
|
|
5143
|
+
CurrencyID: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
|
|
5144
|
+
CurrencyDescription: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
|
|
5145
|
+
IncludeInTransactionTotalCheck: "1",
|
|
5146
|
+
AllowRechargeableVoucherSales: "1",
|
|
5147
|
+
OpenDrawerAtEnd: "1"
|
|
5148
|
+
};
|
|
5149
|
+
(/** @type {?} */ (_this)).rjObject[element.externalTenderKey].push(obj1);
|
|
5150
|
+
}
|
|
5072
5151
|
}
|
|
5073
5152
|
else {
|
|
5074
|
-
/** @type {?} */
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5153
|
+
(/** @type {?} */ (_this)).rjObject['CashTender'] = [];
|
|
5154
|
+
if (element.paymentType.toUpperCase() === 'GIFT CARD') {
|
|
5155
|
+
/** @type {?} */
|
|
5156
|
+
var obj = {
|
|
5157
|
+
XMLSchemaVersion: (/** @type {?} */ (_this)).xmlSchemaVersion,
|
|
5158
|
+
LineNumber: (/** @type {?} */ (_this)).generateLineNumber(),
|
|
5159
|
+
NetValue: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
|
|
5160
|
+
EffectiveNetValue: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
|
|
5161
|
+
Description: (/** @type {?} */ (_this)).getDescription(element),
|
|
5162
|
+
DeviceID: (/** @type {?} */ (_this)).deviceId,
|
|
5163
|
+
UserID: (/** @type {?} */ (_this)).transactionDocument.userName,
|
|
5164
|
+
DateTimeCreated: (/** @type {?} */ (_this)).updatedAt,
|
|
5165
|
+
TenderType: element.externalTenderType ? element.externalTenderType : '',
|
|
5166
|
+
TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',
|
|
5167
|
+
TenderAmount: (/** @type {?} */ (_this)).convertToString(-1 * (/** @type {?} */ (_this)).removeDecimal((Math.round(element.amount)))),
|
|
5168
|
+
CurrencyID: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
|
|
5169
|
+
CurrencyDescription: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
|
|
5170
|
+
GiftVoucherSalesAllowed: '',
|
|
5171
|
+
//todo
|
|
5172
|
+
AllowRechargeableVoucherSales: '',
|
|
5173
|
+
//todo
|
|
5174
|
+
GiftVoucherID: ''
|
|
5175
|
+
};
|
|
5176
|
+
(/** @type {?} */ (_this)).rjObject['CashTender'].push(obj);
|
|
5177
|
+
}
|
|
5178
|
+
else {
|
|
5179
|
+
/** @type {?} */
|
|
5180
|
+
var obj1 = {
|
|
5181
|
+
XMLSchemaVersion: "1",
|
|
5182
|
+
LineNumber: (/** @type {?} */ (_this)).generateLineNumber(),
|
|
5183
|
+
NetValue: JSON.stringify(-1 * (Math.round(element.amount))),
|
|
5184
|
+
EffectiveNetValue: JSON.stringify(-1 * (Math.round(element.amount))),
|
|
5185
|
+
Description: (/** @type {?} */ (_this)).getDescription(element),
|
|
5186
|
+
DeviceID: (/** @type {?} */ (_this)).deviceId,
|
|
5187
|
+
UserID: (/** @type {?} */ (_this)).transactionDocument.userName,
|
|
5188
|
+
DateTimeCreated: (/** @type {?} */ (_this)).updatedAt,
|
|
5189
|
+
TenderType: element.externalTenderType ? element.externalTenderType : '',
|
|
5190
|
+
TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',
|
|
5191
|
+
TenderAmount: JSON.stringify(-1 * (Math.round(element.amount))),
|
|
5192
|
+
CurrencyID: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
|
|
5193
|
+
CurrencyDescription: (/** @type {?} */ (_this)).transactionDocument.baseCurrency,
|
|
5194
|
+
IncludeInTransactionTotalCheck: "1",
|
|
5195
|
+
AllowRechargeableVoucherSales: "1",
|
|
5196
|
+
OpenDrawerAtEnd: "1"
|
|
5197
|
+
};
|
|
5198
|
+
(/** @type {?} */ (_this)).rjObject['CashTender'].push(obj1);
|
|
5199
|
+
}
|
|
5095
5200
|
}
|
|
5096
5201
|
}));
|
|
5097
5202
|
}
|
|
5098
5203
|
return (/** @type {?} */ (this));
|
|
5099
5204
|
};
|
|
5205
|
+
/**
|
|
5206
|
+
* @param {?} productId
|
|
5207
|
+
* @return {?}
|
|
5208
|
+
*/
|
|
5209
|
+
RJMapperBuilderClass.prototype.getNumber = /**
|
|
5210
|
+
* @param {?} productId
|
|
5211
|
+
* @return {?}
|
|
5212
|
+
*/
|
|
5213
|
+
function (productId) {
|
|
5214
|
+
/** @type {?} */
|
|
5215
|
+
var lineNumber;
|
|
5216
|
+
for (var i = 0; i < this.rjObject['ProductSale'].length; i++) {
|
|
5217
|
+
/** @type {?} */
|
|
5218
|
+
var element = this.rjObject['ProductSale'][i];
|
|
5219
|
+
if (JSON.stringify(productId) === JSON.stringify(element.ProductID)) {
|
|
5220
|
+
lineNumber = element.LineNumber;
|
|
5221
|
+
break;
|
|
5222
|
+
}
|
|
5223
|
+
}
|
|
5224
|
+
return lineNumber;
|
|
5225
|
+
};
|
|
5100
5226
|
/**
|
|
5101
5227
|
* @return {?}
|
|
5102
5228
|
*/
|
|
@@ -5518,14 +5644,17 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5518
5644
|
/**
|
|
5519
5645
|
* @param {?} element
|
|
5520
5646
|
* @param {?} lineDiscount
|
|
5647
|
+
* @param {?} transactionDiscount
|
|
5521
5648
|
* @return {?}
|
|
5522
5649
|
*/
|
|
5523
5650
|
RJMapperBuilderClass.prototype.returnProduct = /**
|
|
5524
5651
|
* @param {?} element
|
|
5525
5652
|
* @param {?} lineDiscount
|
|
5653
|
+
* @param {?} transactionDiscount
|
|
5526
5654
|
* @return {?}
|
|
5527
5655
|
*/
|
|
5528
|
-
function (element, lineDiscount) {
|
|
5656
|
+
function (element, lineDiscount, transactionDiscount) {
|
|
5657
|
+
var _this = this;
|
|
5529
5658
|
/** @type {?} */
|
|
5530
5659
|
var obj = {};
|
|
5531
5660
|
/** @type {?} */
|
|
@@ -5561,7 +5690,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5561
5690
|
obj['DisplayTaxCode'] = ''; // todo
|
|
5562
5691
|
obj['ProductAttributes'] = ''; //todo - not required
|
|
5563
5692
|
obj['Perishable'] = this.getAttributes();
|
|
5564
|
-
obj['MMGroupID'] = this.
|
|
5693
|
+
obj['MMGroupID'] = this.getCaregories(element);
|
|
5565
5694
|
obj['CustomerDetails'] = ""; // todo - blank
|
|
5566
5695
|
obj['TotalPromotionSaving'] = element['promotionAmount'] || -1; // TODO
|
|
5567
5696
|
obj['OriginalTaxAmount'] = this.convertToString(this.getOriginalTax(element, taxTotal.VAT) * -1);
|
|
@@ -5600,19 +5729,87 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5600
5729
|
obj.ExtendedValue = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount) * -1;
|
|
5601
5730
|
obj.UnitPrice = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount) * -1;
|
|
5602
5731
|
}
|
|
5732
|
+
if (transactionDiscount) {
|
|
5733
|
+
obj['BasketDiscountModifier'] = [];
|
|
5734
|
+
this.transactionDocument.basket.transactionDiscount.forEach((/**
|
|
5735
|
+
* @param {?} e
|
|
5736
|
+
* @return {?}
|
|
5737
|
+
*/
|
|
5738
|
+
function (e) {
|
|
5739
|
+
/** @type {?} */
|
|
5740
|
+
var discountObj = {};
|
|
5741
|
+
e.itemLineIds.forEach((/**
|
|
5742
|
+
* @param {?} x
|
|
5743
|
+
* @return {?}
|
|
5744
|
+
*/
|
|
5745
|
+
function (x) {
|
|
5746
|
+
if (x == element.itemLineId) {
|
|
5747
|
+
/** @type {?} */
|
|
5748
|
+
var discountAmount = _this.convertToString(e.discountAmount * -1);
|
|
5749
|
+
discountObj.BasketDiscountLineNumber = _this.getLineNumber(e, discountAmount);
|
|
5750
|
+
discountObj.XMLSchemaVersion = _this.xmlSchemaVersion;
|
|
5751
|
+
discountObj.DiscountedValue = _this.getDiscountedValue(element.totalLinePrice, e.discountAmount);
|
|
5752
|
+
obj['BasketDiscountModifier'].push(discountObj);
|
|
5753
|
+
}
|
|
5754
|
+
}));
|
|
5755
|
+
}));
|
|
5756
|
+
/** @type {?} */
|
|
5757
|
+
var totaltransactionDiscount = 0;
|
|
5758
|
+
obj['BasketDiscountModifier'].forEach((/**
|
|
5759
|
+
* @param {?} value
|
|
5760
|
+
* @return {?}
|
|
5761
|
+
*/
|
|
5762
|
+
function (value) {
|
|
5763
|
+
totaltransactionDiscount = totaltransactionDiscount + value.DiscountedValue;
|
|
5764
|
+
}));
|
|
5765
|
+
//update the product price
|
|
5766
|
+
obj['EffectiveNetValue'] = obj.EffectiveNetValue + totaltransactionDiscount;
|
|
5767
|
+
}
|
|
5768
|
+
if (this.transactionDocument.basket.transactionPromotion.length > 0) {
|
|
5769
|
+
obj['PromotionSaving'] = [];
|
|
5770
|
+
this.transactionDocument.basket.transactionPromotion.forEach((/**
|
|
5771
|
+
* @param {?} transactionPromo
|
|
5772
|
+
* @return {?}
|
|
5773
|
+
*/
|
|
5774
|
+
function (transactionPromo) {
|
|
5775
|
+
/** @type {?} */
|
|
5776
|
+
var promotionObj = {};
|
|
5777
|
+
transactionPromo.itemLineIds.forEach((/**
|
|
5778
|
+
* @param {?} itemLineId
|
|
5779
|
+
* @return {?}
|
|
5780
|
+
*/
|
|
5781
|
+
function (itemLineId) {
|
|
5782
|
+
if (itemLineId == element.itemLineId) {
|
|
5783
|
+
promotionObj.ModifierValue = transactionPromo.promotionAmount;
|
|
5784
|
+
promotionObj.ModifierDateTime = _this.transactionDocument.createdAt;
|
|
5785
|
+
promotionObj.ModifierDescription = transactionPromo.displayText;
|
|
5786
|
+
promotionObj.XMLSchemaVersion = _this.xmlSchemaVersion;
|
|
5787
|
+
promotionObj.PromotionID = transactionPromo.promotionId;
|
|
5788
|
+
promotionObj.PromotionDescription = transactionPromo.displayText;
|
|
5789
|
+
promotionObj.HitNumber = '1';
|
|
5790
|
+
promotionObj.PromotionHitProductQuantity = _this.getQuantity(element);
|
|
5791
|
+
promotionObj.PromotionHitQuantity = _this.getQuantity(element) * -1;
|
|
5792
|
+
obj['PromotionSaving'].push(promotionObj);
|
|
5793
|
+
}
|
|
5794
|
+
}));
|
|
5795
|
+
}));
|
|
5796
|
+
}
|
|
5603
5797
|
return obj;
|
|
5604
5798
|
};
|
|
5605
5799
|
/**
|
|
5606
5800
|
* @param {?} element
|
|
5607
5801
|
* @param {?} lineDiscount
|
|
5802
|
+
* @param {?} transactionDiscount
|
|
5608
5803
|
* @return {?}
|
|
5609
5804
|
*/
|
|
5610
5805
|
RJMapperBuilderClass.prototype.addProduct = /**
|
|
5611
5806
|
* @param {?} element
|
|
5612
5807
|
* @param {?} lineDiscount
|
|
5808
|
+
* @param {?} transactionDiscount
|
|
5613
5809
|
* @return {?}
|
|
5614
5810
|
*/
|
|
5615
|
-
function (element, lineDiscount) {
|
|
5811
|
+
function (element, lineDiscount, transactionDiscount) {
|
|
5812
|
+
var _this = this;
|
|
5616
5813
|
/** @type {?} */
|
|
5617
5814
|
var taxTotal = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
|
|
5618
5815
|
* @param {?} item
|
|
@@ -5631,8 +5828,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5631
5828
|
DateTimeCreated: this.createdAt,
|
|
5632
5829
|
ExtendedValue: this.removeDecimal(element.price),
|
|
5633
5830
|
UnitPrice: this.removeDecimal(element.price),
|
|
5634
|
-
MMGroupID: this.
|
|
5635
|
-
//todo
|
|
5831
|
+
MMGroupID: this.getCaregories(element),
|
|
5636
5832
|
Quantity: element.quantity.toFixed(1),
|
|
5637
5833
|
SalespersonID: this.transactionDocument.userId,
|
|
5638
5834
|
SalespersonName: this.transactionDocument.userName,
|
|
@@ -5641,14 +5837,14 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5641
5837
|
* @return {?}
|
|
5642
5838
|
*/
|
|
5643
5839
|
function (item) { return item.itemLineId == element['itemLineId']; })).VATCode,
|
|
5644
|
-
TaxModifiable: 1,
|
|
5840
|
+
TaxModifiable: "1",
|
|
5645
5841
|
//todo
|
|
5646
5842
|
OriginalTaxAmount: this.convertToString(this.getOriginalTax(element, taxTotal.VAT)),
|
|
5647
5843
|
TaxAmount: this.convertToString(taxTotal.taxLineTotal),
|
|
5648
|
-
OriginalTaxAmountSet: 1,
|
|
5844
|
+
OriginalTaxAmountSet: "1",
|
|
5649
5845
|
//todo
|
|
5650
5846
|
ProductID: element.SKU,
|
|
5651
|
-
HandKeyed: 1,
|
|
5847
|
+
HandKeyed: "1",
|
|
5652
5848
|
//todo
|
|
5653
5849
|
CustomerDetails: "",
|
|
5654
5850
|
Perishable: this.getAttributes()
|
|
@@ -5677,7 +5873,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5677
5873
|
obj['PriceOverride'].ModifierReasonID = lineDiscount.priceOverrideReasonCode;
|
|
5678
5874
|
obj['PriceOverride'].ModifierReasonDescription = lineDiscount.priceOverrideReasonName;
|
|
5679
5875
|
obj['PriceOverride'].AuthorisingUserID = this.transactionDocument.userName;
|
|
5680
|
-
obj['PriceOverride'].XMLSchemaVersion =
|
|
5876
|
+
obj['PriceOverride'].XMLSchemaVersion = this.xmlSchemaVersion;
|
|
5681
5877
|
obj['PriceOverride'].NewPrice = this.removeDecimal(lineDiscount.unitPrice);
|
|
5682
5878
|
obj['PriceOverride'].OriginalPrice = this.removeDecimal(lineDiscount.discountedLinePrice || 0 + lineDiscount.discountAmount);
|
|
5683
5879
|
}
|
|
@@ -5687,8 +5883,150 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5687
5883
|
obj['ExtendedValue'] = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount);
|
|
5688
5884
|
obj['UnitPrice'] = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount);
|
|
5689
5885
|
}
|
|
5886
|
+
if (transactionDiscount) {
|
|
5887
|
+
obj['BasketDiscountModifier'] = [];
|
|
5888
|
+
this.transactionDocument.basket.transactionDiscount.forEach((/**
|
|
5889
|
+
* @param {?} e
|
|
5890
|
+
* @return {?}
|
|
5891
|
+
*/
|
|
5892
|
+
function (e) {
|
|
5893
|
+
/** @type {?} */
|
|
5894
|
+
var discountObj = {};
|
|
5895
|
+
e.itemLineIds.forEach((/**
|
|
5896
|
+
* @param {?} itemLineId
|
|
5897
|
+
* @return {?}
|
|
5898
|
+
*/
|
|
5899
|
+
function (itemLineId) {
|
|
5900
|
+
if (itemLineId == element.itemLineId) {
|
|
5901
|
+
/** @type {?} */
|
|
5902
|
+
var discountAmount = _this.convertToString(e.discountAmount * -1);
|
|
5903
|
+
discountObj.XMLSchemaVersion = _this.xmlSchemaVersion;
|
|
5904
|
+
discountObj.DiscountedValue = -(_this.getDiscountedValue(element.totalLinePrice, e.discountAmount).toFixed(0));
|
|
5905
|
+
discountObj.BasketDiscountLineNumber = _this.getLineNumber(e, discountAmount);
|
|
5906
|
+
obj['BasketDiscountModifier'].push(discountObj);
|
|
5907
|
+
}
|
|
5908
|
+
}));
|
|
5909
|
+
}));
|
|
5910
|
+
/** @type {?} */
|
|
5911
|
+
var totaltransactionDiscount_1 = 0;
|
|
5912
|
+
obj['BasketDiscountModifier'].forEach((/**
|
|
5913
|
+
* @param {?} value
|
|
5914
|
+
* @return {?}
|
|
5915
|
+
*/
|
|
5916
|
+
function (value) {
|
|
5917
|
+
totaltransactionDiscount_1 = totaltransactionDiscount_1 + value.DiscountedValue;
|
|
5918
|
+
}));
|
|
5919
|
+
//update the product price
|
|
5920
|
+
obj['EffectiveNetValue'] = obj.EffectiveNetValue + totaltransactionDiscount_1;
|
|
5921
|
+
}
|
|
5922
|
+
if (this.transactionDocument.basket.transactionPromotion.length > 0 || this.transactionDocument.basket.linePromotion.length > 0) {
|
|
5923
|
+
obj['DistributedPromotionSaving'] = [];
|
|
5924
|
+
if (this.transactionDocument.basket.transactionPromotion.length > 0) {
|
|
5925
|
+
this.transactionDocument.basket.transactionPromotion.forEach((/**
|
|
5926
|
+
* @param {?} e
|
|
5927
|
+
* @return {?}
|
|
5928
|
+
*/
|
|
5929
|
+
function (e) {
|
|
5930
|
+
/** @type {?} */
|
|
5931
|
+
var promotionObj = {};
|
|
5932
|
+
e.itemLineIds.forEach((/**
|
|
5933
|
+
* @param {?} itemLineId
|
|
5934
|
+
* @return {?}
|
|
5935
|
+
*/
|
|
5936
|
+
function (itemLineId) {
|
|
5937
|
+
if (itemLineId == element.itemLineId) {
|
|
5938
|
+
promotionObj.PromotionID = e.promotionId;
|
|
5939
|
+
promotionObj.Hit = '1';
|
|
5940
|
+
promotionObj.Saving = _this.getSaving(element.totalLinePrice, e.promotionAmount);
|
|
5941
|
+
promotionObj.ISaving = _this.getSaving(element.totalLinePrice, e.promotionAmount);
|
|
5942
|
+
obj['DistributedPromotionSaving'].push(promotionObj);
|
|
5943
|
+
}
|
|
5944
|
+
}));
|
|
5945
|
+
}));
|
|
5946
|
+
}
|
|
5947
|
+
if (this.transactionDocument.basket.linePromotion.length > 0) {
|
|
5948
|
+
this.transactionDocument.basket.linePromotion.forEach((/**
|
|
5949
|
+
* @param {?} linePromotion
|
|
5950
|
+
* @return {?}
|
|
5951
|
+
*/
|
|
5952
|
+
function (linePromotion) {
|
|
5953
|
+
/** @type {?} */
|
|
5954
|
+
var promotionObj = {};
|
|
5955
|
+
if (element.itemLineId == linePromotion.itemLineId) {
|
|
5956
|
+
promotionObj.PromotionID = linePromotion.promotionId;
|
|
5957
|
+
promotionObj.Hit = "1";
|
|
5958
|
+
promotionObj.Saving = linePromotion.promotionLinePrice;
|
|
5959
|
+
promotionObj.ISaving = linePromotion.promotionLinePrice;
|
|
5960
|
+
obj['DistributedPromotionSaving'].push(promotionObj);
|
|
5961
|
+
}
|
|
5962
|
+
}));
|
|
5963
|
+
}
|
|
5964
|
+
/** @type {?} */
|
|
5965
|
+
var transactionPromotion_1 = 0;
|
|
5966
|
+
obj['DistributedPromotionSaving'].forEach((/**
|
|
5967
|
+
* @param {?} value
|
|
5968
|
+
* @return {?}
|
|
5969
|
+
*/
|
|
5970
|
+
function (value) {
|
|
5971
|
+
transactionPromotion_1 = transactionPromotion_1 + value.Saving;
|
|
5972
|
+
}));
|
|
5973
|
+
obj['EffectiveNetValue'] = obj.EffectiveNetValue + transactionPromotion_1;
|
|
5974
|
+
}
|
|
5690
5975
|
return obj;
|
|
5691
5976
|
};
|
|
5977
|
+
/**
|
|
5978
|
+
* @param {?} price
|
|
5979
|
+
* @param {?} promotionAmount
|
|
5980
|
+
* @return {?}
|
|
5981
|
+
*/
|
|
5982
|
+
RJMapperBuilderClass.prototype.getSaving = /**
|
|
5983
|
+
* @param {?} price
|
|
5984
|
+
* @param {?} promotionAmount
|
|
5985
|
+
* @return {?}
|
|
5986
|
+
*/
|
|
5987
|
+
function (price, promotionAmount) {
|
|
5988
|
+
/** @type {?} */
|
|
5989
|
+
var Saving = (price * promotionAmount) / this.transactionDocument.basketSummary.saleTotal;
|
|
5990
|
+
return Saving;
|
|
5991
|
+
};
|
|
5992
|
+
/**
|
|
5993
|
+
* @param {?} value
|
|
5994
|
+
* @param {?} discountAmount
|
|
5995
|
+
* @return {?}
|
|
5996
|
+
*/
|
|
5997
|
+
RJMapperBuilderClass.prototype.getLineNumber = /**
|
|
5998
|
+
* @param {?} value
|
|
5999
|
+
* @param {?} discountAmount
|
|
6000
|
+
* @return {?}
|
|
6001
|
+
*/
|
|
6002
|
+
function (value, discountAmount) {
|
|
6003
|
+
/** @type {?} */
|
|
6004
|
+
var lineNumber;
|
|
6005
|
+
for (var i = 0; i < this.rjObject['BasketDiscount'].length; i++) {
|
|
6006
|
+
/** @type {?} */
|
|
6007
|
+
var element = this.rjObject['BasketDiscount'][i];
|
|
6008
|
+
if (value.reasonCode === element.ReasonCodeID && discountAmount === element.NetValue) {
|
|
6009
|
+
lineNumber = element.LineNumber;
|
|
6010
|
+
break;
|
|
6011
|
+
}
|
|
6012
|
+
}
|
|
6013
|
+
return lineNumber;
|
|
6014
|
+
};
|
|
6015
|
+
/**
|
|
6016
|
+
* @param {?} price
|
|
6017
|
+
* @param {?} discountAmount
|
|
6018
|
+
* @return {?}
|
|
6019
|
+
*/
|
|
6020
|
+
RJMapperBuilderClass.prototype.getDiscountedValue = /**
|
|
6021
|
+
* @param {?} price
|
|
6022
|
+
* @param {?} discountAmount
|
|
6023
|
+
* @return {?}
|
|
6024
|
+
*/
|
|
6025
|
+
function (price, discountAmount) {
|
|
6026
|
+
/** @type {?} */
|
|
6027
|
+
var DiscountedValue = (price * discountAmount) / this.transactionDocument.basketSummary.saleTotal;
|
|
6028
|
+
return DiscountedValue;
|
|
6029
|
+
};
|
|
5692
6030
|
/**
|
|
5693
6031
|
* @param {?} element
|
|
5694
6032
|
* @param {?} VAT
|
|
@@ -5720,7 +6058,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5720
6058
|
return value;
|
|
5721
6059
|
}
|
|
5722
6060
|
catch (e) {
|
|
5723
|
-
console.log(value, '
|
|
6061
|
+
console.log(value, 'can not be converted in string', e);
|
|
5724
6062
|
}
|
|
5725
6063
|
};
|
|
5726
6064
|
/**
|
|
@@ -5772,6 +6110,34 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5772
6110
|
return "";
|
|
5773
6111
|
}
|
|
5774
6112
|
};
|
|
6113
|
+
/**
|
|
6114
|
+
* @param {?} element
|
|
6115
|
+
* @return {?}
|
|
6116
|
+
*/
|
|
6117
|
+
RJMapperBuilderClass.prototype.getCaregories = /**
|
|
6118
|
+
* @param {?} element
|
|
6119
|
+
* @return {?}
|
|
6120
|
+
*/
|
|
6121
|
+
function (element) {
|
|
6122
|
+
/** @type {?} */
|
|
6123
|
+
var MMGroupId = " ";
|
|
6124
|
+
if (element.categories && element.categories.length > 0) {
|
|
6125
|
+
/** @type {?} */
|
|
6126
|
+
var categories = element.categories.filter((/**
|
|
6127
|
+
* @param {?} x
|
|
6128
|
+
* @return {?}
|
|
6129
|
+
*/
|
|
6130
|
+
function (x) { return x.parentId != ''; }));
|
|
6131
|
+
/** @type {?} */
|
|
6132
|
+
var value = categories.filter((/**
|
|
6133
|
+
* @param {?} x
|
|
6134
|
+
* @return {?}
|
|
6135
|
+
*/
|
|
6136
|
+
function (x) { return x.id != x.parentId; }));
|
|
6137
|
+
MMGroupId = value[0].name;
|
|
6138
|
+
}
|
|
6139
|
+
return MMGroupId;
|
|
6140
|
+
};
|
|
5775
6141
|
/**
|
|
5776
6142
|
* @param {?} date
|
|
5777
6143
|
* @return {?}
|
|
@@ -5808,21 +6174,18 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5808
6174
|
*/
|
|
5809
6175
|
function (transactionPromotion) {
|
|
5810
6176
|
if (transactionPromotion && transactionPromotion.length > 0) {
|
|
5811
|
-
this.rjObject['
|
|
5812
|
-
this.rjObject['
|
|
5813
|
-
this.rjObject['
|
|
5814
|
-
this.rjObject['
|
|
5815
|
-
this.rjObject['
|
|
5816
|
-
this.rjObject['
|
|
5817
|
-
this.rjObject['
|
|
5818
|
-
this.rjObject['
|
|
5819
|
-
this.rjObject['
|
|
5820
|
-
this.rjObject['
|
|
5821
|
-
this.rjObject['
|
|
5822
|
-
this.rjObject['
|
|
5823
|
-
this.rjObject['BasketDiscount']['DiscountPercentage'] = 0; //todo
|
|
5824
|
-
this.rjObject['BasketDiscount']['DiscountedValue'] = 0; //todo
|
|
5825
|
-
this.rjObject['BasketDiscount']['RoundingRule'] = 2;
|
|
6177
|
+
this.rjObject['PromoVoucherItem'] = {};
|
|
6178
|
+
this.rjObject['PromoVoucherItem']['XMLSchemaVersion'] = this.xmlSchemaVersion;
|
|
6179
|
+
this.rjObject['PromoVoucherItem']['LineNumber'] = this.generateLineNumber();
|
|
6180
|
+
this.rjObject['PromoVoucherItem']['NetValue'] = this.removeDecimal(transactionPromotion[0].promotionLinePrice) * -1;
|
|
6181
|
+
this.rjObject['PromoVoucherItem']['EffectiveNetValue'] = this.removeDecimal(transactionPromotion[0].promotionLinePrice) * -1;
|
|
6182
|
+
this.rjObject['PromoVoucherItem']['Description'] = transactionPromotion[0].promotionInfo;
|
|
6183
|
+
this.rjObject['PromoVoucherItem']['DeviceID'] = this.deviceId;
|
|
6184
|
+
this.rjObject['PromoVoucherItem']['UserID'] = this.transactionDocument.userName;
|
|
6185
|
+
this.rjObject['PromoVoucherItem']['DateTimeCreated'] = this.createdAt;
|
|
6186
|
+
this.rjObject['PromoVoucherItem']['ProductId'] = ""; //todo
|
|
6187
|
+
this.rjObject['PromoVoucherItem']['SerialNumber'] = ""; //todo
|
|
6188
|
+
this.rjObject['PromoVoucherItem']['MMGroupId'] = "";
|
|
5826
6189
|
}
|
|
5827
6190
|
};
|
|
5828
6191
|
/**
|