Exemplo n.º 1
0
 /**
  * Test zuora response error
  *
  * @expectedException \Zuora\Exception\ApiException
  */
 public function testClientLogicErrorResponse()
 {
     $enviroment = $this->getEnvironment();
     $error_response = new Response();
     $error_response->setCode(200)->setData(array('success' => false, 'processId' => '3F7EA3FD706C7E7C', 'reasons' => array(array('code' => 53100020, 'message' => ' {com.zuora.constraints.either_or_both}'), array('code' => 53100320, 'message' => "'termType' value should be one of: TERMED, EVERGREEN"))));
     $request = $this->getMock('\\Zuora\\Http\\RequestInterface');
     $request->expects($this->once())->method('call')->will($this->returnValue($error_response));
     $client = new Client($enviroment, $request);
     $client->request('test');
 }
Exemplo n.º 2
0
 /**
  * For paged response fetch next result
  *
  * @return \Zuora\Response
  */
 public function nextPage()
 {
     $data = $this->response->getData();
     if (isset($data['nextPage'])) {
         if (false !== strpos($data['nextPage'], $this->client->getEnvironment()->getUrl(''))) {
             $url = substr($data['nextPage'], strlen($this->client->getEnvironment()->getUrl('')));
             $url = parse_url($url);
             $path = $url['path'];
             parse_str($url['query'], $query);
             return $this->client->request($path, 'GET', $query);
         }
     }
     return null;
 }