i am trying to save my custom field data through plugin but is 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; }
}
Can anyone please help me on this.