diff --git a/src/modules/transaction/transaction/domain/usecases/managers/helpers/mapping-transaction.helper.ts b/src/modules/transaction/transaction/domain/usecases/managers/helpers/mapping-transaction.helper.ts index 719a929..bbc00cf 100644 --- a/src/modules/transaction/transaction/domain/usecases/managers/helpers/mapping-transaction.helper.ts +++ b/src/modules/transaction/transaction/domain/usecases/managers/helpers/mapping-transaction.helper.ts @@ -165,7 +165,7 @@ export function mappingRevertTransaction(data, type) { const discountPercent = discount_value && +discount_value > 0 ? +discount_value / +payment_sub_total - : discount_percentage / 100; + : discount_percentage ?? 0 / 100; const discountValue = payment_sub_total * discountPercent; Object.assign(data, { @@ -192,7 +192,8 @@ export function mappingRevertTransaction(data, type) { item.bundling_items = item.item.bundling_items?.map((bundling) => { if (bundling.item_id) return bundling; - const basePrice = bundling.item_rates ?? bundling.base_price; + const basePrice = + (bundling.item_rates ?? bundling.base_price) * +item.qty; const discount = discountPercent * basePrice; const total = basePrice - discount;