Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Notifier] Add Orange SMS bridge#44884

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
enigma972 wants to merge21 commits intosymfony:5.4fromenigma972:5.4
Closed

[Notifier] Add Orange SMS bridge#44884

enigma972 wants to merge21 commits intosymfony:5.4fromenigma972:5.4

Conversation

@enigma972
Copy link
Contributor

QA
Branch?5.4
Bug fix?no
New feature?yes
Deprecations?no
LicenseMIT

Add Orange SMS bridge

ismail1432 reacted with thumbs up emoji
@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has acontribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (seehttps://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (seehttps://symfony.com/releases)
  • Features and deprecations must be submitted against the 6.1 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@OskarStark
Copy link
Contributor

Please target 6.1 branch


public function toStringProvider(): iterable
{
yield ['orangesms://default?from=FROM&sender_name=SENDER_NAME', $this->createTransport()];
Copy link
Contributor

Choose a reason for hiding this comment

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

Test missing, where Sender name is not set

enigma972 reacted with thumbs up emoji
Comment on lines 28 to 41
private $clientID;
private $clientSecret;
private $from;
private $senderName;

public function __construct(string $clientID, string $clientSecret, string $from, ?string $senderName, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null)
{
$this->clientID = $clientID;
$this->clientSecret = $clientSecret;
$this->from = $from;
$this->senderName = $senderName;

parent::__construct($client, $dispatcher);
}
Copy link
Member

@KocalKocalJan 2, 2022
edited
Loading

Choose a reason for hiding this comment

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

Since 6.1 is PHP 8 only, why not just use constructor property promotion?

Suggested change
private$clientID;
private$clientSecret;
private$from;
private$senderName;
publicfunction __construct(string$clientID,string$clientSecret,string$from, ?string$senderName,HttpClientInterface$client =null,EventDispatcherInterface$dispatcher =null)
{
$this->clientID =$clientID;
$this->clientSecret =$clientSecret;
$this->from =$from;
$this->senderName =$senderName;
parent::__construct($client,$dispatcher);
}
publicfunction __construct(privatestring$clientID,privatestring$clientSecret,privatestring$from,private ?string$senderName,HttpClientInterface$client =null,EventDispatcherInterface$dispatcher =null)
{
parent::__construct($client,$dispatcher);
}

enigma972 reacted with thumbs up emoji
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure Symfony uses it

Cc @symfony/mergers

Copy link
Member

Choose a reason for hiding this comment

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

I don't see any reason not to use it in new code. But before, we have to be sure that PHP-CS-Fixer/fabbot is compatible.

alamirault reacted with thumbs up emoji
Copy link
Member

@GromNaNGromNaN left a comment
edited
Loading

Choose a reason for hiding this comment

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

Nice addition.

After a rebase on branch 6.1, you can update the target of this PR.


$url = 'https://'.$this->getEndpoint().'/smsmessaging/v1/outbound/'.urlencode('tel:'.$this->from).'/requests';
$headers = [
'Authorization' => 'Bearer '.$this->getAccessToken(),
Copy link
Member

Choose a reason for hiding this comment

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

The access token should be cached and reused if several messages are sent. But that would require some expiration management for long running processes.
This is not blocking and could be handled in a future PR.

OskarStark reacted with thumbs up emoji
$url = 'https://'.$this->getEndpoint().'/oauth/v3/token';
$credentials = $this->clientID.':'.$this->clientSecret;
$headers = [
'Authorization' => 'Basic '.base64_encode($credentials),
Copy link
Member

Choose a reason for hiding this comment

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

The HTTP client has theauth_basic option for that.
https://symfony.com/doc/current/http_client.html#authentication

enigma972 and OskarStark reacted with thumbs up emoji
private string $clientID;
private string $clientSecret;
private string $from;
private string $senderName;
Copy link
Member

Choose a reason for hiding this comment

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

this is wrong. The constructor will assignstring|null in this property

OskarStark and enigma972 reacted with thumbs up emoji
$errorMessage = $content['requestError']['serviceException']['messageId'] ?? '';
$errorInfo = $content['requestError']['serviceException']['text'] ?? '';

throw new TransportException(sprintf('Unable to send the SMS: '.$errorMessage.' (%s).', $errorInfo), $response);
Copy link
Member

Choose a reason for hiding this comment

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

concatenating the error message into the format string ofsprintf is a no-go, as it would require escaping% in the error message to avoid breaking it.

enigma972 reacted with thumbs up emoji
@stof
Copy link
Member

stof commentedJan 4, 2022

please also check the CI failures

enigma972 reacted with thumbs up emoji

@OskarStark
Copy link
Contributor

Please rebase on 6.1 branch and target 6.1 afterwards, thanks

@enigma972
Copy link
ContributorAuthor

Please rebase on 6.1 branch and target 6.1 afterwards, thanks

By bad handling I deleted the fork, so I had to open another pull request
At#44913

@GromNaNGromNaN closed thisJan 5, 2022
fabpot added a commit that referenced this pull requestJan 17, 2022
This PR was squashed before being merged into the 6.1 branch.Discussion----------[Notifier] Add Orange SMS bridge| Q             | A| ------------- | ---| Branch?       | 6.1| Bug fix?      | no| New feature?  | yes| Deprecations? | no| License       | MITAdd Orange SMS bridgePreviously [#44884](#44884)Commits-------1aebeaf [Notifier] Add Orange SMS bridge
symfony-splitter pushed a commit to symfony/framework-bundle that referenced this pull requestJan 17, 2022
This PR was squashed before being merged into the 6.1 branch.Discussion----------[Notifier] Add Orange SMS bridge| Q             | A| ------------- | ---| Branch?       | 6.1| Bug fix?      | no| New feature?  | yes| Deprecations? | no| License       | MITAdd Orange SMS bridgePreviously [#44884](symfony/symfony#44884)Commits-------1aebeaf77c [Notifier] Add Orange SMS bridge
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@GromNaNGromNaNAwaiting requested review from GromNaN

@stofstofAwaiting requested review from stof

@OskarStarkOskarStarkAwaiting requested review from OskarStarkOskarStark is a code owner

1 more reviewer

@KocalKocalKocal left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

5.4

Development

Successfully merging this pull request may close these issues.

6 participants

@enigma972@carsonbot@OskarStark@stof@GromNaN@Kocal

[8]ページ先頭

©2009-2025 Movatter.jp