Opcion de enviar update a los servicios externos

This commit is contained in:
Juan Pablo Vial
2025-05-16 19:14:20 -04:00
parent 105179b4ed
commit b7c5e4ebc3
9 changed files with 44 additions and 8 deletions

View File

@ -214,7 +214,9 @@ class Toku extends Ideal\Service
'telefono' => $propietario->datos?->telefono ?? ''
];
$this->customer->edit($customer['toku_id'], $editData);
} catch (EmptyResponse) {}
} catch (EmptyResponse $exception) {
$this->logger->warning($exception);
}
foreach ($cuotas as $cuota) {
try {
$invoice = $this->invoice->getById($cuota->id);
@ -222,7 +224,8 @@ class Toku extends Ideal\Service
'customer' => $customer['toku_id'],
'product_id' => $subscription->venta->id,
'subscription' => $subscription->toku_id,
'cuota' => $cuota
'cuota' => $cuota,
'venta' => $subscription->venta
];
try {
$this->invoice->edit($invoice['toku_id'], $editData);
@ -232,7 +235,8 @@ class Toku extends Ideal\Service
'customer' => $customer['toku_id'],
'product_id' => $subscription->venta->id,
'subscription' => $subscription->toku_id,
'cuota' => $cuota
'cuota' => $cuota,
'venta' => $subscription->venta
];
try {
$this->invoice->add($invoiceData);

View File

@ -17,7 +17,8 @@ class Invoice extends AbstractEndPoint
{
public function __construct(ClientInterface $client,
protected Repository\Venta\MediosPago\Toku\Invoice $invoiceRepository,
protected Pago $pagoService, protected UF $ufService)
protected Pago $pagoService,
protected UF $ufService)
{
parent::__construct($client);
}

View File

@ -59,6 +59,9 @@ class Subscription extends AbstractEndPoint
$existingSubscriptions = [];
try {
$existingSubscriptions = $this->subscriptionRepsitory->fetchByVentas($ids);
array_walk($existingSubscriptions, function(&$subscription) {
$subscription->venta = $this->ventaService->getById($subscription->venta->id);
});
} catch (EmptyResult) {}
if (count($existingSubscriptions) === 0) {
$missingVentas = $ventas;