コード例 #1
0
ファイル: Payflowpro.php プロジェクト: uibar/lavinia2
 /**
  * Perform the payment review
  *
  * @param InfoInterface $payment
  * @param string $action
  * @return bool
  */
 public function reviewPayment(InfoInterface $payment, $action)
 {
     $request = $this->buildBasicRequest();
     $transactionId = $payment->getCcTransId() ? $payment->getCcTransId() : $payment->getLastTransId();
     $request->setTrxtype(self::TRXTYPE_ACCEPT_DENY);
     $request->setOrigid($transactionId);
     $request->setUpdateaction($action);
     $response = $this->postRequest($request, $this->getConfig());
     $payment->setAdditionalInformation((array) $response->getData());
     $this->processErrors($response);
     if (!$this->_isTransactionUnderReview($response->getOrigresult())) {
         $payment->setTransactionId($response->getOrigpnref())->setIsTransactionClosed(0);
         if ($response->getOrigresult() == self::RESPONSE_CODE_APPROVED) {
             $payment->setIsTransactionApproved(true);
         } elseif ($response->getOrigresult() == self::RESPONSE_CODE_DECLINED_BY_MERCHANT) {
             $payment->setIsTransactionDenied(true);
         }
     }
     $rawData = $response->getData();
     return $rawData ? $rawData : [];
 }
コード例 #2
0
ファイル: Pro.php プロジェクト: pradeep-wagento/magento2
 /**
  * Perform the payment review
  *
  * @param \Magento\Payment\Model\InfoInterface $payment
  * @param string $action
  * @return bool
  */
 public function reviewPayment(\Magento\Payment\Model\InfoInterface $payment, $action)
 {
     $api = $this->getApi()->setTransactionId($payment->getLastTransId());
     // check whether the review is still needed
     $api->callGetTransactionDetails();
     $this->importPaymentInfo($api, $payment);
     if (!Info::isPaymentReviewRequired($payment)) {
         return false;
     }
     // perform the review action
     $api->setAction($action)->callManagePendingTransactionStatus();
     $api->callGetTransactionDetails();
     $this->importPaymentInfo($api, $payment);
     return true;
 }
コード例 #3
0
 /**
  * Search for a transaction by transaction types
  * @param \Magento\Payment\Model\InfoInterface $payment
  * @param array $transactionTypes
  * @return \Magento\Sales\Model\Order\Payment\Transaction
  */
 public function lookUpPaymentTransaction($payment, array $transactionTypes)
 {
     $transaction = null;
     $lastPaymentTransactionId = $payment->getLastTransId();
     $transaction = $this->getPaymentTransaction($lastPaymentTransactionId);
     while (isset($transaction)) {
         if (in_array($transaction->getTxnType(), $transactionTypes)) {
             break;
         }
         $transaction = $this->getPaymentTransaction($transaction->getParentId(), 'transaction_id');
     }
     return $transaction;
 }