Skip to content

Commit

Permalink
Merge pull request #62 from SimpleSoftwareIO/develop
Browse files Browse the repository at this point in the history
3.1.1
  • Loading branch information
SimplyCorey authored Mar 19, 2017
2 parents 1879b8a + 06b1c2f commit 93e7feb
Show file tree
Hide file tree
Showing 14 changed files with 58 additions and 56 deletions.
31 changes: 19 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@ Simple SMS

##Change Log

####3.0.1
#### 3.1.1
* Laravel 5.4 Fix
* Added US Cellular

#### 3.1.0
* Added Just Send Driver and Bug Fixes

#### 3.0.1
* Fixed a bug where the config file was not being copied correctly.

####3.0.0
#### 3.0.0
* Updated Readme

####3.0.0-Beta1
#### 3.0.0-Beta1
* Added FlowRoute Driver. --Thanks [rasumo](https://github.com/rasumo)
* Added Plivo Driver. --Thanks [rasumo](https://github.com/rasumo)
* Config file now users env by default. --Thanks [rasumo](https://github.com/rasumo)
Expand All @@ -22,24 +29,24 @@ Simple SMS
* Moved to PSR-4 Autoloading.
* PSR-2 Cleanup.

####2.1.2
#### 2.1.2
* An `outgoing message` is now returned when a message is sent. --Thanks [marfurt](https://github.com/marfurt)
* The E-Mail driver only sends emails in text format now. --Thanks [cozylife](https://github.com/cozylife)
* Added a new Zenvia Driver. --Thanks [filipegar](https://github.com/filipegar)
* Updated docs to point to simplesoftware.io

####2.1.1
#### 2.1.1
* Updated Twilio dependency.

####2.1.0
#### 2.1.0
* Fixed doc blocks --Thanks [Ellrion](https://github.com/Ellrion)
* Created Driver Manager class to better manager drivers. --Thanks [Ellrion](https://github.com/Ellrion)
* Added LabsMobile driver --Thanks [borislalov](https://github.com/borislalov)
* Added Nexmo driver --Thanks [cricu](https://github.com/cricu)
* Added ability to switch drivers at runtime.
* Fixed a bug when the `queue` method is called upon.

####2.0.0
#### 2.0.0
* Full Laravel 5.X support.
* Updated to Guzzle 6.
* Dropped support for PHP 5.4
Expand All @@ -49,22 +56,22 @@ Simple SMS
####2.0.0-Beta1
* Adds support for Laravel 5

####1.1.0
#### 1.1.0
* Added MMS support for Twilio.
* Corrected some typos in the readme.

####1.0.0
#### 1.0.0
* Removed unstable development warnings.
* Basic doc cleanup.

####Beta 1
#### Beta 1
* Dropping receive support for CallFire due to not being able to get a keyword to test.
* Dropping support for Mozeo receive due to not being able to get an API link forwarding set up automatically.

####Alpha 3
#### Alpha 3
* General comment and code clean up.

####Alpha 2
#### Alpha 2
* Expanded documentation.
* EZTexting now supports checking for messages.
* CallFire now supports checking for messages.
Expand Down
3 changes: 2 additions & 1 deletion docs/en/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ The following are currently supported by using the e-mail gateway driver.
| USA | Virgin Mobile | virginmobile | Yes | Yes |
| USA | T-Mobile | tmobile | Yes | Yes |
| USA | Sprint | sprint | Yes | Yes |
| USA | US Cellular | uscellular | Yes | Yes |

>You must know the wireless provider for the mobile phone to use this driver.
Expand Down Expand Up @@ -284,7 +285,7 @@ This driver sends messages through the [JustSend](https://justsend.pl/) messagin
'api_key' => 'Your API Key.'
]
];

`from` can be one of the following:
- `ECO` - cheapest type (about 0.03 PLN per SMS). SMS will be send from random short-code number.
- One of: `INFO`, `INFORMACJA`, `KONKURS`, `NOWOSC`, `OFERTA`, `OKAZJA`, `PROMOCJA`, `SMS` - about 0.06 PLN per SMS.
Expand Down
14 changes: 7 additions & 7 deletions src/DriverManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@

use GuzzleHttp\Client;
use Illuminate\Support\Manager;
use SimpleSoftwareIO\SMS\Drivers\CallFireSMS;
use SimpleSoftwareIO\SMS\Drivers\EmailSMS;
use SimpleSoftwareIO\SMS\Drivers\EZTextingSMS;
use SimpleSoftwareIO\SMS\Drivers\FlowrouteSMS;
use SimpleSoftwareIO\SMS\Drivers\JustSendSMS;
use SimpleSoftwareIO\SMS\Drivers\LabsMobileSMS;
use SimpleSoftwareIO\SMS\Drivers\SMS77;
use SimpleSoftwareIO\SMS\Drivers\LogSMS;
use SimpleSoftwareIO\SMS\Drivers\EmailSMS;
use SimpleSoftwareIO\SMS\Drivers\MozeoSMS;
use SimpleSoftwareIO\SMS\Drivers\NexmoSMS;
use SimpleSoftwareIO\SMS\Drivers\PlivoSMS;
use SimpleSoftwareIO\SMS\Drivers\SMS77;
use SimpleSoftwareIO\SMS\Drivers\TwilioSMS;
use SimpleSoftwareIO\SMS\Drivers\ZenviaSMS;
use SimpleSoftwareIO\SMS\Drivers\CallFireSMS;
use SimpleSoftwareIO\SMS\Drivers\JustSendSMS;
use SimpleSoftwareIO\SMS\Drivers\EZTextingSMS;
use SimpleSoftwareIO\SMS\Drivers\FlowrouteSMS;
use SimpleSoftwareIO\SMS\Drivers\LabsMobileSMS;

class DriverManager extends Manager
{
Expand Down
5 changes: 1 addition & 4 deletions src/Drivers/AbstractSMS.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

abstract class AbstractSMS
{

protected $debug;

/**
Expand Down Expand Up @@ -72,14 +71,12 @@ protected function makeMessage($rawMessage)
abstract protected function processReceive($rawMessage);

/**
* Defines if debug is enabled or disabled (SMS77)
* Defines if debug is enabled or disabled (SMS77).
*
* @param $debug
*/
public function setDebug($debug)
{
$this->debug = $debug;
}


}
10 changes: 6 additions & 4 deletions src/Drivers/EmailSMS.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,11 @@ protected function lookupGateway($carrier, $mms)

case 'airfiremobile':
throw new \InvalidArgumentException('Air Fire Mobile does not support Email Gateway MMS messages.');

case 'alaskacommunicates':
return 'msg.acsalaska.com';

case 'ameritech':
throw new \InvalidArgumentException('Ameritech does not support Email Gateway MMS messages.');

case 'assurancewireless':
return 'vmobl.com';

Expand All @@ -131,7 +129,6 @@ protected function lookupGateway($carrier, $mms)

case 'cleartalk':
throw new \InvalidArgumentException('Clear Talk does not support Email Gateway MMS messages.');

case 'cricket':
return 'mms.mycricket.com ';

Expand All @@ -140,7 +137,6 @@ protected function lookupGateway($carrier, $mms)

case 'nextech':
throw new \InvalidArgumentException('NexTech does not support Email Gateway MMS messages.');

case 'projectfi':
return 'msg.fi.google.com';

Expand All @@ -162,6 +158,9 @@ protected function lookupGateway($carrier, $mms)
case 'sprint':
return 'pm.sprint.com';

case 'uscellular':
return 'mms.uscc.net';

default:
throw new \InvalidArgumentException('Carrier specified is not found.');
}
Expand Down Expand Up @@ -218,6 +217,9 @@ protected function lookupGateway($carrier, $mms)
case 'sprint':
return 'messaging.sprintpcs.com';

case 'uscellular':
return 'email.uscc.net';

default:
throw new \InvalidArgumentException('Carrier specified is not found.');
}
Expand Down
2 changes: 1 addition & 1 deletion src/Drivers/LabsMobileSMS.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace SimpleSoftwareIO\SMS\Drivers;

use GuzzleHttp\Client;
use SimpleSoftwareIO\SMS\DoesNotReceive;
use SimpleSoftwareIO\SMS\MakesRequests;
use SimpleSoftwareIO\SMS\DoesNotReceive;
use SimpleSoftwareIO\SMS\OutgoingMessage;

class LabsMobileSMS extends AbstractSMS implements DriverInterface
Expand Down
2 changes: 1 addition & 1 deletion src/Drivers/MozeoSMS.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace SimpleSoftwareIO\SMS\Drivers;

use GuzzleHttp\Client;
use SimpleSoftwareIO\SMS\DoesNotReceive;
use SimpleSoftwareIO\SMS\MakesRequests;
use SimpleSoftwareIO\SMS\DoesNotReceive;
use SimpleSoftwareIO\SMS\OutgoingMessage;

class MozeoSMS extends AbstractSMS implements DriverInterface
Expand Down
2 changes: 1 addition & 1 deletion src/Drivers/PlivoSMS.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ protected function validateRequest()
$signature = $_SERVER['X-Plivo-Signature'];
$authToken = $this->authToken;

if (!$this->plivo->validate_signature($url, $data, $signature, $authToken)) {
if (! $this->plivo->validate_signature($url, $data, $signature, $authToken)) {
throw new \InvalidArgumentException('This request was not able to verify it came from Plivo.');
}

Expand Down
13 changes: 8 additions & 5 deletions src/Drivers/SMS77.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

namespace SimpleSoftwareIO\SMS\Drivers;

use GuzzleHttp\Client;
use SimpleSoftwareIO\SMS\DoesNotReceive;
use SimpleSoftwareIO\SMS\MakesRequests;
use SimpleSoftwareIO\SMS\DoesNotReceive;
use SimpleSoftwareIO\SMS\OutgoingMessage;

class SMS77 extends AbstractSMS implements DriverInterface
Expand Down Expand Up @@ -67,11 +68,12 @@ public function send(OutgoingMessage $message)
if ($this->hasError($responseBody)) {
$this->handleError($responseBody);
}

return $response;
}

/**
* Checks if the transaction has an error
* Checks if the transaction has an error.
*
* @param $body
* @return bool
Expand All @@ -81,20 +83,21 @@ protected function hasError($body)
if ($body != '100') {
return $body;
}

return false;
}

/**
* Log the error message which ocurred
* Log the error message which ocurred.
*
* @param $body
*/
protected function handleError($body)
{
$error = 'An error occurred. Status code: ' . $body . ' - ';
$error = 'An error occurred. Status code: '.$body.' - ';

//From https://www.sms77.de/api.pdf Rückgabewerte (German doc)
switch($body){
switch ($body) {
case '101':
$error .= 'Versand an mindestens einen Empfänger fehlgeschlagen';
break;
Expand Down
6 changes: 3 additions & 3 deletions src/Drivers/ZenviaSMS.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class ZenviaSMS extends AbstractSMS implements DriverInterface
{
use MakesRequests;

/**
* The API's URL.
*
Expand Down Expand Up @@ -119,7 +119,7 @@ public function checkMessages(array $options = [])

$jsonResponse = json_decode($this->postRequest()->getBody()->getContents());

if (!isset($jsonResponse->receivedResponse)) {
if (! isset($jsonResponse->receivedResponse)) {
throw new \Exception('Invalid response from API. Missing mandatory object.');
}

Expand Down Expand Up @@ -244,7 +244,7 @@ private function generateMessageBody($from, $number, $composeMessage)
'callbackOption' => $this->callbackOption,
];

if (!is_null($number['carrier'])) {
if (! is_null($number['carrier'])) {
$aux['id'] = $number['carrier'];
}

Expand Down
2 changes: 1 addition & 1 deletion src/MakesRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ trait MakesRequests
*/
protected function buildCall($url)
{
if (!$this->callBuilt) {
if (! $this->callBuilt) {
$this->apiBase .= $url;
$this->callBuilt = true;
}
Expand Down
8 changes: 4 additions & 4 deletions src/SMS.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
namespace SimpleSoftwareIO\SMS;

use Closure;
use Illuminate\Container\Container;
use Illuminate\Queue\QueueManager;
use Illuminate\Support\Str;
use SimpleSoftwareIO\SMS\Drivers\DriverInterface;
use SuperClosure\Serializer;
use Illuminate\Queue\QueueManager;
use Illuminate\Container\Container;
use SimpleSoftwareIO\SMS\Drivers\DriverInterface;

class SMS
{
Expand Down Expand Up @@ -191,7 +191,7 @@ public function laterOn($queue, $delay, $view, $data, $callback)
*/
protected function buildQueueCallable($callback)
{
if (!$callback instanceof Closure) {
if (! $callback instanceof Closure) {
return $callback;
}

Expand Down
2 changes: 1 addition & 1 deletion src/SMSServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function register()
*/
public function registerSender()
{
$this->app['sms.sender'] = $this->app->share(function ($app) {
$this->app->singleton('sms.sender', function ($app) {
return (new DriverManager($app))->driver();
});
}
Expand Down
14 changes: 3 additions & 11 deletions tests/SMS77Test.php
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
<?php

use GuzzleHttp\Client;
use Mockery as m;
use SimpleSoftwareIO\SMS\Drivers\SMS77;
use SimpleSoftwareIO\SMS\MakesRequests;
use SimpleSoftwareIO\SMS\OutgoingMessage;
use Mockery as m;

class SMS77Test extends \PHPUnit_Framework_TestCase
{

/**
* @var \SimpleSoftwareIO\SMS\SMS
*/
protected $sms;

/**
*
*/
public function setUp()
{
parent::setUp();
$username = getenv('SMS77USER');
if (!$username) {
if (! $username) {
$this->markTestSkipped('SMS77 integration Testing not possible with out SMS77 user name (SMS77USER + SMS77PASSWORD in ENV). Skipping.');
}
$password = getenv('SMS77PASSWORD');
Expand All @@ -44,10 +38,8 @@ public function testSendSMS()
$this->driver->send($message);
}



public function testSendSMSReal()
{
$this->markTestSkipped('Not sending real SMS - comment this line to try');
}
}
}

0 comments on commit 93e7feb

Please sign in to comment.