pos_cashdro_refund: fix change lines
This commit is contained in:
parent
b7e8f8967c
commit
d994ab600e
1 changed files with 4 additions and 1 deletions
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue