@@ -282,6 +282,63 @@ public function testStartThrowsException(): void
282282 }
283283 }
284284
285+ /**
286+ * @throws ClientExceptionInterface
287+ * @throws Client\Exception\Exception
288+ * @throws ServerException
289+ */
290+ public function testStartThrowsExceptionAndHandlesBlock (): void
291+ {
292+ $ response = $ this ->setupClientForStart ('start-error-blocked ' );
293+
294+ try {
295+ @$ this ->client ->start (
296+ [
297+ 'number ' => '14845551212 ' ,
298+ 'brand ' => 'Test Verify '
299+ ]
300+ );
301+
302+ self ::fail ('did not throw exception ' );
303+ } catch (Client \Exception \Request $ e ) {
304+ $ this ->assertEquals ('7 ' , $ e ->getCode ());
305+ $ this ->assertEquals (
306+ 'The number you are trying to verify is blacklisted for verification ' ,
307+ $ e ->getMessage ()
308+ );
309+ $ this ->assertSame ($ response , @$ e ->getEntity ()->getResponse ());
310+ }
311+ }
312+
313+ /**
314+ * @throws ClientExceptionInterface
315+ * @throws Client\Exception\Exception
316+ * @throws ServerException
317+ */
318+ public function testStartThrowsExceptionAndHandlesConcurrentVerifications (): void
319+ {
320+ $ response = $ this ->setupClientForStart ('start-error-concurrent ' );
321+
322+ try {
323+ @$ this ->client ->start (
324+ [
325+ 'number ' => '14845551212 ' ,
326+ 'brand ' => 'Test Verify '
327+ ]
328+ );
329+
330+ self ::fail ('did not throw exception ' );
331+ } catch (Client \Exception \Request $ e ) {
332+ $ this ->assertEquals ('10 ' , $ e ->getCode ());
333+ $ this ->assertEquals (
334+ 'Concurrent verifications to the same number are not allowed ' ,
335+ $ e ->getMessage ()
336+ );
337+ $ this ->assertEquals ('abcdef0123456789abcdef0123456789 ' , $ e ->getRequestId ());
338+ $ this ->assertSame ($ response , @$ e ->getEntity ()->getResponse ());
339+ }
340+ }
341+
285342 /**
286343 * @throws ClientExceptionInterface
287344 * @throws Client\Exception\Exception
0 commit comments