コード例 #1
0
 public function testNZDrivingLicence()
 {
     $identity = new Identity();
     $container = new DocumentContainer();
     $licence = new DrivingLicence();
     $licence->setNumber('DI123456')->setVersion(123)->setVehicleRegistration('ABC123');
     $container->addIdentityDocument($licence, 'New Zealand');
     $identity->setIdentityDocuments($container);
     $r = new AuthenticateSPRequest();
     $r->addFieldsFromIdentity($identity);
     $test = $r->getInputData()->IdentityDocuments;
     $this->assertSame('DI123456', $test->NewZealand->DrivingLicence->Number);
     $this->assertSame(123, $test->NewZealand->DrivingLicence->Version);
     $this->assertSame('ABC123', $test->NewZealand->DrivingLicence->VehicleRegistration);
 }
コード例 #2
0
 public function AuthenticateSP($profileID, $profileVersion, $customerReference, Identity $identity)
 {
     if (!$profileID) {
         throw new \InvalidArgumentException('No Profile ID has been defined when calling AuthenticateSP()');
     }
     if ($profileVersion === null) {
         throw new \LogicException('No Profile Version has been defined when calling AuthenticateSP()');
     }
     if (!$customerReference) {
         throw new \LogicException('No Customer Reference has been defined when calling AuthenticateSP()');
     }
     if (!$identity || !is_a($identity, 'ID3Global\\Identity\\Identity')) {
         throw new \LogicException('No or invalid Identity defined when calling AuthenticateSP()');
     }
     $request = new AuthenticateSPRequest();
     $request->setCustomerReference($customerReference);
     $profile = new \stdClass();
     $profile->Version = $profileVersion;
     $profile->ID = $profileID;
     $request->setProfileIDVersion($profile);
     $request->addFieldsFromIdentity($identity);
     return $this->getClient()->AuthenticateSP($request);
 }