Mapeo de JSONs

This commit is contained in:
Juan Pablo Vial
2025-01-17 16:56:03 -03:00
parent a5572e7c6a
commit 079fd3bc74

View File

@ -21,6 +21,12 @@ class Facturas extends Controller
'success' => false
];
try {
foreach (['cliente', 'unidades', 'detalle', 'total', 'uf'] as $key) {
if (!isset($data[$key]) or empty($data[$key])) {
continue;
}
$data[$key] = json_decode($data[$key], true);
}
$output['factura'] = $facturaService->add($data);
$output['success'] = true;
} catch (Implement\Exception\EmptyResult) {