@pmcretail/mapper-library 0.0.46 → 0.0.48

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.
@@ -93,6 +93,7 @@
93
93
  (function (PROVIDERS) {
94
94
  PROVIDERS["SALESFORCE"] = "Salesforce";
95
95
  PROVIDERS["MAGENTO"] = "Magento";
96
+ PROVIDERS["MAGENTO2"] = "Magento2";
96
97
  })(PROVIDERS || (PROVIDERS = {}));
97
98
  var PROMOTION_LEVEL;
98
99
  (function (PROMOTION_LEVEL) {
@@ -4146,10 +4147,10 @@
4146
4147
  return WebReturnSalesforceMapperBuilderClass;
4147
4148
  }());
4148
4149
 
4149
- var WebReturnMagentoV2RestMapperBuilderClass = /** @class */ (function () {
4150
- function WebReturnMagentoV2RestMapperBuilderClass(orderDetails, currencyPipe) {
4150
+ var WebReturnMagento2RestV1MapperBuilderClass = /** @class */ (function () {
4151
+ function WebReturnMagento2RestV1MapperBuilderClass(orderDetails, currencyPipe) {
4151
4152
  this.currencyPipe = currencyPipe;
4152
- this.className = "WebReturnMagentoV2RestMapperBuilderClass";
4153
+ this.className = "WebReturnMagento2RestV1MapperBuilderClass";
4153
4154
  this.webReturnObject = {
4154
4155
  id: '',
4155
4156
  orgCode: "",
@@ -4176,16 +4177,16 @@
4176
4177
  postCode: '',
4177
4178
  noCustomerSelected: false
4178
4179
  },
4179
- currentTransactionDetails: {}
4180
+ currentTransactionDetails: {},
4181
+ externalTransactionDetails: []
4180
4182
  };
4181
4183
  if (orderDetails) {
4182
4184
  this.orderDetails = orderDetails;
4183
4185
  }
4184
4186
  this.numberUtilService = new NumberUtilService(currencyPipe);
4185
4187
  }
4186
- WebReturnMagentoV2RestMapperBuilderClass.prototype.webReturnCommonMapper = function () {
4187
- appLogger_service.AppLoggerService.logDebug(this.className, "webReturnCommonMapper", "webReturnCommonMapper started...");
4188
- // this.webReturnObject['type'] = TRANSACTION_TYPE.WEB_RETURNS; // TODO
4188
+ WebReturnMagento2RestV1MapperBuilderClass.prototype.webReturnCommonMapper = function () {
4189
+ appLogger_service.AppLoggerService.logDebug(this.className, "webReturnCommonMapper", "Mapping started...");
4189
4190
  this.webReturnObject['datetime'] = this.getUTCDateTime(this.orderDetails.updated_at);
4190
4191
  this.webReturnObject.baseCurrency = this.orderDetails.order_currency_code;
4191
4192
  this.webReturnObject.subsidiaryId = '1';
@@ -4195,218 +4196,223 @@
4195
4196
  this.webReturnObject.updatedAt = this.getUTCDateTime(this.orderDetails.updated_at);
4196
4197
  this.webReturnObject.transCompletedAt = this.getUTCDateTime(this.orderDetails.updated_at);
4197
4198
  this.webReturnObject['externalTransactionId'] = this.orderDetails.increment_id;
4198
- appLogger_service.AppLoggerService.logDebug(this.className, "webReturnCommonMapper", "webReturnCommonMapper ended...");
4199
+ appLogger_service.AppLoggerService.logDebug(this.className, "webReturnCommonMapper", "Mapping ended...");
4199
4200
  return this;
4200
4201
  };
4201
- // getDeliveryMethod() {
4202
- // if(this.orderDetails.shipments && this.orderDetails.shipments.length > 0) {
4203
- // const shipToStoreShipment = this.orderDetails.shipments.find(shipment => shipment.c_fromStoreId);
4204
- // if(shipToStoreShipment) return DELIVERY_METHODS.SHIP_TO_STORE;
4205
- // else return DELIVERY_METHODS.DELIVERY;
4206
- // } else {
4207
- // return '';
4208
- // }
4209
- // }
4210
- WebReturnMagentoV2RestMapperBuilderClass.prototype.product = function () {
4211
- var _this = this;
4212
- appLogger_service.AppLoggerService.logDebug(this.className, "product", "product mapping started...");
4213
- this.webReturnObject.basket['products'] = [];
4214
- if (this.orderDetails.items && this.orderDetails.items.length > 0) {
4215
- var index_1 = 0;
4216
- this.orderDetails.items.forEach(function (product) {
4217
- if (product && product.base_price) {
4218
- var productObj = {
4219
- description: product.name ? product.name : '',
4220
- SKU: product.sku ? product.sku : '',
4221
- quantity: product.qty_ordered ? product.qty_ordered : 0,
4222
- refundedQuantity: product.qty_refunded ? product.qty_refunded : 0,
4223
- price: product.base_price ? product.base_price : 0,
4224
- itemLineId: (index_1 + 1).toString(),
4225
- externalItemLineId: product.item_id ? product.item_id : (index_1 + 1).toString(),
4226
- // deliveryMethod: this.getDeliveryMethod().toString(),
4227
- totalLinePrice: (product.qty_ordered && product.base_price) ? (product.qty_ordered * product.base_price) : 0
4228
- };
4229
- _this.webReturnObject.basket['products'].push(productObj);
4230
- index_1++;
4231
- }
4202
+ WebReturnMagento2RestV1MapperBuilderClass.prototype.product = function () {
4203
+ var _a;
4204
+ appLogger_service.AppLoggerService.logDebug(this.className, "product", "Mapping started...");
4205
+ this.webReturnObject.basket['products'] = ((_a = this.orderDetails.items) === null || _a === void 0 ? void 0 : _a.filter(function (product) { return product === null || product === void 0 ? void 0 : product.base_price; }).map(function (product, index) {
4206
+ var _a, _b;
4207
+ return ({
4208
+ description: product.name || '',
4209
+ SKU: product.sku || '',
4210
+ quantity: product.qty_ordered || 0,
4211
+ refundedQuantity: product.qty_refunded || 0,
4212
+ price: product.base_price || 0,
4213
+ itemLineId: (index + 1).toString(),
4214
+ externalItemLineId: product.item_id || (index + 1).toString(),
4215
+ totalLinePrice: ((_a = product.qty_ordered) !== null && _a !== void 0 ? _a : 0) * ((_b = product.base_price) !== null && _b !== void 0 ? _b : 0),
4216
+ refundedTotal: product.amount_refunded || 0
4232
4217
  });
4233
- }
4234
- appLogger_service.AppLoggerService.logDebug(this.className, "product", "product mapping ended...");
4218
+ })) || [];
4219
+ appLogger_service.AppLoggerService.logDebug(this.className, "product", "Mapping ended...");
4235
4220
  return this;
4236
4221
  };
4237
- WebReturnMagentoV2RestMapperBuilderClass.prototype.linePromotion = function () {
4222
+ WebReturnMagento2RestV1MapperBuilderClass.prototype.linePromotion = function () {
4238
4223
  var _this = this;
4239
- appLogger_service.AppLoggerService.logDebug(this.className, "linePromotion", "linePromotion mapping started...");
4240
- this.webReturnObject.basket['linePromotion'] = [];
4241
- if (this.orderDetails.items && this.orderDetails.items.length > 0) {
4242
- var index_2 = 0;
4243
- this.orderDetails.items.forEach(function (product) {
4244
- if (product && product.base_price) {
4245
- var linePromotionObj = {};
4246
- var trigger = {};
4247
- trigger.itemLineId = (index_2 + 1).toString();
4248
- trigger.quantity = product.qty_ordered ? product.qty_ordered : 0;
4249
- linePromotionObj.trigger = [];
4250
- linePromotionObj.trigger.push(trigger);
4251
- linePromotionObj.itemLineId = index_2 + 1;
4252
- linePromotionObj.promotionId = '';
4253
- linePromotionObj.displayText = _this.orderDetails.coupon_code ? _this.orderDetails.coupon_code : '';
4254
- linePromotionObj.promotionType = '';
4255
- linePromotionObj.promotionAmount = product.discount_amount ? product.discount_amount : 0;
4256
- linePromotionObj.name = _this.orderDetails.coupon_code ? _this.orderDetails.coupon_code : '';
4257
- ;
4258
- linePromotionObj.promotionInfo = '';
4259
- linePromotionObj.promotionLinePrice = product.row_total ? product.row_total : 0;
4260
- _this.webReturnObject.basket.linePromotion.push(linePromotionObj);
4261
- index_2++;
4262
- }
4263
- });
4264
- }
4265
- appLogger_service.AppLoggerService.logDebug(this.className, "linePromotion", "linePromotion mapping ended...");
4224
+ var _a;
4225
+ appLogger_service.AppLoggerService.logDebug(this.className, "linePromotion", "Mapping started...");
4226
+ this.webReturnObject.basket['linePromotion'] = ((_a = this.orderDetails.items) === null || _a === void 0 ? void 0 : _a.filter(function (product) { return (product === null || product === void 0 ? void 0 : product.base_price) && product.discount_amount; }).map(function (product, index) { return ({
4227
+ trigger: [{
4228
+ itemLineId: (index + 1).toString(),
4229
+ quantity: product.qty_ordered || 0
4230
+ }],
4231
+ itemLineId: index + 1,
4232
+ promotionId: '',
4233
+ displayText: _this.orderDetails.coupon_code || '',
4234
+ promotionType: '',
4235
+ promotionAmount: product.discount_amount || 0,
4236
+ name: _this.orderDetails.coupon_code || '',
4237
+ promotionInfo: '',
4238
+ promotionLinePrice: product.row_total || 0
4239
+ }); })) || [];
4240
+ appLogger_service.AppLoggerService.logDebug(this.className, "linePromotion", "Mapping ended...");
4266
4241
  return this;
4267
4242
  };
4268
- WebReturnMagentoV2RestMapperBuilderClass.prototype.customer = function () {
4269
- var _this = this;
4270
- appLogger_service.AppLoggerService.logDebug(this.className, "customer", "customer mapping started...");
4271
- this.webReturnObject.customer.id = this.orderDetails.customer_id ? this.orderDetails.customer_id : '';
4272
- this.webReturnObject.customer.email = this.orderDetails.customer_email ? this.orderDetails.customer_email : '';
4273
- this.webReturnObject.customer.firstName = this.orderDetails.customer_firstname ? this.orderDetails.customer_firstname : '';
4274
- this.webReturnObject.customer.lastName = this.orderDetails.customer_lastname ? this.orderDetails.customer_lastname : '';
4275
- var isShipping = this.orderDetails.extension_attributes &&
4276
- Object.values(this.orderDetails.extension_attributes).length > 0 && this.orderDetails.extension_attributes.shipping_assignments &&
4277
- this.orderDetails.extension_attributes.shipping_assignments.length > 0;
4278
- if (isShipping) {
4279
- this.orderDetails.extension_attributes.shipping_assignments.forEach(function (shipment) {
4280
- if (shipment.shipping && Object.values(shipment.shipping) && shipment.shipping.address && Object.values(shipment.shipping.address)) {
4281
- var address = shipment.shipping.address;
4282
- var shippingAddressObj = {};
4283
- shippingAddressObj.id = address.customer_address_id ? address.customer_address_id : '';
4284
- shippingAddressObj.countryCode = address.country_id ? address.country_id : '';
4285
- if (address.street && address.street.length > 0) {
4286
- shippingAddressObj.address1 = address.street[0] ? address.street[0] : '';
4287
- shippingAddressObj.address2 = address.street[1] ? address.street[1] : '';
4288
- shippingAddressObj.address3 = address.street[2] ? address.street[2] : '';
4289
- }
4290
- shippingAddressObj.city = address.city ? address.city : '';
4291
- shippingAddressObj.country = '';
4292
- shippingAddressObj.postCode = address.postcode ? address.postcode : '';
4293
- _this.webReturnObject.customer.shippingAddress.push(shippingAddressObj);
4294
- }
4243
+ WebReturnMagento2RestV1MapperBuilderClass.prototype.customer = function () {
4244
+ var _a, _b, _c, _d;
4245
+ appLogger_service.AppLoggerService.logDebug(this.className, "customer", "Mapping started...");
4246
+ var _e = this, orderDetails = _e.orderDetails, webReturnObject = _e.webReturnObject;
4247
+ webReturnObject.customer = {
4248
+ id: orderDetails.customer_id || '',
4249
+ email: orderDetails.customer_email || '',
4250
+ firstName: orderDetails.customer_firstname || '',
4251
+ lastName: orderDetails.customer_lastname || '',
4252
+ shippingAddress: [],
4253
+ billingAddress: []
4254
+ };
4255
+ var shippingAssignments = ((_a = orderDetails.extension_attributes) === null || _a === void 0 ? void 0 : _a.shipping_assignments) || [];
4256
+ webReturnObject.customer.shippingAddress = shippingAssignments
4257
+ .filter(function (shipment) { var _a; return (_a = shipment === null || shipment === void 0 ? void 0 : shipment.shipping) === null || _a === void 0 ? void 0 : _a.address; })
4258
+ .map(function (shipment) {
4259
+ var _a, _b, _c;
4260
+ var address = shipment.shipping.address;
4261
+ return {
4262
+ id: address.customer_address_id || '',
4263
+ countryCode: address.country_id || '',
4264
+ address1: ((_a = address.street) === null || _a === void 0 ? void 0 : _a[0]) || '',
4265
+ address2: ((_b = address.street) === null || _b === void 0 ? void 0 : _b[1]) || '',
4266
+ address3: ((_c = address.street) === null || _c === void 0 ? void 0 : _c[2]) || '',
4267
+ city: address.city || '',
4268
+ country: '',
4269
+ postCode: address.postcode || ''
4270
+ };
4271
+ });
4272
+ var billingAddress = orderDetails.billing_address;
4273
+ if (billingAddress) {
4274
+ webReturnObject.customer.billingAddress.push({
4275
+ id: billingAddress.customer_address_id || '',
4276
+ countryCode: billingAddress.country_id || '',
4277
+ address1: ((_b = billingAddress.street) === null || _b === void 0 ? void 0 : _b[0]) || '',
4278
+ address2: ((_c = billingAddress.street) === null || _c === void 0 ? void 0 : _c[1]) || '',
4279
+ address3: ((_d = billingAddress.street) === null || _d === void 0 ? void 0 : _d[2]) || '',
4280
+ city: billingAddress.city || '',
4281
+ country: '',
4282
+ postCode: billingAddress.postcode || ''
4295
4283
  });
4296
4284
  }
4297
- if (this.orderDetails.billing_address && Object.values(this.orderDetails.billing_address).length > 0) {
4298
- var address = this.orderDetails.billing_address;
4299
- var billingAddressObj = {};
4300
- billingAddressObj.id = address.customer_address_id ? address.customer_address_id : '';
4301
- billingAddressObj.countryCode = address.country_id ? address.country_id : '';
4302
- if (address.street && address.street.length > 0) {
4303
- billingAddressObj.address1 = address.street[0] ? address.street[0] : '';
4304
- billingAddressObj.address2 = address.street[1] ? address.street[1] : '';
4305
- billingAddressObj.address3 = address.street[2] ? address.street[2] : '';
4306
- }
4307
- billingAddressObj.city = address.city ? address.city : '';
4308
- billingAddressObj.country = '';
4309
- billingAddressObj.postCode = address.postcode ? address.postcode : '';
4310
- this.webReturnObject.customer.shippingAddress.push(billingAddressObj);
4311
- }
4312
- // let shipmentDetails = [] as ShipmentDetails[];
4313
- // this.orderDetails.shipments.forEach(
4314
- // shipment => {
4315
- // let shipmentDetailsObj = {} as ShipmentDetails;
4316
- // shipmentDetailsObj.id = shipment.shipment_id ? shipment.shipment_id : '';
4317
- // shipmentDetailsObj.deliveryGroup = shipment.shipment_id ? shipment.shipment_id : '';
4318
- // shipmentDetails.push(shipmentDetailsObj);
4319
- // }
4320
- // );
4321
- // customerObj.shipmentDetails = shipmentDetails;
4322
- // this.webReturnObject.customer = customerObj;
4323
- appLogger_service.AppLoggerService.logDebug(this.className, "customer", "customer mapping ended...");
4285
+ appLogger_service.AppLoggerService.logDebug(this.className, "customer", "Mpping ended...");
4324
4286
  return this;
4325
4287
  };
4326
- WebReturnMagentoV2RestMapperBuilderClass.prototype.isInStoreOrder = function () {
4327
- appLogger_service.AppLoggerService.logDebug(this.className, "isInStoreOrder", "isInStoreOrder mapping started...");
4288
+ WebReturnMagento2RestV1MapperBuilderClass.prototype.isInStoreOrder = function () {
4289
+ appLogger_service.AppLoggerService.logDebug(this.className, "isInStoreOrder", "Mapping started...");
4328
4290
  this.webReturnObject.isInStoreOrder = false;
4329
- appLogger_service.AppLoggerService.logDebug(this.className, "isInStoreOrder", "isInStoreOrder mapping ended...");
4291
+ appLogger_service.AppLoggerService.logDebug(this.className, "isInStoreOrder", "Mapping ended...");
4330
4292
  return this;
4331
4293
  };
4332
- WebReturnMagentoV2RestMapperBuilderClass.prototype.externalTransactionDetails = function () {
4333
- appLogger_service.AppLoggerService.logDebug(this.className, "externalTransactionDetails", "externalTransactionDetails mapping started...");
4334
- var externalTransactionDetails = [];
4335
- var externalTransactionDetailsObj = {};
4336
- var transactionInfo = {};
4337
- externalTransactionDetailsObj.uniqueId = this.orderDetails.increment_id ? this.orderDetails.increment_id : '';
4338
- externalTransactionDetailsObj.providerType = PROVIDERS.MAGENTO;
4339
- externalTransactionDetails.push(externalTransactionDetailsObj);
4340
- this.webReturnObject.externalTransactionDetails = externalTransactionDetails;
4341
- appLogger_service.AppLoggerService.logDebug(this.className, "externalTransactionDetails", "externalTransactionDetails mapping ended...");
4294
+ WebReturnMagento2RestV1MapperBuilderClass.prototype.externalTransactionDetails = function (invoiceId) {
4295
+ appLogger_service.AppLoggerService.logDebug(this.className, "externalTransactionDetails", "Mapping started...");
4296
+ var coupon = this.orderDetails.coupon_code
4297
+ ? { name: this.orderDetails.coupon_code, id: this.orderDetails.coupon_code }
4298
+ : null;
4299
+ var externalTransactionDetailsObj = {
4300
+ uniqueId: this.orderDetails.increment_id || '',
4301
+ providerType: PROVIDERS.MAGENTO2,
4302
+ details: { invoiceId: (invoiceId === null || invoiceId === void 0 ? void 0 : invoiceId.toString()) || '' },
4303
+ coupons: coupon ? [coupon] : []
4304
+ };
4305
+ this.webReturnObject.externalTransactionDetails.push(externalTransactionDetailsObj);
4306
+ appLogger_service.AppLoggerService.logDebug(this.className, "externalTransactionDetails", "Mapping ended...");
4342
4307
  return this;
4343
4308
  };
4344
- WebReturnMagentoV2RestMapperBuilderClass.prototype.basketSummary = function () {
4345
- appLogger_service.AppLoggerService.logDebug(this.className, "basketSummary", "basketSummary mapping started...");
4346
- var basketSummary = {};
4347
- var basketSummaryWebOrder = {};
4348
- var linePromotionTotal = this.webReturnObject.basket.linePromotion.map(function (linePromotion) { return linePromotion.promotionAmount; }).reduce(function (accumulator, currentValue) { return accumulator + currentValue; }, 0);
4349
- var transactionPromotionTotal = 0;
4350
- basketSummary.discountTotal = linePromotionTotal + transactionPromotionTotal;
4351
- basketSummary.VATTotal = this.orderDetails.tax_amount ? this.orderDetails.tax_amount : 0;
4352
- basketSummary.saleTotal = this.orderDetails.subtotal ? this.orderDetails.subtotal : 0;
4353
- basketSummary.basketTotal = (this.orderDetails.subtotal && this.orderDetails.total_online_refunded) ? (this.orderDetails.subtotal - this.orderDetails.total_online_refunded) : 0;
4354
- basketSummary.totalItems = this.orderDetails.total_qty_ordered ? this.orderDetails.total_qty_ordered.length : 0;
4355
- basketSummary.shippingTotal = this.orderDetails.shipping_incl_tax ? this.orderDetails.shipping_incl_tax : 0;
4356
- basketSummary.basketTotalWithShippingTotal = this.orderDetails.total_invoiced ? this.orderDetails.total_invoiced : 0;
4357
- basketSummaryWebOrder.shippingTotal = this.orderDetails.shipping_incl_tax ? this.orderDetails.shipping_incl_tax : 0;
4358
- basketSummaryWebOrder.basketTotalWithShippingTotal = this.orderDetails.total_invoiced ? this.orderDetails.total_invoiced : 0;
4359
- basketSummary.webOrder = basketSummaryWebOrder;
4360
- this.webReturnObject.basketSummary = basketSummary;
4361
- appLogger_service.AppLoggerService.logDebug(this.className, "basketSummary", "basketSummary mapping ended...");
4309
+ WebReturnMagento2RestV1MapperBuilderClass.prototype.basketSummary = function () {
4310
+ var _a;
4311
+ appLogger_service.AppLoggerService.logDebug(this.className, "basketSummary", "Mapping started...");
4312
+ var _e = this, orderDetails = _e.orderDetails, webReturnObject = _e.webReturnObject;
4313
+ var basketSummary = {
4314
+ discountTotal: orderDetails.discount_amount || 0,
4315
+ VATTotal: orderDetails.tax_amount || 0,
4316
+ saleTotal: orderDetails.subtotal || 0,
4317
+ basketTotal: (orderDetails.subtotal || 0) - (orderDetails.total_online_refunded || 0),
4318
+ totalItems: (_a = orderDetails.total_qty_ordered) !== null && _a !== void 0 ? _a : 0,
4319
+ refundTotal: orderDetails.total_online_refunded || 0,
4320
+ shippingTotal: orderDetails.shipping_incl_tax || 0,
4321
+ basketTotalWithShippingTotal: orderDetails.total_invoiced || 0,
4322
+ webOrder: {
4323
+ shippingTotal: orderDetails.shipping_incl_tax || 0,
4324
+ basketTotalWithShippingTotal: orderDetails.total_invoiced || 0
4325
+ }
4326
+ };
4327
+ webReturnObject.basketSummary = basketSummary;
4328
+ appLogger_service.AppLoggerService.logDebug(this.className, "basketSummary", "Mapping ended...");
4329
+ return this;
4330
+ };
4331
+ WebReturnMagento2RestV1MapperBuilderClass.prototype.refundRequest = function () {
4332
+ var _a;
4333
+ appLogger_service.AppLoggerService.logDebug(this.className, "refundRequest", "Mapping started...");
4334
+ this.webReturnObject.refundRequest = ((_a = this.orderDetails.items) === null || _a === void 0 ? void 0 : _a.filter(function (product) { return (product === null || product === void 0 ? void 0 : product.base_price) && (product.qty_refunded || 0) > 0; }).map(function (product, index) { return ({
4335
+ itemLineId: index + 1,
4336
+ refundedQuantity: product.qty_refunded || 0,
4337
+ refundWithPromotion: true,
4338
+ quantity: product.qty_ordered || 0
4339
+ }); })) || [];
4340
+ appLogger_service.AppLoggerService.logDebug(this.className, "refundRequest", "Mapped " + this.webReturnObject.refundRequest.length + " refund items.");
4341
+ appLogger_service.AppLoggerService.logDebug(this.className, "refundRequest", "Mapping ended...");
4362
4342
  return this;
4363
4343
  };
4364
- WebReturnMagentoV2RestMapperBuilderClass.prototype.deviceId = function (deviceId) {
4344
+ WebReturnMagento2RestV1MapperBuilderClass.prototype.updateTaxBreakdown = function () {
4345
+ var _this = this;
4346
+ var _a;
4347
+ appLogger_service.AppLoggerService.logDebug(this.className, "updateTaxBreakdown", "Mapping started...");
4348
+ var taxLines = ((_a = this.orderDetails.items) === null || _a === void 0 ? void 0 : _a.filter(function (product) { return product === null || product === void 0 ? void 0 : product.base_price; }).map(function (product, index) {
4349
+ var taxableAmount = product.row_total_incl_tax || 0;
4350
+ var VAT = product.tax_percent || 0;
4351
+ var preTax = _this.numberUtilService.trimTo2Decimal2((taxableAmount * 100) / (100 + VAT));
4352
+ var taxLineTotal = _this.numberUtilService.trimTo2Decimal2(taxableAmount - preTax);
4353
+ return {
4354
+ itemLineId: index + 1,
4355
+ VAT: VAT,
4356
+ VATCode: '',
4357
+ taxableAmount: taxableAmount,
4358
+ PreTax: preTax,
4359
+ taxLineTotal: taxLineTotal
4360
+ };
4361
+ })) || [];
4362
+ this.webReturnObject.basket["taxBreakdown"] = {
4363
+ taxLines: taxLines,
4364
+ totalTaxableAmount: this.orderDetails.tax_amount || 0
4365
+ };
4366
+ appLogger_service.AppLoggerService.logDebug(this.className, "updateTaxBreakdown", "Mapped " + taxLines.length + " tax lines.");
4367
+ appLogger_service.AppLoggerService.logDebug(this.className, "updateTaxBreakdown", "Mapping ended...");
4368
+ return this;
4369
+ };
4370
+ WebReturnMagento2RestV1MapperBuilderClass.prototype.deviceId = function (deviceId) {
4365
4371
  this.webReturnObject.deviceId = deviceId;
4366
4372
  return this;
4367
4373
  };
4368
- WebReturnMagentoV2RestMapperBuilderClass.prototype.terminalId = function (terminalId) {
4374
+ WebReturnMagento2RestV1MapperBuilderClass.prototype.terminalId = function (terminalId) {
4369
4375
  this.webReturnObject.terminalId = terminalId;
4370
4376
  return this;
4371
4377
  };
4372
- WebReturnMagentoV2RestMapperBuilderClass.prototype.orgCode = function (orgCode) {
4378
+ WebReturnMagento2RestV1MapperBuilderClass.prototype.orgCode = function (orgCode) {
4373
4379
  this.webReturnObject.orgCode = orgCode;
4374
4380
  return this;
4375
4381
  };
4376
- WebReturnMagentoV2RestMapperBuilderClass.prototype.storeId = function () {
4382
+ WebReturnMagento2RestV1MapperBuilderClass.prototype.storeId = function () {
4377
4383
  this.webReturnObject.storeId = this.orderDetails.store_id;
4378
4384
  return this;
4379
4385
  };
4380
- WebReturnMagentoV2RestMapperBuilderClass.prototype.storeNodeId = function (storeNodeId) {
4386
+ WebReturnMagento2RestV1MapperBuilderClass.prototype.storeNodeId = function (storeNodeId) {
4381
4387
  this.webReturnObject.storeNodeId = storeNodeId;
4382
4388
  return this;
4383
4389
  };
4384
- WebReturnMagentoV2RestMapperBuilderClass.prototype.storeNodeStructure = function (storeNodeStructure) {
4390
+ WebReturnMagento2RestV1MapperBuilderClass.prototype.storeNodeStructure = function (storeNodeStructure) {
4385
4391
  this.webReturnObject.storeNodeStructure = storeNodeStructure;
4386
4392
  return this;
4387
4393
  };
4388
- WebReturnMagentoV2RestMapperBuilderClass.prototype.docId = function (docId) {
4394
+ WebReturnMagento2RestV1MapperBuilderClass.prototype.docId = function (docId) {
4389
4395
  this.webReturnObject.id = docId;
4390
4396
  return this;
4391
4397
  };
4392
- WebReturnMagentoV2RestMapperBuilderClass.prototype.updateUserID = function (userID) {
4398
+ WebReturnMagento2RestV1MapperBuilderClass.prototype.updateUserID = function (userID) {
4393
4399
  this.webReturnObject.userId = userID;
4394
4400
  return this;
4395
4401
  };
4396
- WebReturnMagentoV2RestMapperBuilderClass.prototype.updateUserName = function (name) {
4402
+ WebReturnMagento2RestV1MapperBuilderClass.prototype.updateUserName = function (name) {
4397
4403
  this.webReturnObject.userName = name;
4398
4404
  return this;
4399
4405
  };
4400
- WebReturnMagentoV2RestMapperBuilderClass.prototype.build = function () {
4401
- appLogger_service.AppLoggerService.logDebug(this.className, "build", "mapping done...");
4406
+ WebReturnMagento2RestV1MapperBuilderClass.prototype.build = function () {
4407
+ appLogger_service.AppLoggerService.logDebug(this.className, "build", "Mapping done...");
4402
4408
  return this.webReturnObject;
4403
4409
  };
4404
- WebReturnMagentoV2RestMapperBuilderClass.prototype.getUTCDateTime = function (date) {
4410
+ WebReturnMagento2RestV1MapperBuilderClass.prototype.getUTCDateTime = function (date) {
4405
4411
  if (date) {
4406
4412
  return new Date(date).toISOString();
4407
4413
  }
4408
4414
  };
4409
- return WebReturnMagentoV2RestMapperBuilderClass;
4415
+ return WebReturnMagento2RestV1MapperBuilderClass;
4410
4416
  }());
4411
4417
 
4412
4418
  /*
@@ -4420,7 +4426,7 @@
4420
4426
  exports.MapperLibraryComponent = MapperLibraryComponent;
4421
4427
  exports.MapperLibraryModule = MapperLibraryModule;
4422
4428
  exports.RJMapperBuilderClass = RJMapperBuilderClass;
4423
- exports.WebReturnMagentoV2RestMapperBuilderClass = WebReturnMagentoV2RestMapperBuilderClass;
4429
+ exports.WebReturnMagento2RestV1MapperBuilderClass = WebReturnMagento2RestV1MapperBuilderClass;
4424
4430
  exports.WebReturnMapperBuilderClass = WebReturnMapperBuilderClass;
4425
4431
  exports.WebReturnSalesforceMapperBuilderClass = WebReturnSalesforceMapperBuilderClass;
4426
4432