@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
|
@@ -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;
|
|
@@ -4990,50 +4990,94 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
4990
4990
|
obj['TaxPercentage'] = element.VAT.toFixed(2); // todo
|
|
4991
4991
|
(/** @type {?} */ (_this)).rjObject['Trailer']['TaxItem'].push(obj);
|
|
4992
4992
|
}));
|
|
4993
|
-
|
|
4994
|
-
if ((/** @type {?} */ (this)).transactionDocument.basket.linePromotion.length > 0) {
|
|
4993
|
+
if ((/** @type {?} */ (this)).transactionDocument.basket.linePromotion.length > 0 || (/** @type {?} */ (this)).transactionDocument.basket.linePromotion.length > 0) {
|
|
4995
4994
|
(/** @type {?} */ (this)).rjObject['Trailer']['PromotionItem'] = [];
|
|
4996
|
-
(/** @type {?} */ (this)).transactionDocument.basket.linePromotion.
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
*/
|
|
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'] = ""; // todo - not avaialble
|
|
5006
|
-
obj['PromotionDescription'] = element.displayText;
|
|
5007
|
-
obj['PromotionHit'] = {};
|
|
5008
|
-
obj['PromotionHit']['XMLSchemaVersion'] = (/** @type {?} */ (_this)).xmlSchemaVersion;
|
|
5009
|
-
obj['PromotionHit']['HitNumber'] = ""; // todo;
|
|
5010
|
-
obj['PromotionHit']['HitQuantity'] = ""; // todo;
|
|
5011
|
-
obj['PromotionHit']['HitSaving'] = ""; // todo;
|
|
5012
|
-
obj['PromotionHit']['PromotionTrigger'] = {};
|
|
5013
|
-
element.trigger.forEach((/**
|
|
5014
|
-
* @param {?} subElement
|
|
4995
|
+
if ((/** @type {?} */ (this)).transactionDocument.basket.linePromotion.length > 0) {
|
|
4996
|
+
(/** @type {?} */ (this)).transactionDocument.basket.linePromotion.forEach((/**
|
|
4997
|
+
* @param {?} element
|
|
5015
4998
|
* @return {?}
|
|
5016
4999
|
*/
|
|
5017
|
-
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'] = {};
|
|
5018
5013
|
/** @type {?} */
|
|
5019
5014
|
var product = (/** @type {?} */ (_this)).transactionDocument.basket.products.find((/**
|
|
5020
5015
|
* @param {?} item
|
|
5021
5016
|
* @return {?}
|
|
5022
5017
|
*/
|
|
5023
|
-
function (item) { return item.itemLineId ==
|
|
5018
|
+
function (item) { return item.itemLineId == element.itemLineId; }));
|
|
5024
5019
|
obj['PromotionHit']['PromotionTrigger']['XMLSchemaVersion'] = (/** @type {?} */ (_this)).xmlSchemaVersion;
|
|
5025
5020
|
obj['PromotionHit']['PromotionTrigger']['ProductID'] = product.SKU;
|
|
5026
5021
|
obj['PromotionHit']['PromotionTrigger']['UnitValue'] = (/** @type {?} */ (_this)).convertToString(element.promotionLinePrice / product.quantity);
|
|
5027
|
-
obj['PromotionHit']['PromotionTrigger']['LineNumber'] = (/** @type {?} */ (_this)).
|
|
5028
|
-
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));
|
|
5029
5024
|
obj['PromotionHit']['PromotionTrigger']['TaxCode'] = (/** @type {?} */ (_this)).transactionDocument.basket.taxBreakdown.taxLines.find((/**
|
|
5030
5025
|
* @param {?} item
|
|
5031
5026
|
* @return {?}
|
|
5032
5027
|
*/
|
|
5033
5028
|
function (item) { return item.itemLineId == element.itemLineId; })).VATCode; // todo
|
|
5029
|
+
(/** @type {?} */ (_this)).rjObject['Trailer']['PromotionItem'].push(obj);
|
|
5034
5030
|
}));
|
|
5035
|
-
|
|
5036
|
-
}))
|
|
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
|
+
}
|
|
5037
5081
|
}
|
|
5038
5082
|
return (/** @type {?} */ (this));
|
|
5039
5083
|
};
|
|
@@ -5049,64 +5093,136 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5049
5093
|
*/
|
|
5050
5094
|
function () {
|
|
5051
5095
|
var _this = this;
|
|
5052
|
-
(/** @type {?} */ (this)).rjObject['CashTender'] = [];
|
|
5053
5096
|
if ((/** @type {?} */ (this)).transactionDocument.paymentDetails && (/** @type {?} */ (this)).transactionDocument.paymentDetails.length > 0) {
|
|
5054
5097
|
(/** @type {?} */ (this)).transactionDocument.paymentDetails.forEach((/**
|
|
5055
5098
|
* @param {?} element
|
|
5056
5099
|
* @return {?}
|
|
5057
5100
|
*/
|
|
5058
5101
|
function (element) {
|
|
5059
|
-
if (element.
|
|
5060
|
-
/** @type {?} */
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
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
|
+
}
|
|
5082
5151
|
}
|
|
5083
5152
|
else {
|
|
5084
|
-
/** @type {?} */
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
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
|
+
}
|
|
5105
5200
|
}
|
|
5106
5201
|
}));
|
|
5107
5202
|
}
|
|
5108
5203
|
return (/** @type {?} */ (this));
|
|
5109
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
|
+
};
|
|
5110
5226
|
/**
|
|
5111
5227
|
* @return {?}
|
|
5112
5228
|
*/
|
|
@@ -5574,7 +5690,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5574
5690
|
obj['DisplayTaxCode'] = ''; // todo
|
|
5575
5691
|
obj['ProductAttributes'] = ''; //todo - not required
|
|
5576
5692
|
obj['Perishable'] = this.getAttributes();
|
|
5577
|
-
obj['MMGroupID'] = this.
|
|
5693
|
+
obj['MMGroupID'] = this.getCaregories(element);
|
|
5578
5694
|
obj['CustomerDetails'] = ""; // todo - blank
|
|
5579
5695
|
obj['TotalPromotionSaving'] = element['promotionAmount'] || -1; // TODO
|
|
5580
5696
|
obj['OriginalTaxAmount'] = this.convertToString(this.getOriginalTax(element, taxTotal.VAT) * -1);
|
|
@@ -5621,7 +5737,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5621
5737
|
*/
|
|
5622
5738
|
function (e) {
|
|
5623
5739
|
/** @type {?} */
|
|
5624
|
-
var
|
|
5740
|
+
var discountObj = {};
|
|
5625
5741
|
e.itemLineIds.forEach((/**
|
|
5626
5742
|
* @param {?} x
|
|
5627
5743
|
* @return {?}
|
|
@@ -5630,10 +5746,10 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5630
5746
|
if (x == element.itemLineId) {
|
|
5631
5747
|
/** @type {?} */
|
|
5632
5748
|
var discountAmount = _this.convertToString(e.discountAmount * -1);
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
obj['BasketDiscountModifier'].push(
|
|
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);
|
|
5637
5753
|
}
|
|
5638
5754
|
}));
|
|
5639
5755
|
}));
|
|
@@ -5649,6 +5765,35 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5649
5765
|
//update the product price
|
|
5650
5766
|
obj['EffectiveNetValue'] = obj.EffectiveNetValue + totaltransactionDiscount;
|
|
5651
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
|
+
}
|
|
5652
5797
|
return obj;
|
|
5653
5798
|
};
|
|
5654
5799
|
/**
|
|
@@ -5683,8 +5828,7 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5683
5828
|
DateTimeCreated: this.createdAt,
|
|
5684
5829
|
ExtendedValue: this.removeDecimal(element.price),
|
|
5685
5830
|
UnitPrice: this.removeDecimal(element.price),
|
|
5686
|
-
MMGroupID: this.
|
|
5687
|
-
//todo
|
|
5831
|
+
MMGroupID: this.getCaregories(element),
|
|
5688
5832
|
Quantity: element.quantity.toFixed(1),
|
|
5689
5833
|
SalespersonID: this.transactionDocument.userId,
|
|
5690
5834
|
SalespersonName: this.transactionDocument.userName,
|
|
@@ -5693,14 +5837,14 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5693
5837
|
* @return {?}
|
|
5694
5838
|
*/
|
|
5695
5839
|
function (item) { return item.itemLineId == element['itemLineId']; })).VATCode,
|
|
5696
|
-
TaxModifiable: 1,
|
|
5840
|
+
TaxModifiable: "1",
|
|
5697
5841
|
//todo
|
|
5698
5842
|
OriginalTaxAmount: this.convertToString(this.getOriginalTax(element, taxTotal.VAT)),
|
|
5699
5843
|
TaxAmount: this.convertToString(taxTotal.taxLineTotal),
|
|
5700
|
-
OriginalTaxAmountSet: 1,
|
|
5844
|
+
OriginalTaxAmountSet: "1",
|
|
5701
5845
|
//todo
|
|
5702
5846
|
ProductID: element.SKU,
|
|
5703
|
-
HandKeyed: 1,
|
|
5847
|
+
HandKeyed: "1",
|
|
5704
5848
|
//todo
|
|
5705
5849
|
CustomerDetails: "",
|
|
5706
5850
|
Perishable: this.getAttributes()
|
|
@@ -5747,36 +5891,104 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5747
5891
|
*/
|
|
5748
5892
|
function (e) {
|
|
5749
5893
|
/** @type {?} */
|
|
5750
|
-
var
|
|
5894
|
+
var discountObj = {};
|
|
5751
5895
|
e.itemLineIds.forEach((/**
|
|
5752
|
-
* @param {?}
|
|
5896
|
+
* @param {?} itemLineId
|
|
5753
5897
|
* @return {?}
|
|
5754
5898
|
*/
|
|
5755
|
-
function (
|
|
5756
|
-
if (
|
|
5899
|
+
function (itemLineId) {
|
|
5900
|
+
if (itemLineId == element.itemLineId) {
|
|
5757
5901
|
/** @type {?} */
|
|
5758
5902
|
var discountAmount = _this.convertToString(e.discountAmount * -1);
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
obj['BasketDiscountModifier'].push(
|
|
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);
|
|
5763
5907
|
}
|
|
5764
5908
|
}));
|
|
5765
5909
|
}));
|
|
5766
5910
|
/** @type {?} */
|
|
5767
|
-
var
|
|
5911
|
+
var totaltransactionDiscount_1 = 0;
|
|
5768
5912
|
obj['BasketDiscountModifier'].forEach((/**
|
|
5769
5913
|
* @param {?} value
|
|
5770
5914
|
* @return {?}
|
|
5771
5915
|
*/
|
|
5772
5916
|
function (value) {
|
|
5773
|
-
|
|
5917
|
+
totaltransactionDiscount_1 = totaltransactionDiscount_1 + value.DiscountedValue;
|
|
5774
5918
|
}));
|
|
5775
5919
|
//update the product price
|
|
5776
|
-
obj['EffectiveNetValue'] = obj.EffectiveNetValue +
|
|
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;
|
|
5777
5974
|
}
|
|
5778
5975
|
return obj;
|
|
5779
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
|
+
};
|
|
5780
5992
|
/**
|
|
5781
5993
|
* @param {?} value
|
|
5782
5994
|
* @param {?} discountAmount
|
|
@@ -5898,6 +6110,34 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5898
6110
|
return "";
|
|
5899
6111
|
}
|
|
5900
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
|
+
};
|
|
5901
6141
|
/**
|
|
5902
6142
|
* @param {?} date
|
|
5903
6143
|
* @return {?}
|
|
@@ -5934,21 +6174,18 @@ var RJMapperBuilderClass = /** @class */ (function () {
|
|
|
5934
6174
|
*/
|
|
5935
6175
|
function (transactionPromotion) {
|
|
5936
6176
|
if (transactionPromotion && transactionPromotion.length > 0) {
|
|
5937
|
-
this.rjObject['
|
|
5938
|
-
this.rjObject['
|
|
5939
|
-
this.rjObject['
|
|
5940
|
-
this.rjObject['
|
|
5941
|
-
this.rjObject['
|
|
5942
|
-
this.rjObject['
|
|
5943
|
-
this.rjObject['
|
|
5944
|
-
this.rjObject['
|
|
5945
|
-
this.rjObject['
|
|
5946
|
-
this.rjObject['
|
|
5947
|
-
this.rjObject['
|
|
5948
|
-
this.rjObject['
|
|
5949
|
-
this.rjObject['BasketDiscount']['DiscountPercentage'] = 0; //todo
|
|
5950
|
-
this.rjObject['BasketDiscount']['DiscountedValue'] = 0; //todo
|
|
5951
|
-
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'] = "";
|
|
5952
6189
|
}
|
|
5953
6190
|
};
|
|
5954
6191
|
/**
|
|
@@ -6095,6 +6332,310 @@ if (false) {
|
|
|
6095
6332
|
RJMapperBuilderClass.prototype.rjObject;
|
|
6096
6333
|
}
|
|
6097
6334
|
|
|
6335
|
+
/**
|
|
6336
|
+
* @fileoverview added by tsickle
|
|
6337
|
+
* Generated from: lib/WebReturn-mapper.class.ts
|
|
6338
|
+
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
6339
|
+
*/
|
|
6340
|
+
var WebReturnMapperBuilderClass = /** @class */ (function () {
|
|
6341
|
+
function WebReturnMapperBuilderClass(document) {
|
|
6342
|
+
this.webReturnObject = {
|
|
6343
|
+
id: '',
|
|
6344
|
+
orgCode: "",
|
|
6345
|
+
storeId: "",
|
|
6346
|
+
storeNodeId: "",
|
|
6347
|
+
storeNodeStructure: "",
|
|
6348
|
+
deviceId: "",
|
|
6349
|
+
terminalId: "",
|
|
6350
|
+
initiatingModule: "",
|
|
6351
|
+
export: false,
|
|
6352
|
+
basket: {},
|
|
6353
|
+
basketSummary: {},
|
|
6354
|
+
baseCurrency: "",
|
|
6355
|
+
customer: {
|
|
6356
|
+
firstName: '',
|
|
6357
|
+
lastName: '',
|
|
6358
|
+
email: '',
|
|
6359
|
+
postCode: '',
|
|
6360
|
+
id: '',
|
|
6361
|
+
billingAddress: {},
|
|
6362
|
+
shippingAddress: {},
|
|
6363
|
+
}
|
|
6364
|
+
};
|
|
6365
|
+
if (document) {
|
|
6366
|
+
this.document = document;
|
|
6367
|
+
}
|
|
6368
|
+
}
|
|
6369
|
+
/**
|
|
6370
|
+
* @template THIS
|
|
6371
|
+
* @this {THIS}
|
|
6372
|
+
* @return {THIS}
|
|
6373
|
+
*/
|
|
6374
|
+
WebReturnMapperBuilderClass.prototype.WebReturnMapper = /**
|
|
6375
|
+
* @template THIS
|
|
6376
|
+
* @this {THIS}
|
|
6377
|
+
* @return {THIS}
|
|
6378
|
+
*/
|
|
6379
|
+
function () {
|
|
6380
|
+
(/** @type {?} */ (this)).webReturnObject['type'] = 'WEB_RETURNS';
|
|
6381
|
+
(/** @type {?} */ (this)).webReturnObject['datetime'] = (/** @type {?} */ (this)).getUTCDateTime((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.updated_at));
|
|
6382
|
+
(/** @type {?} */ (this)).webReturnObject.baseCurrency = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_currency_code);
|
|
6383
|
+
(/** @type {?} */ (this)).webReturnObject.storeId = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.store_id);
|
|
6384
|
+
(/** @type {?} */ (this)).webReturnObject.subsidiaryId = '1';
|
|
6385
|
+
(/** @type {?} */ (this)).webReturnObject.initiatingModule = 'MAGENTO';
|
|
6386
|
+
(/** @type {?} */ (this)).webReturnObject.createdAt = (/** @type {?} */ (this)).getUTCDateTime((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.created_at));
|
|
6387
|
+
(/** @type {?} */ (this)).webReturnObject.updatedAt = (/** @type {?} */ (this)).getUTCDateTime((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.updated_at));
|
|
6388
|
+
(/** @type {?} */ (this)).webReturnObject.export = true;
|
|
6389
|
+
(/** @type {?} */ (this)).webReturnObject.transCompletedAt = (/** @type {?} */ (this)).getUTCDateTime((/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.updated_at));
|
|
6390
|
+
(/** @type {?} */ (this)).webReturnObject['externalTransactionId'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.order_id);
|
|
6391
|
+
// customer
|
|
6392
|
+
(/** @type {?} */ (this)).webReturnObject['customer']['firstName'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.customer_firstname) || '';
|
|
6393
|
+
(/** @type {?} */ (this)).webReturnObject['customer']['lastName'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.customer_lastname) || '';
|
|
6394
|
+
(/** @type {?} */ (this)).webReturnObject['customer']['email'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.customer_email) || '';
|
|
6395
|
+
(/** @type {?} */ (this)).webReturnObject['customer']['postCode'] = '';
|
|
6396
|
+
// Billing address
|
|
6397
|
+
(/** @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) : '';
|
|
6398
|
+
(/** @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) : '';
|
|
6399
|
+
(/** @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) : '';
|
|
6400
|
+
(/** @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) : '';
|
|
6401
|
+
(/** @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) : '';
|
|
6402
|
+
// Shipping address
|
|
6403
|
+
(/** @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) : '';
|
|
6404
|
+
(/** @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) : '';
|
|
6405
|
+
(/** @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) : '';
|
|
6406
|
+
(/** @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) : '';
|
|
6407
|
+
(/** @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) : '';
|
|
6408
|
+
// basketSummary
|
|
6409
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['discountTotal'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.discount_amount);
|
|
6410
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['VATTotal'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_paid);
|
|
6411
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['saleTotal'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_invoiced);
|
|
6412
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['basketTotal'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_paid);
|
|
6413
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['totalItems'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.total_qty_ordered);
|
|
6414
|
+
(/** @type {?} */ (this)).webReturnObject.basketSummary['refundTotal'] = (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.base_total_refunded) || 0;
|
|
6415
|
+
// basket line discount
|
|
6416
|
+
(/** @type {?} */ (this)).webReturnObject.basket['lineDiscount'] = [];
|
|
6417
|
+
/** @type {?} */
|
|
6418
|
+
var lineDiscount = {
|
|
6419
|
+
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,
|
|
6420
|
+
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
|
|
6421
|
+
};
|
|
6422
|
+
(/** @type {?} */ (this)).webReturnObject.basket['lineDiscount'].push(lineDiscount);
|
|
6423
|
+
// basket transaction discount
|
|
6424
|
+
(/** @type {?} */ (this)).webReturnObject.basket['transactionDiscount'] = [];
|
|
6425
|
+
/** @type {?} */
|
|
6426
|
+
var transactionDiscount = {
|
|
6427
|
+
discountAmount: (/** @type {?} */ (this)).getText((/** @type {?} */ (this)).document.discount_amount) || 0
|
|
6428
|
+
};
|
|
6429
|
+
(/** @type {?} */ (this)).webReturnObject.basket['transactionDiscount'].push(transactionDiscount);
|
|
6430
|
+
// basket products
|
|
6431
|
+
(/** @type {?} */ (this)).webReturnObject.basket['products'] = [];
|
|
6432
|
+
/** @type {?} */
|
|
6433
|
+
var product = {
|
|
6434
|
+
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) : '',
|
|
6435
|
+
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) : '',
|
|
6436
|
+
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) : '',
|
|
6437
|
+
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) : '',
|
|
6438
|
+
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) : '',
|
|
6439
|
+
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) : '',
|
|
6440
|
+
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) : '',
|
|
6441
|
+
};
|
|
6442
|
+
(/** @type {?} */ (this)).webReturnObject.basket['products'].push(product);
|
|
6443
|
+
return (/** @type {?} */ (this));
|
|
6444
|
+
};
|
|
6445
|
+
/**
|
|
6446
|
+
* @template THIS
|
|
6447
|
+
* @this {THIS}
|
|
6448
|
+
* @param {?} deviceId
|
|
6449
|
+
* @return {THIS}
|
|
6450
|
+
*/
|
|
6451
|
+
WebReturnMapperBuilderClass.prototype.deviceId = /**
|
|
6452
|
+
* @template THIS
|
|
6453
|
+
* @this {THIS}
|
|
6454
|
+
* @param {?} deviceId
|
|
6455
|
+
* @return {THIS}
|
|
6456
|
+
*/
|
|
6457
|
+
function (deviceId) {
|
|
6458
|
+
(/** @type {?} */ (this)).webReturnObject.deviceId = deviceId;
|
|
6459
|
+
return (/** @type {?} */ (this));
|
|
6460
|
+
};
|
|
6461
|
+
/**
|
|
6462
|
+
* @template THIS
|
|
6463
|
+
* @this {THIS}
|
|
6464
|
+
* @param {?} terminalId
|
|
6465
|
+
* @return {THIS}
|
|
6466
|
+
*/
|
|
6467
|
+
WebReturnMapperBuilderClass.prototype.terminalId = /**
|
|
6468
|
+
* @template THIS
|
|
6469
|
+
* @this {THIS}
|
|
6470
|
+
* @param {?} terminalId
|
|
6471
|
+
* @return {THIS}
|
|
6472
|
+
*/
|
|
6473
|
+
function (terminalId) {
|
|
6474
|
+
(/** @type {?} */ (this)).webReturnObject.terminalId = terminalId;
|
|
6475
|
+
return (/** @type {?} */ (this));
|
|
6476
|
+
};
|
|
6477
|
+
/**
|
|
6478
|
+
* @template THIS
|
|
6479
|
+
* @this {THIS}
|
|
6480
|
+
* @param {?} orgCode
|
|
6481
|
+
* @return {THIS}
|
|
6482
|
+
*/
|
|
6483
|
+
WebReturnMapperBuilderClass.prototype.orgCode = /**
|
|
6484
|
+
* @template THIS
|
|
6485
|
+
* @this {THIS}
|
|
6486
|
+
* @param {?} orgCode
|
|
6487
|
+
* @return {THIS}
|
|
6488
|
+
*/
|
|
6489
|
+
function (orgCode) {
|
|
6490
|
+
(/** @type {?} */ (this)).webReturnObject.orgCode = orgCode;
|
|
6491
|
+
return (/** @type {?} */ (this));
|
|
6492
|
+
};
|
|
6493
|
+
/**
|
|
6494
|
+
* @template THIS
|
|
6495
|
+
* @this {THIS}
|
|
6496
|
+
* @param {?} storeId
|
|
6497
|
+
* @return {THIS}
|
|
6498
|
+
*/
|
|
6499
|
+
WebReturnMapperBuilderClass.prototype.storeId = /**
|
|
6500
|
+
* @template THIS
|
|
6501
|
+
* @this {THIS}
|
|
6502
|
+
* @param {?} storeId
|
|
6503
|
+
* @return {THIS}
|
|
6504
|
+
*/
|
|
6505
|
+
function (storeId) {
|
|
6506
|
+
(/** @type {?} */ (this)).webReturnObject.storeId = storeId;
|
|
6507
|
+
return (/** @type {?} */ (this));
|
|
6508
|
+
};
|
|
6509
|
+
/**
|
|
6510
|
+
* @template THIS
|
|
6511
|
+
* @this {THIS}
|
|
6512
|
+
* @param {?} storeNodeId
|
|
6513
|
+
* @return {THIS}
|
|
6514
|
+
*/
|
|
6515
|
+
WebReturnMapperBuilderClass.prototype.storeNodeId = /**
|
|
6516
|
+
* @template THIS
|
|
6517
|
+
* @this {THIS}
|
|
6518
|
+
* @param {?} storeNodeId
|
|
6519
|
+
* @return {THIS}
|
|
6520
|
+
*/
|
|
6521
|
+
function (storeNodeId) {
|
|
6522
|
+
(/** @type {?} */ (this)).webReturnObject.storeNodeId = storeNodeId;
|
|
6523
|
+
return (/** @type {?} */ (this));
|
|
6524
|
+
};
|
|
6525
|
+
/**
|
|
6526
|
+
* @template THIS
|
|
6527
|
+
* @this {THIS}
|
|
6528
|
+
* @param {?} storeNodeStructure
|
|
6529
|
+
* @return {THIS}
|
|
6530
|
+
*/
|
|
6531
|
+
WebReturnMapperBuilderClass.prototype.storeNodeStructure = /**
|
|
6532
|
+
* @template THIS
|
|
6533
|
+
* @this {THIS}
|
|
6534
|
+
* @param {?} storeNodeStructure
|
|
6535
|
+
* @return {THIS}
|
|
6536
|
+
*/
|
|
6537
|
+
function (storeNodeStructure) {
|
|
6538
|
+
(/** @type {?} */ (this)).webReturnObject.storeNodeStructure = storeNodeStructure;
|
|
6539
|
+
return (/** @type {?} */ (this));
|
|
6540
|
+
};
|
|
6541
|
+
/**
|
|
6542
|
+
* @template THIS
|
|
6543
|
+
* @this {THIS}
|
|
6544
|
+
* @param {?} docId
|
|
6545
|
+
* @return {THIS}
|
|
6546
|
+
*/
|
|
6547
|
+
WebReturnMapperBuilderClass.prototype.docId = /**
|
|
6548
|
+
* @template THIS
|
|
6549
|
+
* @this {THIS}
|
|
6550
|
+
* @param {?} docId
|
|
6551
|
+
* @return {THIS}
|
|
6552
|
+
*/
|
|
6553
|
+
function (docId) {
|
|
6554
|
+
(/** @type {?} */ (this)).webReturnObject.id = docId;
|
|
6555
|
+
return (/** @type {?} */ (this));
|
|
6556
|
+
};
|
|
6557
|
+
/**
|
|
6558
|
+
* @template THIS
|
|
6559
|
+
* @this {THIS}
|
|
6560
|
+
* @param {?} userID
|
|
6561
|
+
* @return {THIS}
|
|
6562
|
+
*/
|
|
6563
|
+
WebReturnMapperBuilderClass.prototype.updateUserID = /**
|
|
6564
|
+
* @template THIS
|
|
6565
|
+
* @this {THIS}
|
|
6566
|
+
* @param {?} userID
|
|
6567
|
+
* @return {THIS}
|
|
6568
|
+
*/
|
|
6569
|
+
function (userID) {
|
|
6570
|
+
(/** @type {?} */ (this)).webReturnObject.userId = userID;
|
|
6571
|
+
return (/** @type {?} */ (this));
|
|
6572
|
+
};
|
|
6573
|
+
/**
|
|
6574
|
+
* @template THIS
|
|
6575
|
+
* @this {THIS}
|
|
6576
|
+
* @param {?} name
|
|
6577
|
+
* @return {THIS}
|
|
6578
|
+
*/
|
|
6579
|
+
WebReturnMapperBuilderClass.prototype.updateUserName = /**
|
|
6580
|
+
* @template THIS
|
|
6581
|
+
* @this {THIS}
|
|
6582
|
+
* @param {?} name
|
|
6583
|
+
* @return {THIS}
|
|
6584
|
+
*/
|
|
6585
|
+
function (name) {
|
|
6586
|
+
(/** @type {?} */ (this)).webReturnObject.userName = name;
|
|
6587
|
+
return (/** @type {?} */ (this));
|
|
6588
|
+
};
|
|
6589
|
+
/**
|
|
6590
|
+
* @return {?}
|
|
6591
|
+
*/
|
|
6592
|
+
WebReturnMapperBuilderClass.prototype.build = /**
|
|
6593
|
+
* @return {?}
|
|
6594
|
+
*/
|
|
6595
|
+
function () {
|
|
6596
|
+
return this.webReturnObject;
|
|
6597
|
+
};
|
|
6598
|
+
/**
|
|
6599
|
+
* @param {?} obj
|
|
6600
|
+
* @return {?}
|
|
6601
|
+
*/
|
|
6602
|
+
WebReturnMapperBuilderClass.prototype.getText = /**
|
|
6603
|
+
* @param {?} obj
|
|
6604
|
+
* @return {?}
|
|
6605
|
+
*/
|
|
6606
|
+
function (obj) {
|
|
6607
|
+
if (obj) {
|
|
6608
|
+
return obj.text;
|
|
6609
|
+
}
|
|
6610
|
+
};
|
|
6611
|
+
/**
|
|
6612
|
+
* @param {?} date
|
|
6613
|
+
* @return {?}
|
|
6614
|
+
*/
|
|
6615
|
+
WebReturnMapperBuilderClass.prototype.getUTCDateTime = /**
|
|
6616
|
+
* @param {?} date
|
|
6617
|
+
* @return {?}
|
|
6618
|
+
*/
|
|
6619
|
+
function (date) {
|
|
6620
|
+
if (date) {
|
|
6621
|
+
return new Date(date).toISOString();
|
|
6622
|
+
}
|
|
6623
|
+
};
|
|
6624
|
+
return WebReturnMapperBuilderClass;
|
|
6625
|
+
}());
|
|
6626
|
+
if (false) {
|
|
6627
|
+
/**
|
|
6628
|
+
* @type {?}
|
|
6629
|
+
* @private
|
|
6630
|
+
*/
|
|
6631
|
+
WebReturnMapperBuilderClass.prototype.document;
|
|
6632
|
+
/**
|
|
6633
|
+
* @type {?}
|
|
6634
|
+
* @private
|
|
6635
|
+
*/
|
|
6636
|
+
WebReturnMapperBuilderClass.prototype.webReturnObject;
|
|
6637
|
+
}
|
|
6638
|
+
|
|
6098
6639
|
/**
|
|
6099
6640
|
* @fileoverview added by tsickle
|
|
6100
6641
|
* Generated from: public-api.ts
|
|
@@ -6107,5 +6648,5 @@ if (false) {
|
|
|
6107
6648
|
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
6108
6649
|
*/
|
|
6109
6650
|
|
|
6110
|
-
export { MapperLibraryComponent, MapperLibraryModule, RJMapperBuilderClass };
|
|
6651
|
+
export { MapperLibraryComponent, MapperLibraryModule, RJMapperBuilderClass, WebReturnMapperBuilderClass };
|
|
6111
6652
|
//# sourceMappingURL=pmcretail-mapper-library.js.map
|