/** * Execute an asynchronous request to the API * * @param Content $contentBlock Content block to send * @param string $asyncPolicyId Intacct asynchronous policy ID * @param bool $transaction Force the operation to be one transaction * @param string $requestControlId Request control ID * @param bool $uniqueFunctionControlIds Force the function control ID's to be unique * @param array $params Overriding params, @see IntacctClient::__construct() * * @return AsynchronousResponse */ protected function executeAsync(Content $contentBlock, $asyncPolicyId, $transaction = false, $requestControlId = null, $uniqueFunctionControlIds = false, array $params = []) { $config = array_merge($this->getSessionConfig(), ['policy_id' => $asyncPolicyId, 'transaction' => $transaction, 'control_id' => $requestControlId, 'unique_id' => $uniqueFunctionControlIds], $params); $requestHandler = new RequestHandler($config); $response = $requestHandler->executeAsynchronous($config, $contentBlock); return $response; }
/** * @covers Intacct\Xml\RequestHandler::__construct * @covers Intacct\Xml\RequestHandler::executeAsynchronous * @expectedException InvalidArgumentException * @expectedExceptionMessage Required "policy_id" key not supplied in params for asynchronous request */ public function testMockExecuteAsynchronousMissingPolicyId() { $config = ['sender_id' => 'testsenderid', 'sender_password' => 'pass123!', 'session_id' => 'testsession..', 'control_id' => 'requestUnitTest']; $contentBlock = new Content([new ApiSessionCreate()]); $requestHandler = new RequestHandler($config); $response = $requestHandler->executeAsynchronous($config, $contentBlock); }