diff --git a/src/Ramcar/CMBModeOfPayment.php b/src/Ramcar/CMBModeOfPayment.php index c7ae9908..a6a8db4e 100644 --- a/src/Ramcar/CMBModeOfPayment.php +++ b/src/Ramcar/CMBModeOfPayment.php @@ -4,13 +4,15 @@ namespace App\Ramcar; class CMBModeOfPayment extends NameValue { - const CASH = 'cash'; + const SHOPEE = 'shopee'; + const LAZADA = 'lazada'; const CREDIT_CARD = 'credit_card'; - const BANK_TRANSFER = 'bank_transfer'; + const ONLINE_TRANSFER = 'online_transfer'; const COLLECTION = [ - 'cash' => 'Cash', + 'shopee' => 'Shopee', + 'lazada' => 'Lazada', 'credit_card' => 'Credit Card', - 'bank_transfer' => 'Bank Transfer', + 'online_transfer' => 'Online Transfer', ]; } diff --git a/src/Service/RiderAPIHandler/CMBRiderAPIHandler.php b/src/Service/RiderAPIHandler/CMBRiderAPIHandler.php index d14eac69..c299b12e 100644 --- a/src/Service/RiderAPIHandler/CMBRiderAPIHandler.php +++ b/src/Service/RiderAPIHandler/CMBRiderAPIHandler.php @@ -1007,7 +1007,10 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface public function payment(Request $req) { - $required_params = ['jo_id']; + $required_params = [ + 'jo_id', + 'mode_of_payment', + ]; $data = $this->checkActiveJO($req, $required_params, $jo); if (isset($data['error'])) { @@ -1015,6 +1018,11 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface return $data; } + // add mode of payment + $mode = $req->request->get('mode_of_payment'); + $jo->setModeOfPayment($mode); + + // set invoice to paid $jo->getInvoice()->setStatus(InvoiceStatus::PAID);