diff --git a/public/static/privacy.html b/public/static/privacy.html new file mode 100644 index 00000000..bcecf84e --- /dev/null +++ b/public/static/privacy.html @@ -0,0 +1,117 @@ +

Privacy Policy

+

+Oriental and Motolite Marketing Corporation ("Company," "We," "Us," "Our"), is committed to protecting the privacy and security of all personal and/or sensitive information ("Personal Data") related to its employees, customers, business partners, suppliers, contractors, and other parties that the Company will and is engaged into. For this reason, uniform practice and procedure for collecting, recording, consolidating, updating, disclosing, storing, accessing, transferring, retaining, destroying and disposing of Personal Data by the Company is hereby adopted in order to process Personal Data fairly, appropriately, and lawfully. +

+ +

+This Privacy Policy sets out how the Company uses, protects and controls any Personal Data that you will provide in our website and mobile application (the "Site"). The Company may change this policy from time to time by updating it in accordance with subsequent Laws and Implementing Rules and Regulations. The terms of this Privacy Policy apply to all users of this Site. +

+ +

Collection of Personal Data

+

+The Company collects Personal Data you voluntarily submitted in our Site and our mobile apps, as well as non-personal information provided therein. +

+ +

User Registration

+

+We collect information about you (i) when you register in order to receive a product/service; (ii) when you subscribe to marketing emails; (iii) when you apply for a job post; (iv) when you contact us for inquiries, support or feedback. Information may include Personal Data such as but not limited to your first name, last name, email address, birthdate, gender, mobile number, address and password. +

+ +

Log information

+

+When you visit our Site, we may also collect non-personal information such as but not limited to web page from which you came to our Site, your web page request, Internet Protocol (IP) address, geolocation, browser type, browser language, the date and time of your request and your registration data. Please be noted that when you purchase a product or use a web-based service in our Site, we may also log the specific path, actions, and navigation choices you make. +

+ +

Cookies

+

+We may use cookies in analyzing and evaluating performance to provide you better experience when using our Site. Cookies are small files that a Site or its service provider transfers to your computer's hard drive through your web browser (you can disable this) that allows the Site's or service provider's systems to recognize your browser and capture and remember certain information. +

+ +

Location Services

+

+Your current location is only determined if you permit our services to do so. If you allow your location to be obtained using our RESQ app, or with a browser, we will use this information to return your estimated location. We use this information solely to distinguish your current location and not to identify you. Motolite does not automatically track your location. +

+ +

Use of Personal Data

+

+

+

+ +

+The Company may share the Personal Data gathered from you within the Ramcar Group of Companies and will use it consistent with the purpose of this Privacy Policy. We may also use the information in the aggregate to understand how our users as a group, use the services and resources provided on our Site. +

+ +

Further Disclosure

+

+We take reasonable precautions to be sure that nonaffiliated third parties and affiliates, to whom we disclose your Personal Data are aware of our Privacy Policy and will treat the information in a similarly responsible manner. Our contracts and written agreements with nonaffiliated third parties that receive information from us about you prohibit those parties from transferring the information other than to provide the service that you obtain from us. +

+ +

Agents and contractors

+

+Our contractors sometimes have access to your Personal Data in the course of assisting in operating our business and providing products or services to you. These contractors may include vendors and suppliers that provide us with technology, services, and/or content for the operation and maintenance of our Site. Access to your Personal Data by these contractors is limited to the information reasonably necessary for the contractor to perform its limited function. Contractors have an obligation under their contracts with us to keep your information confidential and to comply with our privacy and security policies. +

+ +

Disclosure for legal reasons

+

+We may release Personal Data to third parties: (1) to comply with valid legal requirements such as a law, regulation, search warrant, subpoena or court order; or (2) in special cases, such as a threat to security, a threat to our system or network, or cases in which we believe it is reasonably necessary to investigate or prevent harm, fraud, abuse, or illegal conduct. +

+ +

Changes in our corporate structure

+

+If all or part of the Company is sold, merged or otherwise transferred to another entity, the Personal Data you have provided to us may be transferred as part of that transaction. We will take steps to ensure that, without your consent, any Personal Data that is transferred will not be used or shared in a manner inconsistent with this Privacy Policy. +

+ +

Accuracy and Access

+

+The Company will keep your Personal Data as accurate, complete and up-to-date as is necessary for the purpose for which it is processed. In case you need to access, correct, amend, delete inaccurate Personal Data, or withdraw your consent, please immediately inform us. (see Contact Us section below) +

+ +

Security

+

+The Company employs adequate organizational, physical and technical security measures such as password protection, encryption, firewalls and other controls, to ensure and preserve the confidentiality, integrity and availability of your Personal Data. We work to protect the security of your information during transmission by using Secure Sockets Layer (SSL) software, which encrypts information you input online. Only authorized persons from the Company will have access to your Personal Data. Employees who misuse any information are subject to disciplinary action, including termination. +

+ +

Third Party Links

+

+The Company may offer links to sites that is run by third parties. If you visit other sites, you should read the site’s privacy policy, terms and conditions, and their other policies. The Company is not responsible for the policies and practices of third parties. Any information you give to those organizations is dealt with under their privacy statement, terms and conditions, and other policies. + +

Retention and Disposal

+

+The Company will retain your Personal Data only as long as necessary for the fulfillment of the stated purposes. In case that the Site is no longer functional or decommissioned, all of your Personal Data in digital or hard copies will be disposed or erased according to the Company's guidelines, where it is irretrievable, unreadable, or unidentifiable. In case you subscribed to email/SMS marketing, you will still receive email/SMS notifications. If you want to cancel your subscription, you may click the unsubscribe link at the bottom of any email message from the Company, or follow the SMS cancellation instructions. +

+ +

Minors' Privacy

+

+The Company takes minors' privacy seriously. If you are under 18 years of age, please do not submit any Personal Data through our Site without the express consent and participation of a parent or guardian. If you are a parent or guardian, please make every effort to guard your children's privacy. +

+ +

Applicable Law and Rights

+

+The Company upholds compliance with Republic Act No. 10173 or the Data Privacy Act of 2012 (DPA), its Implementing Rules and Regulations, and other relevant policies, including issuances of the National Privacy Commission. The Company acknowledges your right to be informed, object processing, access and rectify, suspend or withdraw Personal Data, and be indemnified in case of damages pursuant to the provisions of DPA. +

+ +

Changes to Privacy Policy

+

+The Company reserves the right to amend this Privacy Policy at any time, consistent with applicable law. In such case, an updated version will be posted in our Site. If we are going to process your Personal Data in a manner different from that stated at the time of collection, we will notify you, and you will have a choice as to whether or not we can use your Personal Data in such a way. +

+ +

Contact Us

+

+For any inquiry regarding this Privacy Policy, please contact our Data Privacy Officer, Mr. Luis Quiogue at: +

+ +

+OMMC
+Ramcar Center
+80-82 Roces Ave.
+Diliman, Quezon City PH
+(+632) 370-1100 +

