예제 #1
0
 /**
  * @return \Magento\Framework\Controller\Result\Redirect
  */
 public function execute()
 {
     /**
      * @var $clientOrderHelper \Orba\Payupl\Model\Client\OrderInterface
      */
     $resultRedirect = $this->resultRedirectFactory->create();
     $redirectUrl = '/';
     try {
         if ($this->successValidator->isValid()) {
             $redirectUrl = 'orba_payupl/payment/error';
             $this->session->setLastOrderId(null);
             $clientOrderHelper = $this->getClientOrderHelper();
             if ($this->orderHelper->paymentSuccessCheck() && $clientOrderHelper->paymentSuccessCheck()) {
                 $redirectUrl = 'checkout/onepage/success';
             }
         } else {
             if ($this->session->getLastOrderId()) {
                 $redirectUrl = 'orba_payupl/payment/repeat_error';
                 $clientOrderHelper = $this->getClientOrderHelper();
                 if ($this->orderHelper->paymentSuccessCheck() && $clientOrderHelper->paymentSuccessCheck()) {
                     $redirectUrl = 'orba_payupl/payment/repeat_success';
                 }
             }
         }
     } catch (LocalizedException $e) {
         $this->logger->critical($e);
     }
     $resultRedirect->setPath($redirectUrl);
     return $resultRedirect;
 }
예제 #2
0
 public function testIsValidTrue()
 {
     $checkoutSession = $this->getMockBuilder('Magento\\Checkout\\Model\\Session')->disableOriginalConstructor()->getMock();
     $checkoutSession->expects($this->at(0))->method('__call')->with('getLastSuccessQuoteId')->will($this->returnValue(1));
     $checkoutSession->expects($this->at(1))->method('__call')->with('getLastQuoteId')->will($this->returnValue(1));
     $checkoutSession->expects($this->at(2))->method('__call')->with('getLastOrderId')->will($this->returnValue(1));
     $this->assertTrue($this->object->isValid($checkoutSession));
 }
예제 #3
0
 /**
  * @return int|false
  */
 public function getOrderIdForPaymentStart()
 {
     if ($this->checkoutSuccessValidator->isValid()) {
         return $this->checkoutSession->getLastOrderId();
     }
     $orderId = $this->request->getParam('id');
     if ($orderId) {
         return $orderId;
     }
     return false;
 }