Compare commits
3 Commits
91ad1e39f8
...
e9b2fe9963
Author | SHA1 | Date | |
---|---|---|---|
e9b2fe9963 | |||
2f481ef8a9 | |||
386fe452af |
@ -161,7 +161,7 @@ class Toku extends Ideal\Service
|
||||
$customer = $this->customer->getByExternalId($request['customer']);
|
||||
$invoice = $this->invoice->getByExternalId($request['invoice']);
|
||||
|
||||
return $this->invoice->update($invoice['id'], $request);
|
||||
return $this->invoice->update($invoice['toku_id'], $request);
|
||||
}
|
||||
protected function successTransaction(array $input): bool
|
||||
{
|
||||
@ -253,6 +253,9 @@ class Toku extends Ideal\Service
|
||||
protected function mapPaymentEventData(array $input): array
|
||||
{
|
||||
$data = $input['payment'];
|
||||
if (!array_key_exists('amount', $data) and array_key_exists('payment_amount', $data)) {
|
||||
$data['amount'] = $data['payment_amount'];
|
||||
}
|
||||
$data['status'] = 'AUTHORIZED';
|
||||
$data['date'] = $data['payment_date'];
|
||||
return $data;
|
||||
|
@ -76,9 +76,15 @@ class Invoice extends AbstractEndPoint
|
||||
if ($uf === 0.0) {
|
||||
throw new InvalidResult("No hay UF para la fecha: {$dateString}", 422);
|
||||
}
|
||||
$valor = $data['amount'] / $uf;
|
||||
$valor = $data['amount'];
|
||||
if ($valor > 1000) {
|
||||
$valor = $data['amount'] / $uf;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class Pago
|
||||
$pago = $this->process($this->pagoRepository->fetchById($pago->id));
|
||||
$this->getUF($pago);
|
||||
return true;
|
||||
} catch (PDOException) {
|
||||
} catch (PDOException | EmptyResult) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user