解密/id3global-service

允许PHP驱动的网站与GBG ID3global API通信以验证身份。此库与GBG PLC没有任何关联。

0.2.8 2020-10-15 12:51 UTC

This package is auto-updated.

Last update: 2024-09-15 21:27:53 UTC


README

允许PHP驱动的网站通过 GBG ID3global API 验证身份。

安装

用法

WSDL文件概述了可以提供的值,这些值将因国家/地区而异。

注意:下面的代码完全可能更改。目前它主要关注ID3Global API的AuthenticateSP方法,特别是针对新西兰,但它应该足够通用,可以轻松支持非新西兰系统。

/**
 * 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
}