@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
|
@@ -3556,7 +3556,7 @@ class RJMapperBuilderClass {
|
|
|
3556
3556
|
(/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.TerminalNumber = (/** @type {?} */ (this)).terminalNumber;
|
|
3557
3557
|
(/** @type {?} */ (this)).rjObject['Header'].OriginatedBy.TransactionNumber = (/** @type {?} */ (this)).transactionNumber;
|
|
3558
3558
|
(/** @type {?} */ (this)).rjObject['Header'].TaxMethodID = (/** @type {?} */ (this)).taxMethodId;
|
|
3559
|
-
(/** @type {?} */ (this)).rjObject['Header'].DynamicStockLookup = (/** @type {?} */ (this)).generateDynamicStockLookUp();
|
|
3559
|
+
(/** @type {?} */ (this)).rjObject['Header'].DynamicStockLookup = (/** @type {?} */ (this)).generateDynamicStockLookUp();
|
|
3560
3560
|
(/** @type {?} */ (this)).rjObject['Header'].BasketLanguageID = (/** @type {?} */ (this)).basketLanguageId; //todo
|
|
3561
3561
|
(/** @type {?} */ (this)).rjObject['Header'].BasketCountryID = (/** @type {?} */ (this)).basketCountryId; //todo
|
|
3562
3562
|
(/** @type {?} */ (this)).rjObject['Header'].BasketCurrencyID = (/** @type {?} */ (this)).transactionDocument.baseCurrency;
|
|
@@ -3572,6 +3572,11 @@ class RJMapperBuilderClass {
|
|
|
3572
3572
|
* @return {THIS}
|
|
3573
3573
|
*/
|
|
3574
3574
|
rjMapper() {
|
|
3575
|
+
/** @type {?} */
|
|
3576
|
+
var transactionDiscount = [];
|
|
3577
|
+
if ((/** @type {?} */ (this)).transactionDocument.basket.transactionDiscount && (/** @type {?} */ (this)).transactionDocument.basket.transactionDiscount.length > 0) {
|
|
3578
|
+
transactionDiscount = (/** @type {?} */ (this)).transactionDocument.basket.transactionDiscount;
|
|
3579
|
+
}
|
|
3575
3580
|
if ((/** @type {?} */ (this)).transactionDocument.type === TRANSACTION_TYPE.SALE) {
|
|
3576
3581
|
(/** @type {?} */ (this)).rjObject['ProductSale'] = [];
|
|
3577
3582
|
(/** @type {?} */ (this)).rjObject['ModifierItem'] = [];
|
|
@@ -3597,7 +3602,7 @@ class RJMapperBuilderClass {
|
|
|
3597
3602
|
}
|
|
3598
3603
|
}
|
|
3599
3604
|
/** @type {?} */
|
|
3600
|
-
let data = (/** @type {?} */ (this)).addProduct(element, (lineDiscount.length > 0 ? lineDiscount[0] : null));
|
|
3605
|
+
let data = (/** @type {?} */ (this)).addProduct(element, (lineDiscount.length > 0 ? lineDiscount[0] : null), (transactionDiscount.length > 0 ? transactionDiscount : null));
|
|
3601
3606
|
(/** @type {?} */ (this)).rjObject['ProductSale'].push(data);
|
|
3602
3607
|
(/** @type {?} */ (this)).getModifierItem(lineDiscount.length > 0 ? lineDiscount[0] : null, element.itemLineId);
|
|
3603
3608
|
}));
|
|
@@ -3617,7 +3622,7 @@ class RJMapperBuilderClass {
|
|
|
3617
3622
|
*/
|
|
3618
3623
|
(element) => {
|
|
3619
3624
|
/** @type {?} */
|
|
3620
|
-
let data = (/** @type {?} */ (this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
|
|
3625
|
+
let data = (/** @type {?} */ (this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null), (transactionDiscount.length > 0 ? transactionDiscount : null));
|
|
3621
3626
|
(/** @type {?} */ (this)).rjObject['ProductReturn'].push(data);
|
|
3622
3627
|
(/** @type {?} */ (this)).getModifierItem(element.lineDiscount, element.itemLineId);
|
|
3623
3628
|
}));
|
|
@@ -3633,7 +3638,7 @@ class RJMapperBuilderClass {
|
|
|
3633
3638
|
*/
|
|
3634
3639
|
(element) => {
|
|
3635
3640
|
/** @type {?} */
|
|
3636
|
-
let data = (/** @type {?} */ (this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
|
|
3641
|
+
let data = (/** @type {?} */ (this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null), (transactionDiscount.length > 0 ? transactionDiscount : null));
|
|
3637
3642
|
/** @type {?} */
|
|
3638
3643
|
let obj = {
|
|
3639
3644
|
"OriginalReceiptSupplied": 0,
|
|
@@ -3660,7 +3665,7 @@ class RJMapperBuilderClass {
|
|
|
3660
3665
|
(element) => {
|
|
3661
3666
|
if (element.refundedQuantity > 0) {
|
|
3662
3667
|
/** @type {?} */
|
|
3663
|
-
let returnProduct = (/** @type {?} */ (this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
|
|
3668
|
+
let returnProduct = (/** @type {?} */ (this)).returnProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null), (transactionDiscount.length > 0 ? transactionDiscount : null));
|
|
3664
3669
|
/** @type {?} */
|
|
3665
3670
|
let obj = {
|
|
3666
3671
|
"OriginalReceiptSupplied": 0,
|
|
@@ -3674,7 +3679,7 @@ class RJMapperBuilderClass {
|
|
|
3674
3679
|
}
|
|
3675
3680
|
else {
|
|
3676
3681
|
/** @type {?} */
|
|
3677
|
-
let addProduct = (/** @type {?} */ (this)).addProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null));
|
|
3682
|
+
let addProduct = (/** @type {?} */ (this)).addProduct(element, (element.hasOwnProperty('lineDiscount') ? element.lineDiscount : null), (transactionDiscount.length > 0 ? transactionDiscount : null));
|
|
3678
3683
|
(/** @type {?} */ (this)).rjObject['ProductSale'].push(addProduct);
|
|
3679
3684
|
}
|
|
3680
3685
|
(/** @type {?} */ (this)).getModifierItem(element.lineDiscount, element.itemLineId);
|
|
@@ -3698,18 +3703,24 @@ class RJMapperBuilderClass {
|
|
|
3698
3703
|
(element) => {
|
|
3699
3704
|
/** @type {?} */
|
|
3700
3705
|
let obj = {};
|
|
3701
|
-
obj['XMLSchemaVersion'] =
|
|
3702
|
-
obj['NetValue'] = (/** @type {?} */ (this)).convertToString(element.discountAmount
|
|
3703
|
-
obj['EffectiveNetValue'] = (/** @type {?} */ (this)).convertToString(element.discountAmount
|
|
3706
|
+
obj['XMLSchemaVersion'] = (/** @type {?} */ (this)).xmlSchemaVersion;
|
|
3707
|
+
obj['NetValue'] = (/** @type {?} */ (this)).convertToString(element.discountAmount * -1);
|
|
3708
|
+
obj['EffectiveNetValue'] = (/** @type {?} */ (this)).convertToString(element.discountAmount * -1);
|
|
3704
3709
|
obj['Description'] = element.reasonDisplayText;
|
|
3705
3710
|
obj['UserID'] = (/** @type {?} */ (this)).transactionDocument.userName;
|
|
3706
3711
|
obj['ReasonCodeID'] = element.reasonCode;
|
|
3707
|
-
obj['DiscountType'] = (/** @type {?} */ (this)).convertToString(element.discountType.toUpperCase() == DISCOUNTTYPE.PERCENT.toUpperCase() ? 0 : 1);
|
|
3712
|
+
obj['DiscountType'] = (/** @type {?} */ (this)).convertToString(element.discountType.toUpperCase() == DISCOUNTTYPE.PERCENT.toUpperCase() ? 0 : 1);
|
|
3708
3713
|
obj['RoundingRule'] = (/** @type {?} */ (this)).convertToString(2);
|
|
3709
3714
|
obj['ModifiedLineNumber'] = element.itemLineIds;
|
|
3710
3715
|
obj['LineNumber'] = (/** @type {?} */ (this)).convertToString((/** @type {?} */ (this)).generateLineNumber());
|
|
3711
|
-
|
|
3712
|
-
|
|
3716
|
+
obj['DiscountedValue'] = (/** @type {?} */ (this)).transactionDocument.basketSummary.basketTotal + (/** @type {?} */ (this)).transactionDocument.basketSummary.discountTotal;
|
|
3717
|
+
if (element.discountType.toUpperCase() == DISCOUNTTYPE.PERCENT.toUpperCase()) {
|
|
3718
|
+
obj['DiscountPercentage'] = (/** @type {?} */ (this)).convertToString((element.discountAmount / (/** @type {?} */ (this)).transactionDocument.basketSummary.basketTotal).toFixed(1));
|
|
3719
|
+
}
|
|
3720
|
+
if ((/** @type {?} */ (this)).transactionDocument.type === 'REFUND') {
|
|
3721
|
+
obj['NetValue'] = (/** @type {?} */ (this)).convertToString(element.discountAmount < 0 ? -element.discountAmount : element.discountAmount);
|
|
3722
|
+
obj['EffectiveNetValue'] = (/** @type {?} */ (this)).convertToString(element.discountAmount < 0 ? -element.discountAmount : element.discountAmount);
|
|
3723
|
+
}
|
|
3713
3724
|
(/** @type {?} */ (this)).rjObject['BasketDiscount'].push(obj);
|
|
3714
3725
|
}));
|
|
3715
3726
|
return (/** @type {?} */ (this));
|
|
@@ -3776,51 +3787,94 @@ class RJMapperBuilderClass {
|
|
|
3776
3787
|
obj['TaxPercentage'] = element.VAT.toFixed(2); // todo
|
|
3777
3788
|
(/** @type {?} */ (this)).rjObject['Trailer']['TaxItem'].push(obj);
|
|
3778
3789
|
}));
|
|
3779
|
-
|
|
3780
|
-
if ((/** @type {?} */ (this)).transactionDocument.basket.linePromotion.length > 0) {
|
|
3790
|
+
if ((/** @type {?} */ (this)).transactionDocument.basket.linePromotion.length > 0 || (/** @type {?} */ (this)).transactionDocument.basket.linePromotion.length > 0) {
|
|
3781
3791
|
(/** @type {?} */ (this)).rjObject['Trailer']['PromotionItem'] = [];
|
|
3782
|
-
(/** @type {?} */ (this)).transactionDocument.basket.linePromotion.
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
*/
|
|
3786
|
-
(element) => {
|
|
3787
|
-
console.log('element', element);
|
|
3788
|
-
/** @type {?} */
|
|
3789
|
-
let obj = {};
|
|
3790
|
-
obj['PromotionID'] = element.promotionId;
|
|
3791
|
-
obj['PromotionSaving'] = element.promotionAmount < 0 ? element.promotionAmount : -element.promotionAmount;
|
|
3792
|
-
obj['PromotionQuantity'] = ""; // todo - not avaialble
|
|
3793
|
-
obj['PromotionDescription'] = element.displayText;
|
|
3794
|
-
obj['PromotionHit'] = {};
|
|
3795
|
-
obj['PromotionHit']['XMLSchemaVersion'] = (/** @type {?} */ (this)).xmlSchemaVersion;
|
|
3796
|
-
obj['PromotionHit']['HitNumber'] = ""; // todo;
|
|
3797
|
-
obj['PromotionHit']['HitQuantity'] = ""; // todo;
|
|
3798
|
-
obj['PromotionHit']['HitSaving'] = ""; // todo;
|
|
3799
|
-
obj['PromotionHit']['PromotionTrigger'] = {};
|
|
3800
|
-
element.trigger.forEach((/**
|
|
3801
|
-
* @param {?} subElement
|
|
3792
|
+
if ((/** @type {?} */ (this)).transactionDocument.basket.linePromotion.length > 0) {
|
|
3793
|
+
(/** @type {?} */ (this)).transactionDocument.basket.linePromotion.forEach((/**
|
|
3794
|
+
* @param {?} element
|
|
3802
3795
|
* @return {?}
|
|
3803
3796
|
*/
|
|
3804
|
-
(
|
|
3797
|
+
(element) => {
|
|
3798
|
+
/** @type {?} */
|
|
3799
|
+
let obj = {};
|
|
3800
|
+
obj['PromotionID'] = element.promotionId;
|
|
3801
|
+
obj['PromotionSaving'] = element.promotionAmount < 0 ? element.promotionAmount : -element.promotionAmount;
|
|
3802
|
+
obj['PromotionQuantity'] = "1";
|
|
3803
|
+
obj['PromotionDescription'] = element.displayText;
|
|
3804
|
+
obj['PromotionHit'] = {};
|
|
3805
|
+
obj['PromotionHit']['XMLSchemaVersion'] = (/** @type {?} */ (this)).xmlSchemaVersion;
|
|
3806
|
+
obj['PromotionHit']['HitNumber'] = "1";
|
|
3807
|
+
obj['PromotionHit']['HitQuantity'] = "1";
|
|
3808
|
+
obj['PromotionHit']['HitSaving'] = element.promotionAmount < 0 ? element.promotionAmount : -element.promotionAmount;
|
|
3809
|
+
obj['PromotionHit']['PromotionTrigger'] = {};
|
|
3805
3810
|
/** @type {?} */
|
|
3806
3811
|
let product = (/** @type {?} */ (this)).transactionDocument.basket.products.find((/**
|
|
3807
3812
|
* @param {?} item
|
|
3808
3813
|
* @return {?}
|
|
3809
3814
|
*/
|
|
3810
|
-
(item) => item.itemLineId ==
|
|
3815
|
+
(item) => item.itemLineId == element.itemLineId));
|
|
3811
3816
|
obj['PromotionHit']['PromotionTrigger']['XMLSchemaVersion'] = (/** @type {?} */ (this)).xmlSchemaVersion;
|
|
3812
3817
|
obj['PromotionHit']['PromotionTrigger']['ProductID'] = product.SKU;
|
|
3813
3818
|
obj['PromotionHit']['PromotionTrigger']['UnitValue'] = (/** @type {?} */ (this)).convertToString(element.promotionLinePrice / product.quantity);
|
|
3814
|
-
obj['PromotionHit']['PromotionTrigger']['LineNumber'] = (/** @type {?} */ (this)).
|
|
3815
|
-
obj['PromotionHit']['PromotionTrigger']['Quantity'] = (/** @type {?} */ (this)).convertToString(
|
|
3819
|
+
obj['PromotionHit']['PromotionTrigger']['LineNumber'] = (/** @type {?} */ (this)).getNumber(product.SKU);
|
|
3820
|
+
obj['PromotionHit']['PromotionTrigger']['Quantity'] = (/** @type {?} */ (this)).convertToString(product.quantity.toFixed(1));
|
|
3816
3821
|
obj['PromotionHit']['PromotionTrigger']['TaxCode'] = (/** @type {?} */ (this)).transactionDocument.basket.taxBreakdown.taxLines.find((/**
|
|
3817
3822
|
* @param {?} item
|
|
3818
3823
|
* @return {?}
|
|
3819
3824
|
*/
|
|
3820
3825
|
(item) => item.itemLineId == element.itemLineId)).VATCode; // todo
|
|
3826
|
+
(/** @type {?} */ (this)).rjObject['Trailer']['PromotionItem'].push(obj);
|
|
3821
3827
|
}));
|
|
3822
|
-
|
|
3823
|
-
}))
|
|
3828
|
+
}
|
|
3829
|
+
if ((/** @type {?} */ (this)).transactionDocument.basket.transactionPromotion.length > 0) {
|
|
3830
|
+
(/** @type {?} */ (this)).transactionDocument.basket.transactionPromotion.forEach((/**
|
|
3831
|
+
* @param {?} element
|
|
3832
|
+
* @return {?}
|
|
3833
|
+
*/
|
|
3834
|
+
(element) => {
|
|
3835
|
+
/** @type {?} */
|
|
3836
|
+
let obj = {};
|
|
3837
|
+
console.log('element');
|
|
3838
|
+
obj['PromotionID'] = element.promotionId;
|
|
3839
|
+
obj['PromotionSaving'] = element.promotionAmount < 0 ? element.promotionAmount : -element.promotionAmount;
|
|
3840
|
+
obj['PromotionQuantity'] = "1";
|
|
3841
|
+
obj['PromotionDescription'] = element.displayText;
|
|
3842
|
+
obj['PromotionHit'] = {};
|
|
3843
|
+
obj['PromotionHit']['XMLSchemaVersion'] = (/** @type {?} */ (this)).xmlSchemaVersion;
|
|
3844
|
+
obj['PromotionHit']['HitNumber'] = "1";
|
|
3845
|
+
obj['PromotionHit']['HitQuantity'] = "1";
|
|
3846
|
+
obj['PromotionHit']['HitSaving'] = element.promotionAmount < 0 ? element.promotionAmount : -element.promotionAmount;
|
|
3847
|
+
obj['PromotionHit']['PromotionTrigger'] = [];
|
|
3848
|
+
(/** @type {?} */ (this)).transactionDocument.basket.products.forEach((/**
|
|
3849
|
+
* @param {?} product
|
|
3850
|
+
* @return {?}
|
|
3851
|
+
*/
|
|
3852
|
+
(product) => {
|
|
3853
|
+
/** @type {?} */
|
|
3854
|
+
let promotionTrigger = {};
|
|
3855
|
+
element.itemLineIds.forEach((/**
|
|
3856
|
+
* @param {?} itemLineId
|
|
3857
|
+
* @return {?}
|
|
3858
|
+
*/
|
|
3859
|
+
(itemLineId) => {
|
|
3860
|
+
if (JSON.stringify(itemLineId) === product.itemLineId) {
|
|
3861
|
+
promotionTrigger['XMLSchemaVersion'] = (/** @type {?} */ (this)).xmlSchemaVersion;
|
|
3862
|
+
promotionTrigger['ProductID'] = product.SKU;
|
|
3863
|
+
promotionTrigger['UnitValue'] = (/** @type {?} */ (this)).convertToString(element.promotionLinePrice / product.quantity);
|
|
3864
|
+
promotionTrigger['LineNumber'] = (/** @type {?} */ (this)).getNumber(product.SKU);
|
|
3865
|
+
promotionTrigger['Quantity'] = (/** @type {?} */ (this)).convertToString(product.quantity);
|
|
3866
|
+
promotionTrigger['TaxCode'] = (/** @type {?} */ (this)).transactionDocument.basket.taxBreakdown.taxLines.find((/**
|
|
3867
|
+
* @param {?} item
|
|
3868
|
+
* @return {?}
|
|
3869
|
+
*/
|
|
3870
|
+
(item) => item.itemLineId == product.itemLineId)).VATCode;
|
|
3871
|
+
obj['PromotionHit']['PromotionTrigger'].push(promotionTrigger);
|
|
3872
|
+
}
|
|
3873
|
+
}));
|
|
3874
|
+
}));
|
|
3875
|
+
(/** @type {?} */ (this)).rjObject['Trailer']['PromotionItem'].push(obj);
|
|
3876
|
+
}));
|
|
3877
|
+
}
|
|
3824
3878
|
}
|
|
3825
3879
|
return (/** @type {?} */ (this));
|
|
3826
3880
|
}
|
|
@@ -3830,64 +3884,132 @@ class RJMapperBuilderClass {
|
|
|
3830
3884
|
* @return {THIS}
|
|
3831
3885
|
*/
|
|
3832
3886
|
getTenderInfo() {
|
|
3833
|
-
(/** @type {?} */ (this)).rjObject['CashTender'] = [];
|
|
3834
3887
|
if ((/** @type {?} */ (this)).transactionDocument.paymentDetails && (/** @type {?} */ (this)).transactionDocument.paymentDetails.length > 0) {
|
|
3835
3888
|
(/** @type {?} */ (this)).transactionDocument.paymentDetails.forEach((/**
|
|
3836
3889
|
* @param {?} element
|
|
3837
3890
|
* @return {?}
|
|
3838
3891
|
*/
|
|
3839
3892
|
(element) => {
|
|
3840
|
-
if (element.
|
|
3841
|
-
/** @type {?} */
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3893
|
+
if (element.externalTenderKey) {
|
|
3894
|
+
(/** @type {?} */ (this)).rjObject[element.externalTenderKey] = [];
|
|
3895
|
+
if (element.paymentType.toUpperCase() === 'GIFT CARD') {
|
|
3896
|
+
/** @type {?} */
|
|
3897
|
+
let obj = {
|
|
3898
|
+
XMLSchemaVersion: (/** @type {?} */ (this)).xmlSchemaVersion,
|
|
3899
|
+
LineNumber: (/** @type {?} */ (this)).generateLineNumber(),
|
|
3900
|
+
NetValue: (/** @type {?} */ (this)).convertToString(-1 * (/** @type {?} */ (this)).removeDecimal((Math.round(element.amount)))),
|
|
3901
|
+
EffectiveNetValue: (/** @type {?} */ (this)).convertToString(-1 * (/** @type {?} */ (this)).removeDecimal((Math.round(element.amount)))),
|
|
3902
|
+
Description: (/** @type {?} */ (this)).getDescription(element),
|
|
3903
|
+
DeviceID: (/** @type {?} */ (this)).deviceId,
|
|
3904
|
+
UserID: (/** @type {?} */ (this)).transactionDocument.userName,
|
|
3905
|
+
DateTimeCreated: (/** @type {?} */ (this)).updatedAt,
|
|
3906
|
+
TenderType: element.externalTenderType ? element.externalTenderType : '',
|
|
3907
|
+
TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',
|
|
3908
|
+
TenderAmount: (/** @type {?} */ (this)).convertToString(-1 * (/** @type {?} */ (this)).removeDecimal((Math.round(element.amount)))),
|
|
3909
|
+
CurrencyID: (/** @type {?} */ (this)).transactionDocument.baseCurrency,
|
|
3910
|
+
CurrencyDescription: (/** @type {?} */ (this)).transactionDocument.baseCurrency,
|
|
3911
|
+
GiftVoucherSalesAllowed: '',
|
|
3912
|
+
//todo
|
|
3913
|
+
AllowRechargeableVoucherSales: '',
|
|
3914
|
+
//todo
|
|
3915
|
+
GiftVoucherID: ''
|
|
3916
|
+
};
|
|
3917
|
+
(/** @type {?} */ (this)).rjObject[element.externalTenderKey].push(obj);
|
|
3918
|
+
}
|
|
3919
|
+
else {
|
|
3920
|
+
/** @type {?} */
|
|
3921
|
+
let obj1 = {
|
|
3922
|
+
XMLSchemaVersion: "1",
|
|
3923
|
+
LineNumber: (/** @type {?} */ (this)).generateLineNumber(),
|
|
3924
|
+
//todo
|
|
3925
|
+
NetValue: JSON.stringify(-1 * (Math.round(element.amount))),
|
|
3926
|
+
EffectiveNetValue: JSON.stringify(-1 * (Math.round(element.amount))),
|
|
3927
|
+
Description: (/** @type {?} */ (this)).getDescription(element),
|
|
3928
|
+
DeviceID: (/** @type {?} */ (this)).deviceId,
|
|
3929
|
+
UserID: (/** @type {?} */ (this)).transactionDocument.userName,
|
|
3930
|
+
DateTimeCreated: (/** @type {?} */ (this)).updatedAt,
|
|
3931
|
+
TenderType: element.externalTenderType ? element.externalTenderType : '',
|
|
3932
|
+
TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',
|
|
3933
|
+
TenderAmount: JSON.stringify(-1 * (Math.round(element.amount))),
|
|
3934
|
+
CurrencyID: (/** @type {?} */ (this)).transactionDocument.baseCurrency,
|
|
3935
|
+
CurrencyDescription: (/** @type {?} */ (this)).transactionDocument.baseCurrency,
|
|
3936
|
+
IncludeInTransactionTotalCheck: "1",
|
|
3937
|
+
AllowRechargeableVoucherSales: "1",
|
|
3938
|
+
OpenDrawerAtEnd: "1"
|
|
3939
|
+
};
|
|
3940
|
+
(/** @type {?} */ (this)).rjObject[element.externalTenderKey].push(obj1);
|
|
3941
|
+
}
|
|
3863
3942
|
}
|
|
3864
3943
|
else {
|
|
3865
|
-
/** @type {?} */
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3944
|
+
(/** @type {?} */ (this)).rjObject['CashTender'] = [];
|
|
3945
|
+
if (element.paymentType.toUpperCase() === 'GIFT CARD') {
|
|
3946
|
+
/** @type {?} */
|
|
3947
|
+
let obj = {
|
|
3948
|
+
XMLSchemaVersion: (/** @type {?} */ (this)).xmlSchemaVersion,
|
|
3949
|
+
LineNumber: (/** @type {?} */ (this)).generateLineNumber(),
|
|
3950
|
+
NetValue: (/** @type {?} */ (this)).convertToString(-1 * (/** @type {?} */ (this)).removeDecimal((Math.round(element.amount)))),
|
|
3951
|
+
EffectiveNetValue: (/** @type {?} */ (this)).convertToString(-1 * (/** @type {?} */ (this)).removeDecimal((Math.round(element.amount)))),
|
|
3952
|
+
Description: (/** @type {?} */ (this)).getDescription(element),
|
|
3953
|
+
DeviceID: (/** @type {?} */ (this)).deviceId,
|
|
3954
|
+
UserID: (/** @type {?} */ (this)).transactionDocument.userName,
|
|
3955
|
+
DateTimeCreated: (/** @type {?} */ (this)).updatedAt,
|
|
3956
|
+
TenderType: element.externalTenderType ? element.externalTenderType : '',
|
|
3957
|
+
TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',
|
|
3958
|
+
TenderAmount: (/** @type {?} */ (this)).convertToString(-1 * (/** @type {?} */ (this)).removeDecimal((Math.round(element.amount)))),
|
|
3959
|
+
CurrencyID: (/** @type {?} */ (this)).transactionDocument.baseCurrency,
|
|
3960
|
+
CurrencyDescription: (/** @type {?} */ (this)).transactionDocument.baseCurrency,
|
|
3961
|
+
GiftVoucherSalesAllowed: '',
|
|
3962
|
+
//todo
|
|
3963
|
+
AllowRechargeableVoucherSales: '',
|
|
3964
|
+
//todo
|
|
3965
|
+
GiftVoucherID: ''
|
|
3966
|
+
};
|
|
3967
|
+
(/** @type {?} */ (this)).rjObject['CashTender'].push(obj);
|
|
3968
|
+
}
|
|
3969
|
+
else {
|
|
3970
|
+
/** @type {?} */
|
|
3971
|
+
let obj1 = {
|
|
3972
|
+
XMLSchemaVersion: "1",
|
|
3973
|
+
LineNumber: (/** @type {?} */ (this)).generateLineNumber(),
|
|
3974
|
+
NetValue: JSON.stringify(-1 * (Math.round(element.amount))),
|
|
3975
|
+
EffectiveNetValue: JSON.stringify(-1 * (Math.round(element.amount))),
|
|
3976
|
+
Description: (/** @type {?} */ (this)).getDescription(element),
|
|
3977
|
+
DeviceID: (/** @type {?} */ (this)).deviceId,
|
|
3978
|
+
UserID: (/** @type {?} */ (this)).transactionDocument.userName,
|
|
3979
|
+
DateTimeCreated: (/** @type {?} */ (this)).updatedAt,
|
|
3980
|
+
TenderType: element.externalTenderType ? element.externalTenderType : '',
|
|
3981
|
+
TenderSubType: element.externalSubTenderType ? element.externalSubTenderType : '',
|
|
3982
|
+
TenderAmount: JSON.stringify(-1 * (Math.round(element.amount))),
|
|
3983
|
+
CurrencyID: (/** @type {?} */ (this)).transactionDocument.baseCurrency,
|
|
3984
|
+
CurrencyDescription: (/** @type {?} */ (this)).transactionDocument.baseCurrency,
|
|
3985
|
+
IncludeInTransactionTotalCheck: "1",
|
|
3986
|
+
AllowRechargeableVoucherSales: "1",
|
|
3987
|
+
OpenDrawerAtEnd: "1"
|
|
3988
|
+
};
|
|
3989
|
+
(/** @type {?} */ (this)).rjObject['CashTender'].push(obj1);
|
|
3990
|
+
}
|
|
3886
3991
|
}
|
|
3887
3992
|
}));
|
|
3888
3993
|
}
|
|
3889
3994
|
return (/** @type {?} */ (this));
|
|
3890
3995
|
}
|
|
3996
|
+
/**
|
|
3997
|
+
* @param {?} productId
|
|
3998
|
+
* @return {?}
|
|
3999
|
+
*/
|
|
4000
|
+
getNumber(productId) {
|
|
4001
|
+
/** @type {?} */
|
|
4002
|
+
let lineNumber;
|
|
4003
|
+
for (let i = 0; i < this.rjObject['ProductSale'].length; i++) {
|
|
4004
|
+
/** @type {?} */
|
|
4005
|
+
const element = this.rjObject['ProductSale'][i];
|
|
4006
|
+
if (JSON.stringify(productId) === JSON.stringify(element.ProductID)) {
|
|
4007
|
+
lineNumber = element.LineNumber;
|
|
4008
|
+
break;
|
|
4009
|
+
}
|
|
4010
|
+
}
|
|
4011
|
+
return lineNumber;
|
|
4012
|
+
}
|
|
3891
4013
|
/**
|
|
3892
4014
|
* @return {?}
|
|
3893
4015
|
*/
|
|
@@ -4168,9 +4290,10 @@ class RJMapperBuilderClass {
|
|
|
4168
4290
|
/**
|
|
4169
4291
|
* @param {?} element
|
|
4170
4292
|
* @param {?} lineDiscount
|
|
4293
|
+
* @param {?} transactionDiscount
|
|
4171
4294
|
* @return {?}
|
|
4172
4295
|
*/
|
|
4173
|
-
returnProduct(element, lineDiscount) {
|
|
4296
|
+
returnProduct(element, lineDiscount, transactionDiscount) {
|
|
4174
4297
|
/** @type {?} */
|
|
4175
4298
|
let obj = {};
|
|
4176
4299
|
/** @type {?} */
|
|
@@ -4206,7 +4329,7 @@ class RJMapperBuilderClass {
|
|
|
4206
4329
|
obj['DisplayTaxCode'] = ''; // todo
|
|
4207
4330
|
obj['ProductAttributes'] = ''; //todo - not required
|
|
4208
4331
|
obj['Perishable'] = this.getAttributes();
|
|
4209
|
-
obj['MMGroupID'] = this.
|
|
4332
|
+
obj['MMGroupID'] = this.getCaregories(element);
|
|
4210
4333
|
obj['CustomerDetails'] = ""; // todo - blank
|
|
4211
4334
|
obj['TotalPromotionSaving'] = element['promotionAmount'] || -1; // TODO
|
|
4212
4335
|
obj['OriginalTaxAmount'] = this.convertToString(this.getOriginalTax(element, taxTotal.VAT) * -1);
|
|
@@ -4245,14 +4368,80 @@ class RJMapperBuilderClass {
|
|
|
4245
4368
|
obj.ExtendedValue = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount) * -1;
|
|
4246
4369
|
obj.UnitPrice = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount) * -1;
|
|
4247
4370
|
}
|
|
4371
|
+
if (transactionDiscount) {
|
|
4372
|
+
obj['BasketDiscountModifier'] = [];
|
|
4373
|
+
this.transactionDocument.basket.transactionDiscount.forEach((/**
|
|
4374
|
+
* @param {?} e
|
|
4375
|
+
* @return {?}
|
|
4376
|
+
*/
|
|
4377
|
+
(e) => {
|
|
4378
|
+
/** @type {?} */
|
|
4379
|
+
let discountObj = {};
|
|
4380
|
+
e.itemLineIds.forEach((/**
|
|
4381
|
+
* @param {?} x
|
|
4382
|
+
* @return {?}
|
|
4383
|
+
*/
|
|
4384
|
+
(x) => {
|
|
4385
|
+
if (x == element.itemLineId) {
|
|
4386
|
+
/** @type {?} */
|
|
4387
|
+
var discountAmount = this.convertToString(e.discountAmount * -1);
|
|
4388
|
+
discountObj.BasketDiscountLineNumber = this.getLineNumber(e, discountAmount);
|
|
4389
|
+
discountObj.XMLSchemaVersion = this.xmlSchemaVersion;
|
|
4390
|
+
discountObj.DiscountedValue = this.getDiscountedValue(element.totalLinePrice, e.discountAmount);
|
|
4391
|
+
obj['BasketDiscountModifier'].push(discountObj);
|
|
4392
|
+
}
|
|
4393
|
+
}));
|
|
4394
|
+
}));
|
|
4395
|
+
/** @type {?} */
|
|
4396
|
+
var totaltransactionDiscount = 0;
|
|
4397
|
+
obj['BasketDiscountModifier'].forEach((/**
|
|
4398
|
+
* @param {?} value
|
|
4399
|
+
* @return {?}
|
|
4400
|
+
*/
|
|
4401
|
+
(value) => {
|
|
4402
|
+
totaltransactionDiscount = totaltransactionDiscount + value.DiscountedValue;
|
|
4403
|
+
}));
|
|
4404
|
+
//update the product price
|
|
4405
|
+
obj['EffectiveNetValue'] = obj.EffectiveNetValue + totaltransactionDiscount;
|
|
4406
|
+
}
|
|
4407
|
+
if (this.transactionDocument.basket.transactionPromotion.length > 0) {
|
|
4408
|
+
obj['PromotionSaving'] = [];
|
|
4409
|
+
this.transactionDocument.basket.transactionPromotion.forEach((/**
|
|
4410
|
+
* @param {?} transactionPromo
|
|
4411
|
+
* @return {?}
|
|
4412
|
+
*/
|
|
4413
|
+
(transactionPromo) => {
|
|
4414
|
+
/** @type {?} */
|
|
4415
|
+
let promotionObj = {};
|
|
4416
|
+
transactionPromo.itemLineIds.forEach((/**
|
|
4417
|
+
* @param {?} itemLineId
|
|
4418
|
+
* @return {?}
|
|
4419
|
+
*/
|
|
4420
|
+
(itemLineId) => {
|
|
4421
|
+
if (itemLineId == element.itemLineId) {
|
|
4422
|
+
promotionObj.ModifierValue = transactionPromo.promotionAmount;
|
|
4423
|
+
promotionObj.ModifierDateTime = this.transactionDocument.createdAt;
|
|
4424
|
+
promotionObj.ModifierDescription = transactionPromo.displayText;
|
|
4425
|
+
promotionObj.XMLSchemaVersion = this.xmlSchemaVersion;
|
|
4426
|
+
promotionObj.PromotionID = transactionPromo.promotionId;
|
|
4427
|
+
promotionObj.PromotionDescription = transactionPromo.displayText;
|
|
4428
|
+
promotionObj.HitNumber = '1';
|
|
4429
|
+
promotionObj.PromotionHitProductQuantity = this.getQuantity(element);
|
|
4430
|
+
promotionObj.PromotionHitQuantity = this.getQuantity(element) * -1;
|
|
4431
|
+
obj['PromotionSaving'].push(promotionObj);
|
|
4432
|
+
}
|
|
4433
|
+
}));
|
|
4434
|
+
}));
|
|
4435
|
+
}
|
|
4248
4436
|
return obj;
|
|
4249
4437
|
}
|
|
4250
4438
|
/**
|
|
4251
4439
|
* @param {?} element
|
|
4252
4440
|
* @param {?} lineDiscount
|
|
4441
|
+
* @param {?} transactionDiscount
|
|
4253
4442
|
* @return {?}
|
|
4254
4443
|
*/
|
|
4255
|
-
addProduct(element, lineDiscount) {
|
|
4444
|
+
addProduct(element, lineDiscount, transactionDiscount) {
|
|
4256
4445
|
/** @type {?} */
|
|
4257
4446
|
let taxTotal = this.transactionDocument.basket['taxBreakdown']['taxLines'].find((/**
|
|
4258
4447
|
* @param {?} item
|
|
@@ -4271,8 +4460,7 @@ class RJMapperBuilderClass {
|
|
|
4271
4460
|
DateTimeCreated: this.createdAt,
|
|
4272
4461
|
ExtendedValue: this.removeDecimal(element.price),
|
|
4273
4462
|
UnitPrice: this.removeDecimal(element.price),
|
|
4274
|
-
MMGroupID: this.
|
|
4275
|
-
//todo
|
|
4463
|
+
MMGroupID: this.getCaregories(element),
|
|
4276
4464
|
Quantity: element.quantity.toFixed(1),
|
|
4277
4465
|
SalespersonID: this.transactionDocument.userId,
|
|
4278
4466
|
SalespersonName: this.transactionDocument.userName,
|
|
@@ -4281,14 +4469,14 @@ class RJMapperBuilderClass {
|
|
|
4281
4469
|
* @return {?}
|
|
4282
4470
|
*/
|
|
4283
4471
|
(item) => item.itemLineId == element['itemLineId'])).VATCode,
|
|
4284
|
-
TaxModifiable: 1,
|
|
4472
|
+
TaxModifiable: "1",
|
|
4285
4473
|
//todo
|
|
4286
4474
|
OriginalTaxAmount: this.convertToString(this.getOriginalTax(element, taxTotal.VAT)),
|
|
4287
4475
|
TaxAmount: this.convertToString(taxTotal.taxLineTotal),
|
|
4288
|
-
OriginalTaxAmountSet: 1,
|
|
4476
|
+
OriginalTaxAmountSet: "1",
|
|
4289
4477
|
//todo
|
|
4290
4478
|
ProductID: element.SKU,
|
|
4291
|
-
HandKeyed: 1,
|
|
4479
|
+
HandKeyed: "1",
|
|
4292
4480
|
//todo
|
|
4293
4481
|
CustomerDetails: "",
|
|
4294
4482
|
Perishable: this.getAttributes()
|
|
@@ -4317,7 +4505,7 @@ class RJMapperBuilderClass {
|
|
|
4317
4505
|
obj['PriceOverride'].ModifierReasonID = lineDiscount.priceOverrideReasonCode;
|
|
4318
4506
|
obj['PriceOverride'].ModifierReasonDescription = lineDiscount.priceOverrideReasonName;
|
|
4319
4507
|
obj['PriceOverride'].AuthorisingUserID = this.transactionDocument.userName;
|
|
4320
|
-
obj['PriceOverride'].XMLSchemaVersion =
|
|
4508
|
+
obj['PriceOverride'].XMLSchemaVersion = this.xmlSchemaVersion;
|
|
4321
4509
|
obj['PriceOverride'].NewPrice = this.removeDecimal(lineDiscount.unitPrice);
|
|
4322
4510
|
obj['PriceOverride'].OriginalPrice = this.removeDecimal(lineDiscount.discountedLinePrice || 0 + lineDiscount.discountAmount);
|
|
4323
4511
|
}
|
|
@@ -4327,8 +4515,135 @@ class RJMapperBuilderClass {
|
|
|
4327
4515
|
obj['ExtendedValue'] = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount);
|
|
4328
4516
|
obj['UnitPrice'] = ((lineDiscount.discountedLinePrice || 0) + lineDiscount.discountAmount);
|
|
4329
4517
|
}
|
|
4518
|
+
if (transactionDiscount) {
|
|
4519
|
+
obj['BasketDiscountModifier'] = [];
|
|
4520
|
+
this.transactionDocument.basket.transactionDiscount.forEach((/**
|
|
4521
|
+
* @param {?} e
|
|
4522
|
+
* @return {?}
|
|
4523
|
+
*/
|
|
4524
|
+
(e) => {
|
|
4525
|
+
/** @type {?} */
|
|
4526
|
+
let discountObj = {};
|
|
4527
|
+
e.itemLineIds.forEach((/**
|
|
4528
|
+
* @param {?} itemLineId
|
|
4529
|
+
* @return {?}
|
|
4530
|
+
*/
|
|
4531
|
+
(itemLineId) => {
|
|
4532
|
+
if (itemLineId == element.itemLineId) {
|
|
4533
|
+
/** @type {?} */
|
|
4534
|
+
let discountAmount = this.convertToString(e.discountAmount * -1);
|
|
4535
|
+
discountObj.XMLSchemaVersion = this.xmlSchemaVersion;
|
|
4536
|
+
discountObj.DiscountedValue = -(this.getDiscountedValue(element.totalLinePrice, e.discountAmount).toFixed(0));
|
|
4537
|
+
discountObj.BasketDiscountLineNumber = this.getLineNumber(e, discountAmount);
|
|
4538
|
+
obj['BasketDiscountModifier'].push(discountObj);
|
|
4539
|
+
}
|
|
4540
|
+
}));
|
|
4541
|
+
}));
|
|
4542
|
+
/** @type {?} */
|
|
4543
|
+
let totaltransactionDiscount = 0;
|
|
4544
|
+
obj['BasketDiscountModifier'].forEach((/**
|
|
4545
|
+
* @param {?} value
|
|
4546
|
+
* @return {?}
|
|
4547
|
+
*/
|
|
4548
|
+
(value) => {
|
|
4549
|
+
totaltransactionDiscount = totaltransactionDiscount + value.DiscountedValue;
|
|
4550
|
+
}));
|
|
4551
|
+
//update the product price
|
|
4552
|
+
obj['EffectiveNetValue'] = obj.EffectiveNetValue + totaltransactionDiscount;
|
|
4553
|
+
}
|
|
4554
|
+
if (this.transactionDocument.basket.transactionPromotion.length > 0 || this.transactionDocument.basket.linePromotion.length > 0) {
|
|
4555
|
+
obj['DistributedPromotionSaving'] = [];
|
|
4556
|
+
if (this.transactionDocument.basket.transactionPromotion.length > 0) {
|
|
4557
|
+
this.transactionDocument.basket.transactionPromotion.forEach((/**
|
|
4558
|
+
* @param {?} e
|
|
4559
|
+
* @return {?}
|
|
4560
|
+
*/
|
|
4561
|
+
(e) => {
|
|
4562
|
+
/** @type {?} */
|
|
4563
|
+
let promotionObj = {};
|
|
4564
|
+
e.itemLineIds.forEach((/**
|
|
4565
|
+
* @param {?} itemLineId
|
|
4566
|
+
* @return {?}
|
|
4567
|
+
*/
|
|
4568
|
+
(itemLineId) => {
|
|
4569
|
+
if (itemLineId == element.itemLineId) {
|
|
4570
|
+
promotionObj.PromotionID = e.promotionId;
|
|
4571
|
+
promotionObj.Hit = '1';
|
|
4572
|
+
promotionObj.Saving = this.getSaving(element.totalLinePrice, e.promotionAmount);
|
|
4573
|
+
promotionObj.ISaving = this.getSaving(element.totalLinePrice, e.promotionAmount);
|
|
4574
|
+
obj['DistributedPromotionSaving'].push(promotionObj);
|
|
4575
|
+
}
|
|
4576
|
+
}));
|
|
4577
|
+
}));
|
|
4578
|
+
}
|
|
4579
|
+
if (this.transactionDocument.basket.linePromotion.length > 0) {
|
|
4580
|
+
this.transactionDocument.basket.linePromotion.forEach((/**
|
|
4581
|
+
* @param {?} linePromotion
|
|
4582
|
+
* @return {?}
|
|
4583
|
+
*/
|
|
4584
|
+
(linePromotion) => {
|
|
4585
|
+
/** @type {?} */
|
|
4586
|
+
let promotionObj = {};
|
|
4587
|
+
if (element.itemLineId == linePromotion.itemLineId) {
|
|
4588
|
+
promotionObj.PromotionID = linePromotion.promotionId;
|
|
4589
|
+
promotionObj.Hit = "1";
|
|
4590
|
+
promotionObj.Saving = linePromotion.promotionLinePrice;
|
|
4591
|
+
promotionObj.ISaving = linePromotion.promotionLinePrice;
|
|
4592
|
+
obj['DistributedPromotionSaving'].push(promotionObj);
|
|
4593
|
+
}
|
|
4594
|
+
}));
|
|
4595
|
+
}
|
|
4596
|
+
/** @type {?} */
|
|
4597
|
+
let transactionPromotion = 0;
|
|
4598
|
+
obj['DistributedPromotionSaving'].forEach((/**
|
|
4599
|
+
* @param {?} value
|
|
4600
|
+
* @return {?}
|
|
4601
|
+
*/
|
|
4602
|
+
(value) => {
|
|
4603
|
+
transactionPromotion = transactionPromotion + value.Saving;
|
|
4604
|
+
}));
|
|
4605
|
+
obj['EffectiveNetValue'] = obj.EffectiveNetValue + transactionPromotion;
|
|
4606
|
+
}
|
|
4330
4607
|
return obj;
|
|
4331
4608
|
}
|
|
4609
|
+
/**
|
|
4610
|
+
* @param {?} price
|
|
4611
|
+
* @param {?} promotionAmount
|
|
4612
|
+
* @return {?}
|
|
4613
|
+
*/
|
|
4614
|
+
getSaving(price, promotionAmount) {
|
|
4615
|
+
/** @type {?} */
|
|
4616
|
+
let Saving = (price * promotionAmount) / this.transactionDocument.basketSummary.saleTotal;
|
|
4617
|
+
return Saving;
|
|
4618
|
+
}
|
|
4619
|
+
/**
|
|
4620
|
+
* @param {?} value
|
|
4621
|
+
* @param {?} discountAmount
|
|
4622
|
+
* @return {?}
|
|
4623
|
+
*/
|
|
4624
|
+
getLineNumber(value, discountAmount) {
|
|
4625
|
+
/** @type {?} */
|
|
4626
|
+
let lineNumber;
|
|
4627
|
+
for (let i = 0; i < this.rjObject['BasketDiscount'].length; i++) {
|
|
4628
|
+
/** @type {?} */
|
|
4629
|
+
const element = this.rjObject['BasketDiscount'][i];
|
|
4630
|
+
if (value.reasonCode === element.ReasonCodeID && discountAmount === element.NetValue) {
|
|
4631
|
+
lineNumber = element.LineNumber;
|
|
4632
|
+
break;
|
|
4633
|
+
}
|
|
4634
|
+
}
|
|
4635
|
+
return lineNumber;
|
|
4636
|
+
}
|
|
4637
|
+
/**
|
|
4638
|
+
* @param {?} price
|
|
4639
|
+
* @param {?} discountAmount
|
|
4640
|
+
* @return {?}
|
|
4641
|
+
*/
|
|
4642
|
+
getDiscountedValue(price, discountAmount) {
|
|
4643
|
+
/** @type {?} */
|
|
4644
|
+
let DiscountedValue = (price * discountAmount) / this.transactionDocument.basketSummary.saleTotal;
|
|
4645
|
+
return DiscountedValue;
|
|
4646
|
+
}
|
|
4332
4647
|
/**
|
|
4333
4648
|
* @param {?} element
|
|
4334
4649
|
* @param {?} VAT
|
|
@@ -4351,7 +4666,7 @@ class RJMapperBuilderClass {
|
|
|
4351
4666
|
return value;
|
|
4352
4667
|
}
|
|
4353
4668
|
catch (e) {
|
|
4354
|
-
console.log(value, '
|
|
4669
|
+
console.log(value, 'can not be converted in string', e);
|
|
4355
4670
|
}
|
|
4356
4671
|
}
|
|
4357
4672
|
/**
|
|
@@ -4397,6 +4712,30 @@ class RJMapperBuilderClass {
|
|
|
4397
4712
|
return "";
|
|
4398
4713
|
}
|
|
4399
4714
|
}
|
|
4715
|
+
/**
|
|
4716
|
+
* @param {?} element
|
|
4717
|
+
* @return {?}
|
|
4718
|
+
*/
|
|
4719
|
+
getCaregories(element) {
|
|
4720
|
+
/** @type {?} */
|
|
4721
|
+
let MMGroupId = " ";
|
|
4722
|
+
if (element.categories && element.categories.length > 0) {
|
|
4723
|
+
/** @type {?} */
|
|
4724
|
+
let categories = element.categories.filter((/**
|
|
4725
|
+
* @param {?} x
|
|
4726
|
+
* @return {?}
|
|
4727
|
+
*/
|
|
4728
|
+
(x) => x.parentId != ''));
|
|
4729
|
+
/** @type {?} */
|
|
4730
|
+
let value = categories.filter((/**
|
|
4731
|
+
* @param {?} x
|
|
4732
|
+
* @return {?}
|
|
4733
|
+
*/
|
|
4734
|
+
(x) => x.id != x.parentId));
|
|
4735
|
+
MMGroupId = value[0].name;
|
|
4736
|
+
}
|
|
4737
|
+
return MMGroupId;
|
|
4738
|
+
}
|
|
4400
4739
|
/**
|
|
4401
4740
|
* @param {?} date
|
|
4402
4741
|
* @return {?}
|
|
@@ -4425,21 +4764,18 @@ class RJMapperBuilderClass {
|
|
|
4425
4764
|
*/
|
|
4426
4765
|
getTransactionPromotion(transactionPromotion) {
|
|
4427
4766
|
if (transactionPromotion && transactionPromotion.length > 0) {
|
|
4428
|
-
this.rjObject['
|
|
4429
|
-
this.rjObject['
|
|
4430
|
-
this.rjObject['
|
|
4431
|
-
this.rjObject['
|
|
4432
|
-
this.rjObject['
|
|
4433
|
-
this.rjObject['
|
|
4434
|
-
this.rjObject['
|
|
4435
|
-
this.rjObject['
|
|
4436
|
-
this.rjObject['
|
|
4437
|
-
this.rjObject['
|
|
4438
|
-
this.rjObject['
|
|
4439
|
-
this.rjObject['
|
|
4440
|
-
this.rjObject['BasketDiscount']['DiscountPercentage'] = 0; //todo
|
|
4441
|
-
this.rjObject['BasketDiscount']['DiscountedValue'] = 0; //todo
|
|
4442
|
-
this.rjObject['BasketDiscount']['RoundingRule'] = 2;
|
|
4767
|
+
this.rjObject['PromoVoucherItem'] = {};
|
|
4768
|
+
this.rjObject['PromoVoucherItem']['XMLSchemaVersion'] = this.xmlSchemaVersion;
|
|
4769
|
+
this.rjObject['PromoVoucherItem']['LineNumber'] = this.generateLineNumber();
|
|
4770
|
+
this.rjObject['PromoVoucherItem']['NetValue'] = this.removeDecimal(transactionPromotion[0].promotionLinePrice) * -1;
|
|
4771
|
+
this.rjObject['PromoVoucherItem']['EffectiveNetValue'] = this.removeDecimal(transactionPromotion[0].promotionLinePrice) * -1;
|
|
4772
|
+
this.rjObject['PromoVoucherItem']['Description'] = transactionPromotion[0].promotionInfo;
|
|
4773
|
+
this.rjObject['PromoVoucherItem']['DeviceID'] = this.deviceId;
|
|
4774
|
+
this.rjObject['PromoVoucherItem']['UserID'] = this.transactionDocument.userName;
|
|
4775
|
+
this.rjObject['PromoVoucherItem']['DateTimeCreated'] = this.createdAt;
|
|
4776
|
+
this.rjObject['PromoVoucherItem']['ProductId'] = ""; //todo
|
|
4777
|
+
this.rjObject['PromoVoucherItem']['SerialNumber'] = ""; //todo
|
|
4778
|
+
this.rjObject['PromoVoucherItem']['MMGroupId'] = "";
|
|
4443
4779
|
}
|
|
4444
4780
|
}
|
|
4445
4781
|
/**
|