FIX: mapeo de datos al actualizar pago

This commit is contained in:
Juan Pablo Vial
2025-05-15 10:06:35 -04:00
parent 386fe452af
commit 2f481ef8a9

View File

@ -161,7 +161,7 @@ class Toku extends Ideal\Service
$customer = $this->customer->getByExternalId($request['customer']); $customer = $this->customer->getByExternalId($request['customer']);
$invoice = $this->invoice->getByExternalId($request['invoice']); $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 protected function successTransaction(array $input): bool
{ {
@ -253,6 +253,9 @@ class Toku extends Ideal\Service
protected function mapPaymentEventData(array $input): array protected function mapPaymentEventData(array $input): array
{ {
$data = $input['payment']; $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['status'] = 'AUTHORIZED';
$data['date'] = $data['payment_date']; $data['date'] = $data['payment_date'];
return $data; return $data;