diff --git a/pos_cashdro_refund/static/src/js/payment_cashdro_refund.esm.js b/pos_cashdro_refund/static/src/js/payment_cashdro_refund.esm.js index de8bc67..05e812b 100644 --- a/pos_cashdro_refund/static/src/js/payment_cashdro_refund.esm.js +++ b/pos_cashdro_refund/static/src/js/payment_cashdro_refund.esm.js @@ -77,7 +77,10 @@ PaymentCashdro.prototype._cashdro_send_refund_request = async function (order) { const data = JSON.parse(operation_data.data); payment_line.cashdro_operation_data = data; // CashDro reports the dispensed amount in totalout for payouts. - const dispensed = data.operation.totalout / 100; + // The API may return totalout as a negative value (money going out), + // so we use Math.abs to get the magnitude and explicitly set the + // payment line to a negative amount (refund to customer). + const dispensed = Math.abs(data.operation.totalout) / 100; payment_line.set_amount(-dispensed); return true; };