示例#1
0
 /**
  * @test
  */
 public function testSetServiceName()
 {
     $this->object->setServiceName('Invoice');
     $this->assertEquals('Invoice', $this->object->serviceName);
     $object = new PPAPIService('ServiceName');
     $this->assertEquals('ServiceName', $object->serviceName);
 }
示例#2
0
 /**
  * 
  * @param string $method - API method to call
  * @param object $requestObject Request object 
  * @param mixed $apiCredential - Optional API credential - can either be
  * 		a username configured in sdk_config.ini or a ICredential object
  *      created dynamically 		
  */
 public function call($port, $method, $requestObject, $apiUserName = NULL)
 {
     $service = new PPAPIService($port, $this->serviceName, $this->serviceBinding, $this->handlers, $this->config);
     $ret = $service->makeRequest($method, $requestObject, $apiUserName);
     $this->lastRequest = $ret['request'];
     $this->lastResponse = $ret['response'];
     return $this->lastResponse;
 }
 /**
  * @test
  */
 public function testMakeRequestWithHandlers()
 {
     $this->object->addHandler(new MockHandler());
     $req = new PPRequest(new MockNVPClass(), "NV");
     $ret = $this->object->makeRequest('GetInvoiceDetails', $req);
     $this->assertArrayHasKey('response', $ret);
     $this->assertContains("responseEnvelope.timestamp=", $ret['response']);
 }
示例#4
0
 public function call($method, $requestObject, $apiUsername = null)
 {
     $params = $this->marshall($requestObject);
     $service = new PPAPIService();
     $service->setServiceName($this->serviceName);
     $this->lastRequest = $params;
     $this->lastResponse = $service->makeRequest($method, $params, $apiUsername, $this->accessToken, $this->tokenSecret);
     return $this->lastResponse;
 }
示例#5
0
 /**
  * 
  * @param string $method - API method to call
  * @param object $requestObject Request object 
  * @param apiContext $apiContext object containing credential and SOAP headers
  * @param mixed $apiUserName - Optional API credential - can either be
  * 		a username configured in sdk_config.ini or a ICredential object created dynamically 		
  */
 public function call($port, $method, $requestObject, $apiContext, $handlers)
 {
     if ($apiContext == null) {
         $apiContext = new PPApiContext(PPConfigManager::getConfigWithDefaults($this->config));
     }
     if ($apiContext->getConfig() == null) {
         $apiContext->setConfig(PPConfigManager::getConfigWithDefaults($this->config));
     }
     $service = new PPAPIService($port, $this->serviceName, $this->serviceBinding, $apiContext, $handlers);
     $ret = $service->makeRequest($method, new PPRequest($requestObject, $this->serviceBinding));
     $this->lastRequest = $ret['request'];
     $this->lastResponse = $ret['response'];
     return $this->lastResponse;
 }
 /**
  * @test
  */
 public function testSetServiceName()
 {
     $this->assertEquals('AdaptiveAccounts', $this->object->serviceName);
     $this->object->setServiceName('Invoice');
     $this->assertEquals('Invoice', $this->object->serviceName);
 }
 /**
  * 
  * @param string $method - API method to call
  * @param object $requestObject Request object 
  * @param mixed $apiCredential - Optional API credential - can either be
  * 		a username configured in sdk_config.ini or a ICredential object
  *      created dynamically 		
  */
 public function call($port, $method, $requestObject, $apiCredential = null)
 {
     $service = new PPAPIService($port, $this->serviceName, $this->serviceBinding, $this->handlers);
     $ret = $service->makeRequest($method, $requestObject, $apiCredential, $this->accessToken, $this->tokenSecret);
     $this->lastRequest = $ret['request'];
     $this->lastResponse = $ret['response'];
     return $this->lastResponse;
 }