From c8d03163b7aa2af835475791e4a1a9333c4e0f3e Mon Sep 17 00:00:00 2001 From: mehmet-yoti Date: Mon, 19 Aug 2024 01:07:29 +0300 Subject: [PATCH] SDK-2438 added aml checks --- src/Aml/SandboxAddress.php | 73 +++++++ src/Aml/SandboxCountry.php | 39 ++++ src/Aml/SandboxProfile.php | 115 +++++++++++ src/Aml/SandboxResult.php | 140 +++++++++++++ src/Aml/SandboxService.php | 122 +++++++++++ src/Exception/SandboxAmlException.php | 11 + src/Exception/SandboxPemFileException.php | 9 + src/Exception/base/SandboxException.php | 109 ++++++++++ tests/Aml/SandboxAddressTest.php | 93 +++++++++ tests/Aml/SandboxCountryTest.php | 49 +++++ tests/Aml/SandboxProfileTest.php | 122 +++++++++++ tests/Aml/SandboxResultTest.php | 95 +++++++++ tests/Aml/SandboxServiceTest.php | 218 ++++++++++++++++++++ tests/TestCase.php | 16 ++ tests/TestData.php | 4 + tests/sample-data/aml-check-private-key.pem | 27 +++ tests/sample-data/aml-check-public-key.pem | 9 + tests/sample-data/aml-check-result.json | 5 + 18 files changed, 1256 insertions(+) create mode 100644 src/Aml/SandboxAddress.php create mode 100644 src/Aml/SandboxCountry.php create mode 100644 src/Aml/SandboxProfile.php create mode 100644 src/Aml/SandboxResult.php create mode 100644 src/Aml/SandboxService.php create mode 100644 src/Exception/SandboxAmlException.php create mode 100644 src/Exception/SandboxPemFileException.php create mode 100644 src/Exception/base/SandboxException.php create mode 100644 tests/Aml/SandboxAddressTest.php create mode 100644 tests/Aml/SandboxCountryTest.php create mode 100644 tests/Aml/SandboxProfileTest.php create mode 100644 tests/Aml/SandboxResultTest.php create mode 100644 tests/Aml/SandboxServiceTest.php create mode 100644 tests/sample-data/aml-check-private-key.pem create mode 100644 tests/sample-data/aml-check-public-key.pem create mode 100644 tests/sample-data/aml-check-result.json diff --git a/src/Aml/SandboxAddress.php b/src/Aml/SandboxAddress.php new file mode 100644 index 0000000..057eab6 --- /dev/null +++ b/src/Aml/SandboxAddress.php @@ -0,0 +1,73 @@ +country = $country; + $this->postcode = $postcode; + } + + /** + * @return \Yoti\Sandbox\Aml\SandboxCountry + */ + public function getCountry(): SandboxCountry + { + return $this->country; + } + + /** + * @return null|string + */ + public function getPostcode(): ?string + { + return $this->postcode; + } + + /** + * Get address data. + * + * @return stdClass + */ + public function jsonSerialize(): stdClass + { + return (object) [ + self::POSTCODE_ATTR => $this->getPostcode(), + self::COUNTRY_ATTR => $this->getCountry(), + ]; + } + + /** + * @return string + */ + public function __toString(): string + { + return Json::encode($this); + } +} diff --git a/src/Aml/SandboxCountry.php b/src/Aml/SandboxCountry.php new file mode 100644 index 0000000..1c8912d --- /dev/null +++ b/src/Aml/SandboxCountry.php @@ -0,0 +1,39 @@ +code = $code; + } + + /** + * @return string + */ + public function getCode(): string + { + return $this->code; + } + + /** + * @return string + */ + public function jsonSerialize(): string + { + return $this->getCode(); + } +} diff --git a/src/Aml/SandboxProfile.php b/src/Aml/SandboxProfile.php new file mode 100644 index 0000000..b817aaf --- /dev/null +++ b/src/Aml/SandboxProfile.php @@ -0,0 +1,115 @@ +givenNames = $givenNames; + $this->familyName = $familyName; + $this->ssn = $ssn; + $this->amlAddress = $amlAddress; + } + + /** + * @return string + */ + public function getGivenNames(): string + { + return $this->givenNames; + } + + /** + * @return string + */ + public function getFamilyName(): string + { + return $this->familyName; + } + + /** + * @return string|null + */ + public function getSsn(): ?string + { + return $this->ssn; + } + + /** + * @return \Yoti\Sandbox\Aml\SandboxAddress + */ + public function getAmlAddress(): SandboxAddress + { + return $this->amlAddress; + } + + /** + * Get Aml profile data. + * + * @return stdClass + */ + public function jsonSerialize(): stdClass + { + return (object) [ + self::GIVEN_NAMES_ATTR => $this->getGivenNames(), + self::FAMILY_NAME_ATTR => $this->getFamilyName(), + self::SSN_ATTR => $this->getSsn(), + self::ADDRESS_ATTR => $this->getAmlAddress(), + ]; + } + + /** + * @return string + */ + public function __toString(): string + { + return Json::encode($this); + } +} diff --git a/src/Aml/SandboxResult.php b/src/Aml/SandboxResult.php new file mode 100644 index 0000000..eaf776a --- /dev/null +++ b/src/Aml/SandboxResult.php @@ -0,0 +1,140 @@ + + */ + private $rawResult; + + /** + * AmlResult constructor. + * + * @param array $result + * @param ResponseInterface $response + * + * @throws \Yoti\Sandbox\Exception\SandboxAmlException + */ + public function __construct(array $result, ResponseInterface $response) + { + $this->rawResult = $result; + $this->setAttributes($response); + } + + /** + * Check if user is a politically exposed person. + * + * @return bool + */ + public function isOnPepList(): bool + { + return $this->onPepList; + } + + /** + * Check if user is on a fraud list. + * + * @return bool + */ + public function isOnFraudList(): bool + { + return $this->onFraudList; + } + + /** + * Check if user is on a watch list. + * + * @return bool + */ + public function isOnWatchList(): bool + { + return $this->onWatchList; + } + + /** + * Set attribute values. + * + * @param ResponseInterface $response + * + * @throws \Yoti\Sandbox\Exception\SandboxAmlException + */ + private function setAttributes(ResponseInterface $response): void + { + $result = $this->rawResult; + // Check if no attribute is missing from the result + self::checkAttributes($result, $response); + + $this->onPepList = (bool) $result[self::ON_PEP_LIST_KEY]; + $this->onFraudList = (bool) $result[self::ON_FRAUD_LIST_KEY]; + $this->onWatchList = (bool) $result[self::ON_WATCH_LIST_KEY]; + } + + /** + * Check if all the attributes are included in the result. + * + * @param array $result + * @param ResponseInterface $response + * + * @throws \Yoti\Sandbox\Exception\SandboxAmlException + */ + public static function checkAttributes(array $result, ResponseInterface $response): void + { + $expectedAttributes = [ + self::ON_PEP_LIST_KEY, + self::ON_WATCH_LIST_KEY, + self::ON_WATCH_LIST_KEY, + ]; + $providedAttributes = array_keys($result); + $missingAttr = array_diff($expectedAttributes, $providedAttributes); + + // Throw an error if any expected attribute is missing. + if (count($missingAttr) > 0) { + throw new SandboxAmlException('Missing attributes from the result: ' . implode(',', $missingAttr), $response); + } + } + + /** + * Returns json string of the raw data. + * + * @return string + */ + public function __toString(): string + { + return Json::encode($this->rawResult); + } +} diff --git a/src/Aml/SandboxService.php b/src/Aml/SandboxService.php new file mode 100644 index 0000000..50314e0 --- /dev/null +++ b/src/Aml/SandboxService.php @@ -0,0 +1,122 @@ +sdkId = $sdkId; + $this->pemFile = $pemFile; + $this->config = $config; + } + + /** + * @param SandboxProfile $amlProfile + * + * @return SandboxResult + * + * @throws SandboxAmlException + */ + public function performCheck(SandboxProfile $amlProfile): SandboxResult + { + $response = (new RequestBuilder($this->config)) + ->withBaseUrl($this->config->getApiUrl() ?? Constants::API_URL) + ->withEndpoint('/aml-check') + ->withQueryParam('appId', $this->sdkId) + ->withPost() + ->withPayload(Payload::fromJsonData($amlProfile)) + ->withPemFile($this->pemFile) + ->build() + ->execute(); + + // Validate result + $this->validateAmlResult($response); + + // Set and return result + return new SandboxResult(Json::decode((string)$response->getBody()), $response); + } + + /** + * Handle request result. + * + * @param ResponseInterface $response + * + * @throws SandboxAmlException + */ + private function validateAmlResult(ResponseInterface $response): void + { + $httpCode = $response->getStatusCode(); + + if ($httpCode >= 200 && $httpCode < 300) { + // The request is successful - nothing to do + return; + } + + throw new SandboxAmlException($this->getErrorMessage($response), $response); + } + + /** + * Get error message from the response. + * + * @param ResponseInterface $response + * + * @return string + */ + private function getErrorMessage(ResponseInterface $response): string + { + $httpCode = $response->getStatusCode(); + $statusCodeMessage = "Server responded with {$httpCode}"; + + if ( + $response->hasHeader('Content-Type') && + $response->getHeader('Content-Type')[0] !== 'application/json' + ) { + return $statusCodeMessage; + } + + $jsonData = Json::decode((string)$response->getBody()); + + $errorCode = $jsonData['code'] ?? 'Error'; + + // Throw the error message that's included in the response. + if (isset($jsonData['errors'][0]['property']) && isset($jsonData['errors'][0]['message'])) { + $errorMessage = $jsonData['errors'][0]['property'] . ': ' . $jsonData['errors'][0]['message']; + return "{$errorCode} - {$errorMessage}"; + } + + // Throw a general error message. + return "{$errorCode} - {$statusCodeMessage}"; + } +} diff --git a/src/Exception/SandboxAmlException.php b/src/Exception/SandboxAmlException.php new file mode 100644 index 0000000..b5ebe64 --- /dev/null +++ b/src/Exception/SandboxAmlException.php @@ -0,0 +1,11 @@ +formatMessage($message, $response), 0, $previous); + + $this->response = $response; + } + + /** + * Returns the HTTP response object returned + * from the API. + * + * @return ResponseInterface|null + */ + public function getResponse(): ?ResponseInterface + { + return $this->response; + } + + /** + * @param string $message + * @param ResponseInterface|null $response + * + * @return string + */ + private function formatMessage(string $message, ?ResponseInterface $response): string + { + if ( + $response === null || + !$response->hasHeader('Content-Type') || + $response->getHeader('Content-Type')[0] !== 'application/json' + ) { + return $message; + } + + $jsonData = Json::decode((string)$response->getBody(), false); + $formattedResponse = $this->formatResponse($jsonData); + if ($formattedResponse !== null) { + return sprintf('%s - %s', $message, $formattedResponse); + } + + return $message; + } + + /** + * @param \stdClass $jsonData + * + * @return string|null + */ + private function formatResponse(\stdClass $jsonData): ?string + { + if (!isset($jsonData->message) || !isset($jsonData->code)) { + return null; + } + + $responseMessage = sprintf('%s - %s', $jsonData->code, $jsonData->message); + + $propertyErrors = $this->formatPropertyErrors($jsonData); + if (count($propertyErrors) > 0) { + return sprintf('%s: %s', $responseMessage, implode(', ', $propertyErrors)); + } + + return $responseMessage; + } + + /** + * @param \stdClass $jsonData + * + * @return string[] + */ + private function formatPropertyErrors(\stdClass $jsonData): array + { + if (!isset($jsonData->errors) || !is_array($jsonData->errors)) { + return []; + } + + return array_reduce( + $jsonData->errors, + function ($carry, $error): array { + if (isset($error->property) && isset($error->message)) { + $carry[] = sprintf('%s "%s"', $error->property, $error->message); + } + return $carry; + }, + [] + ); + } +} diff --git a/tests/Aml/SandboxAddressTest.php b/tests/Aml/SandboxAddressTest.php new file mode 100644 index 0000000..4067063 --- /dev/null +++ b/tests/Aml/SandboxAddressTest.php @@ -0,0 +1,93 @@ +countryMock = $this->createMock(SandboxCountry::class); + $this->countryMock + ->method('jsonSerialize') + ->willReturn(self::SOME_COUNTRY_CODE); + } + + /** + * @covers ::__construct + * @covers ::getCountry + */ + public function testGetCountry() + { + $amlAddress = new SandboxAddress($this->countryMock); + + $this->assertEquals($this->countryMock, $amlAddress->getCountry()); + } + + /** + * @covers ::__construct + * @covers ::getPostcode + */ + public function testGetPostcode() + { + $amlAddress = new SandboxAddress( + $this->countryMock, + self::SOME_POSTCODE + ); + + $this->assertEquals(self::SOME_POSTCODE, $amlAddress->getPostcode()); + } + + /** + * @covers ::__construct + * @covers ::getPostcode + */ + public function testGetPostcodeNull() + { + $amlAddress = new SandboxAddress($this->countryMock); + + $this->assertNull($amlAddress->getPostcode()); + } + + /** + * @covers ::jsonSerialize + * @covers ::__toString + */ + public function testJsonSerialize() + { + $amlAddress = new SandboxAddress($this->countryMock, self::SOME_POSTCODE); + + $expectedData = (object)[ + 'post_code' => self::SOME_POSTCODE, + 'country' => $this->countryMock, + ]; + + $this->assertEquals($expectedData, $amlAddress->jsonSerialize()); + + $this->assertJsonStringEqualsJsonString( + json_encode($expectedData), + json_encode($amlAddress) + ); + + $this->assertJsonStringEqualsJsonString( + json_encode($expectedData), + (string) $amlAddress + ); + } +} diff --git a/tests/Aml/SandboxCountryTest.php b/tests/Aml/SandboxCountryTest.php new file mode 100644 index 0000000..b66be9f --- /dev/null +++ b/tests/Aml/SandboxCountryTest.php @@ -0,0 +1,49 @@ +country = new SandboxCountry(self::SOME_COUNTRY_CODE); + } + + /** + * @covers ::__construct + * @covers ::getCode + */ + public function testGetCode() + { + $this->assertEquals( + self::SOME_COUNTRY_CODE, + $this->country->getCode() + ); + } + + /** + * @covers ::jsonSerialize + */ + public function testJsonSerialize() + { + $this->assertJsonStringEqualsJsonString( + json_encode(self::SOME_COUNTRY_CODE), + json_encode($this->country) + ); + } +} diff --git a/tests/Aml/SandboxProfileTest.php b/tests/Aml/SandboxProfileTest.php new file mode 100644 index 0000000..37c7627 --- /dev/null +++ b/tests/Aml/SandboxProfileTest.php @@ -0,0 +1,122 @@ +amlAddressMock = $this->createMock(SandboxAddress::class); + $this->amlAddressMock + ->method('jsonSerialize') + ->willReturn((object)['some' => 'address']); + + $this->amlProfile = new SandboxProfile( + self::SOME_GIVEN_NAMES, + self::SOME_FAMILY_NAME, + $this->amlAddressMock, + self::SOME_SSN + ); + } + + /** + * @covers ::__construct + * @covers ::getGivenNames + */ + public function testGetGivenNames() + { + $this->assertEquals(self::SOME_GIVEN_NAMES, $this->amlProfile->getGivenNames()); + } + + /** + * @covers ::__construct + * @covers ::getFamilyName + */ + public function testGetFamilyName() + { + $this->assertEquals(self::SOME_FAMILY_NAME, $this->amlProfile->getFamilyName()); + } + + /** + * @covers ::__construct + * @covers ::getSsn + */ + public function testGetSsn() + { + $this->assertEquals(self::SOME_SSN, $this->amlProfile->getSsn()); + } + + /** + * @covers ::__construct + * @covers ::getSsn + */ + public function testGetSsnNull() + { + $amlProfile = new SandboxProfile( + self::SOME_GIVEN_NAMES, + self::SOME_FAMILY_NAME, + $this->amlAddressMock + ); + $this->assertNull($amlProfile->getSsn()); + } + + /** + * @covers ::__construct + * @covers ::getAmlAddress + */ + public function testGetAmlAddress() + { + $this->assertSame($this->amlAddressMock, $this->amlProfile->getAmlAddress()); + } + + /** + * @covers ::__construct + * @covers ::jsonSerialize + * @covers ::__toString + */ + public function testJsonSerialize() + { + $expectedData = [ + 'given_names' => self::SOME_GIVEN_NAMES, + 'family_name' => self::SOME_FAMILY_NAME, + 'ssn' => self::SOME_SSN, + 'address' => $this->amlAddressMock, + ]; + + $this->assertJsonStringEqualsJsonString( + json_encode($expectedData), + json_encode($this->amlProfile) + ); + + $this->assertJsonStringEqualsJsonString( + json_encode($expectedData), + (string) $this->amlProfile + ); + } +} diff --git a/tests/Aml/SandboxResultTest.php b/tests/Aml/SandboxResultTest.php new file mode 100644 index 0000000..6e18843 --- /dev/null +++ b/tests/Aml/SandboxResultTest.php @@ -0,0 +1,95 @@ +responseMock = $this->createMock(ResponseInterface::class); + $this->amlResult = new SandboxResult( + Json::decode(file_get_contents(TestData::AML_CHECK_RESULT_JSON)), + $this->responseMock + ); + } + + /** + * @covers ::isOnPepList + * @covers ::__construct + * @covers ::setAttributes + * @covers ::checkAttributes + */ + public function testIsOnPepeList() + { + $this->assertTrue($this->amlResult->isOnPepList()); + } + + /** + * @covers ::isOnFraudList + * @covers ::__construct + * @covers ::setAttributes + * @covers ::checkAttributes + */ + public function testIsOnFraudList() + { + $this->assertFalse($this->amlResult->isOnFraudList()); + } + + /** + * @covers ::isOnWatchList + * @covers ::__construct + * @covers ::setAttributes + * @covers ::checkAttributes + */ + public function testIsOnWatchList() + { + $this->assertFalse($this->amlResult->isOnWatchList()); + } + + /** + */ + public function testMissingAttributes() + { + $this->expectException(\Yoti\Sandbox\Exception\SandboxAmlException::class); + $this->expectExceptionMessage('Missing attributes from the result: on_pep_list,on_watch_list,on_watch_list'); + + new SandboxResult([], $this->responseMock); + } + + /** + */ + public function testTooFewArguments() + { + $this->expectException(ArgumentCountError::class); + + new SandboxResult([]); + } + + /** + * @covers ::__toString + */ + public function testToString() + { + $this->assertJsonStringEqualsJsonString( + file_get_contents(TestData::AML_CHECK_RESULT_JSON), + (string) $this->amlResult + ); + } +} diff --git a/tests/Aml/SandboxServiceTest.php b/tests/Aml/SandboxServiceTest.php new file mode 100644 index 0000000..0384588 --- /dev/null +++ b/tests/Aml/SandboxServiceTest.php @@ -0,0 +1,218 @@ +createMock(ResponseInterface::class); + $body = file_get_contents(TestData::AML_CHECK_RESULT_JSON); + $response->method('getBody')->willReturn(Psr7\Utils::streamFor($body)); + $response->method('getStatusCode')->willReturn(200); + + $httpClient = $this->createMock(ClientInterface::class); + $httpClient->expects($this->exactly(1)) + ->method('sendRequest') + ->with( + $this->callback(function ($requestMessage) use ($amlProfile, $expectedPathPattern) { + $this->assertEquals('POST', $requestMessage->getMethod()); + $this->assertEquals((string) $amlProfile, (string) $requestMessage->getBody()); + $this->assertMatchesRegularExpression($expectedPathPattern, (string) $requestMessage->getUri()); + $this->assertEquals('application/json', $requestMessage->getHeader('Content-Type')[0]); + return true; + }) + ) + ->willReturn($response); + + $amlService = new SandboxService( + TestData::SDK_ID, + PemFile::fromFilePath(TestData::PEM_FILE), + new Config([ + Config::HTTP_CLIENT => $httpClient, + ]) + ); + + $result = $amlService->performCheck($amlProfile); + + $this->assertInstanceOf(SandboxResult::class, $result); + } + + /** + * @covers ::performCheck + * @covers ::validateAmlResult + * @covers ::getErrorMessage + * + * @dataProvider httpErrorStatusCodeProvider + */ + public function testPerformAmlCheckFailure($statusCode) + { + $this->expectException(SandboxException::class); + + $amlService = $this->createServiceWithErrorResponse($statusCode); + $amlService->performCheck($this->createMock(SandboxProfile::class)); + } + + /** + * @covers ::performCheck + * @covers ::validateAmlResult + * @covers ::getErrorMessage + * + * @dataProvider httpErrorStatusCodeProvider + */ + public function testPerformAmlCheckFailureWithErrorMessage($statusCode) + { + $this->expectException(SandboxException::class); + + $amlService = $this->createServiceWithErrorResponse( + $statusCode, + json_encode([ + 'errors' => [ + [ + 'message' => 'some message', + 'property' => 'some property', + ] + ] + ]) + ); + + $amlService->performCheck($this->createMock(SandboxProfile::class)); + } + + /** + * @covers ::performCheck + * @covers ::validateAmlResult + * @covers ::getErrorMessage + * + * @dataProvider httpErrorStatusCodeProvider + */ + public function testPerformAmlCheckFailureWithCode($statusCode) + { + $this->expectException(SandboxException::class); + + $amlService = $this->createServiceWithErrorResponse( + $statusCode, + json_encode([ + 'code' => 'SOME_CODE', + ]) + ); + + $amlService->performCheck($this->createMock(SandboxProfile::class)); + } + + /** + * @covers ::performCheck + * @covers ::validateAmlResult + * @covers ::getErrorMessage + * + * @dataProvider httpErrorStatusCodeProvider + */ + public function testPerformAmlCheckFailureWithCodeAndErrors($statusCode) + { + $this->expectException(SandboxException::class); + + $amlService = $this->createServiceWithErrorResponse( + $statusCode, + json_encode([ + 'code' => 'SOME_CODE', + 'errors' => [ + [ + 'message' => 'some message', + 'property' => 'some property', + ] + ] + ]) + ); + + $amlService->performCheck($this->createMock(SandboxProfile::class)); + } + + /** + * @covers ::performCheck + * @covers ::validateAmlResult + * @covers ::getErrorMessage + * + * @dataProvider httpErrorStatusCodeProvider + */ + public function testPerformAmlCheckFailureWithoutJsonResponse($statusCode) + { + $this->expectException(SandboxException::class); + + $amlService = $this->createServiceWithErrorResponse( + $statusCode, + 'some response', + 'text/html' + ); + + $amlService->performCheck($this->createMock(SandboxProfile::class)); + } + + /** + * @param int $statusCode + * @param string $body + * @param string|null $contentType + * @return SandboxService + * @throws SandboxPemFileException + */ + private function createServiceWithErrorResponse($statusCode, $body = '{}', ?string $contentType = null) + { + $response = $this->createMock(ResponseInterface::class); + $response->method('getBody')->willReturn(Psr7\Utils::streamFor($body)); + $response->method('getStatusCode')->willReturn($statusCode); + + if ($contentType !== null) { + $response->method('hasHeader')->willReturn(true); + $response->method('getHeader')->willReturn([$contentType]); + } + + $httpClient = $this->createMock(ClientInterface::class); + $httpClient + ->method('sendRequest') + ->willReturn($response); + + return new SandboxService( + TestData::SDK_ID, + PemFile::fromFilePath(TestData::PEM_FILE), + new Config([ + Config::HTTP_CLIENT => $httpClient, + ]) + ); + } +} diff --git a/tests/TestCase.php b/tests/TestCase.php index 49626e3..0066a40 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -8,6 +8,22 @@ abstract class TestCase extends PHPUnitTestCase { + /** + * Provides HTTP error status codes. + */ + public function httpErrorStatusCodeProvider() + { + $clientCodes = [400, 401, 402, 403, 404]; + $serverCodes = [500, 501, 502, 503, 504]; + + return array_map( + function ($code) { + return [$code]; + }, + $clientCodes + $serverCodes + ); + } + /** * Override assertMatchesRegularExpression to support older versions of PHPUnit. * diff --git a/tests/TestData.php b/tests/TestData.php index 0ba888a..77de259 100644 --- a/tests/TestData.php +++ b/tests/TestData.php @@ -8,4 +8,8 @@ class TestData { public const SDK_ID = '990a3996-5762-4e8a-aa64-cb406fdb0e68'; public const PEM_FILE = __DIR__ . '/sample-data/test.pem'; + public const AML_CHECK_RESULT_JSON = __DIR__ . '/sample-data/aml-check-result.json'; + public const AML_PRIVATE_KEY = __DIR__ . '/sample-data/aml-check-private-key.pem'; + public const AML_PUBLIC_KEY = __DIR__ . '/sample-data/aml-check-public-key.pem'; + public const CONNECT_BASE_URL = 'https://api.yoti.com/api/v1'; } diff --git a/tests/sample-data/aml-check-private-key.pem b/tests/sample-data/aml-check-private-key.pem new file mode 100644 index 0000000..bad6513 --- /dev/null +++ b/tests/sample-data/aml-check-private-key.pem @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEoQIBAAKCAQBbQ/PGZ/A3m1fhIPLQ+Q9+AwtOxFxB+/x/cUy5/WUj3TzZ8kFG +Z26hQrRT4zERSQMie7S9ZbPi0JXoE1HlFsD6vWCqM0WN0enxNA02ek/RKiitp0v6 +Q1ZxPGjBT1h2l9n0dnqTzrGbUpHTtXv3zSWYobdtgptcVJDlXSF/XdxdIzprujjX +sHjeWf6H3gSPtJRBsgexM9hS+6Ta1pmbfNo39BCG96hGhDNN7gE3xeBUimeJuylz +NWTo+IgGzsWsRPyeKe029f+aIfWdxwFlbeaF387gCWnXR8IyXNLCDAhpr4wupKNF +aCZDUg1i9Bw/QnTvXF0QkmjXUB7Qb7V7B7qpAgMBAAECggEAOe7DkqEtwg6Q1S52 +FCLVK7dA+Un6CkSrfjZsbu+jwQVR+EMoHknP1vuhvlJMNl2zaLNAAq3JZ2PilIOX +C6XK8B9Aeim7sA+cwei5rmgrvGlXkwvMVdtixtSC5pq4W+d+igifPK4K3b6nJM1i +GOWXRPD6n8A1YIGpzH62ocPx+wh7lvbT2XwFkzZT+8rrSvO74k8SukcGg6WCTPuB +TdoD8v72zuDi3Lpyi8BaK0eYSErNZxeC/5tdy/qjisaO6t0vQ8t6mBXvvZv8xTp+ +hLoDI0VMbHXptMvt4cRowzmJoshFk/uZZeUkD2t92wGzFwbvAHzFsmIT8ScKLoWW +qwQskQKBgQCpiaHHMIXy+Jx7fzXWcKA8VZiRlf6hM3NVNDOlLtPlnn0ENnR/+/W4 +hcrv2F4qknFzbX/M0PNIZZ3e5PEwO6a8EnHBWNEP/MkAj42NkTCtS8UvD5z86juC +dmdY1KZ2REMLZdvm2tTdmTBqBy+KLDD0jLrzAhZ/KdHO9j6QL3lb7QKBgQCJz1Fn +Wx6XNNJyDhXKECTvULZyuDcATUj6Q+0foJuHgbMyD+/zQUARSBRDNrfjpA+Ndgob +aovsKU+ANSgjP9GXdfL/kei0ZO0IBq2pE13ep7RwFmnjnssjfyu+E1z8wc1cLKUv +CcfOUceD+LbqOldTzJSD1vEwH7Mzblshlj6aLQKBgCCyIVgH3J1aItuSUfC0McLR +AyZ4le3CvWheM+OUX1s2MIgCdH9GOUJH0zZkNOzi5yxKns4CMhjxN/wHjRgvON2m +dPfDyDXcG2uXQ8ZcjNWu+i00RqNkDOwBJ7cy85N1YLSvBTTFWS4PYA3iquFr2lkf +VuKMsYf+qa7PQIuQDEiVAoGABpnCeWPY5D8ocUQRcRsy2a+Q/Y+rOr146FvGiMRF +jsj8j0JKKOmQKwO7zLhbOHEMOadUtpl02DvmTeq94GpXHJ0OpYUUk0dePwsq2DVQ +QrDfqJq6OafKbQnTS4hb5NNXhbmxs74RLuWl28FW6YMf2air2GC8LqTmDWmUvdgX +aYUCgYAWKfJ81DtCGQpChlOaw84K+buliOJXO80zOFOttjOEWp16uSLFxTSlHZpl +IT1h0HmaZnAjS4PcvrUh3xXGjRE+8GoLZIDrOZUq+T8KTvsR6ZpIr6UENs3bgcxp +6gdhIIaRymiCWqLg45QwNQ6bMgWYzQy/FbT3nLLY3nqyfDLIrA== +-----END RSA PRIVATE KEY----- \ No newline at end of file diff --git a/tests/sample-data/aml-check-public-key.pem b/tests/sample-data/aml-check-public-key.pem new file mode 100644 index 0000000..1757b83 --- /dev/null +++ b/tests/sample-data/aml-check-public-key.pem @@ -0,0 +1,9 @@ +-----BEGIN PUBLIC KEY----- +MIIBITANBgkqhkiG9w0BAQEFAAOCAQ4AMIIBCQKCAQBbQ/PGZ/A3m1fhIPLQ+Q9+ +AwtOxFxB+/x/cUy5/WUj3TzZ8kFGZ26hQrRT4zERSQMie7S9ZbPi0JXoE1HlFsD6 +vWCqM0WN0enxNA02ek/RKiitp0v6Q1ZxPGjBT1h2l9n0dnqTzrGbUpHTtXv3zSWY +obdtgptcVJDlXSF/XdxdIzprujjXsHjeWf6H3gSPtJRBsgexM9hS+6Ta1pmbfNo3 +9BCG96hGhDNN7gE3xeBUimeJuylzNWTo+IgGzsWsRPyeKe029f+aIfWdxwFlbeaF +387gCWnXR8IyXNLCDAhpr4wupKNFaCZDUg1i9Bw/QnTvXF0QkmjXUB7Qb7V7B7qp +AgMBAAE= +-----END PUBLIC KEY----- \ No newline at end of file diff --git a/tests/sample-data/aml-check-result.json b/tests/sample-data/aml-check-result.json new file mode 100644 index 0000000..e9341e8 --- /dev/null +++ b/tests/sample-data/aml-check-result.json @@ -0,0 +1,5 @@ +{ + "on_pep_list": true, + "on_fraud_list": false, + "on_watch_list": false +} \ No newline at end of file