@pmcretail/mapper-library 0.0.14 → 0.0.16
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 +652 -110
- 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 +334 -110
- package/esm2015/lib/WebReturn-mapper.class.js +236 -0
- package/esm2015/pmcretail-mapper-library.js +2 -2
- package/esm2015/public-api.js +2 -1
- package/esm5/lib/RJ-mapper.class.js +348 -111
- package/esm5/lib/WebReturn-mapper.class.js +305 -0
- package/esm5/pmcretail-mapper-library.js +2 -2
- package/esm5/public-api.js +2 -1
- package/fesm2015/pmcretail-mapper-library.js +570 -110
- package/fesm2015/pmcretail-mapper-library.js.map +1 -1
- package/fesm5/pmcretail-mapper-library.js +652 -111
- package/fesm5/pmcretail-mapper-library.js.map +1 -1
- package/lib/RJ-mapper.class.d.ts +3 -0
- package/lib/WebReturn-mapper.class.d.ts +19 -0
- package/package.json +1 -1
- package/pmcretail-mapper-library.metadata.json +1 -1
- package/public-api.d.ts +1 -0
|
@@ -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;
|
|
@@ -3787,50 +3787,94 @@ class RJMapperBuilderClass {
|
|
|
3787
3787
|
obj['TaxPercentage'] = element.VAT.toFixed(2); // todo
|
|
3788
3788
|
(/** @type {?} */ (this)).rjObject['Trailer']['TaxItem'].push(obj);
|
|
3789
3789
|
}));
|
|
3790
|
-
|
|
3791
|
-
if ((/** @type {?} */ (this)).transactionDocument.basket.linePromotion.length > 0) {
|
|
3790
|
+
if ((/** @type {?} */ (this)).transactionDocument.basket.linePromotion.length > 0 || (/** @type {?} */ (this)).transactionDocument.basket.linePromotion.length > 0) {
|
|
3792
3791
|
(/** @type {?} */ (this)).rjObject['Trailer']['PromotionItem'] = [];
|
|
3793
|
-
(/** @type {?} */ (this)).transactionDocument.basket.linePromotion.
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
*/
|
|
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'] = ""; // todo - not avaialble
|
|
3803
|
-
obj['PromotionDescription'] = element.displayText;
|
|
3804
|
-
obj['PromotionHit'] = {};
|
|
3805
|
-
obj['PromotionHit']['XMLSchemaVersion'] = (/** @type {?} */ (this)).xmlSchemaVersion;
|
|
3806
|
-
obj['PromotionHit']['HitNumber'] = ""; // todo;
|
|
3807
|
-
obj['PromotionHit']['HitQuantity'] = ""; // todo;
|
|
3808
|
-
obj['PromotionHit']['HitSaving'] = ""; // todo;
|
|
3809
|
-
obj['PromotionHit']['PromotionTrigger'] = {};
|
|
3810
|
-
element.trigger.forEach((/**
|
|
3811
|
-
* @param {?} subElement
|
|
3792
|
+
if ((/** @type {?} */ (this)).transactionDocument.basket.linePromotion.length > 0) {
|
|
3793
|
+
(/** @type {?} */ (this)).transactionDocument.basket.linePromotion.forEach((/**
|
|
3794
|
+
* @param {?} element
|
|
3812
3795
|
* @return {?}
|
|
3813
3796
|
*/
|
|
3814
|
-
(
|
|
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'] = {};
|
|
3815
3810
|
/** @type {?} */
|
|
3816
3811
|
let product = (/** @type {?} */ (this)).transactionDocument.basket.products.find((/**
|
|
3817
3812
|
* @param {?} item
|
|
3818
3813
|
* @return {?}
|
|
3819
3814
|
*/
|
|
3820
|
-
(item) => item.itemLineId ==
|
|
3815
|
+
(item) => item.itemLineId == element.itemLineId));
|
|
3821
3816
|
obj['PromotionHit']['PromotionTrigger']['XMLSchemaVersion'] = (/** @type {?} */ (this)).xmlSchemaVersion;
|
|
3822
3817
|
obj['PromotionHit']['PromotionTrigger']['ProductID'] = product.SKU;
|
|
3823
3818
|
obj['PromotionHit']['PromotionTrigger']['UnitValue'] = (/** @type {?} */ (this)).convertToString(element.promotionLinePrice / product.quantity);
|
|
3824
|
-
obj['PromotionHit']['PromotionTrigger']['LineNumber'] = (/** @type {?} */ (this)).
|
|
3825
|
-
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));
|
|
3826
3821
|
obj['PromotionHit']['PromotionTrigger']['TaxCode'] = (/** @type {?} */ (this)).transactionDocument.basket.taxBreakdown.taxLines.find((/**
|
|
3827
3822
|
* @param {?} item
|
|
3828
3823
|
* @return {?}
|
|
3829
3824
|
*/
|
|
3830
3825
|
(item) => item.itemLineId == element.itemLineId)).VATCode; // todo
|
|
3826
|
+
(/** @type {?} */ (this)).rjObject['Trailer']['PromotionItem'].push(obj);
|
|
3831
3827
|
}));
|
|
3832
|
-
|
|
3833
|
-
}))
|
|
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
|
+
}
|
|
3834
3878
|
}
|
|
3835
3879
|
return (/** @type {?} */ (this));
|
|
3836
3880
|
}
|
|
@@ -3840,64 +3884,132 @@ class RJMapperBuilderClass {
|
|
|
3840
3884
|
* @return {THIS}
|
|
3841
3885
|
*/
|
|
3842
3886
|
getTenderInfo() {
|
|
3843
|
-
(/** @type {?} */ (this)).rjObject['CashTender'] = [];
|
|
3844
3887
|
if ((/** @type {?} */ (this)).transactionDocument.paymentDetails && (/** @type {?} */ (this)).transactionDocument.paymentDetails.length > 0) {
|
|
3845
3888
|
(/** @type {?} */ (this)).transactionDocument.paymentDetails.forEach((/**
|
|
3846
3889
|
* @param {?} element
|
|
3847
3890
|
* @return {?}
|
|
3848
3891
|
*/
|
|
3849
3892
|
(element) => {
|
|
3850
|
-
if (element.
|
|
3851
|
-
/** @type {?} */
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
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
|
+
}
|
|
3873
3942
|
}
|
|
3874
3943
|
else {
|
|
3875
|
-
/** @type {?} */
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
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
|
+
}
|
|
3896
3991
|
}
|
|
3897
3992
|
}));
|
|
3898
3993
|
}
|
|
3899
3994
|
return (/** @type {?} */ (this));
|
|
3900
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
|
+
}
|
|
3901
4013
|
/**
|
|
3902
4014
|
* @return {?}
|
|
3903
4015
|
*/
|
|
@@ -4217,7 +4329,7 @@ class RJMapperBuilderClass {
|
|
|
4217
4329
|
obj['DisplayTaxCode'] = ''; // todo
|
|
4218
4330
|
obj['ProductAttributes'] = ''; //todo - not required
|
|
4219
4331
|
obj['Perishable'] = this.getAttributes();
|
|
4220
|
-
obj['MMGroupID'] = this.
|
|
4332
|
+
obj['MMGroupID'] = this.getCaregories(element);
|
|
4221
4333
|
obj['CustomerDetails'] = ""; // todo - blank
|
|
4222
4334
|
obj['TotalPromotionSaving'] = element['promotionAmount'] || -1; // TODO
|
|
4223
4335
|
obj['OriginalTaxAmount'] = this.convertToString(this.getOriginalTax(element, taxTotal.VAT) * -1);
|
|
@@ -4264,7 +4376,7 @@ class RJMapperBuilderClass {
|
|
|
4264
4376
|
*/
|
|
4265
4377
|
(e) => {
|
|
4266
4378
|
/** @type {?} */
|
|
4267
|
-
let
|
|
4379
|
+
let discountObj = {};
|
|
4268
4380
|
e.itemLineIds.forEach((/**
|
|
4269
4381
|
* @param {?} x
|
|
4270
4382
|
* @return {?}
|
|
@@ -4273,10 +4385,10 @@ class RJMapperBuilderClass {
|
|
|
4273
4385
|
if (x == element.itemLineId) {
|
|
4274
4386
|
/** @type {?} */
|
|
4275
4387
|
var discountAmount = this.convertToString(e.discountAmount * -1);
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
obj['BasketDiscountModifier'].push(
|
|
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);
|
|
4280
4392
|
}
|
|
4281
4393
|
}));
|
|
4282
4394
|
}));
|
|
@@ -4292,6 +4404,35 @@ class RJMapperBuilderClass {
|
|
|
4292
4404
|
//update the product price
|
|
4293
4405
|
obj['EffectiveNetValue'] = obj.EffectiveNetValue + totaltransactionDiscount;
|
|
4294
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
|
+
}
|
|
4295
4436
|
return obj;
|
|
4296
4437
|
}
|
|
4297
4438
|
/**
|
|
@@ -4319,8 +4460,7 @@ class RJMapperBuilderClass {
|
|
|
4319
4460
|
DateTimeCreated: this.createdAt,
|
|
4320
4461
|
ExtendedValue: this.removeDecimal(element.price),
|
|
4321
4462
|
UnitPrice: this.removeDecimal(element.price),
|
|
4322
|
-
MMGroupID: this.
|
|
4323
|
-
//todo
|
|
4463
|
+
MMGroupID: this.getCaregories(element),
|
|
4324
4464
|
Quantity: element.quantity.toFixed(1),
|
|
4325
4465
|
SalespersonID: this.transactionDocument.userId,
|
|
4326
4466
|
SalespersonName: this.transactionDocument.userName,
|
|
@@ -4329,14 +4469,14 @@ class RJMapperBuilderClass {
|
|
|
4329
4469
|
* @return {?}
|
|
4330
4470
|
*/
|
|
4331
4471
|
(item) => item.itemLineId == element['itemLineId'])).VATCode,
|
|
4332
|
-
TaxModifiable: 1,
|
|
4472
|
+
TaxModifiable: "1",
|
|
4333
4473
|
//todo
|
|
4334
4474
|
OriginalTaxAmount: this.convertToString(this.getOriginalTax(element, taxTotal.VAT)),
|
|
4335
4475
|
TaxAmount: this.convertToString(taxTotal.taxLineTotal),
|
|
4336
|
-
OriginalTaxAmountSet: 1,
|
|
4476
|
+
OriginalTaxAmountSet: "1",
|
|
4337
4477
|
//todo
|
|
4338
4478
|
ProductID: element.SKU,
|
|
4339
|
-
HandKeyed: 1,
|
|
4479
|
+
HandKeyed: "1",
|
|
4340
4480
|
//todo
|
|
4341
4481
|
CustomerDetails: "",
|
|
4342
4482
|
Perishable: this.getAttributes()
|
|
@@ -4383,24 +4523,24 @@ class RJMapperBuilderClass {
|
|
|
4383
4523
|
*/
|
|
4384
4524
|
(e) => {
|
|
4385
4525
|
/** @type {?} */
|
|
4386
|
-
|
|
4526
|
+
let discountObj = {};
|
|
4387
4527
|
e.itemLineIds.forEach((/**
|
|
4388
|
-
* @param {?}
|
|
4528
|
+
* @param {?} itemLineId
|
|
4389
4529
|
* @return {?}
|
|
4390
4530
|
*/
|
|
4391
|
-
(
|
|
4392
|
-
if (
|
|
4531
|
+
(itemLineId) => {
|
|
4532
|
+
if (itemLineId == element.itemLineId) {
|
|
4393
4533
|
/** @type {?} */
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
obj['BasketDiscountModifier'].push(
|
|
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);
|
|
4399
4539
|
}
|
|
4400
4540
|
}));
|
|
4401
4541
|
}));
|
|
4402
4542
|
/** @type {?} */
|
|
4403
|
-
|
|
4543
|
+
let totaltransactionDiscount = 0;
|
|
4404
4544
|
obj['BasketDiscountModifier'].forEach((/**
|
|
4405
4545
|
* @param {?} value
|
|
4406
4546
|
* @return {?}
|
|
@@ -4411,8 +4551,71 @@ class RJMapperBuilderClass {
|
|
|
4411
4551
|
//update the product price
|
|
4412
4552
|
obj['EffectiveNetValue'] = obj.EffectiveNetValue + totaltransactionDiscount;
|
|
4413
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
|
+
}
|
|
4414
4607
|
return obj;
|
|
4415
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
|
+
}
|
|
4416
4619
|
/**
|
|
4417
4620
|
* @param {?} value
|
|
4418
4621
|
* @param {?} discountAmount
|
|
@@ -4509,6 +4712,30 @@ class RJMapperBuilderClass {
|
|
|
4509
4712
|
return "";
|
|
4510
4713
|
}
|
|
4511
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
|
+
}
|
|
4512
4739
|
/**
|
|
4513
4740
|
* @param {?} date
|
|
4514
4741
|
* @return {?}
|
|
@@ -4537,21 +4764,18 @@ class RJMapperBuilderClass {
|
|
|
4537
4764
|
*/
|
|
4538
4765
|
getTransactionPromotion(transactionPromotion) {
|
|
4539
4766
|
if (transactionPromotion && transactionPromotion.length > 0) {
|
|
4540
|
-
this.rjObject['
|
|
4541
|
-
this.rjObject['
|
|
4542
|
-
this.rjObject['
|
|
4543
|
-
this.rjObject['
|
|
4544
|
-
this.rjObject['
|
|
4545
|
-
this.rjObject['
|
|
4546
|
-
this.rjObject['
|
|
4547
|
-
this.rjObject['
|
|
4548
|
-
this.rjObject['
|
|
4549
|
-
this.rjObject['
|
|
4550
|
-
this.rjObject['
|
|
4551
|
-
this.rjObject['
|
|
4552
|
-
this.rjObject['BasketDiscount']['DiscountPercentage'] = 0; //todo
|
|
4553
|
-
this.rjObject['BasketDiscount']['DiscountedValue'] = 0; //todo
|
|
4554
|
-
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'] = "";
|
|
4555
4779
|
}
|
|
4556
4780
|
}
|
|
4557
4781
|
/**
|
|
@@ -4693,6 +4917,242 @@ if (false) {
|
|
|
4693
4917
|
RJMapperBuilderClass.prototype.rjObject;
|
|
4694
4918
|
}
|
|
4695
4919
|
|
|
4920
|
+
/**
|
|
4921
|
+
* @fileoverview added by tsickle
|
|
4922
|
+
* Generated from: lib/WebReturn-mapper.class.ts
|
|
4923
|
+
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4924
|
+
*/
|
|
4925
|
+
class WebReturnMapperBuilderClass {
|
|
4926
|
+
/**
|
|
4927
|
+
* @param {?} document
|
|
4928
|
+
*/
|
|
4929
|
+
constructor(document) {
|
|
4930
|
+
this.webReturnObject = {
|
|
4931
|
+
id: '',
|
|
4932
|
+
orgCode: "",
|
|
4933
|
+
storeId: "",
|
|
4934
|
+
storeNodeId: "",
|
|
4935
|
+
storeNodeStructure: "",
|
|
4936
|
+
deviceId: "",
|
|
4937
|
+
terminalId: "",
|
|
4938
|
+
initiatingModule: "",
|
|
4939
|
+
export: false,
|
|
4940
|
+
basket: {},
|
|
4941
|
+
basketSummary: {},
|
|
4942
|
+
baseCurrency: "",
|
|
4943
|
+
customer: {
|
|
4944
|
+
firstName: '',
|
|
4945
|
+
lastName: '',
|
|
4946
|
+
email: '',
|
|
4947
|
+
postCode: '',
|
|
4948
|
+
id: '',
|
|
4949
|
+
billingAddress: {},
|
|
4950
|
+
shippingAddress: {},
|
|
4951
|
+
}
|
|
4952
|
+
};
|
|
4953
|
+
if (document) {
|
|
4954
|
+
this.document = document;
|
|
4955
|
+
}
|
|
4956
|
+
}
|
|
4957
|
+
/**
|
|
4958
|
+
* @template THIS
|
|
4959
|
+
* @this {THIS}
|
|
4960
|
+
* @return {THIS}
|
|
4961
|
+
*/
|
|
4962
|
+
WebReturnMapper() {
|
|
4963
|
+
(/** @type {?} */ (this)).webReturnObject['type'] = 'WEB_RETURNS';
|
|
4964
|
+
(/** @type {?} */ (this)).webReturnObject['datetime'] = (/** @type {?} */ (this)).getUTCDateTime((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.updated_at));
|
|
4965
|
+
(/** @type {?} */ (this)).webReturnObject.baseCurrency = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_currency_code);
|
|
4966
|
+
(/** @type {?} */ (this)).webReturnObject.storeId = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.store_id);
|
|
4967
|
+
(/** @type {?} */ (this)).webReturnObject.subsidiaryId = '1';
|
|
4968
|
+
(/** @type {?} */ (this)).webReturnObject.initiatingModule = 'MAGENTO';
|
|
4969
|
+
(/** @type {?} */ (this)).webReturnObject.createdAt = (/** @type {?} */ (this)).getUTCDateTime((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.created_at));
|
|
4970
|
+
(/** @type {?} */ (this)).webReturnObject.updatedAt = (/** @type {?} */ (this)).getUTCDateTime((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.updated_at));
|
|
4971
|
+
(/** @type {?} */ (this)).webReturnObject.export = true;
|
|
4972
|
+
(/** @type {?} */ (this)).webReturnObject.transCompletedAt = (/** @type {?} */ (this)).getUTCDateTime((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.updated_at));
|
|
4973
|
+
(/** @type {?} */ (this)).webReturnObject['externalTransactionId'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.order_id);
|
|
4974
|
+
// customer
|
|
4975
|
+
(/** @type {?} */ (this)).webReturnObject['customer']['firstName'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.customer_firstname) || '';
|
|
4976
|
+
(/** @type {?} */ (this)).webReturnObject['customer']['lastName'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.customer_lastname) || '';
|
|
4977
|
+
(/** @type {?} */ (this)).webReturnObject['customer']['email'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.customer_email) || '';
|
|
4978
|
+
(/** @type {?} */ (this)).webReturnObject['customer']['postCode'] = '';
|
|
4979
|
+
// Billing address
|
|
4980
|
+
(/** @type {?} */ (this)).webReturnObject['customer']['billingAddress']['address1'] = ((/** @type {?} */ (this)).document.billing_address && (/** @type {?} */ (this)).document.billing_address.street) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.billing_address.street) : '';
|
|
4981
|
+
(/** @type {?} */ (this)).webReturnObject['customer']['billingAddress']['city'] = ((/** @type {?} */ (this)).document.billing_address && (/** @type {?} */ (this)).document.billing_address.city) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.billing_address.city) : '';
|
|
4982
|
+
(/** @type {?} */ (this)).webReturnObject['customer']['billingAddress']['county'] = ((/** @type {?} */ (this)).document.billing_address && (/** @type {?} */ (this)).document.billing_address.region) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.billing_address.region) : '';
|
|
4983
|
+
(/** @type {?} */ (this)).webReturnObject['customer']['billingAddress']['postCode'] = ((/** @type {?} */ (this)).document.billing_address && (/** @type {?} */ (this)).document.billing_address.postcode) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.billing_address.postcode) : '';
|
|
4984
|
+
(/** @type {?} */ (this)).webReturnObject['customer']['billingAddress']['country'] = ((/** @type {?} */ (this)).document.billing_address && (/** @type {?} */ (this)).document.billing_address.country) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.billing_address.country) : '';
|
|
4985
|
+
// Shipping address
|
|
4986
|
+
(/** @type {?} */ (this)).webReturnObject['customer']['shippingAddress']['address1'] = ((/** @type {?} */ (this)).document.shipping_address && (/** @type {?} */ (this)).document.shipping_address.street) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.shipping_address.street) : '';
|
|
4987
|
+
(/** @type {?} */ (this)).webReturnObject['customer']['shippingAddress']['city'] = ((/** @type {?} */ (this)).document.shipping_address && (/** @type {?} */ (this)).document.shipping_address.city) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.shipping_address.city) : '';
|
|
4988
|
+
(/** @type {?} */ (this)).webReturnObject['customer']['shippingAddress']['county'] = ((/** @type {?} */ (this)).document.shipping_address && (/** @type {?} */ (this)).document.shipping_address.region) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.shipping_address.region) : '';
|
|
4989
|
+
(/** @type {?} */ (this)).webReturnObject['customer']['shippingAddress']['postCode'] = ((/** @type {?} */ (this)).document.shipping_address && (/** @type {?} */ (this)).document.shipping_address.postcode) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.shipping_address.postcode) : '';
|
|
4990
|
+
(/** @type {?} */ (this)).webReturnObject['customer']['shippingAddress']['country'] = ((/** @type {?} */ (this)).document.shipping_address && (/** @type {?} */ (this)).document.shipping_address.country) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.shipping_address.country) : '';
|
|
4991
|
+
// basketSummary
|
|
4992
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['discountTotal'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.discount_amount);
|
|
4993
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['VATTotal'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_paid);
|
|
4994
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['saleTotal'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_invoiced);
|
|
4995
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['basketTotal'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_paid);
|
|
4996
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['totalItems'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.total_qty_ordered);
|
|
4997
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['refundTotal'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_refunded) || 0;
|
|
4998
|
+
// basket line discount
|
|
4999
|
+
(/** @type {?} */ (this)).webReturnObject.basket['lineDiscount'] = [];
|
|
5000
|
+
/** @type {?} */
|
|
5001
|
+
let lineDiscount = {
|
|
5002
|
+
itemLineId: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.item_id) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.item_id) : 0,
|
|
5003
|
+
discountAmount: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.discount_amount) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.discount_amount) : 0
|
|
5004
|
+
};
|
|
5005
|
+
(/** @type {?} */ (this)).webReturnObject.basket['lineDiscount'].push(lineDiscount);
|
|
5006
|
+
// basket transaction discount
|
|
5007
|
+
(/** @type {?} */ (this)).webReturnObject.basket['transactionDiscount'] = [];
|
|
5008
|
+
/** @type {?} */
|
|
5009
|
+
let transactionDiscount = {
|
|
5010
|
+
discountAmount: (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.discount_amount) || 0
|
|
5011
|
+
};
|
|
5012
|
+
(/** @type {?} */ (this)).webReturnObject.basket['transactionDiscount'].push(transactionDiscount);
|
|
5013
|
+
// basket products
|
|
5014
|
+
(/** @type {?} */ (this)).webReturnObject.basket['products'] = [];
|
|
5015
|
+
/** @type {?} */
|
|
5016
|
+
let product = {
|
|
5017
|
+
description: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.name) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.name) : '',
|
|
5018
|
+
SKU: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.sku) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.sku) : '',
|
|
5019
|
+
quantity: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.qty_ordered) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.qty_ordered) : '',
|
|
5020
|
+
refundedQuantity: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.qty_refunded) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.qty_refunded) : '',
|
|
5021
|
+
price: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.original_price) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.original_price) : '',
|
|
5022
|
+
itemLineId: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.item_id) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.item_id) : '',
|
|
5023
|
+
totalLinePrice: ((/** @type {?} */ (this)).document.items && (/** @type {?} */ (this)).document.items.item && (/** @type {?} */ (this)).document.items.item.row_invoiced) ? (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.items.item.row_invoiced) : '',
|
|
5024
|
+
};
|
|
5025
|
+
(/** @type {?} */ (this)).webReturnObject.basket['products'].push(product);
|
|
5026
|
+
return (/** @type {?} */ (this));
|
|
5027
|
+
}
|
|
5028
|
+
/**
|
|
5029
|
+
* @template THIS
|
|
5030
|
+
* @this {THIS}
|
|
5031
|
+
* @param {?} deviceId
|
|
5032
|
+
* @return {THIS}
|
|
5033
|
+
*/
|
|
5034
|
+
deviceId(deviceId) {
|
|
5035
|
+
(/** @type {?} */ (this)).webReturnObject.deviceId = deviceId;
|
|
5036
|
+
return (/** @type {?} */ (this));
|
|
5037
|
+
}
|
|
5038
|
+
/**
|
|
5039
|
+
* @template THIS
|
|
5040
|
+
* @this {THIS}
|
|
5041
|
+
* @param {?} terminalId
|
|
5042
|
+
* @return {THIS}
|
|
5043
|
+
*/
|
|
5044
|
+
terminalId(terminalId) {
|
|
5045
|
+
(/** @type {?} */ (this)).webReturnObject.terminalId = terminalId;
|
|
5046
|
+
return (/** @type {?} */ (this));
|
|
5047
|
+
}
|
|
5048
|
+
/**
|
|
5049
|
+
* @template THIS
|
|
5050
|
+
* @this {THIS}
|
|
5051
|
+
* @param {?} orgCode
|
|
5052
|
+
* @return {THIS}
|
|
5053
|
+
*/
|
|
5054
|
+
orgCode(orgCode) {
|
|
5055
|
+
(/** @type {?} */ (this)).webReturnObject.orgCode = orgCode;
|
|
5056
|
+
return (/** @type {?} */ (this));
|
|
5057
|
+
}
|
|
5058
|
+
/**
|
|
5059
|
+
* @template THIS
|
|
5060
|
+
* @this {THIS}
|
|
5061
|
+
* @param {?} storeId
|
|
5062
|
+
* @return {THIS}
|
|
5063
|
+
*/
|
|
5064
|
+
storeId(storeId) {
|
|
5065
|
+
(/** @type {?} */ (this)).webReturnObject.storeId = storeId;
|
|
5066
|
+
return (/** @type {?} */ (this));
|
|
5067
|
+
}
|
|
5068
|
+
/**
|
|
5069
|
+
* @template THIS
|
|
5070
|
+
* @this {THIS}
|
|
5071
|
+
* @param {?} storeNodeId
|
|
5072
|
+
* @return {THIS}
|
|
5073
|
+
*/
|
|
5074
|
+
storeNodeId(storeNodeId) {
|
|
5075
|
+
(/** @type {?} */ (this)).webReturnObject.storeNodeId = storeNodeId;
|
|
5076
|
+
return (/** @type {?} */ (this));
|
|
5077
|
+
}
|
|
5078
|
+
/**
|
|
5079
|
+
* @template THIS
|
|
5080
|
+
* @this {THIS}
|
|
5081
|
+
* @param {?} storeNodeStructure
|
|
5082
|
+
* @return {THIS}
|
|
5083
|
+
*/
|
|
5084
|
+
storeNodeStructure(storeNodeStructure) {
|
|
5085
|
+
(/** @type {?} */ (this)).webReturnObject.storeNodeStructure = storeNodeStructure;
|
|
5086
|
+
return (/** @type {?} */ (this));
|
|
5087
|
+
}
|
|
5088
|
+
/**
|
|
5089
|
+
* @template THIS
|
|
5090
|
+
* @this {THIS}
|
|
5091
|
+
* @param {?} docId
|
|
5092
|
+
* @return {THIS}
|
|
5093
|
+
*/
|
|
5094
|
+
docId(docId) {
|
|
5095
|
+
(/** @type {?} */ (this)).webReturnObject.id = docId;
|
|
5096
|
+
return (/** @type {?} */ (this));
|
|
5097
|
+
}
|
|
5098
|
+
/**
|
|
5099
|
+
* @template THIS
|
|
5100
|
+
* @this {THIS}
|
|
5101
|
+
* @param {?} userID
|
|
5102
|
+
* @return {THIS}
|
|
5103
|
+
*/
|
|
5104
|
+
updateUserID(userID) {
|
|
5105
|
+
(/** @type {?} */ (this)).webReturnObject.userId = userID;
|
|
5106
|
+
return (/** @type {?} */ (this));
|
|
5107
|
+
}
|
|
5108
|
+
/**
|
|
5109
|
+
* @template THIS
|
|
5110
|
+
* @this {THIS}
|
|
5111
|
+
* @param {?} name
|
|
5112
|
+
* @return {THIS}
|
|
5113
|
+
*/
|
|
5114
|
+
updateUserName(name) {
|
|
5115
|
+
(/** @type {?} */ (this)).webReturnObject.userName = name;
|
|
5116
|
+
return (/** @type {?} */ (this));
|
|
5117
|
+
}
|
|
5118
|
+
/**
|
|
5119
|
+
* @return {?}
|
|
5120
|
+
*/
|
|
5121
|
+
build() {
|
|
5122
|
+
return this.webReturnObject;
|
|
5123
|
+
}
|
|
5124
|
+
/**
|
|
5125
|
+
* @param {?} obj
|
|
5126
|
+
* @return {?}
|
|
5127
|
+
*/
|
|
5128
|
+
getText(obj) {
|
|
5129
|
+
if (obj) {
|
|
5130
|
+
return obj.text;
|
|
5131
|
+
}
|
|
5132
|
+
}
|
|
5133
|
+
/**
|
|
5134
|
+
* @param {?} date
|
|
5135
|
+
* @return {?}
|
|
5136
|
+
*/
|
|
5137
|
+
getUTCDateTime(date) {
|
|
5138
|
+
if (date) {
|
|
5139
|
+
return new Date(date).toISOString();
|
|
5140
|
+
}
|
|
5141
|
+
}
|
|
5142
|
+
}
|
|
5143
|
+
if (false) {
|
|
5144
|
+
/**
|
|
5145
|
+
* @type {?}
|
|
5146
|
+
* @private
|
|
5147
|
+
*/
|
|
5148
|
+
WebReturnMapperBuilderClass.prototype.document;
|
|
5149
|
+
/**
|
|
5150
|
+
* @type {?}
|
|
5151
|
+
* @private
|
|
5152
|
+
*/
|
|
5153
|
+
WebReturnMapperBuilderClass.prototype.webReturnObject;
|
|
5154
|
+
}
|
|
5155
|
+
|
|
4696
5156
|
/**
|
|
4697
5157
|
* @fileoverview added by tsickle
|
|
4698
5158
|
* Generated from: public-api.ts
|
|
@@ -4705,5 +5165,5 @@ if (false) {
|
|
|
4705
5165
|
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4706
5166
|
*/
|
|
4707
5167
|
|
|
4708
|
-
export { MapperLibraryComponent, MapperLibraryModule, RJMapperBuilderClass };
|
|
5168
|
+
export { MapperLibraryComponent, MapperLibraryModule, RJMapperBuilderClass, WebReturnMapperBuilderClass };
|
|
4709
5169
|
//# sourceMappingURL=pmcretail-mapper-library.js.map
|