/**
  * @param string $number
  * @param string $message
  * @param null|string $fromName
  * @param int $status_report_req
  * @return SmsSendResponse
  */
 public function sendText($number, $message, $fromName = null, $status_report_req = 0)
 {
     $fromName = $fromName !== null ? $fromName : $this->defaultFromName;
     $number = PhoneNumber::prefixFilter($number);
     $response = $this->nexmoClient->sendTextMessage($fromName, $number, $message, $status_report_req);
     return SmsSendResponse::createFromResponse($response);
 }
Example #2
0
 /**
  * @param stdClass $response
  * @return SmsSendResponse
  */
 public static function createFromResponse($response)
 {
     $smsSendResponse = new SmsSendResponse();
     $smsSendResponse->setTo($response['to']);
     $smsSendResponse->setMessageId($response['message-id']);
     $smsSendResponse->setStatus((int) $response['status']);
     $smsSendResponse->setRemainingBalance(floatval($response['remaining-balance']));
     $smsSendResponse->setMessagePrice(floatval($response['message-price']));
     $smsSendResponse->setNetwork((int) $response['network']);
     return $smsSendResponse;
 }
Example #3
0
 /**
  * @param string $number
  * @param string $pin
  * @param int $client_ref
  * @return SmsSendResponse
  */
 public function send2fa($number, $pin, $client_ref = false)
 {
     $number = PhoneNumber::prefixFilter($number);
     $response = $this->nexmoClient->send2faMessage($number, $pin, $client_ref);
     return SmsSendResponse::createFromResponse($response);
 }