Add SMS messaging to customer when rider fulfills a JO from rider app. #464
This commit is contained in:
parent
2c48c619b8
commit
28b939a969
1 changed files with 13 additions and 1 deletions
|
|
@ -21,6 +21,7 @@ use App\Service\MQTTClient;
|
|||
use App\Service\WarrantyHandler;
|
||||
use App\Service\JobOrderHandlerInterface;
|
||||
use App\Service\InvoiceGeneratorInterface;
|
||||
use App\Service\RisingTideGateway;
|
||||
|
||||
use App\Entity\RiderSession;
|
||||
use App\Entity\Rider;
|
||||
|
|
@ -45,12 +46,13 @@ class ResqRiderAPIHandler implements RiderAPIHandlerInterface
|
|||
protected $jo_handler;
|
||||
protected $ic;
|
||||
protected $session;
|
||||
protected $rt;
|
||||
|
||||
public function __construct(EntityManagerInterface $em, RedisClientProvider $redis,
|
||||
EncoderFactoryInterface $ef, RiderCache $rcache,
|
||||
string $country_code, MQTTClient $mclient,
|
||||
WarrantyHandler $wh, JobOrderHandlerInterface $jo_handler,
|
||||
InvoiceGeneratorInterface $ic)
|
||||
InvoiceGeneratorInterface $ic, RisingTideGateway $rt)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->redis = $redis;
|
||||
|
|
@ -61,6 +63,7 @@ class ResqRiderAPIHandler implements RiderAPIHandlerInterface
|
|||
$this->wh = $wh;
|
||||
$this->jo_handler = $jo_handler;
|
||||
$this->ic = $ic;
|
||||
$this->rt = $rt;
|
||||
|
||||
// one device = one session, since we have control over the devices
|
||||
// when a rider logs in, we just change the rider assigned to the device
|
||||
|
|
@ -579,6 +582,15 @@ class ResqRiderAPIHandler implements RiderAPIHandlerInterface
|
|||
];
|
||||
$this->mclient->sendEvent($jo, $payload);
|
||||
|
||||
// send SMS to customer
|
||||
$phone_number = $jo->getCustomer()->getPhoneMobile();
|
||||
if (!empty($phone_number))
|
||||
{
|
||||
// TODO: put this in config file or somewhere
|
||||
$message = "Your Resq job order has been completed.";
|
||||
$this->rt->sendSMS($phone_number, 'MOTOLITE', $message);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue