fix: wrap order.change access in try-catch to prevent crash on missing rounding_method
This commit is contained in:
parent
ac9b328e51
commit
7279f740cd
@ -899,7 +899,13 @@ patch(PosPrinterService.prototype, {
|
||||
paymentAmount = typeof order.amountPaid === 'number' ? order.amountPaid : total;
|
||||
}
|
||||
|
||||
const change = typeof order.change === 'number' ? Math.max(0, order.change) : 0;
|
||||
let change = 0;
|
||||
try {
|
||||
// Accessing order.change might throw if rounding_method is undefined in config
|
||||
change = typeof order.change === 'number' ? Math.max(0, order.change) : 0;
|
||||
} catch (error) {
|
||||
console.warn('[BluetoothPrint] Error accessing order.change (likely asymmetricRound issue):', error);
|
||||
}
|
||||
|
||||
const paymentData = { method: paymentMethod, amount: paymentAmount, change };
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user