Ejemplo n.º 1
0
 public function testGetSetCredentials()
 {
     $api = new QPayApi();
     static::assertNull($api->getCredentials());
     $credentials = QPayApiCredentialsTest::makeCredentials();
     $api->setCredentials($credentials);
     static::assertEquals($credentials, $api->getCredentials());
 }
 /**
  * buildApiInstance
  *
  * @return QPayApi
  * @throws AccessDeniedException
  */
 protected function buildApiInstance($credentials = null)
 {
     $api = new QPayApi(ApiInterface::MODE_LIVE, true);
     if ($credentials === null) {
         $credentials = $this->readSettings()['credentials'];
     }
     if ($credentials === null) {
         throw new AccessDeniedException('Invalid Credentials');
     }
     $api->setCredentials($credentials);
     $providerResponse = $this->get('session')->get('qpay_session.provider_response');
     if ($providerResponse instanceof GetProvidersResponse) {
         QPayApi::setProvidersResponse($providerResponse);
     }
     return $api;
 }