Ejemplo n.º 1
0
 /**
  * This test shopuld return an API error
  * @expectedException Upg\Library\Api\Exception\ApiError
  */
 public function testApiCallThatReturnsAnAPIError()
 {
     if (is_null($this->config)) {
         $this->markTestSkipped('Config is not set, please set up the required environment variables');
         return false;
     }
     $configData = $this->config->getConfigData();
     $configData['storeID'] = "WRONGSTOREID";
     $config = new Config($configData);
     $request = new CreateTransactionRequest($config);
     //unique ID for the tests
     $orderId = hash('crc32b', microtime());
     $userId = "GUEST:" . hash('md5', microtime());
     $request->setOrderID($orderId)->setUserID($userId)->setIntegrationType(CreateTransactionRequest::INTEGRATION_TYPE_API)->setAutoCapture(true)->setContext(CreateTransactionRequest::CONTEXT_OFFLINE)->setMerchantReference("TEST")->setUserType(CreateTransactionRequest::USER_TYPE_PRIVATE)->setUserRiskClass(RiskClass::RISK_CLASS_DEFAULT)->setUserData($this->getUser())->setBillingAddress($this->getAddress())->setAmount($this->getAmount())->addBasketItem($this->getBasketItem())->setLocale(Codes::LOCALE_EN);
     $apiEndPoint = new CreateTransaction($config, $request);
     $apiEndPoint->sendRequest();
 }