Add mode_of_payment field to change service call in rider API #159

This commit is contained in:
Kendrick Chan 2018-07-23 02:07:56 +08:00
parent 2925ec3df3
commit 9ae9a550d0

View file

@ -22,6 +22,7 @@ use App\Ramcar\APIRiderStatus;
use App\Ramcar\TransactionOrigin;
use App\Ramcar\TradeInType;
use App\Ramcar\InvoiceStatus;
use App\Ramcar\ModeOfPayment;
use App\Service\InvoiceCreator;
use App\Service\MQTTClient;
@ -732,6 +733,13 @@ class RAPIController extends Controller
if (!TradeInType::validate($trade_in))
$trade_in = null;
// check mode of payment
$mode = $req->request->get('mode_of_payment');
if (!ModeOfPayment::validate($mode))
$mode = ModeOfPayment::CASH;
$jo->setModeOfPayment($mode);
// generate new invoice
$crit = new InvoiceCriteria();
$crit->setServiceType($stype_id);