Skip to content

Commit b903787

Browse files
authored
From can now be added for sender_id on Verify2 SMS (#461)
1 parent 2c8d6b4 commit b903787

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/Verify2/Request/SMSRequest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ public function __construct(
1111
protected string $to,
1212
protected string $brand,
1313
protected ?VerificationLocale $locale = null,
14+
protected string $from = '',
1415
) {
1516
if (!$this->locale) {
1617
$this->locale = new VerificationLocale();
1718
}
1819

19-
$workflow = new VerificationWorkflow(VerificationWorkflow::WORKFLOW_SMS, $to);
20+
$workflow = new VerificationWorkflow(VerificationWorkflow::WORKFLOW_SMS, $to, $from);
2021

2122
$this->addWorkflow($workflow);
2223
}

test/Verify2/ClientTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,10 @@ public function testCanRequestSMS(): void
8484
'to' => '07785254785',
8585
'client_ref' => 'my-verification',
8686
'brand' => 'my-brand',
87+
'from' => 'vonage'
8788
];
8889

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

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

0 commit comments

Comments
 (0)