Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Rollback to Revision 5 - Edit approval overridden by post owner or moderator
Source Link
rajat kara
  • 1.2k
  • 3
  • 19
  • 28

I am trying to save my custom field data through the plugin but it's not working.

Plugin Class

namespace Vendor\Module\Model\Checkout;

class PaymentInformationManagementPlugin {

    protected $paymentMethodManagement;

    public function __construct(
        \Magento\Quote\Model\QuoteFactory $quote, 
        \Magento\Quote\Api\PaymentMethodManagementInterface $paymentMethodManagement
    ) {
        $this->paymentMethodManagement = $paymentMethodManagement;
        $this->quoteManagement = $quoteManagement;
    }    

    public function beforeSavePaymentInformation(
        \Magento\Checkout\Model\PaymentInformationManagement $subject, 
$cartId, 
        \Magento\Quote\Api\Data\PaymentInterface $paymentInformation
    ) {
        //$paymentInformation->getData('extension_attributes');
        $extenstinAttributes = $paymentInformation->getExtensionAttributes();
        $taxCode = $extenstinAttributes->getTaxCode();

        $paymentInformation->setExtensionAttributes($taxCode);
        $this->paymentMethodManagement->set($cartId, $paymentInformation);

        return true;
//        var_dump($taxCode);exit;
//        $quote=$this->quote->create();
//        $quote->getPayment()->setData('tax_code',$taxCode);
//        return $paymentInformation;
    }

}

extenstion_attribute.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="Magento\Quote\Api\Data\PaymentInterface">
        <attribute code="tax_code" type="string"/>
    </extension_attributes>
</config>

di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Checkout\Model\PaymentInformationManagement">
        <plugin name="save-in-quote-payment" type="Vendor\Module\Model\Checkout\PaymentInformationManagementPlugin" sortOrder="12349"/>
    </type>
</config>

Can anyone please help me withon this?.

I am trying to save my custom field data through the plugin but it's not working.

Plugin Class

namespace Vendor\Module\Model\Checkout;

class PaymentInformationManagementPlugin {

    protected $paymentMethodManagement;

    public function __construct(
        \Magento\Quote\Model\QuoteFactory $quote, 
        \Magento\Quote\Api\PaymentMethodManagementInterface $paymentMethodManagement
    ) {
        $this->paymentMethodManagement = $paymentMethodManagement;
        $this->quoteManagement = $quoteManagement;
    }    

    public function beforeSavePaymentInformation(
        \Magento\Checkout\Model\PaymentInformationManagement $subject, 
$cartId, 
        \Magento\Quote\Api\Data\PaymentInterface $paymentInformation
    ) {
        //$paymentInformation->getData('extension_attributes');
        $extenstinAttributes = $paymentInformation->getExtensionAttributes();
        $taxCode = $extenstinAttributes->getTaxCode();

        $paymentInformation->setExtensionAttributes($taxCode);
        $this->paymentMethodManagement->set($cartId, $paymentInformation);

        return true;
//        var_dump($taxCode);exit;
//        $quote=$this->quote->create();
//        $quote->getPayment()->setData('tax_code',$taxCode);
//        return $paymentInformation;
    }

}

extenstion_attribute.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="Magento\Quote\Api\Data\PaymentInterface">
        <attribute code="tax_code" type="string"/>
    </extension_attributes>
</config>

di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Checkout\Model\PaymentInformationManagement">
        <plugin name="save-in-quote-payment" type="Vendor\Module\Model\Checkout\PaymentInformationManagementPlugin" sortOrder="12349"/>
    </type>
</config>

Can anyone please help me with this?

I am trying to save my custom field data through plugin but it's not working.

Plugin Class

namespace Vendor\Module\Model\Checkout;

class PaymentInformationManagementPlugin {

    protected $paymentMethodManagement;

    public function __construct(
        \Magento\Quote\Model\QuoteFactory $quote, 
        \Magento\Quote\Api\PaymentMethodManagementInterface $paymentMethodManagement
    ) {
        $this->paymentMethodManagement = $paymentMethodManagement;
        $this->quoteManagement = $quoteManagement;
    }    

    public function beforeSavePaymentInformation(
        \Magento\Checkout\Model\PaymentInformationManagement $subject, 
$cartId, 
        \Magento\Quote\Api\Data\PaymentInterface $paymentInformation
    ) {
        //$paymentInformation->getData('extension_attributes');
        $extenstinAttributes = $paymentInformation->getExtensionAttributes();
        $taxCode = $extenstinAttributes->getTaxCode();

        $paymentInformation->setExtensionAttributes($taxCode);
        $this->paymentMethodManagement->set($cartId, $paymentInformation);

        return true;
//        var_dump($taxCode);exit;
//        $quote=$this->quote->create();
//        $quote->getPayment()->setData('tax_code',$taxCode);
//        return $paymentInformation;
    }

}

extenstion_attribute.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="Magento\Quote\Api\Data\PaymentInterface">
        <attribute code="tax_code" type="string"/>
    </extension_attributes>
</config>

di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Checkout\Model\PaymentInformationManagement">
        <plugin name="save-in-quote-payment" type="Vendor\Module\Model\Checkout\PaymentInformationManagementPlugin" sortOrder="12349"/>
    </type>
</config>

Can anyone please help me on this.

I am trying to save my custom field data through plugin but it's not working. **Plugin Class** namespace Vendor\Module\Model\Checkout; class PaymentInformationManagementPlugin { protected $paymentMethodManagement; public function __construct( \Magento\Quote\
Source Link

I am trying to save my custom field data through the plugin but it's not working.

Plugin Class

namespace Vendor\Module\Model\Checkout;

class PaymentInformationManagementPlugin {

    protected $paymentMethodManagement;

    public function __construct(
        \Magento\Quote\Model\QuoteFactory $quote, 
        \Magento\Quote\Api\PaymentMethodManagementInterface $paymentMethodManagement
    ) {
        $this->paymentMethodManagement = $paymentMethodManagement;
        $this->quoteManagement = $quoteManagement;
    }    

    public function beforeSavePaymentInformation(
        \Magento\Checkout\Model\PaymentInformationManagement $subject, 
$cartId, 
        \Magento\Quote\Api\Data\PaymentInterface $paymentInformation
    ) {
        //$paymentInformation->getData('extension_attributes');
        $extenstinAttributes = $paymentInformation->getExtensionAttributes();
        $taxCode = $extenstinAttributes->getTaxCode();

        $paymentInformation->setExtensionAttributes($taxCode);
        $this->paymentMethodManagement->set($cartId, $paymentInformation);

        return true;
//        var_dump($taxCode);exit;
//        $quote=$this->quote->create();
//        $quote->getPayment()->setData('tax_code',$taxCode);
//        return $paymentInformation;
    }

}

extenstion_attribute.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="Magento\Quote\Api\Data\PaymentInterface">
        <attribute code="tax_code" type="string"/>
    </extension_attributes>
</config>

di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Checkout\Model\PaymentInformationManagement">
        <plugin name="save-in-quote-payment" type="Vendor\Module\Model\Checkout\PaymentInformationManagementPlugin" sortOrder="12349"/>
    </type>
</config>

Can anyone please help me onwith this.?

I am trying to save my custom field data through plugin but it's not working.

Plugin Class

namespace Vendor\Module\Model\Checkout;

class PaymentInformationManagementPlugin {

    protected $paymentMethodManagement;

    public function __construct(
        \Magento\Quote\Model\QuoteFactory $quote, 
        \Magento\Quote\Api\PaymentMethodManagementInterface $paymentMethodManagement
    ) {
        $this->paymentMethodManagement = $paymentMethodManagement;
        $this->quoteManagement = $quoteManagement;
    }    

    public function beforeSavePaymentInformation(
        \Magento\Checkout\Model\PaymentInformationManagement $subject, 
$cartId, 
        \Magento\Quote\Api\Data\PaymentInterface $paymentInformation
    ) {
        //$paymentInformation->getData('extension_attributes');
        $extenstinAttributes = $paymentInformation->getExtensionAttributes();
        $taxCode = $extenstinAttributes->getTaxCode();

        $paymentInformation->setExtensionAttributes($taxCode);
        $this->paymentMethodManagement->set($cartId, $paymentInformation);

        return true;
//        var_dump($taxCode);exit;
//        $quote=$this->quote->create();
//        $quote->getPayment()->setData('tax_code',$taxCode);
//        return $paymentInformation;
    }

}

extenstion_attribute.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="Magento\Quote\Api\Data\PaymentInterface">
        <attribute code="tax_code" type="string"/>
    </extension_attributes>
</config>

di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Checkout\Model\PaymentInformationManagement">
        <plugin name="save-in-quote-payment" type="Vendor\Module\Model\Checkout\PaymentInformationManagementPlugin" sortOrder="12349"/>
    </type>
</config>

Can anyone please help me on this.

I am trying to save my custom field data through the plugin but it's not working.

Plugin Class

namespace Vendor\Module\Model\Checkout;

class PaymentInformationManagementPlugin {

    protected $paymentMethodManagement;

    public function __construct(
        \Magento\Quote\Model\QuoteFactory $quote, 
        \Magento\Quote\Api\PaymentMethodManagementInterface $paymentMethodManagement
    ) {
        $this->paymentMethodManagement = $paymentMethodManagement;
        $this->quoteManagement = $quoteManagement;
    }    

    public function beforeSavePaymentInformation(
        \Magento\Checkout\Model\PaymentInformationManagement $subject, 
$cartId, 
        \Magento\Quote\Api\Data\PaymentInterface $paymentInformation
    ) {
        //$paymentInformation->getData('extension_attributes');
        $extenstinAttributes = $paymentInformation->getExtensionAttributes();
        $taxCode = $extenstinAttributes->getTaxCode();

        $paymentInformation->setExtensionAttributes($taxCode);
        $this->paymentMethodManagement->set($cartId, $paymentInformation);

        return true;
//        var_dump($taxCode);exit;
//        $quote=$this->quote->create();
//        $quote->getPayment()->setData('tax_code',$taxCode);
//        return $paymentInformation;
    }

}

extenstion_attribute.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="Magento\Quote\Api\Data\PaymentInterface">
        <attribute code="tax_code" type="string"/>
    </extension_attributes>
</config>

di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Checkout\Model\PaymentInformationManagement">
        <plugin name="save-in-quote-payment" type="Vendor\Module\Model\Checkout\PaymentInformationManagementPlugin" sortOrder="12349"/>
    </type>
</config>

Can anyone please help me with this?

Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
added 58 characters in body
Source Link
Zefiryn
  • 5.9k
  • 2
  • 27
  • 34


namespace Vendor\Module\Model\Checkout;

class PaymentInformationManagementPlugin {

    protected $paymentMethodManagement;

    public function __construct(
        \Magento\Quote\Model\QuoteFactory $quote, 
        \Magento\Quote\Api\PaymentMethodManagementInterface $paymentMethodManagement
    ) {
        $this->paymentMethodManagement = $paymentMethodManagement;

        $this->quoteManagement = $quoteManagement;
    }    
    
    public function beforeSavePaymentInformation(
    \Magento\Checkout\Model\PaymentInformationManagement $subject, 
    $cartId, 
    \Magento\Quote\Api\Data\PaymentInterface $paymentInformation
    ) {
    //       $paymentInformation->getData('extension_attributes');
    
        $extenstinAttributes = $paymentInformation->getExtensionAttributes();
        $taxCode = $extenstinAttributes->getTaxCode();
    
        $paymentInformation->setExtensionAttributes($taxCode);
        $this->paymentMethodManagement->set($cartId, $paymentInformation);
    
        return true;
    //        var_dump($taxCode);exit;
    //        $quote=$this->quote->create();
    //        $quote->getPayment()->setData('tax_code',$taxCode);
    //        return $paymentInformation;
    }

}
namespace Vendor\Module\Model\Checkout;

class PaymentInformationManagementPlugin {

    protected $paymentMethodManagement;

    public function __construct(
        \Magento\Quote\Model\QuoteFactory $quote, 
        \Magento\Quote\Api\PaymentMethodManagementInterface $paymentMethodManagement
    ) {
        $this->paymentMethodManagement = $paymentMethodManagement;
        $this->quoteManagement = $quoteManagement;
    }    

    public function beforeSavePaymentInformation(
        \Magento\Checkout\Model\PaymentInformationManagement $subject, 
$cartId, 
        \Magento\Quote\Api\Data\PaymentInterface $paymentInformation
    ) {
        //$paymentInformation->getData('extension_attributes');
        $extenstinAttributes = $paymentInformation->getExtensionAttributes();
        $taxCode = $extenstinAttributes->getTaxCode();

        $paymentInformation->setExtensionAttributes($taxCode);
        $this->paymentMethodManagement->set($cartId, $paymentInformation);

        return true;
//        var_dump($taxCode);exit;
//        $quote=$this->quote->create();
//        $quote->getPayment()->setData('tax_code',$taxCode);
//        return $paymentInformation;
    }

}

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="Magento\Quote\Api\Data\PaymentInterface">
        <attribute code="tax_code" type="string"/>
    </extension_attributes>
