fix: add capture error when calculate pos formula
continuous-integration/drone/push Build is passing Details

pull/107/head
shancheas 2024-10-07 05:58:45 +07:00
parent c5590ab7b1
commit e6066b534c
1 changed files with 15 additions and 8 deletions

View File

@ -81,21 +81,28 @@ export class PosTransactionHandler implements IEventHandler<ChangeDocEvent> {
// }; // };
// }); // });
const { dpp_value, tax_datas, other } = await this.calculator.calculate(
data,
);
mappingRevertTransaction(data, TransactionType.COUNTER); mappingRevertTransaction(data, TransactionType.COUNTER);
Object.assign(data, { Object.assign(data, {
taxes: tax_datas,
payment_total_dpp: dpp_value,
profit_share_formula: profit_formula.formula_string, profit_share_formula: profit_formula.formula_string,
sales_price_formula: sales_formula.formula_string, sales_price_formula: sales_formula.formula_string,
payment_total_share: other.total_profit_share,
payment_total_tax: other.payment_total_tax,
}); });
try {
const { dpp_value, tax_datas, other } =
await this.calculator.calculate(data);
Object.assign(data, {
taxes: tax_datas,
payment_total_dpp: dpp_value,
profit_share_formula: profit_formula.formula_string,
sales_price_formula: sales_formula.formula_string,
payment_total_share: other.total_profit_share,
payment_total_tax: other.payment_total_tax,
});
} catch (error) {
apm.captureError(error);
}
apmTransactions.setLabel('Id', data?.id); apmTransactions.setLabel('Id', data?.id);
apmTransactions.setLabel('Code', data?.code); apmTransactions.setLabel('Code', data?.code);
apmTransactions.setLabel('Status', data?.status); apmTransactions.setLabel('Status', data?.status);