@pmcretail/mapper-library 0.0.33 → 0.0.35
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 +41 -60
- 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/WebReturnSalesforceMapper.class.js +42 -61
- package/esm2015/lib/mapper-library.component.js +5 -5
- package/esm2015/lib/mapper-library.module.js +1 -1
- package/esm5/lib/WebReturnSalesforceMapper.class.js +42 -61
- package/esm5/lib/mapper-library.component.js +1 -1
- package/esm5/lib/mapper-library.module.js +1 -1
- package/fesm2015/pmcretail-mapper-library.js +45 -64
- package/fesm2015/pmcretail-mapper-library.js.map +1 -1
- package/fesm5/pmcretail-mapper-library.js +41 -60
- package/fesm5/pmcretail-mapper-library.js.map +1 -1
- package/package.json +1 -1
|
@@ -7499,7 +7499,7 @@ var WebReturnSalesforceMapperBuilderClass = /** @class */ (function () {
|
|
|
7499
7499
|
var transactionPromotionObj = (/** @type {?} */ ({}));
|
|
7500
7500
|
transactionPromotionObj.displayText = transactionPromotion.item_text ? transactionPromotion.item_text : '';
|
|
7501
7501
|
transactionPromotionObj.name = transactionPromotion.coupon_code ? transactionPromotion.coupon_code : (transactionPromotion.item_text ? transactionPromotion.item_text : '');
|
|
7502
|
-
transactionPromotionObj.promotionAmount = transactionPromotion.price ?
|
|
7502
|
+
transactionPromotionObj.promotionAmount = transactionPromotion.price ? Math.abs(transactionPromotion.price) : 0;
|
|
7503
7503
|
transactionPromotionObj.promotionId = transactionPromotion.promotion_id ? transactionPromotion.promotion_id : '';
|
|
7504
7504
|
transactionPromotionObj.promotionInfo = transactionPromotion.item_text ? transactionPromotion.item_text : '';
|
|
7505
7505
|
transactionPromotionObj.promotionType = transactionPromotion.applied_discount && transactionPromotion.applied_discount.type ? transactionPromotion.applied_discount.type : '';
|
|
@@ -7643,66 +7643,47 @@ var WebReturnSalesforceMapperBuilderClass = /** @class */ (function () {
|
|
|
7643
7643
|
*/
|
|
7644
7644
|
function (txDoc, promotion) {
|
|
7645
7645
|
var _this = this;
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
-
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
|
|
7659
|
-
|
|
7660
|
-
|
|
7661
|
-
|
|
7662
|
-
|
|
7663
|
-
|
|
7664
|
-
|
|
7665
|
-
|
|
7666
|
-
|
|
7667
|
-
|
|
7668
|
-
|
|
7669
|
-
|
|
7670
|
-
|
|
7671
|
-
|
|
7672
|
-
|
|
7673
|
-
|
|
7674
|
-
|
|
7675
|
-
* @return {?}
|
|
7676
|
-
*/
|
|
7677
|
-
function (p) {
|
|
7678
|
-
if (promotion.itemLineIds && promotion.itemLineIds.includes(p.itemLineId) && !p.giftCard) {
|
|
7679
|
-
p = _this.validateProductItemDiscount(p);
|
|
7680
|
-
/** @type {?} */
|
|
7681
|
-
var productContributionInTotal = _this.numberUtilService.trimTo2Decimal2(p.itemDiscounts.trnDiscountsPortion) +
|
|
7682
|
-
_this.numberUtilService.trimTo2Decimal2(p.itemDiscounts.trnPromotionsPortion) -
|
|
7683
|
-
_this.numberUtilService.trimTo2Decimal2(p.itemDiscounts.refundPortion);
|
|
7684
|
-
total += (p.total - _this.numberUtilService.trimTo2Decimal2(productContributionInTotal));
|
|
7685
|
-
}
|
|
7686
|
-
}));
|
|
7687
|
-
console.log("ebasket: trnsactionPromotion: " + JSON.stringify(promotion) + ", selected products total: " + total);
|
|
7688
|
-
txDoc.basket.products.forEach((/**
|
|
7689
|
-
* @param {?} product
|
|
7690
|
-
* @return {?}
|
|
7691
|
-
*/
|
|
7692
|
-
function (product) {
|
|
7693
|
-
product = _this.validateProductItemDiscount(product);
|
|
7646
|
+
console.log("ebasket: transactionPromotionProductPortionCalc: trnsactionPromotion: " + JSON.stringify(promotion));
|
|
7647
|
+
if (promotion.type === PROMOTION_TYPE.COUPON && promotion.subLevelType === PROMOTION_LEVEL.LINE) {
|
|
7648
|
+
txDoc.basket.products.forEach((/**
|
|
7649
|
+
* @param {?} product
|
|
7650
|
+
* @return {?}
|
|
7651
|
+
*/
|
|
7652
|
+
function (product) {
|
|
7653
|
+
product = _this.validateProductItemDiscount(product);
|
|
7654
|
+
if (promotion.trigger && promotion.trigger.length > 0) {
|
|
7655
|
+
promotion.trigger.forEach((/**
|
|
7656
|
+
* @param {?} t
|
|
7657
|
+
* @return {?}
|
|
7658
|
+
*/
|
|
7659
|
+
function (t) {
|
|
7660
|
+
if (t.itemLineId === product.itemLineId.toString()) {
|
|
7661
|
+
product.itemDiscounts.trnPromotionsPortion += t.promotionAmount;
|
|
7662
|
+
}
|
|
7663
|
+
}));
|
|
7664
|
+
}
|
|
7665
|
+
}));
|
|
7666
|
+
}
|
|
7667
|
+
else {
|
|
7668
|
+
txDoc.basket.products.forEach((/**
|
|
7669
|
+
* @param {?} product
|
|
7670
|
+
* @return {?}
|
|
7671
|
+
*/
|
|
7672
|
+
function (product) {
|
|
7673
|
+
product = _this.validateProductItemDiscount(product);
|
|
7674
|
+
if (promotion.itemLineIds.includes(+product.itemLineId)) {
|
|
7694
7675
|
/** @type {?} */
|
|
7695
|
-
var
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
}
|
|
7705
|
-
}
|
|
7676
|
+
var productItem = _this.orderDetails.product_items.find((/**
|
|
7677
|
+
* @param {?} productItem
|
|
7678
|
+
* @return {?}
|
|
7679
|
+
*/
|
|
7680
|
+
function (productItem) { return productItem.product_id === product.SKU; }));
|
|
7681
|
+
/** @type {?} */
|
|
7682
|
+
var transactionPromotionPortion = (productItem && productItem.price_after_item_discount && productItem.price_after_order_discount) ?
|
|
7683
|
+
(productItem.price_after_item_discount - productItem.price_after_order_discount) : 0;
|
|
7684
|
+
product.itemDiscounts.trnPromotionsPortion += _this.numberUtilService.trimTo2Decimal2(transactionPromotionPortion);
|
|
7685
|
+
}
|
|
7686
|
+
}));
|
|
7706
7687
|
}
|
|
7707
7688
|
return txDoc;
|
|
7708
7689
|
};
|