Merge branch '110-ios-additional-fixes-for-new-services' into 'master'
Resolve "iOS additional fixes for new services" Closes #110 See merge request jankstudio/resq!94
This commit is contained in:
commit
1ea7ae5ab7
3 changed files with 42 additions and 13 deletions
|
|
@ -690,7 +690,7 @@ class APIController extends Controller
|
||||||
$required_params = [
|
$required_params = [
|
||||||
'service_type',
|
'service_type',
|
||||||
'cv_id',
|
'cv_id',
|
||||||
'batt_id',
|
// 'batt_id',
|
||||||
'trade_in',
|
'trade_in',
|
||||||
'long',
|
'long',
|
||||||
'lat',
|
'lat',
|
||||||
|
|
@ -784,13 +784,19 @@ class APIController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
// check battery
|
// check battery
|
||||||
$batt = $em->getRepository(Battery::class)->find($req->request->get('batt_id'));
|
$batt_id = $req->request->get('batt_id');
|
||||||
if ($batt == null)
|
if ($batt_id != null)
|
||||||
{
|
{
|
||||||
$res->setError(true)
|
$batt = $em->getRepository(Battery::class)->find($batt_id);
|
||||||
->setErrorMessage('Invalid battery id');
|
if ($batt == null)
|
||||||
return $res->getReturnResponse();
|
{
|
||||||
|
$res->setError(true)
|
||||||
|
->setErrorMessage('Invalid battery id');
|
||||||
|
return $res->getReturnResponse();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
$batt = null;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// put battery in criteria
|
// put battery in criteria
|
||||||
|
|
@ -860,7 +866,7 @@ class APIController extends Controller
|
||||||
$required_params = [
|
$required_params = [
|
||||||
'service_type',
|
'service_type',
|
||||||
'cv_id',
|
'cv_id',
|
||||||
'batt_id',
|
// 'batt_id',
|
||||||
'trade_in',
|
'trade_in',
|
||||||
];
|
];
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
@ -915,13 +921,19 @@ class APIController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
// check battery
|
// check battery
|
||||||
$batt = $em->getRepository(Battery::class)->find($req->request->get('batt_id'));
|
$batt_id = $req->request->get('batt_id');
|
||||||
if ($batt == null)
|
if ($batt_id != null)
|
||||||
{
|
{
|
||||||
$res->setError(true)
|
$batt = $em->getRepository(Battery::class)->find($batt_id);
|
||||||
->setErrorMessage('Invalid battery id');
|
if ($batt == null)
|
||||||
return $res->getReturnResponse();
|
{
|
||||||
|
$res->setError(true)
|
||||||
|
->setErrorMessage('Invalid battery id');
|
||||||
|
return $res->getReturnResponse();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
$batt = null;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// put battery in criteria
|
// put battery in criteria
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ class ServiceType extends NameValue
|
||||||
const POST_RECHARGED = 'post_recharged';
|
const POST_RECHARGED = 'post_recharged';
|
||||||
const POST_REPLACEMENT = 'post_replacement';
|
const POST_REPLACEMENT = 'post_replacement';
|
||||||
const TIRE_REPAIR = 'tire';
|
const TIRE_REPAIR = 'tire';
|
||||||
const OVERHEAT_ASSITANCE = 'overheat';
|
const OVERHEAT_ASSISTANCE = 'overheat';
|
||||||
const EMERGENCY_REFUEL = 'fuel';
|
const EMERGENCY_REFUEL = 'fuel';
|
||||||
|
|
||||||
const COLLECTION = [
|
const COLLECTION = [
|
||||||
|
|
|
||||||
|
|
@ -256,6 +256,18 @@ class InvoiceCreator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function processOtherServices(&$total, $invoice, $stype)
|
||||||
|
{
|
||||||
|
$item = new InvoiceItem();
|
||||||
|
$item->setInvoice($invoice)
|
||||||
|
->setTitle('Service - ' . ServiceType::getName($stype))
|
||||||
|
->setQuantity(1)
|
||||||
|
->setPrice(200.00);
|
||||||
|
$invoice->addItem($item);
|
||||||
|
|
||||||
|
$total['total_price'] = 200.00;
|
||||||
|
}
|
||||||
|
|
||||||
public function processCriteria(InvoiceCriteria $criteria)
|
public function processCriteria(InvoiceCriteria $criteria)
|
||||||
{
|
{
|
||||||
// initialize
|
// initialize
|
||||||
|
|
@ -296,6 +308,11 @@ class InvoiceCreator
|
||||||
break;
|
break;
|
||||||
case ServiceType::POST_REPLACEMENT:
|
case ServiceType::POST_REPLACEMENT:
|
||||||
$this->processReplacement($total, $invoice);
|
$this->processReplacement($total, $invoice);
|
||||||
|
break;
|
||||||
|
case ServiceType::TIRE_REPAIR:
|
||||||
|
case ServiceType::OVERHEAT_ASSISTANCE:
|
||||||
|
case ServiceType::EMERGENCY_REFUEL:
|
||||||
|
$this->processOtherServices($total, $invoice, $stype);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: check if any promo is applied
|
// TODO: check if any promo is applied
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue