0

This method is calling at checkout step but with plugin using after method it's not calling, core method is calling.

etc/di.xml

<type name="Magento\Checkout\Model\PaymentInformationManagement">
        <plugin name="k365_payemnt_management_plugin" type="K365\Checkout\Plugin\Model\PaymentInfoManagement" />
    </type>

PaymentInfoManagement.php

<?php
namespace K365\Checkout\Plugin\Model;

use Magento\Checkout\Model\PaymentInformationManagement;

class PaymentInfoManagement
{
    
public function afterSavePaymentInformationAndPlaceOrder(
    PaymentInformationManagement $subject, $result,
    $cartId,
    \Magento\Quote\Api\Data\PaymentInterface $paymentMethod,
    \Magento\Quote\Api\Data\AddressInterface $billingAddress = null
) {
    $this->getLogger()->critical(
            '******calllllllllllllllllllllll ' );

    $this->savePaymentInformation($cartId, $paymentMethod, $billingAddress);
    try {
        $orderId = $this->cartManagement->placeOrder($cartId);
    } catch (\Magento\Framework\Exception\LocalizedException $e) {
        $this->getLogger()->critical(
            '******Placing an order with quote_id ' . $cartId . ' is failed: ' . $e->getMessage()
        );
        throw new CouldNotSaveException(
            __('*******'.$e->getMessage()),
            $e
        );
    } catch (\Exception $e) {
        $this->getLogger()->critical($e);
        throw new CouldNotSaveException(
            __('*******A server error stopped your order from being placed. Please try to place your order again.'),
            $e
        );
    }
    return $result;
}

}

Thanks....

2
  • Any error in logs ?
    – Pawan
    Commented Feb 11, 2023 at 13:29
  • it's issue with scop. i have put di.xml in frontend folder. Commented Mar 1, 2023 at 7:39

0

Your Answer

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