Move to env file the fuel charges. #634

This commit is contained in:
Korina Cordero 2022-03-09 09:15:35 +00:00
parent e986d07f70
commit 726d787ef1
3 changed files with 17 additions and 6 deletions

View file

@ -90,3 +90,8 @@ HUB_JO_KEY=hub_jo_count
# hub geofence
HUB_GEOFENCE_ENABLE=set_to_true_or_false
HUB_FILTER_ENABLE=set_to_true_or_false
# fuel charges
REFUEL_FEE_GAS=set_fuel_price
REFUEL_FEE_DIESEL=set_fuel_price

View file

@ -161,7 +161,10 @@ services:
- { name: kernel.event_listener, event: kernel.controller, method: onKernelController }
# invoice generator
App\Service\InvoiceGenerator\ResqInvoiceGenerator: ~
App\Service\InvoiceGenerator\ResqInvoiceGenerator:
arguments:
$refuel_fee_gas: "%env(REFUEL_FEE_GAS)%"
$refuel_fee_diesel: "%env(REFUEL_FEE_DIESEL)%"
# invoice generator interface
App\Service\InvoiceGeneratorInterface: "@App\\Service\\InvoiceGenerator\\ResqInvoiceGenerator"

View file

@ -35,20 +35,23 @@ class ResqInvoiceGenerator implements InvoiceGeneratorInterface
const WARRANTY_FEE = 0;
const OTHER_SERVICES_FEE = 200;
const COOLANT_FEE = 1600;
const REFUEL_FEE_GAS = 300;
const REFUEL_FEE_DIESEL = 260;
private $security;
protected $em;
protected $validator;
protected $refuel_fee_gas;
protected $refuel_fee_diesel;
// creates invoice based on the criteria sent
public function __construct(Security $security, EntityManagerInterface $em,
ValidatorInterface $validator)
ValidatorInterface $validator, $refuel_fee_gas, $refuel_fee_diesel)
{
$this->security = $security;
$this->em = $em;
$this->validator = $validator;
$this->refuel_fee_gas = $refuel_fee_gas;
$this->refuel_fee_diesel = $refuel_fee_diesel;
}
public function generateInvoice(InvoiceCriteria $criteria)
@ -669,8 +672,8 @@ class ResqInvoiceGenerator implements InvoiceGeneratorInterface
$total_price = $fee;
// $total['total_price'] = 200.00;
$gas_price = self::REFUEL_FEE_GAS;
$diesel_price = self::REFUEL_FEE_DIESEL;
$gas_price = $this->refuel_fee_gas;
$diesel_price = $this->refuel_fee_diesel;
$fuel = new InvoiceItem();
//error_log('fuel type - ' . $ftype);