Merge branch '752-resq-2-fix-return-values-for-invoice-data' into '746-resq-2-0-final'
Resolve "RESQ 2: Fix return values for invoice data" See merge request jankstudio/resq!867
This commit is contained in:
commit
49ff4b604b
6 changed files with 13 additions and 11 deletions
|
|
@ -9,7 +9,7 @@ use Doctrine\ORM\Query;
|
|||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use Catalyst\ApiBundle\Controller\ApiController;
|
||||
use Catalyst\ApiBundle\Response\APIResponse;
|
||||
use Catalyst\ApiBundle\Component\Response as APIResponse;
|
||||
use App\Ramcar\APIResult;
|
||||
|
||||
use App\Entity\Vehicle;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
|||
use CrEOF\Spatial\PHP\Types\Geometry\Point;
|
||||
|
||||
use Catalyst\ApiBundle\Controller\ApiController;
|
||||
use Catalyst\ApiBundle\Response\APIResponse;
|
||||
use Catalyst\ApiBundle\Component\Response as APIResponse;
|
||||
|
||||
use App\Ramcar\WarrantyClass;
|
||||
use App\Ramcar\JOStatus;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use Doctrine\ORM\Query;
|
|||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use Catalyst\ApiBundle\Controller\ApiController;
|
||||
use Catalyst\ApiBundle\Response\APIResponse;
|
||||
use Catalyst\ApiBundle\Component\Response as APIResponse;
|
||||
|
||||
use App\Entity\Promo;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use Doctrine\ORM\Query;
|
|||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use Catalyst\ApiBundle\Controller\ApiController;
|
||||
use Catalyst\ApiBundle\Response\APIResponse;
|
||||
use Catalyst\ApiBundle\Component\Response as APIResponse;
|
||||
|
||||
use App\Entity\Service;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use Doctrine\ORM\Query;
|
|||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use Catalyst\ApiBundle\Controller\ApiController;
|
||||
use Catalyst\ApiBundle\Response\APIResponse;
|
||||
use Catalyst\ApiBundle\Component\Response as APIResponse;
|
||||
|
||||
use App\Entity\VehicleManufacturer;
|
||||
use App\Entity\Vehicle;
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ class InvoiceManager implements InvoiceGeneratorInterface
|
|||
$invoice_item->setInvoice($invoice)
|
||||
->setTitle($item['title'])
|
||||
->setQuantity($item['quantity'])
|
||||
->setPrice($item['price']);
|
||||
->setPrice((float)$item['price']);
|
||||
|
||||
if ($item['battery'] != null)
|
||||
$invoice_item->setBattery($item['battery']);
|
||||
|
|
@ -271,11 +271,13 @@ class InvoiceManager implements InvoiceGeneratorInterface
|
|||
$invoice->addItem($invoice_item);
|
||||
}
|
||||
|
||||
$invoice->setTotalPrice($total['total_price'])
|
||||
->setVATExclusivePrice($total['vat_ex_price'])
|
||||
->setVAT($total['vat'])
|
||||
->setDiscount($total['discount'])
|
||||
->setTradeIn($total['ti_rate'])
|
||||
// RULE: TYPECAST these values since bc operations return a string
|
||||
// and these fields are going to be placed in a JSON response
|
||||
$invoice->setTotalPrice((float)$total['total_price'])
|
||||
->setVATExclusivePrice((float)$total['vat_ex_price'])
|
||||
->setVAT((float)$total['vat'])
|
||||
->setDiscount((float)$total['discount'])
|
||||
->setTradeIn((float)$total['ti_rate'])
|
||||
->setStatus(InvoiceStatus::DRAFT);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue