decrypted/id3global-service

Allows a PHP-powered website to communicate with the GBG ID3global API to verify identities. This library is not affiliated with GBG PLC in any way.

0.2.8 2020-10-15 12:51 UTC

This package is auto-updated.

Last update: 2024-05-15 20:52:20 UTC


README

Allows a PHP-powered website to communicate with the GBG ID3global API to verify identities.

Installation

Usage

The WSDL file gives an overview of the values that can be provided, these will vary by country.

Note: The code below is entirely subject to change. It is primarily focused at the moment around the AuthenticateSP method of the ID3Global API, and specifically on NZ, however it should be generic enough to easily support non-NZ systems easily.

/**
 * Namespaces:
 *
 * \ID3Global\Constants\Identity
 * \ID3Global\Gateways\GlobalAuthenticationGateway
 * \ID3Global\Services\GlobalAuthenticationService
 * \ID3Global\Identity\Address\FreeFormatAddress
 * \ID3Global\Identity\Address\FixedFormatAddress
 * \ID3Global\Identity\ContactDetails
 * \ID3Global\Identity\ContactDetails\LandTelephone
 * \ID3Global\Identity\ContactDetails\MobileTelephone
 * \ID3Global\Identity\ContactDetails\WorkTelephone
 * \ID3Global\Identity\Documents\NZ\DrivingLicence
 * \ID3Global\Identity\PersonalDetails
 *
 * \ID3Global\Identity\Addresses<\ID3Global\Identity\Address\FreeFormatAddress, \ID3Global\Identity\Address\FixedFormatAddress>
 *     - CurrentAddress
 *     - PreviousAddress[1-3]
 *     - HistoricAddresses<\ID3Global\Identity\Address\FreeFormatAddress, \ID3Global\Identity\Address\FixedFormatAddress>
 *
 * \ID3Global\Identity\Documents
 *
 * Not core for implementation
 * \ID3Global\Identity\Aliases
 * \ID3Global\Identity\AlternateName
 * \ID3Global\Identity\BankingDetails\BankAccount
 * \ID3Global\Identity\BankingDetails\CreditDebitCard
 * \ID3Global\Identity\Documents\Address\UK\ElectricitySupplier
 * \ID3Global\Identity\Documents\Identity\Global\InternationalPassport
 * \ID3Global\Identity\Documents\Identity\Europe\EuropeanIdentityCard
 * \ID3Global\Identity\Documents\Identity\AU\ShortPassport
 * \ID3Global\Identity\Documents\Identity\AU\Medicare
 * \ID3Global\Identity\Documents\Identity\BR\CPFNumber
 * \ID3Global\Identity\Documents\Identity\CA\SocialInsuranceNumber
 * \ID3Global\Identity\Documents\Identity\CN\ResidentIdentityCard
 * \ID3Global\Identity\Documents\Identity\ES\TaxIDNumber
 * \ID3Global\Identity\Documents\Identity\MX\TaxIdentificationNumber
 * \ID3Global\Identity\Documents\Identity\UK\Passport
 * \ID3Global\Identity\Documents\Identity\UK\DrivingLicence
 * \ID3Global\Identity\Documents\Identity\UK\NationalInsuranceNumber
 * \ID3Global\Identity\Documents\Identity\UK\DrivingLicence
 * \ID3Global\Identity\Documents\Identity\US\DrivingLicence
 * \ID3Global\Identity\Documents\Identity\US\SocialSecurity
 * \ID3Global\Identity\Documents\Identity\US\IdentityCard
 * \ID3Global\Identity\Employment
 * \ID3Global\Identity\GlobalGeneric
 * \ID3Global\Identity\Images
 * \ID3Global\Identity\Location
 * \ID3Global\Identity\PersonalDetails\BirthInfo
 */

$personalDetails = new \ID3Global\Identity\PersonalDetails();
$personalDetails
    ->setTitle('Mr')
    ->setForeName('Dworkin')
    ->setMiddleName('John')
    ->setSurname('Barimen')
    ->setGender(ID3GlobalService::GENDER_MALE)
    ->setDateOfBirth(1922, 08, 20);

$currentAddress = new \ID3Global\Identity\Address\FreeFormatAddress();
$currentAddress
    ->setCountry(ID3GlobalService::COUNTRY_NZ)
    ->setZipPostcode(90210)
    // You can set up to 8 address lines if required using ->setAddressLine3(), ->setAddressLine8() etc.
    ->setAddressLine1('Dungeon 1')
    ->setAddressLine2('Courts of Amber');

$addressContainer = new \ID3Global\Identity\Addresses();
$addressContainer
    ->setCurrentAddress($currentAddress);

$contactDetails = new \ID3Global\Identity\ContactDetails();
$contactDetails
    ->setLandPhone(new \ID3Global\Identity\ContactDetails\LandTelephone(1234567890, false))
    ->setMobilePhone(new \ID3Global\Identity\ContactDetails\MobileTelephone(1234567890))
    ->setWorkPhone(new \ID3Global\Identity\ContactDetails\WorkTelephone(1234567890))
    ->setEmail('dworkin@thepattern.net');

/**
 * $result will be one of the following:
 * - \ID3Global\Constants\Identity::IDENTITY_BAND_PASS
 * - \ID3Global\Constants\Identity::IDENTITY_BAND_REFER
 * - \ID3Global\Constants\Identity::IDENTITY_BAND_ALERT
 *
 * It is up to the implemenetation how these are handled.
 * An exception is thrown if the web service fails or cannot be contacted.
 */
$identity = new \ID3Global\Identity\Identity();
$identity
    ->setPersonalDetails($$personalDetails)
    ->setAddresses($addressContainer)
    ->setContactDetails($contactDetails);

$id3Service = new \ID3Global\Services\GlobalAuthenticationService();
$result = $id3Service
    ->setIdentity($identity)
    ->verifyIdentity();

if($result === \ID3Global\Constants\Identity::IDENTITY_BAND_PASS) {
    // Identity is verified, continue processing
}