</config>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="Magento\Quote\Api\Data\PaymentInterface">
        <attribute code="tax_code" type="string"/>
    </extension_attributes>
</config>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Checkout\Model\PaymentInformationManagement">
        <plugin name="save-in-quote-payment" type="Vendor\Module\Model\Checkout\PaymentInformationManagementPlugin" sortOrder="12349"/>
    </type>

</config>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Checkout\Model\PaymentInformationManagement">
        <plugin name="save-in-quote-payment" type="Vendor\Module\Model\Checkout\PaymentInformationManagementPlugin" sortOrder="12349"/>
    </type>
</config>


namespace Vendor\Module\Model\Checkout;

class PaymentInformationManagementPlugin {

    protected $paymentMethodManagement;

    public function __construct(
        \Magento\Quote\Model\QuoteFactory $quote, 
        \Magento\Quote\Api\PaymentMethodManagementInterface $paymentMethodManagement
    ) {
        $this->paymentMethodManagement = $paymentMethodManagement;

        $this->quoteManagement = $quoteManagement;
    }    
    
    public function beforeSavePaymentInformation(
    \Magento\Checkout\Model\PaymentInformationManagement $subject, 
    $cartId, 
    \Magento\Quote\Api\Data\PaymentInterface $paymentInformation
    ) {
    //       $paymentInformation->getData('extension_attributes');
    
        $extenstinAttributes = $paymentInformation->getExtensionAttributes();
        $taxCode = $extenstinAttributes->getTaxCode();
    
        $paymentInformation->setExtensionAttributes($taxCode);
        $this->paymentMethodManagement->set($cartId, $paymentInformation);
    
        return true;
    //        var_dump($taxCode);exit;
    //        $quote=$this->quote->create();
    //        $quote->getPayment()->setData('tax_code',$taxCode);
    //        return $paymentInformation;
    }

}

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="Magento\Quote\Api\Data\PaymentInterface">
        <attribute code="tax_code" type="string"/>
    </extension_attributes>
</config>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Checkout\Model\PaymentInformationManagement">
        <plugin name="save-in-quote-payment" type="Vendor\Module\Model\Checkout\PaymentInformationManagementPlugin" sortOrder="12349"/>
    </type>

</config>
namespace Vendor\Module\Model\Checkout;

class PaymentInformationManagementPlugin {

    protected $paymentMethodManagement;

    public function __construct(
        \Magento\Quote\Model\QuoteFactory $quote, 
        \Magento\Quote\Api\PaymentMethodManagementInterface $paymentMethodManagement
    ) {
        $this->paymentMethodManagement = $paymentMethodManagement;
        $this->quoteManagement = $quoteManagement;
    }    

    public function beforeSavePaymentInformation(
        \Magento\Checkout\Model\PaymentInformationManagement $subject, 
$cartId, 
        \Magento\Quote\Api\Data\PaymentInterface $paymentInformation
    ) {
        //$paymentInformation->getData('extension_attributes');
        $extenstinAttributes = $paymentInformation->getExtensionAttributes();
        $taxCode = $extenstinAttributes->getTaxCode();

        $paymentInformation->setExtensionAttributes($taxCode);
        $this->paymentMethodManagement->set($cartId, $paymentInformation);

        return true;
//        var_dump($taxCode);exit;
//        $quote=$this->quote->create();
//        $quote->getPayment()->setData('tax_code',$taxCode);
//        return $paymentInformation;
    }

}
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="Magento\Quote\Api\Data\PaymentInterface">
        <attribute code="tax_code" type="string"/>
    </extension_attributes>
</config>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Checkout\Model\PaymentInformationManagement">
        <plugin name="save-in-quote-payment" type="Vendor\Module\Model\Checkout\PaymentInformationManagementPlugin" sortOrder="12349"/>
    </type>
</config>
Tweeted twitter.com/StackMagento/status/816058767511060480
added 27 characters in body
Source Link
Sohel Rana
  • 36.1k
  • 3
  • 73
  • 91
Loading
added 795 characters in body
Source Link
rajat kara
  • 1.2k
  • 3
  • 19
  • 28
Loading
added 80 characters in body
Source Link
Sohel Rana
  • 36.1k
  • 3
  • 73
  • 91
Loading