public function testSetGetReasonCode()
 {
     $transaction = new FinancialTransaction();
     $this->assertNull($transaction->getReasonCode());
     $transaction->setReasonCode('foo');
     $this->assertEquals('foo', $transaction->getReasonCode());
 }
 public function testDeposit()
 {
     $controller = $this->getController(array(), false);
     $controller->addPlugin($plugin = $this->getPlugin());
     $plugin->expects($this->once())->method('deposit');
     $controller->expects($this->once())->method('buildFinancialTransaction')->will($this->returnCallback(function () {
         $transaction = new FinancialTransaction();
         $transaction->setProcessedAmount(123.45);
         $transaction->setResponseCode(PluginInterface::RESPONSE_CODE_SUCCESS);
         $transaction->setReasonCode(PluginInterface::REASON_CODE_SUCCESS);
         return $transaction;
     }));
     $payment = $this->getPayment();
     $payment->setState(PaymentInterface::STATE_APPROVED);
     $payment->setApprovedAmount(123.45);
     $instruction = $payment->getPaymentInstruction();
     $instruction->setState(PaymentInstructionInterface::STATE_VALID);
     $instruction->setApprovedAmount(10);
     $result = $this->callDeposit($controller, array($payment, 123.45));
     $this->assertEquals(Result::STATUS_SUCCESS, $result->getStatus(), 'Result status is not success: ' . $result->getReasonCode());
     $this->assertEquals(123.45, $payment->getDepositedAmount());
     $this->assertEquals(123.45, $instruction->getDepositedAmount());
     $this->assertEquals(PaymentInterface::STATE_DEPOSITED, $payment->getState());
     $this->assertEquals(0, $payment->getDepositingAmount());
     $this->assertEquals(0, $instruction->getDepositingAmount());
 }