pos_cashdro_refund: fix change lines

This commit is contained in:
Luis 2026-04-27 13:26:03 +02:00
parent b7e8f8967c
commit d994ab600e

View file

@ -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;
};