• Resolved Chris

    (@eaonflux)


    Ik krijg best wel vaak in de foutmeldingen in mijn dev console.

    “Undefined array key “billing_birthdate”” en nog hoop andere. Nu ben ik zelf even in jullie code gaan kijken aangezien ik dit snel opgelost moet hebben ivm dat ik bezig ben met het schrijven van een plugin.

    Het gaat nu om jullie “wp-content/plugins/mollie-payments-for-woocommerce/src/Gateway/GatewayModule.php”

    IN de method addPaymentMethodMandatoryFields checken julli niet altijd als een array element bestaat.

    Dit is mijn aangepaste versie

    public function addPaymentMethodMandatoryFields($fields, string $gatewayName, string $field, $errors, string $paymentMethodName)
        {
            if (!isset($fields['payment_method']) || $fields['payment_method'] !== $gatewayName) {
                return $fields;
            }
    
            $fieldExists = isset($fields[$field]);
            $fieldEmpty = $fieldExists ? $fields[$field] === '' : true;
    
            if (!$fieldExists || $fieldEmpty) {
                $fieldPosted = filter_input(INPUT_POST, $field, FILTER_SANITIZE_SPECIAL_CHARS) ?? false;
    
                if ($fieldPosted) {
                    $fields[$field] = $fieldPosted;
                } else {
                    $errors->add(
                        'validation',
                        sprintf(
                            __(
                                'Error processing %1$s payment, the %2$s field is required.',
                                'mollie-payments-for-woocommerce'
                            ),
                            $paymentMethodName,
                            $field
                        )
                    );
                }
            }
    
            if ($fieldEmpty) {
                $errors->add(
                    'validation',
                    sprintf(
                        __(
                            'Please enter your %1$s, this is required for %2$s payments',
                            'mollie-payments-for-woocommerce'
                        ),
                        $field,
                        $paymentMethodName
                    )
                );
            }
    
            return $fields;
        }

Viewing 1 replies (of 1 total)
  • Plugin Support Femi

    (@femiyb)

    Hello

    Apologies for getting back to you just now! While the community support forum hasn’t been actively maintained recently, you can always count on direct assistance from the dedicated Mollie support team to address any questions or suggestions about the Mollie Payments for WooCommerce plugin.

    That being said, thank you for pointing this out. Your feedback regarding the undefined array keys issue in the Mollie Payments for WooCommerce plugin has been noted. Our development team will look into this to address and resolve the problem. Your contribution is greatly appreciated.

    Regards,
    Femi.

Viewing 1 replies (of 1 total)
  • The topic ‘Undefined array keys’ is closed to new replies.