fix: transaction NaN without discount
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
34ae5964c4
commit
22f4e732db
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue