function approveAndDeposit(FinancialTransactionInterface $transaction, $retry)
 {
     try {
         $this->responseClient->isValid();
         $transaction->setReferenceNumber($this->responseClient->getOrderNumber());
         $transaction->setProcessedAmount($transaction->getPayment()->getApprovingAmount());
         $transaction->setResponseCode(PluginInterface::RESPONSE_CODE_SUCCESS);
         $transaction->setReasonCode(PluginInterface::REASON_CODE_SUCCESS);
     } catch (ActionRequiredException $e) {
         $actionRequest = new ActionRequiredException('User has not yet authorized the transaction.');
         $actionRequest->setFinancialTransaction($transaction);
         $actionRequest->setAction(new VisitUrl($this->getRedirectUrl($transaction)));
         throw $actionRequest;
     }
 }
 /**
  * {@inheritdoc}
  */
 public function approve(FinancialTransactionInterface $transaction, $retry)
 {
     $data = $transaction->getExtendedData();
     $this->checkExtendedDataBeforeApproveAndDeposit($data);
     if ((int) $data->get('confirmations') >= 6) {
         $transaction->setReferenceNumber($data->get('transaction_hash'));
         $transaction->setProcessedAmount($data->get('value'));
         $transaction->setResponseCode(PluginInterface::RESPONSE_CODE_SUCCESS);
         $transaction->setReasonCode(PluginInterface::REASON_CODE_SUCCESS);
     } else {
         $e = new FinancialException('Payment status unknow: ' . $data->get('confirmations'));
         $e->setFinancialTransaction($transaction);
         $transaction->setResponseCode('Unknown');
         $transaction->setReasonCode($data->get('confirmations'));
         throw $e;
     }
 }
 /**
  * {@inheritdoc}
  */
 public function approve(FinancialTransactionInterface $transaction, $retry)
 {
     $data = $transaction->getExtendedData();
     $this->checkExtendedDataBeforeApproveAndDeposit($data);
     if ($data->get('sStatus') == self::STATUS_COMPLETED || $data->get('sId') == self::TEST_ID && $data->get('sStatus') == self::STATUS_TEST_SUCCESS) {
         $transaction->setReferenceNumber($data->get('sId'));
         $transaction->setProcessedAmount($data->get('fAmount'));
         $transaction->setResponseCode(PluginInterface::RESPONSE_CODE_SUCCESS);
         $transaction->setReasonCode(PluginInterface::REASON_CODE_SUCCESS);
     } else {
         $e = new FinancialException('Payment status unknow: ' . $data->get('sStatus'));
         $e->setFinancialTransaction($transaction);
         $transaction->setResponseCode('Unknown');
         $transaction->setReasonCode($data->get('sStatus'));
         throw $e;
     }
 }
 /**
  * {@inheritdoc}
  */
 public function approve(FinancialTransactionInterface $transaction, $retry)
 {
     $data = $transaction->getExtendedData();
     $this->checkExtendedDataBeforeApproveAndDeposit($data);
     if ($data->get('ok_txn_status') == CallbackResponse::STATUS_COMPLETED) {
         $transaction->setReferenceNumber(OkPayClient::REF_NUM_PREFIX . $data->get("ok_txn_id"));
         $transaction->setProcessedAmount($data->get('ok_txn_gross'));
         $transaction->setResponseCode(PluginInterface::RESPONSE_CODE_SUCCESS);
         $transaction->setReasonCode(PluginInterface::REASON_CODE_SUCCESS);
     } else {
         $e = new FinancialException('Payment status unknow: ' . $data->get('ok_txn_status'));
         $e->setFinancialTransaction($transaction);
         $transaction->setResponseCode('Unknown');
         $transaction->setReasonCode($data->get('ok_txn_status'));
         throw $e;
     }
 }