public function testIsProcessing()
 {
     $this->object->exchangeArray(array('status' => 'processing'));
     $this->assertTrue($this->object->isProcessing());
     $this->object->exchangeArray(array('type' => 'async-response'));
     $this->assertTrue($this->object->isProcessing());
     $this->object->exchangeArray(array('status' => 'error'));
     $this->assertFalse($this->object->isProcessing());
     $this->object->exchangeArray(array('type' => 'error'));
     $this->assertFalse($this->object->isProcessing());
 }
 /**
  * Sets action, that library client have to execute.
  *
  * @param       Response        $response       PaynetEasy response.
  */
 protected function setNeededAction(Response $response)
 {
     if ($response->hasHtml()) {
         $response->setNeededAction(Response::NEEDED_SHOW_HTML);
     } elseif ($response->isProcessing()) {
         $response->setNeededAction(Response::NEEDED_STATUS_UPDATE);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function processResponse(PaymentTransaction $paymentTransaction, Response $response)
 {
     if ($response->isProcessing() || $response->isApproved()) {
         $validate = array($this, 'validateResponseOnSuccess');
         $update = array($this, 'updatePaymentTransactionOnSuccess');
     } else {
         $validate = array($this, 'validateResponseOnError');
         $update = array($this, 'updatePaymentTransactionOnError');
     }
     try {
         call_user_func($validate, $paymentTransaction, $response);
     } catch (Exception $e) {
         $paymentTransaction->addError($e)->setStatus(PaymentTransaction::STATUS_ERROR);
         throw $e;
     }
     call_user_func($update, $paymentTransaction, $response);
     if ($response->isError()) {
         throw $response->getError();
     }
     return $response;
 }