@@ -393,6 +393,33 @@ public function testCanRequestSilentAuth(): void
393
393
$ this ->assertEquals ('https://api.nexmo.com/v2/verify/c11236f4-00bf-4b89-84ba-88b25df97315/silent-auth/redirect ' , $ result ['check_url ' ]);
394
394
}
395
395
396
+ public function testCanRequestSilentAuthWithRedirectUrl (): void
397
+ {
398
+ $ payload = [
399
+ 'to ' => '07784587411 ' ,
400
+ 'brand ' => 'my-brand ' ,
401
+ 'redirect_url ' => 'https://my-app-endpoint/webhook '
402
+ ];
403
+
404
+ $ silentAuthRequest = new SilentAuthRequest ($ payload ['to ' ], $ payload ['brand ' ], $ payload ['redirect_url ' ]);
405
+
406
+ $ this ->vonageClient ->send (Argument::that (function (Request $ request ) use ($ payload ) {
407
+ $ this ->assertRequestJsonBodyContains ('brand ' , $ payload ['brand ' ], $ request );
408
+ $ this ->assertRequestJsonBodyContains ('to ' , $ payload ['to ' ], $ request , true );
409
+ $ this ->assertRequestJsonBodyContains ('channel ' , 'silent_auth ' , $ request , true );
410
+ $ this ->assertRequestJsonBodyContains ('redirect_url ' , 'https://my-app-endpoint/webhook ' , $ request , true );
411
+ $ this ->assertEquals ('POST ' , $ request ->getMethod ());
412
+
413
+ return true ;
414
+ }))->willReturn ($ this ->getResponse ('verify-silent-auth-request-success ' , 202 ));
415
+
416
+ $ result = $ this ->verify2Client ->startVerification ($ silentAuthRequest );
417
+ $ this ->assertIsArray ($ result );
418
+ $ this ->assertArrayHasKey ('request_id ' , $ result );
419
+ $ this ->assertArrayHasKey ('check_url ' , $ result );
420
+ $ this ->assertEquals ('https://api.nexmo.com/v2/verify/c11236f4-00bf-4b89-84ba-88b25df97315/silent-auth/redirect ' , $ result ['check_url ' ]);
421
+ }
422
+
396
423
public function testCannotSendConcurrentVerifications (): void
397
424
{
398
425
$ this ->expectException (Client \Exception \Request::class);
0 commit comments