0

I have below code. I'm overriding Paypal Express 1 function.

magento\app\code\Custom\Module\Model\Api\Nvp.php

namespace Custom\Module\Model\Api;

class Nvp extends \Magento\Paypal\Model\Api\Nvp {

    public function getPaymentAction() {
      // Here need to show error message & redirect to checkout page
      return $this->_getDataOrConfig('payment_action');
    }
}

I have 2 issues. When i create constructor it keeps giving error this object is missing & how to redirect from here?

Don't want to use direct objectManager in Method. Would like to above things

protected $_checkoutSession;

public function __construct(\Magento\Checkout\Model\Session $checkoutSession) {
    $this->_checkoutSession = $checkoutSession;
}

By putting above code it gives below error

Incompatible argument type: Required type: \Magento\Customer\Helper\Address. Actual type: array;

-1

By using these lines in your code you can redirect from Model

$resultRedirect = $this->resultRedirectFactory->create();

return $resultRedirect->setPath('redirect path');
| improve this answer | |
  • It works fine if ur in Controller but for this Model it's not working – Jackson Mar 16 '17 at 7:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.