-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Notifier] Add Infobip bridge #36480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Notifier] Add Infobip bridge #36480
Conversation
$scheme = $dsn->getScheme(); | ||
$username = $this->getUser($dsn); | ||
$password = $this->getPassword($dsn); | ||
$from = $dsn->getOption('from'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should probably throw an exception if not passed (have a look at the Freemobile transport factory for an example).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added it but we do not have that exception thrown for Nexmo and Twilio. Do you want me to add it too for those?
6573106
to
f4a37fc
Compare
Infobip recommends API key authentication which is more flexible than using basic auth. https://dev.infobip.com/#section/Authentication |
I have changed the auth. Thank you @Jontsa |
I have added tests based on Freemobile too. |
return $message instanceof SmsMessage; | ||
} | ||
|
||
protected function doSend(MessageInterface $message): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should return a SentMessage
:)
=============== | ||
|
||
Provides Infobip integration for Symfony Notifier. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should probably document the DSN pattern here (we should do the same for all other transports if you have time to contribute that in another PR).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
@@ -0,0 +1,12 @@ | |||
Infobip Notifier | |||
=============== |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing = at the end.
$factory->create(Dsn::fromString($dsnUnsupported)); | ||
} | ||
|
||
private function initFactory(): InfobipTransportFactory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove the method and inline the instance creation instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
$transport->send($this->createMock(MessageInterface::class)); | ||
} | ||
|
||
private function initTransport(): InfobipTransport |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would call it getTransport()
(I've renamed it in Freemobile tests).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
@@ -34,6 +34,10 @@ | |||
<tag name="texter.transport_factory" /> | |||
</service> | |||
|
|||
<service id="notifier.transport_factory.infobip" class="Symfony\Component\Notifier\Bridge\Infobip\InfobipTransportFactory" parent="notifier.transport_factory.abstract"> | |||
<tag name="texter.transport_factory" /> | |||
</service> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should rebase on current master and move this to the new transport.php file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
45683cd
to
f1941b5
Compare
f1941b5
to
e138cba
Compare
Thank you @jeremyFreeAgent. |
@jeremyFreeAgent Can you submit a PR on symfony/recipes (you can have a look at other notifier bridge recipes to get some inspiration)? |
I've submitted the PR symfony/recipes#812 |
This PR was merged into the master branch. Discussion ---------- [Notifier] Add Infobip Docs for symfony/symfony#36480 Commits ------- f54b53b [Notifier] Add Infobip
Add Infobip SMS.
see https://www.infobip.com