diff --git a/src/ChurchCRM/dto/Notification.php b/src/ChurchCRM/dto/Notification.php index 05a5a4f011..6b483aead5 100644 --- a/src/ChurchCRM/dto/Notification.php +++ b/src/ChurchCRM/dto/Notification.php @@ -2,56 +2,54 @@ namespace ChurchCRM\dto; -use ChurchCRM\Person; -use ChurchCRM\dto\SystemConfig; + use ChurchCRM\Emails\NotificationEmail; -use Nexmo\Client; -use Nexmo\Client\Credentials\Basic as NexmoBasicCred; -use ChurchCRM\dto\OpenLPNotification; +use Vonage\Client; +use Vonage\Client\Credentials\Basic; class Notification { - + protected $projectorText; protected $recipients; protected $person; - + public function __construct() { - + } - + public function setRecipients($recipients) { $this->recipients = $recipients; - + } - + public function setSMSText($text) { - + } - + public function setEmailText($text) { - + } - + public function setPerson(\ChurchCRM\Person $Person) { $this->person = $Person; } - + public function setProjectorText($text) { $this->projectorText=$text; } - + private function sendEmail() { $emailaddresses = []; Foreach ($this->recipients as $recipient) - { + { array_push($emailaddresses,$recipient->getEmail()); } try @@ -62,19 +60,19 @@ private function sendEmail() } catch (Exception $ex) { return false; } - + } - + private function sendSMS() { try { - - $client = new Client(New NexmoBasicCred(SystemConfig::getValue("sNexmoAPIKey"),SystemConfig::getValue("sNexmoAPISecret"))); - + + $client = new Client(new Basic(SystemConfig::getValue("sNexmoAPIKey"),SystemConfig::getValue("sNexmoAPISecret"))); + Foreach ($this->recipients as $recipient) { - $message = $client->message()->send([ + $message = $client->message()->sendText([ 'to' => $recipient->getNumericCellPhone(), 'from' => SystemConfig::getValue("sNexmoFromNumber"), 'text' => gettext('Notification for') . " " . $this->person->getFullName() @@ -84,9 +82,9 @@ private function sendSMS() } catch (Exception $ex) { return false; } - + } - + private function sendProjector() { try @@ -99,12 +97,12 @@ private function sendProjector() } catch (Exception $ex) { return false; } - + } - + public function send() { - + $methods = []; if(SystemConfig::hasValidMailServerSettings()) { @@ -125,9 +123,9 @@ public function send() "status"=>"", "methods"=>$methods ]; - + return json_encode($sendStatus); - + } - + } diff --git a/src/composer.json b/src/composer.json index 2961726aa0..3e0eecff68 100644 --- a/src/composer.json +++ b/src/composer.json @@ -47,7 +47,7 @@ "geocoder-php/google-maps-provider": "4.5.0", "geocoder-php/bing-maps-provider": "4.0.0", "mustache/mustache": "v2.13.0", - "nexmo/client": "@beta", + "vonage/client": "^2.4", "slim/http-cache": "^1.0.0", "azuyalabs/yasumi": "^1.8.1", "defuse/php-encryption": "^2.2.1", @@ -71,4 +71,4 @@ "type": "composer" } } -} \ No newline at end of file +}