Skip to content

Commit

Permalink
From can now be added for sender_id on Verify2 SMS (#461)
Browse files Browse the repository at this point in the history
  • Loading branch information
SecondeJK authored Dec 13, 2023
1 parent 2c8d6b4 commit b903787
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Verify2/Request/SMSRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ public function __construct(
protected string $to,
protected string $brand,
protected ?VerificationLocale $locale = null,
protected string $from = '',
) {
if (!$this->locale) {
$this->locale = new VerificationLocale();
}

$workflow = new VerificationWorkflow(VerificationWorkflow::WORKFLOW_SMS, $to);
$workflow = new VerificationWorkflow(VerificationWorkflow::WORKFLOW_SMS, $to, $from);

$this->addWorkflow($workflow);
}
Expand Down
4 changes: 3 additions & 1 deletion test/Verify2/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ public function testCanRequestSMS(): void
'to' => '07785254785',
'client_ref' => 'my-verification',
'brand' => 'my-brand',
'from' => 'vonage'
];

$smsVerification = new SMSRequest($payload['to'], $payload['brand']);
$smsVerification = new SMSRequest($payload['to'], $payload['brand'], null, $payload['from']);
$smsVerification->setClientRef($payload['client_ref']);

$this->vonageClient->send(Argument::that(function (Request $request) use ($payload) {
Expand All @@ -104,6 +105,7 @@ public function testCanRequestSMS(): void
$this->assertRequestJsonBodyContains('code_length', 4, $request);
$this->assertRequestJsonBodyContains('brand', $payload['brand'], $request);
$this->assertRequestJsonBodyContains('to', $payload['to'], $request, true);
$this->assertRequestJsonBodyContains('from', $payload['from'], $request, true);
$this->assertRequestJsonBodyContains('channel', 'sms', $request, true);
$this->assertEquals('POST', $request->getMethod());

Expand Down

0 comments on commit b903787

Please sign in to comment.