From 59e6e9eb5c4677ed98839db9cda08d5427653768 Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Sat, 20 Jun 2020 21:49:35 +0800 Subject: [PATCH] Support null date_status_change for rider api #424 --- .../RiderAPIHandler/CMBRiderAPIHandler.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Service/RiderAPIHandler/CMBRiderAPIHandler.php b/src/Service/RiderAPIHandler/CMBRiderAPIHandler.php index e3cd75dc..2b225daf 100644 --- a/src/Service/RiderAPIHandler/CMBRiderAPIHandler.php +++ b/src/Service/RiderAPIHandler/CMBRiderAPIHandler.php @@ -653,6 +653,11 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface if (empty($trade_in_type)) $trade_in_type = 'none'; + if ($jo->getDateStatusChange() == null) + $date_status_change = null; + else + $date_status_change = $jo->getDateStatusChange()->format('Ymd H:i:s'); + $data = [ 'id' => $jo->getID(), 'service_type' => $jo->getServiceType(), @@ -660,6 +665,7 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface 'longitude' => $coord->getLongitude(), 'latitude' => $coord->getLatitude(), 'status' => $jo->getStatus(), + 'date_status_change' => $date_status_change, 'customer' => [ 'title' => $cust->getTitle(), 'first_name' => $cust->getFirstName(), @@ -1814,6 +1820,15 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface return $data; } + $jo_data = $this->formatJobOrderData($jo); + + $data = [ + 'job_order' => $jo_data + ]; + + return $data; + + /* $coord = $jo->getCoordinates(); $cust = $jo->getCustomer(); $cv = $jo->getCustomerVehicle(); @@ -1904,8 +1919,7 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface 'has_motolite' => $cv->hasMotoliteBattery(), ] ]; - - return $data; + */ } public function getPaymentMethods(Request $req)