예제 #1
0
 /**
  * Saves payment information in quote
  *
  * @param Object $response
  * @return void
  */
 public function savePaymentInQuote($response)
 {
     $quote = $this->quoteRepository->get($this->sessionTransparent->getQuoteId());
     /** @var InfoInterface $payment */
     $payment = $this->paymentManagement->get($quote->getId());
     $payment->setAdditionalInformation('pnref', $response->getPnref());
     $this->errorHandler->handle($payment, $response);
     $this->paymentManagement->set($quote->getId(), $payment);
 }
예제 #2
0
 /**
  * @param DataObject $payment
  * @param DataObject $response
  *
  * @return Object
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function setTransStatus($payment, $response)
 {
     if ($payment instanceof InfoInterface) {
         $this->errorHandler->handle($payment, $response);
     }
     switch ($response->getResultCode()) {
         case self::RESPONSE_CODE_APPROVED:
             $payment->setTransactionId($response->getPnref())->setIsTransactionClosed(0);
             break;
         case self::RESPONSE_CODE_DECLINED_BY_FILTER:
         case self::RESPONSE_CODE_FRAUDSERVICE_FILTER:
             $payment->setTransactionId($response->getPnref())->setIsTransactionClosed(0);
             $payment->setIsTransactionPending(true);
             $payment->setIsFraudDetected(true);
             break;
         case self::RESPONSE_CODE_DECLINED:
             throw new \Magento\Framework\Exception\LocalizedException(__($response->getRespmsg()));
         default:
             break;
     }
     return $payment;
 }