You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*[Sample code per country](http://www.id3globalsupport.com/Website/Sample-Code.html)
16
16
17
-
*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 New Zealand (Aotearoa), however it should be generic enough to easily support other countries.
17
+
Please see the [Full Code Example](docs/full-code-example.md) that provides a complete overview of usage of this module.
18
+
19
+
### Accessing the underlying ID3global request and response
20
+
Depending on your use case, you may need to access the underlying request sent to ID3global, or the response returned by the ID3global API. Typical use cases of this are for auditing purposes - to confirm that identity information hasn't changed since the last time an identity verification was performed for example.
21
+
22
+
In order to facilitate this, the `GlobalAuthenticationService` class has a number of helper methods to give you access to the underlying data. All of the below code assumes that you have already called the `->verifyIdentity()` method and that either you have a valid BandText, or you have caught the `IdentityVerificationFailureException` that may be thrown.
// Access the underlying SoapClient object to perform more detailed debugging
35
+
$gateway = $service->getGateway(); // Returns a ID3Global\Gateway\GlobalAuthenticationGateway object
36
+
$soapClient = $gateway->getSoapClient(); // Returns a ID3Global\Gateway\SoapClient\ID3GlobalSoapClient object
37
+
38
+
// You can then do anything you'd normally do on SoapClient, such as:
39
+
$lastRawRequestHeaders = $soapClient->__getLastRequestHeaders(); // Returns an array of the headers sent to the API
40
+
$lastRawResponse = $soapClient->__getLastResponse(); // Returns the last response returned by the API
41
+
```
42
+
43
+
### Debugging identity verification failures
44
+
In certain circumstances, generally when the ID3Global API produces unexpected results, you may get an `IdentityVerificationFailureException` returned to you. This can happen in a number of scenarios, such as required fields being missing from the request, or data being in an invalid format.
45
+
46
+
You should also wrap your `->verifyIdentity()` calls within a try/catch to prevent users from seeing these exceptions.
47
+
48
+
By default, this library does not expose information in the exception message that would leak personally identifiable information, however this can be enabled if you are confident that the exception is properly handled (e.g. is being forwarded to a GDPR-compliant logging service). Sometimes this level of detail is necessary to determine why the API request failed.
49
+
50
+
You can enable logging of this information via the exception message with the following configuration:
51
+
52
+
```php
53
+
$service = new ID3Global\Service\GlobalAuthenticationService;
54
+
55
+
// Must be set before calling ->verifyIdentity()
56
+
$service->setVerboseExceptionHandling(true);
57
+
58
+
// Either way, regardless of whether or not you enable verbose exception handling, IdentityVerificationFailureException will still contain the response
*`ID3Global\Service\GlobalAuthenticationService`: The core service class used to request identity verification
7
+
*`ID3Global\Gateway\GlobalAuthenticationGateway`: The internal gateway class that communicates (via SOAP) with ID3global
8
+
9
+
**Identity information:**
10
+
*`ID3Global\Identity\Identity`: The base class for a single person's identity
11
+
*`ID3Global\Identity\PersonalDetails`: A class to capture core identity information (name, date of birth etc)
12
+
*`ID3Global\Identity\ContactDetails\PhoneNumber`: Include a single phone number (can be used for landline, mobile etc)
13
+
14
+
**Address specification:**
15
+
*`ID3Global\Identity\Address\FreeFormatAddress`: A 'free-form' address where individual address fields aren't specified
16
+
*`ID3Global\Identity\Address\FixedFormatAddress`: A fixed address format (e.g. fields for street, city, subcity etc)
17
+
18
+
**Additional identity documents:**
19
+
*`ID3Global\Identity\Documents\DocumentContainer`: Class that contains all below documents
20
+
*`ID3Global\Identity\Documents\InternationalPassport`: Contains details about a passport
21
+
*`ID3Global\Identity\Documents\NZ\DrivingLicence`: Contains details about a New Zealand drivers licence
22
+
23
+
## Full code example
24
+
25
+
Below is a complete example of how to utilise this module, configuring personal details, a single address, multiple phone numbers and a passport.
26
+
27
+
Once the identity is created, we create and submit it to the `GlobalAuthenticationService`.
28
+
29
+
In the below example, we enable the 'pilot' site, which is the ID3global test environment. Leave this line out to query production (this will incur costs).
30
+
31
+
Finally, please review the comment below regarding the value of `$validIdentityBandText` - it's critically important that this is correct.
0 commit comments