Skip to content

Commit

Permalink
remove verification checks, API behaviour too unstable currently (#449)
Browse files Browse the repository at this point in the history
  • Loading branch information
SecondeJK authored Oct 24, 2023
1 parent e9881df commit e472cad
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 82 deletions.
43 changes: 0 additions & 43 deletions src/Verify2/VerifyObjects/VerificationLocale.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,8 @@

class VerificationLocale
{
private array $allowedCodes = [
'fr-fr',
'en-gb',
'en-us',
'es-es',
'es-us',
'it-it',
'de-de',
'pt-br',
'pt-pt',
'ru-ru',
'hi-in',
'id-id',
'he-il',
'yue-cn',
'ja-jp',
'ar-xa',
'cs-cz',
'cy-gb',
'el-gr',
'en-au',
'en-in',
'es-mx',
'fi-fi',
'fil-ph',
'fr-ca',
'hu-hu',
'is-is',
'nb-no',
'nl-nl',
'pl-pl',
'ro-ro',
'sv-se',
'th-th',
'tr-tr',
'vi-vn',
'zh-cn',
'zh-tw'
];

public function __construct(protected string $code = 'en-us')
{
if (! in_array($code, $this->allowedCodes, true)) {
throw new \InvalidArgumentException('Invalid Locale Code Provided');
}
}

public function getCode(): string
Expand Down
39 changes: 0 additions & 39 deletions test/Verify2/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,45 +138,6 @@ public function testCanBypassFraudCheck(): void
$this->assertArrayHasKey('request_id', $result);
}

/**
* @dataProvider localeProvider
*/
public function testCannotRequestSMSWithInvalidLocale($locale, $valid): void
{
if (!$valid) {
$this->expectException(\InvalidArgumentException::class);
}

$verificationLocale = new VerificationLocale($locale);

$payload = [
'to' => '07785254785',
'client_ref' => 'my-verification',
'brand' => 'my-brand',
'locale' => $verificationLocale,
];

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

$this->vonageClient->send(Argument::that(function (Request $request) use ($payload) {
$this->assertEquals(
'Basic ',
mb_substr($request->getHeaders()['Authorization'][0], 0, 6)
);

$this->assertRequestJsonBodyContains('locale', $payload['locale']->getCode(), $request);
$this->assertEquals('POST', $request->getMethod());

return true;
}))->willReturn($this->getResponse('verify-request-success', 202));

$result = $this->verify2Client->startVerification($smsVerification);

$this->assertIsArray($result);
$this->assertArrayHasKey('request_id', $result);
}

/**
* @dataProvider timeoutProvider
*/
Expand Down

0 comments on commit e472cad

Please sign in to comment.