FIX: monto enviado en UF
This commit is contained in:
@ -76,9 +76,15 @@ class Invoice extends AbstractEndPoint
|
|||||||
if ($uf === 0.0) {
|
if ($uf === 0.0) {
|
||||||
throw new InvalidResult("No hay UF para la fecha: {$dateString}", 422);
|
throw new InvalidResult("No hay UF para la fecha: {$dateString}", 422);
|
||||||
}
|
}
|
||||||
|
$valor = $data['amount'];
|
||||||
|
if ($valor > 1000) {
|
||||||
$valor = $data['amount'] / $uf;
|
$valor = $data['amount'] / $uf;
|
||||||
|
}
|
||||||
if (abs($valor - $invoice->cuota->pago->valor()) >= 0.0001) {
|
if (abs($valor - $invoice->cuota->pago->valor()) >= 0.0001) {
|
||||||
throw new InvalidResult("Valor en UF no coincide: {$data['amount']}", 422);
|
throw new InvalidResult("Valor en UF no coincide: {$data['amount']}, {$valor} <=> {$invoice->cuota->pago->valor()}", 422);
|
||||||
|
}
|
||||||
|
if ($invoice->cuota->pago->isPagado()) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return $this->pagoService->depositar($invoice->cuota->pago, $date);
|
return $this->pagoService->depositar($invoice->cuota->pago, $date);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user