Merge pull request 'FIX: invoice product_id = venta_id' (#41) from fix/toku-invoice-product-id into develop
Reviewed-on: #41
This commit is contained in:
@ -251,7 +251,7 @@ class Invoice extends AbstractEndPoint
|
|||||||
{
|
{
|
||||||
$paramsMap = [
|
$paramsMap = [
|
||||||
'customer' => 'customer',
|
'customer' => 'customer',
|
||||||
'product_id' => 'cuota_id',
|
'product_id' => 'venta_id',
|
||||||
'due_date' => 'fecha',
|
'due_date' => 'fecha',
|
||||||
'subscription' => 'subscription',
|
'subscription' => 'subscription',
|
||||||
'amount' => 'valor',
|
'amount' => 'valor',
|
||||||
@ -266,8 +266,6 @@ class Invoice extends AbstractEndPoint
|
|||||||
'invoice_external_id' => 'cuota_id'
|
'invoice_external_id' => 'cuota_id'
|
||||||
];
|
];
|
||||||
|
|
||||||
$today = new DateTimeImmutable('now', new DateTimeZone('America/Santiago'));
|
|
||||||
|
|
||||||
$params = [];
|
$params = [];
|
||||||
foreach ($paramsMap as $key => $ref) {
|
foreach ($paramsMap as $key => $ref) {
|
||||||
if ($ref === null) {
|
if ($ref === null) {
|
||||||
@ -278,14 +276,6 @@ class Invoice extends AbstractEndPoint
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($ref === 'valor') {
|
if ($ref === 'valor') {
|
||||||
/*$valor = 0;
|
|
||||||
if ($data['cuota']->pago->fecha <= $today) {
|
|
||||||
$valor = $data['cuota']->pago->valor();
|
|
||||||
}
|
|
||||||
if ($valor === 0) {
|
|
||||||
$valor = $data['cuota']->pago->valor / $data['venta']->uf;
|
|
||||||
}
|
|
||||||
$params[$key] = $valor;*/
|
|
||||||
$params[$key] = $data['cuota']->pago->valor;
|
$params[$key] = $data['cuota']->pago->valor;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -303,6 +293,10 @@ class Invoice extends AbstractEndPoint
|
|||||||
$params[$key] = $data['cuota']->id;
|
$params[$key] = $data['cuota']->id;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if ($ref === 'product_id') {
|
||||||
|
$params[$key] = $data['venta']->id;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (array_key_exists($ref, $data) and $data[$ref] !== '' and $data[$ref] !== null) {
|
if (array_key_exists($ref, $data) and $data[$ref] !== '' and $data[$ref] !== null) {
|
||||||
$params[$key] = $data[$ref];
|
$params[$key] = $data[$ref];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user