Esempio n. 1
0
 /**
  * @return array|Data\Provider[]
  */
 protected function getProviders()
 {
     $providersXml = $this->loadFixture('GetProviders.xml');
     $providersResponse = new GetProvidersResponse();
     QPayXMLParser::parseResponse($providersXml, $providersResponse);
     return $providersResponse->getProviders();
 }
Esempio n. 2
0
 /**
  * @param ResponseInterface|null $response
  *
  * @throws ApiErrorHappenException
  */
 public function __construct(ResponseInterface $response = null)
 {
     if ($response) {
         $this->setXml($response->getBody()->getContents());
         $this->response = QPayXMLParser::parseResponse($this->getXml(), $this);
         //response with failure code always thrown a exception
         if ($this->getErrorCode() > 0) {
             throw new ApiErrorHappenException($this->getErrorMessage());
         }
     }
 }