diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php
index 529f69b..beb0ad5 100644
--- a/DependencyInjection/Configuration.php
+++ b/DependencyInjection/Configuration.php
@@ -33,12 +33,18 @@ class Configuration implements ConfigurationInterface
->booleanNode('verbose_curl')
->defaultFalse()
->end()
+ ->scalarNode('sms_account_id')
+ ->defaultFalse()
+ ->end()
->scalarNode('username')
->isRequired()
->end()
->scalarNode('password')
->isRequired()
->end()
+ ->scalarNode('from')
+ ->isRequired()
+ ->end()
->end();
return $treeBuilder;
diff --git a/DependencyInjection/GergelyPolonkaiSmsSenderExtension.php b/DependencyInjection/GergelyPolonkaiSmsSenderExtension.php
index 03712b3..6edfc1c 100644
--- a/DependencyInjection/GergelyPolonkaiSmsSenderExtension.php
+++ b/DependencyInjection/GergelyPolonkaiSmsSenderExtension.php
@@ -28,5 +28,7 @@ class GergelyPolonkaiSmsSenderExtension extends Extension
$container->setParameter('verbose_curl', $config['verbose_curl']);
$container->setParameter('username', $config['username']);
$container->setParameter('password', $config['password']);
+ $container->setParameter('sms_account_id', $config['sms_account_id']);
+ $container->setParameter('from', $config['from']);
}
}
diff --git a/Resources/config/services.xml b/Resources/config/services.xml
index 5cb47f5..6b5dc43 100644
--- a/Resources/config/services.xml
+++ b/Resources/config/services.xml
@@ -6,11 +6,15 @@
GergelyPolonkai\SmsSenderBundle\Service\Sender
+ GergelyPolonkai\SmsSenderBundle\Service\OvhSoapSender
+
+
+
\ No newline at end of file
diff --git a/Service/OvhSoapSender.php b/Service/OvhSoapSender.php
new file mode 100644
index 0000000..422e13b
--- /dev/null
+++ b/Service/OvhSoapSender.php
@@ -0,0 +1,58 @@
+container = $container;
+
+ $this->sender = new BaseSender(
+ $this->container->getParameter('sender_url'),
+ $this->container->getParameter('sms_account_id'),
+ $this->container->getParameter('from'));
+ }
+
+ public function login()
+ {
+ if ($this->sender->login($this->container->getParameter('username'), $this->container->getParameter('password'))){
+ $this->loggedIn = true;
+ } else {
+ throw new \RuntimeException('Unable to login to gateway!');
+ }
+ }
+
+ public function sendMessage($recipient, $message, array $passwordLocations)
+ {
+ if (!$this->loggedIn) {
+ return false;
+ }
+ $this->sender->sendMessage($recipient, $message, $passwordLocations);
+ }
+
+ public function logout()
+ {
+ if (!$this->loggedIn) {
+ return false;
+ }
+ $this->sender->logout();
+ }
+}
diff --git a/Service/Sender.php b/Service/Sender.php
index c30dfb6..6b880a7 100644
--- a/Service/Sender.php
+++ b/Service/Sender.php
@@ -3,12 +3,12 @@ namespace GergelyPolonkai\SmsSenderBundle\Service;
use Symfony\Component\DependencyInjection\ContainerInterface;
use RuntimeException;
-use GergelyPolonkai\SmsSender\Sender as BaseSender;
+use GergelyPolonkai\SmsSender\OvhSoapSender as BaseSender;
/**
* @author Gergely Polonkai
*
- * SMS Sending service for JSON-RPC based SMS Sender server
+ * SMS Sending service for OVH Soap based SMS Sender server
*/
class Sender
{