Envio de datos editados de Propietario
This commit is contained in:
@ -7,8 +7,10 @@ use Psr\Http\Message\ResponseInterface;
|
|||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
use Incoviba\Common\Ideal\Controller;
|
use Incoviba\Common\Ideal\Controller;
|
||||||
use Incoviba\Common\Implement\Exception\EmptyRedis;
|
use Incoviba\Common\Implement\Exception\EmptyRedis;
|
||||||
|
use Incoviba\Common\Implement\Exception\EmptyResponse;
|
||||||
use Incoviba\Common\Implement\Exception\EmptyResult;
|
use Incoviba\Common\Implement\Exception\EmptyResult;
|
||||||
use Incoviba\Controller\withRedis;
|
use Incoviba\Controller\withRedis;
|
||||||
|
use Incoviba\Exception\InvalidResult;
|
||||||
use Incoviba\Exception\ServiceAction\Read;
|
use Incoviba\Exception\ServiceAction\Read;
|
||||||
use Incoviba\Exception\ServiceAction\Create;
|
use Incoviba\Exception\ServiceAction\Create;
|
||||||
use Incoviba\Exception\ServiceAction\Update;
|
use Incoviba\Exception\ServiceAction\Update;
|
||||||
@ -306,6 +308,7 @@ class Ventas extends Controller
|
|||||||
return $this->withJson($response, $output);
|
return $this->withJson($response, $output);
|
||||||
}
|
}
|
||||||
public function propietario(ServerRequestInterface $request, ResponseInterface $response,
|
public function propietario(ServerRequestInterface $request, ResponseInterface $response,
|
||||||
|
Service\Venta\MediosPago\Toku\Customer $customerService,
|
||||||
Service\Venta\Propietario $propietarioService,
|
Service\Venta\Propietario $propietarioService,
|
||||||
Repository\Venta $ventaRepository, int $venta_id): ResponseInterface
|
Repository\Venta $ventaRepository, int $venta_id): ResponseInterface
|
||||||
{
|
{
|
||||||
@ -335,6 +338,18 @@ class Ventas extends Controller
|
|||||||
} else {
|
} else {
|
||||||
$propietario = $propietarioService->edit($propietario, $data);
|
$propietario = $propietarioService->edit($propietario, $data);
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
$customer = $customerService->getById($propietario->rut);
|
||||||
|
$customerData = [
|
||||||
|
'rut' => $customer['rut'],
|
||||||
|
'nombreCompleto' => $propietario->nombreCompleto(),
|
||||||
|
'email' => $propietario->datos?->email ?? '',
|
||||||
|
'telefono' => $propietario->datos?->telefono ?? ''
|
||||||
|
];
|
||||||
|
$customerService->edit($customer['toku_id'], $customerData);
|
||||||
|
} catch (InvalidResult|EmptyResponse $exception) {
|
||||||
|
$this->logger->warning($exception);
|
||||||
|
}
|
||||||
$output['edited'] = true;
|
$output['edited'] = true;
|
||||||
} catch (EmptyResult|Read|Create|Update) {}
|
} catch (EmptyResult|Read|Create|Update) {}
|
||||||
return $this->withJson($response, $output);
|
return $this->withJson($response, $output);
|
||||||
|
Reference in New Issue
Block a user