diff --git a/src/Controller/APIController.php b/src/Controller/APIController.php index b8736440..acf3cb74 100644 --- a/src/Controller/APIController.php +++ b/src/Controller/APIController.php @@ -218,12 +218,30 @@ class APIController extends Controller ->setPhoneNumber($phone_number); $em->flush(); - // TODO: send sms to number + // TODO: send sms with validation code to number // response return $res->getReturnResponse(); } + // TODO: find session customer by phone number + protected function findNumberSession($number) + { + $em = $this->getDoctrine()->getManager(); + $query = $em->getRepository(MobileSession::class)->createQueryBuilder('s') + ->where('s.phone_number = :number') + ->andWhere('s.customer is not null') + ->andWhere('s.confirm_flag = 1') + ->setParameter('number', $number) + ->setMaxResults(1) + ->getQuery(); + + // we just need one + $res = $query->getOneOrNullResult(); + + return $res; + } + public function validateCode(Request $req) { // check parameters @@ -250,6 +268,16 @@ class APIController extends Controller $date = new DateTime(); $this->session->setDateConfirmed($date) ->setConfirmed(); + + + // TODO: check if we have the number registered before and merge + $dupe_sess = $this->findNumberSession($this->session->getPhoneNumber()); + if ($dupe_sess != null) + { + $dupe_cust = $dupe_sess->getCustomer(); + $this->session->setCustomer($dupe_cust); + } + $em->flush(); // response @@ -314,6 +342,9 @@ class APIController extends Controller ->setLastName($req->request->get('last_name')) ->setConfirmed($this->session->isConfirmed()); + // update mobile phone of customer + $cust->setPhoneMobile(substr(2, $this->session->getPhoneNumber())); + $em->flush(); return $res->getReturnResponse(); @@ -690,7 +721,7 @@ class APIController extends Controller $required_params = [ 'service_type', 'cv_id', - 'batt_id', + // 'batt_id', 'trade_in', 'long', 'lat', @@ -784,13 +815,19 @@ class APIController extends Controller } // check battery - $batt = $em->getRepository(Battery::class)->find($req->request->get('batt_id')); - if ($batt == null) + $batt_id = $req->request->get('batt_id'); + if ($batt_id != null) { - $res->setError(true) - ->setErrorMessage('Invalid battery id'); - return $res->getReturnResponse(); + $batt = $em->getRepository(Battery::class)->find($batt_id); + if ($batt == null) + { + $res->setError(true) + ->setErrorMessage('Invalid battery id'); + return $res->getReturnResponse(); + } } + else + $batt = null; /* // put battery in criteria @@ -860,7 +897,7 @@ class APIController extends Controller $required_params = [ 'service_type', 'cv_id', - 'batt_id', + // 'batt_id', 'trade_in', ]; $em = $this->getDoctrine()->getManager(); @@ -915,13 +952,19 @@ class APIController extends Controller } // check battery - $batt = $em->getRepository(Battery::class)->find($req->request->get('batt_id')); - if ($batt == null) + $batt_id = $req->request->get('batt_id'); + if ($batt_id != null) { - $res->setError(true) - ->setErrorMessage('Invalid battery id'); - return $res->getReturnResponse(); + $batt = $em->getRepository(Battery::class)->find($batt_id); + if ($batt == null) + { + $res->setError(true) + ->setErrorMessage('Invalid battery id'); + return $res->getReturnResponse(); + } } + else + $batt = null; /* // put battery in criteria @@ -1022,6 +1065,7 @@ class APIController extends Controller $res->setData([ 'status' => APIRiderStatus::OUTLET_ASSIGN, 'jo_id' => $jo->getID(), + 'service_type' => $jo->getServiceType(), 'destination' => [ 'long' => $dest->getLongitude(), 'lat' => $dest->getLatitude(), @@ -1032,6 +1076,7 @@ class APIController extends Controller $res->setData([ 'status' => APIRiderStatus::RIDER_ASSIGN, 'jo_id' => $jo->getID(), + 'service_type' => $jo->getServiceType(), 'destination' => [ 'long' => $dest->getLongitude(), 'lat' => $dest->getLatitude(), @@ -1048,6 +1093,7 @@ class APIController extends Controller $res->setData([ 'status' => APIRiderStatus::RIDER_PICK_UP, 'jo_id' => $jo->getID(), + 'service_type' => $jo->getServiceType(), 'destination' => [ 'long' => $dest->getLongitude(), 'lat' => $dest->getLatitude(), @@ -1179,6 +1225,11 @@ class APIController extends Controller ->setJobOrder($jo) ->setRating($rating_num); + // rider rating comment + $comment = $req->request->get('comment'); + if (!empty($comment)) + $rating->setComment($comment); + $em->persist($rating); $em->flush(); diff --git a/src/Controller/JobOrderController.php b/src/Controller/JobOrderController.php index c515c345..e25be13c 100644 --- a/src/Controller/JobOrderController.php +++ b/src/Controller/JobOrderController.php @@ -1364,15 +1364,20 @@ class JobOrderController extends BaseController protected function sendEvent(JobOrder $job_order, $payload) { - $session = $job_order->getCustomer()->getMobileSessions(); - if (count($session) == 0) + $sessions = $job_order->getCustomer()->getMobileSessions(); + if (count($sessions) == 0) return; - $phone_num = $session[0]->getPhoneNumber(); - $channel = 'motolite.control.' . $phone_num; $client = new MosquittoClient(); $client->connect('localhost', 1883); - $client->publish($channel, json_encode($payload)); + + foreach ($sessions as $sess) + { + $phone_num = $sess->getPhoneNumber(); + $channel = 'motolite.control.' . $phone_num; + $client->publish($channel, json_encode($payload)); + } + $client->disconnect(); } @@ -1783,6 +1788,14 @@ class JobOrderController extends BaseController // save $em->flush(); + // send mobile app event + $payload = [ + 'event' => 'cancelled', + 'reason' => $cancel_reason, + 'jo_id' => $obj->getID(), + ]; + $this->sendEvent($obj, $payload); + // return successful response return $this->json([ 'success' => 'Job order has been cancelled!' diff --git a/src/Entity/RiderRating.php b/src/Entity/RiderRating.php index e0a03ddc..f5875c27 100644 --- a/src/Entity/RiderRating.php +++ b/src/Entity/RiderRating.php @@ -52,10 +52,17 @@ class RiderRating */ protected $rating; + // customer's comment that goes along with the rating + /** + * @ORM\Column(type="text") + */ + protected $comment; + public function __construct() { $this->date_create = new DateTime(); $this->rating = 0; + $this->comment = ''; } public function getID() @@ -111,4 +118,15 @@ class RiderRating { return $this->rating; } + + public function setComment($comment) + { + $this->comment = $comment; + return $this; + } + + public function getComment() + { + return $this->comment; + } } diff --git a/src/Entity/VehicleManufacturer.php b/src/Entity/VehicleManufacturer.php index 48de14b0..00026b05 100644 --- a/src/Entity/VehicleManufacturer.php +++ b/src/Entity/VehicleManufacturer.php @@ -30,6 +30,7 @@ class VehicleManufacturer // vehicles /** * @ORM\OneToMany(targetEntity="Vehicle", mappedBy="manufacturer") + * @ORM\OrderBy({"make" = "ASC"}) */ protected $vehicles; diff --git a/src/Ramcar/FuelType.php b/src/Ramcar/FuelType.php index c85a4d81..62f2c13a 100644 --- a/src/Ramcar/FuelType.php +++ b/src/Ramcar/FuelType.php @@ -4,11 +4,13 @@ namespace App\Ramcar; class FuelType extends NameValue { - const GAS = 'gas'; - const DIESEL = 'diesel'; + const GAS = 'gas'; + const DIESEL = 'diesel'; + const LPG = 'lpg'; const COLLECTION = [ 'gas' => 'Gas', 'diesel' => 'Diesel', + 'lpg' => 'LPG', ]; } diff --git a/src/Ramcar/ServiceType.php b/src/Ramcar/ServiceType.php index 29bc03a7..83768bdc 100644 --- a/src/Ramcar/ServiceType.php +++ b/src/Ramcar/ServiceType.php @@ -11,7 +11,7 @@ class ServiceType extends NameValue const POST_RECHARGED = 'post_recharged'; const POST_REPLACEMENT = 'post_replacement'; const TIRE_REPAIR = 'tire'; - const OVERHEAT_ASSITANCE = 'overheat'; + const OVERHEAT_ASSISTANCE = 'overheat'; const EMERGENCY_REFUEL = 'fuel'; const COLLECTION = [ diff --git a/src/Service/InvoiceCreator.php b/src/Service/InvoiceCreator.php index 695a9e2b..b0588dc8 100644 --- a/src/Service/InvoiceCreator.php +++ b/src/Service/InvoiceCreator.php @@ -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) { // initialize @@ -296,6 +308,11 @@ class InvoiceCreator break; case ServiceType::POST_REPLACEMENT: $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 diff --git a/src/Service/MapTools.php b/src/Service/MapTools.php index 693b3c21..aa38cd6d 100644 --- a/src/Service/MapTools.php +++ b/src/Service/MapTools.php @@ -52,7 +52,12 @@ class MapTools // query google maps api - $res = $client->request('GET', $maps_url, ['query' => $gmaps_params]); + $res = $client->request('GET', $maps_url, [ + 'query' => $gmaps_params, + 'curl' => [ + CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4 + ], + ]); return $res->getBody(); }