Make sure change status calls for rider api are being saved #132

This commit is contained in:
Kendrick Chan 2018-05-27 06:03:20 +08:00
parent bcc606f52a
commit ed8ed03136

View file

@ -425,6 +425,7 @@ class RAPIController extends Controller
// set jo status to in transit
$jo->setStatus(JOStatus::IN_TRANSIT);
$em->flush();
// TODO: send mqtt event
@ -444,6 +445,7 @@ class RAPIController extends Controller
// set jo status to cancelled
$jo->setStatus(JOStatus::CANCELLED);
$em->flush();
// TODO: send mqtt event
@ -463,6 +465,7 @@ class RAPIController extends Controller
// set jo status to in progress
$jo->setStatus(JOStatus::IN_PROGRESS);
$em->flush();
// TODO: send mqtt event
@ -473,9 +476,19 @@ class RAPIController extends Controller
public function payment(Request $req)
{
$em = $this->getDoctrine()->getManager();
$required_params = ['jo_id', 'stype_id', 'promo_id', 'batt_id', 'trade_in'];
$res = $this->checkJO($req, $required_params, $jo);
if ($res->isError())
return $res->getReturnResponse();
// set invoice to paid
$jo->getInvoice()->setStatus(InvoiceStatus::PAID);
// set jo status to fulfilled
$jo->setStatus(JOStatus::FULFILLED);
$em->flush();
}
public function getPromos(Request $req)