Skip to content

[Notifier] Add Mobyt bridge #36648

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 13, 2020
Merged

Conversation

Deamon
Copy link
Contributor

@Deamon Deamon commented Apr 30, 2020

Q A
Branch? master
Bug fix? no
New feature? yes
Deprecations? no
Tickets #33687
License MIT
Doc PR symfony/symfony-docs#13606
recipe PR symfony/recipes#768

Add Mobyt notifier bridge.

In this SMS Provider, you can choose a sort of "quality service" to send the message.

I updated src/Symfony/Component/Notifier/Message/SmsMessage.php to add the notification in order to be able to use the notification importance when creating options.

@nicolas-grekas nicolas-grekas added this to the next milestone May 1, 2020
@Deamon Deamon force-pushed the add-mobyt-notifier-bridge branch from 512440f to 3b5cdbb Compare May 2, 2020 20:26
@Deamon Deamon force-pushed the add-mobyt-notifier-bridge branch from 3b5cdbb to 59acfa2 Compare June 12, 2020 15:24
@Deamon
Copy link
Contributor Author

Deamon commented Jun 12, 2020

Rebased few minutes ago on master.
Fixed conflicts and fixed notifier_transport that changed from xml to php.

return $message;
}

public function getNotification(): ?Notification
Copy link
Member

Choose a reason for hiding this comment

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

This should be reverted

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @fabpot, you mean this function only or the entire modification of the file ?

Copy link
Member

Choose a reason for hiding this comment

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

The whole change in the SmsMessage class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Question about that, I need to know the notification level inside the Moby Transport class to select a "type_quality" parameter (which implies cost differences).

Is there an other way ?

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 use the less costly by default and let's talk about this issue in another PR. That would allow to merge this one and think about the issue is a more broader sense instead of just for this specific provider.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank for you feedback. Fix is on the way.

@fabpot
Copy link
Member

fabpot commented Aug 10, 2020

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

@Deamon
Copy link
Contributor Author

Deamon commented Aug 10, 2020

Hello @fabpot, thanks for your comment,
Here is the pr: symfony/recipes#768

There is also a documentation pr waiting.

@fabpot
Copy link
Member

fabpot commented Aug 10, 2020

@daemon Can you also rebase this PR on current master and take my comment into account? Thank you.

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.

This must return a SentMessage now.

"ext-json": "*",
"php": "^7.2.5",
"symfony/http-client": "^4.3|^5.0",
"symfony/notifier": "^5.0"
Copy link
Member

Choose a reason for hiding this comment

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

Should be ^5.2

@Deamon Deamon force-pushed the add-mobyt-notifier-bridge branch from 59acfa2 to cee47a1 Compare August 12, 2020 09:20
@Deamon
Copy link
Contributor Author

Deamon commented Aug 12, 2020

@fabpot, all changes have been pushed

{
$options = $this->options;
unset($options['message']);
unset($options['recipient']);
Copy link
Member

Choose a reason for hiding this comment

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

Could be merged with the previous line.

@@ -0,0 +1,4 @@
/Tests export-ignore
/phpunit.xml.dist export-ignore
/.gitattributes export-ignore
Copy link
Member

Choose a reason for hiding this comment

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

Can be removed to be consistent with the other similar files in core.


throw new TransportException(sprintf('Unable to send the SMS: "%s".', $error['result']), $response);
}
}
Copy link
Member

Choose a reason for hiding this comment

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

You must return a SentMessage instance. Can you also test with a real account to be sure that everything works as expected?

@Deamon Deamon force-pushed the add-mobyt-notifier-bridge branch from cee47a1 to bf594b7 Compare August 12, 2020 16:10
@Deamon
Copy link
Contributor Author

Deamon commented Aug 12, 2020

@fabpot your last feedback have been resolved.

the code is teste in v5.1 only, I couldn't get rid of the following error using dev-master branch:

Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 1
!!
!!  In PhpDumper.php line 1838:
!!
!!    Cannot dump definition because of invalid class name ('chatter.transport_factory').
!!
!!
!!
Script @auto-scripts was called via post-update-cmd
exit status 1

tried several ways but none worked for me.

and yes, the sentMessage part isn't tested because class doesn't exists in 5.1

@fabpot
Copy link
Member

fabpot commented Aug 13, 2020

Thank you @Deamon.

@fabpot fabpot merged commit acda2dc into symfony:master Aug 13, 2020
@Deamon Deamon deleted the add-mobyt-notifier-bridge branch August 14, 2020 06:46
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 Mobyt Notifier

Hi all,

here is the doc for symfony/symfony#36648

Commits
-------

63ea8b7 Add Mobyt Notifier doc
@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