Integracion Toku a flujo
This commit is contained in:
@ -1,12 +1,14 @@
|
||||
<?php
|
||||
namespace Incoviba\Service\Venta;
|
||||
|
||||
use PDOException;
|
||||
use DateTimeImmutable;
|
||||
use DateInterval;
|
||||
use Incoviba\Common\Implement\Exception\EmptyResult;
|
||||
use IntlDateFormatter;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Incoviba\Common\Ideal;
|
||||
use Incoviba\Common\Implement\Exception\EmptyResult;
|
||||
use Incoviba\Exception\ServiceAction\Create;
|
||||
use Incoviba\Repository;
|
||||
use Incoviba\Model;
|
||||
|
||||
@ -92,9 +94,18 @@ class Cuota extends Ideal\Service
|
||||
return $this->cuotaRepository->fetchVigenteByPie($pie_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @return Model\Venta\Cuota
|
||||
* @throws Create
|
||||
*/
|
||||
public function add(array $data): Model\Venta\Cuota
|
||||
{
|
||||
$tipoPago = $this->tipoPagoRepository->fetchByDescripcion('cheque');
|
||||
try {
|
||||
$tipoPago = $this->tipoPagoRepository->fetchByDescripcion('cheque');
|
||||
} catch (EmptyResult $exception) {
|
||||
throw new Create(__CLASS__, $exception);
|
||||
}
|
||||
$fields = array_flip([
|
||||
'fecha',
|
||||
'banco',
|
||||
@ -112,8 +123,11 @@ class Cuota extends Ideal\Service
|
||||
$mapped_data = $filtered_data;
|
||||
$mapped_data['valor_$'] = $mapped_data['valor'];
|
||||
unset($mapped_data['valor']);
|
||||
$cuota = $this->cuotaRepository->create($mapped_data);
|
||||
$this->cuotaRepository->save($cuota);
|
||||
return $cuota;
|
||||
try {
|
||||
$cuota = $this->cuotaRepository->create($mapped_data);
|
||||
return $this->cuotaRepository->save($cuota);
|
||||
} catch (PDOException $exception) {
|
||||
throw new Create(__CLASS__, $exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user