Add source to invoice criteria. Modify invoice rules to get service fees from... #1701

Merged
arcticzero merged 217 commits from 746-resq-2-0-final into master 2023-11-22 08:54:48 +00:00
Showing only changes of commit f94cec4bfa - Show all commits

View file

@ -55,22 +55,18 @@ class Jumpstart implements InvoiceRuleInterface
public function getServiceTypeFee($source, CustomerVehicle $cv) public function getServiceTypeFee($source, CustomerVehicle $cv)
{ {
$code = 'jumpstart_fee'; // check the source of JO
// (1) if from app, service fee is 0 if motolite user. jumpstart fee for app if non-motolite user.
// check if customer vehicle has a motolite battery // (2) any other source, jumpstart fees are charged whether motolite user or not
// if yes, set the code to the motolite user service fee if ($source == TransactionOrigin::MOBILE_APP)
if ($cv->hasMotoliteBattery())
$code = 'motolite_user_service_fee';
else
{ {
// find the service fee for jumpstart using the code if ($cv->hasMotoliteBattery())
// if we can't find the fee, return 0 $code = 'motolite_user_service_fee';
// jumpstart fee depends on the JO source. Jumpstart from app has a different fee else
// we set the code to search for the default
if ($source == TransactionOrigin::MOBILE_APP)
$code = 'jumpstart_fee_mobile_app'; $code = 'jumpstart_fee_mobile_app';
} }
else
$code = 'jumpstart_fee';
$fee = $this->em->getRepository(ServiceOffering::class)->findOneBy(['code' => $code]); $fee = $this->em->getRepository(ServiceOffering::class)->findOneBy(['code' => $code]);