0

I am getting below error on rest api call on this method

public function handleDecline($order)
    {
        $result = $this->forterConfig->getDeclinePost();
        if ($result == '1') {
            $this->customerSession->setForterMessage($this->forterConfig->getPostThanksMsg());
            if ($order->canHold()) {
                $order->setCanSendNewEmailFlag(false);
                $this->decline->holdOrder($order);
                $this->setMessageToQueue($order, 'decline');
            }
        } elseif ($result == '2') {
            $order->setCanSendNewEmailFlag(false);
            $this->decline->markOrderPaymentReview($order);
        }

        throw new PaymentException($this->forterConfig->getPostThanksMsg());
    }

TypeError: Argument 1 passed to Magento\Framework\Exception\LocalizedException::__construct() must be an instance of Magento\Framework\Phrase, string given, called in

Any thoughts how this can be solved ?

I think this is related to type of "$this->forterConfig->getPostThanksMsg()"

1 Answer 1

0

Use that:

throw new PaymentException(__($this->forterConfig->getPostThanksMsg()));
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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