Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions lib/Checkout/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,23 +97,30 @@ public function delete(string $path, SdkAuthorization $authorization): array
}

/**
* Performs a GET with an optional query filter.
*
* The filter is nullable: several clients expose an optional filter argument and pass it
* straight through, so a null must behave exactly like a plain get().
*
* @param string $path
* @param AbstractQueryFilter $requestBody
* @param AbstractQueryFilter|null $requestBody
* @param SdkAuthorization $authorization
* @param mixed $headers
* @return array
* @throws CheckoutApiException
*/
public function query(
string $path,
AbstractQueryFilter $requestBody,
?AbstractQueryFilter $requestBody,
SdkAuthorization $authorization,
$headers = null
): array {
$this->logger->info("GET " . $path);
$queryParameters = $requestBody->getEncodedQueryParameters();
if (!empty($queryParameters)) {
$path .= "?" . $queryParameters;
if ($requestBody !== null) {
$queryParameters = $requestBody->getEncodedQueryParameters();
if (!empty($queryParameters)) {
$path .= "?" . $queryParameters;
}
}
return $this->invoke("GET", $path, null, $authorization, null, $headers);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use Checkout\CheckoutApiException;
use Checkout\CheckoutConfiguration;
use Checkout\Client;
use Checkout\Identities\Entities\AttemptAssetsQueryFilter;
use Checkout\Identities\Entities\AttemptsQueryFilter;
use Checkout\Identities\AddressDocumentVerification\Requests\AddressDocumentVerificationRequest;
use Checkout\Identities\AddressDocumentVerification\Requests\AddressDocumentVerificationAttemptRequest;

Expand All @@ -15,6 +17,7 @@ class AddressDocumentVerificationClient extends Client
const ADDRESS_DOCUMENT_VERIFICATIONS_PATH = "address-document-verifications";
const ANONYMIZE_PATH = "anonymize";
const ATTEMPTS_PATH = "attempts";
const ASSETS_PATH = "assets";
const PDF_REPORT_PATH = "pdf-report";

public function __construct(ApiClient $apiClient, CheckoutConfiguration $configuration)
Expand Down Expand Up @@ -96,20 +99,28 @@ public function createAddressDocumentVerificationAttempt(
}

/**
* Get the details of all attempts for a specific address document verification.
* Results are paginated. Use the skip and limit query parameters to page through them.
* Beta.
*
* addressDocumentVerificationId is the address document verification's unique identifier. (Required)
*
* @param string $addressDocumentVerificationId
* @param AttemptsQueryFilter|null $query the pagination query parameters (skip and limit)
* @return array
* @throws CheckoutApiException
*/
public function getAddressDocumentVerificationAttempts(string $addressDocumentVerificationId): array
{
return $this->apiClient->get(
public function getAddressDocumentVerificationAttempts(
string $addressDocumentVerificationId,
?AttemptsQueryFilter $query = null
): array {
return $this->apiClient->query(
$this->buildPath(
self::ADDRESS_DOCUMENT_VERIFICATIONS_PATH,
$addressDocumentVerificationId,
self::ATTEMPTS_PATH
),
$query,
$this->sdkAuthorization()
);
}
Expand Down Expand Up @@ -156,4 +167,36 @@ public function getAddressDocumentVerificationReport(string $addressDocumentVeri
$this->sdkAuthorization()
);
}

/**
* Get the assets (the document image) uploaded for an address document verification attempt.
* Results are paginated. Use the skip and limit query parameters to page through them.
* Beta.
*
* addressDocumentVerificationId is the address document verification's unique identifier. (Required)
* attemptId is the attempt's unique identifier. (Required)
*
* @param string $addressDocumentVerificationId
* @param string $attemptId
* @param AttemptAssetsQueryFilter|null $query the pagination query parameters (skip and limit)
* @return array
* @throws CheckoutApiException
*/
public function getAddressDocumentVerificationAttemptAssets(
string $addressDocumentVerificationId,
string $attemptId,
?AttemptAssetsQueryFilter $query = null
): array {
return $this->apiClient->query(
$this->buildPath(
self::ADDRESS_DOCUMENT_VERIFICATIONS_PATH,
$addressDocumentVerificationId,
self::ATTEMPTS_PATH,
$attemptId,
self::ASSETS_PATH
),
$query,
$this->sdkAuthorization()
);
}
}
24 changes: 24 additions & 0 deletions lib/Checkout/Identities/Entities/AttemptsQueryFilter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace Checkout\Identities\Entities;

use Checkout\Common\AbstractQueryFilter;

class AttemptsQueryFilter extends AbstractQueryFilter
{
/**
* The number of attempts to skip.
* [Optional]
* Default: 0
* @var int|null $skip
*/
public $skip;

/**
* The maximum number of attempts to return.
* [Optional]
* Default: 10
* @var int|null $limit
*/
public $limit;
}
13 changes: 9 additions & 4 deletions lib/Checkout/Identities/Entities/ClientInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,20 @@ class ClientInformation
{
/**
* The applicant's residence country.
*
* @var string values of Country
* [Optional]
* Standard: ISO 3166-1 alpha-2 country code
* ^[A-Z]{2}
* Example: FR
* @var string|null values of Checkout\Common\CountryCode
*/
public $pre_selected_residence_country;

/**
* The language you want to use for the user interface.
*
* @var string
* [Optional]
* Format: IETF BCP 47 language tag
* Example: en-US
* @var string|null
*/
public $pre_selected_language;
}
15 changes: 13 additions & 2 deletions lib/Checkout/Identities/Entities/DeclaredData.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,20 @@
class DeclaredData
{
/**
* The applicant's name (Required)
*
* The applicant's name.
* [Required]
* min 2 characters, max 255 characters
* Example: Hannah Bret
* @var string
*/
public $name;

/**
* The applicant's birth date.
* [Optional]
* Format: YYYY-MM-DD
* Example: 1994-10-15
* @var string|null
*/
public $birth_date;

Check warning on line 23 in lib/Checkout/Identities/Entities/DeclaredData.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "$birth_date" to match the regular expression ^[a-z][a-zA-Z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=checkout_checkout-sdk-php&issues=AaC0XJRpGFb_3m2xTpre&open=AaC0XJRpGFb_3m2xTpre&pullRequest=381
}
35 changes: 35 additions & 0 deletions lib/Checkout/Identities/Entities/IdentityDeclaredData.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace Checkout\Identities\Entities;

/**
* The personal details provided by the applicant for an identity verification.
* Extends the shared declared data with the fields the identity verification schemas add.
*/
class IdentityDeclaredData extends DeclaredData
{
/**
* The applicant's mobile phone number, if sharing the attempt URL via SMS.
* [Optional]
* @var PhoneNumber|null
*/
public $phone_number;

Check warning on line 16 in lib/Checkout/Identities/Entities/IdentityDeclaredData.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "$phone_number" to match the regular expression ^[a-z][a-zA-Z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=checkout_checkout-sdk-php&issues=AaC0XJRbGFb_3m2xTprd&open=AaC0XJRbGFb_3m2xTprd&pullRequest=381

/**
* The applicant's email address. Explicitly nullable in the spec, so the API may return null
* for it rather than omitting it.
* [Optional]
* Format: email
* Nullable: true
* Example: hannah.bret@example.com
* @var string|null
*/
public $email;

/**
* The applicant's address.
* [Optional]
* @var IdvAddress|null
*/
public $address;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace Checkout\Identities\Entities;

/**
* The applicant's details for an identity verification attempt.
* Extends the shared client information with the two fields that only the identity verification
* attempt accepts. The face authentication attempt must keep using ClientInformation, because its
* schema does not declare these.
*/
class IdentityVerificationClientInformation extends ClientInformation
{
/**
* The country that issued the applicant's identity document.
* [Optional]
* Standard: ISO 3166-1 alpha-2 country code
* ^[A-Z]{2}
* Example: FR
* @var string|null values of Checkout\Common\CountryCode
*/
public $pre_selected_document_issuing_country;

Check warning on line 21 in lib/Checkout/Identities/Entities/IdentityVerificationClientInformation.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "$pre_selected_document_issuing_country" to match the regular expression ^[a-z][a-zA-Z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=checkout_checkout-sdk-php&issues=AaC0XJSMGFb_3m2xTprg&open=AaC0XJSMGFb_3m2xTprg&pullRequest=381

/**
* The type of identity document the applicant uses for the attempt.
* [Optional]
* Enum: "Driving licence" "ID" "Other" "Passport" "Residence Permit" "Travel Document" "Visa"
* @var string|null
*/
public $pre_selected_document_type;

Check warning on line 29 in lib/Checkout/Identities/Entities/IdentityVerificationClientInformation.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "$pre_selected_document_type" to match the regular expression ^[a-z][a-zA-Z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=checkout_checkout-sdk-php&issues=AaC0XJSMGFb_3m2xTprh&open=AaC0XJSMGFb_3m2xTprh&pullRequest=381
}
61 changes: 61 additions & 0 deletions lib/Checkout/Identities/Entities/IdvAddress.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php

namespace Checkout\Identities\Entities;

class IdvAddress
{
/**
* The first line of the address.
* [Optional]
* max 250 characters
* Example: 123 Main Street
* @var string|null
*/
public $address_line1;

Check warning on line 14 in lib/Checkout/Identities/Entities/IdvAddress.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "$address_line1" to match the regular expression ^[a-z][a-zA-Z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=checkout_checkout-sdk-php&issues=AaC0XJRTGFb_3m2xTprb&open=AaC0XJRTGFb_3m2xTprb&pullRequest=381

/**
* The second line of the address.
* [Optional]
* max 250 characters
* Example: Apt 4B
* @var string|null
*/
public $address_line2;

Check warning on line 23 in lib/Checkout/Identities/Entities/IdvAddress.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "$address_line2" to match the regular expression ^[a-z][a-zA-Z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=checkout_checkout-sdk-php&issues=AaC0XJRTGFb_3m2xTprc&open=AaC0XJRTGFb_3m2xTprc&pullRequest=381

/**
* The city or town.
* [Optional]
* max 50 characters
* Example: London
* @var string|null
*/
public $city;

/**
* The state, county, or province.
* [Optional]
* max 50 characters
* Example: Greater London
* @var string|null
*/
public $state;

/**
* The postal or ZIP code.
* [Optional]
* max 50 characters
* Example: SW1A 1AA
* @var string|null
*/
public $zip;

/**
* The two-letter ISO country code of the address.
* [Optional]
* Standard: ISO 3166-1 alpha-2 country code
* max 2 characters
* Example: GB
* @var string|null values of Checkout\Common\CountryCode
*/
public $country;
}
24 changes: 24 additions & 0 deletions lib/Checkout/Identities/Entities/PhoneNumber.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace Checkout\Identities\Entities;

class PhoneNumber
{
/**
* The international phone country code. This is a dialling prefix, not an ISO country code.
* [Required]
* ^\+(\d+)$
* Example: +33
* @var string
*/
public $country_code;

Check warning on line 14 in lib/Checkout/Identities/Entities/PhoneNumber.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "$country_code" to match the regular expression ^[a-z][a-zA-Z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=checkout_checkout-sdk-php&issues=AaC0XJSDGFb_3m2xTprf&open=AaC0XJSDGFb_3m2xTprf&pullRequest=381

/**
* The applicant's mobile number, without the country code.
* [Required]
* ^\d{1,14}$
* Example: 5555550102
* @var string
*/
public $number;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Checkout\CheckoutApiException;
use Checkout\CheckoutConfiguration;
use Checkout\Client;
use Checkout\Identities\Entities\AttemptsQueryFilter;
use Checkout\Identities\Entities\AttemptAssetsQueryFilter;
use Checkout\Identities\FaceAuthentication\Requests\FaceAuthenticationRequest;
use Checkout\Identities\FaceAuthentication\Requests\FaceAuthenticationAttemptRequest;
Expand Down Expand Up @@ -88,16 +89,24 @@ public function createFaceAuthenticationAttempt(
}

/**
* Get the details of all attempts for a specific face authentication.
* Results are paginated. Use the skip and limit query parameters to page through them.
* Beta.
*
* faceAuthenticationId is the face authentication's unique identifier. (Required)
*
* @param string $faceAuthenticationId
* @param AttemptsQueryFilter|null $query the pagination query parameters (skip and limit)
* @return array
* @throws CheckoutApiException
*/
public function getFaceAuthenticationAttempts(string $faceAuthenticationId): array
{
return $this->apiClient->get(
public function getFaceAuthenticationAttempts(
string $faceAuthenticationId,
?AttemptsQueryFilter $query = null
): array {
return $this->apiClient->query(
$this->buildPath(self::FACE_AUTHENTICATIONS_PATH, $faceAuthenticationId, self::ATTEMPTS_PATH),
$query,
$this->sdkAuthorization()
);
}
Expand All @@ -120,7 +129,10 @@ public function getFaceAuthenticationAttempt(string $faceAuthenticationId, strin
}

/**
* Retrieves the assets (face images and videos) captured during a face authentication attempt.
* Get the assets (face images and videos) captured during a face authentication attempt.
* Videos are not exposed by default; contact your account manager to enable them.
* Results are paginated. Use the skip and limit query parameters to page through them.
* Beta.
*
* faceAuthenticationId is the face authentication's unique identifier. (Required)
* attemptId is the attempt's unique identifier. (Required)
Expand Down
Loading
Loading