When try to process an order via API during checkout, if no address is set an exception error occurred:
PHP message: PHP Fatal error: Uncaught TypeError: Argument 4 passed to Experius\ExtraCheckoutAddressFields\Plugin\Magento\Checkout\Model\PaymentInformationManagement::beforeSavePaymentInformation() must implement interface Magento\Quote\Api\Data\AddressInterface, null given ...
This happen because no default null value is set of fourth parameter, and also check if address is null.
The code method beforeSavePaymentInformation in Experius\ExtraCheckoutAddressFields\Plugin\Magento\Checkout\Model\PaymentInformationManagement should be modified as:
public function beforeSavePaymentInformation(
\Magento\Checkout\Model\PaymentInformationManagement $subject,
$cartId,
\Magento\Quote\Api\Data\PaymentInterface $paymentMethod,
\Magento\Quote\Api\Data\AddressInterface $address = null
) {
if (is_null($address))
return;
$extAttributes = $address->getExtensionAttributes();
if (!empty($extAttributes)) {
$this->helper->transportFieldsFromExtensionAttributesToObject(
$extAttributes,
$address,
'extra_checkout_billing_address_fields'
);
}
}
When try to process an order via API during checkout, if no address is set an exception error occurred:
PHP message: PHP Fatal error: Uncaught TypeError: Argument 4 passed to Experius\ExtraCheckoutAddressFields\Plugin\Magento\Checkout\Model\PaymentInformationManagement::beforeSavePaymentInformation() must implement interface Magento\Quote\Api\Data\AddressInterface, null given ...
This happen because no default null value is set of fourth parameter, and also check if address is null.
The code method beforeSavePaymentInformation in Experius\ExtraCheckoutAddressFields\Plugin\Magento\Checkout\Model\PaymentInformationManagement should be modified as: