Skip to content

[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

Merged
merged 1 commit into from
Aug 10, 2020

Conversation

jeremyFreeAgent
Copy link
Contributor

@jeremyFreeAgent jeremyFreeAgent commented Apr 17, 2020

Q A
Branch? master
Bug fix? no
New feature? yes
Deprecations? no
Tickets
License MIT
Doc PR symfony/symfony-docs#13623
  • Remove default host

Add Infobip SMS.

see https://www.infobip.com

$scheme = $dsn->getScheme();
$username = $this->getUser($dsn);
$password = $this->getPassword($dsn);
$from = $dsn->getOption('from');
Copy link
Member

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).

Copy link
Contributor Author

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?

@Jontsa
Copy link
Contributor

Jontsa commented Apr 24, 2020

Infobip recommends API key authentication which is more flexible than using basic auth. https://dev.infobip.com/#section/Authentication

@jeremyFreeAgent
Copy link
Contributor Author

I have changed the auth.

Thank you @Jontsa

@jeremyFreeAgent
Copy link
Contributor Author

jeremyFreeAgent commented Apr 27, 2020

I have added tests based on Freemobile too.

return $message instanceof SmsMessage;
}

protected function doSend(MessageInterface $message): void
Copy link
Member

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.

Copy link
Member

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).

Copy link
Contributor Author

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
===============
Copy link
Member

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
Copy link
Member

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.

Copy link
Contributor Author

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
Copy link
Member

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).

Copy link
Contributor Author

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>
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@jeremyFreeAgent jeremyFreeAgent force-pushed the notifier-infobip-bridge branch from 45683cd to f1941b5 Compare August 10, 2020 09:31
@fabpot fabpot force-pushed the notifier-infobip-bridge branch from f1941b5 to e138cba Compare August 10, 2020 09:56
@fabpot
Copy link
Member

fabpot commented Aug 10, 2020

Thank you @jeremyFreeAgent.

@fabpot fabpot merged commit c5d6c10 into symfony:master Aug 10, 2020
@fabpot
Copy link
Member

fabpot commented Aug 10, 2020

@jeremyFreeAgent Can you submit a PR on symfony/recipes (you can have a look at other notifier bridge recipes to get some inspiration)?

@jeremyFreeAgent
Copy link
Contributor Author

I've submitted the PR symfony/recipes#812

javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Sep 9, 2020
This PR was merged into the master branch.

Discussion
----------

[Notifier] Add Infobip

Docs for symfony/symfony#36480

Commits
-------

f54b53b [Notifier] Add Infobip
@nicolas-grekas nicolas-grekas modified the milestones: next, 5.2 Oct 5, 2020
@fabpot fabpot mentioned this pull request Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants