Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict with International Phone Number Format plugin on international phone number validation #2190

Open
HLFH opened this issue Apr 30, 2024 · 0 comments
Labels
enhancement New feature or request third-party Issues relating to third-party plugins

Comments

@HLFH
Copy link

HLFH commented Apr 30, 2024

Describe the Bug

There is a conflict with International Phone Number Format plugin on international phone number validation and your extension.
You should adapt your validation code in order to support E.164 international phone number format.

To Reproduce

  1. Install extension: https://fr.wordpress.org/plugins/international-phone-number-format/
  2. Go at the PayPal plugin in modules/ppcp-api-client/src/Factory/PayerFactory.php
  3. You should adapt the code to support international numbers that contain the "+" sign.
        public function from_wc_order( \WC_Order $wc_order ): Payer {
                $payer_id  = '';
                $birthdate = null;

                $phone = null;
                if ( $wc_order->get_billing_phone() ) {
                        // make sure the phone number contains only numbers and is max 14. chars long.
                        $national_number = $wc_order->get_billing_phone();
                        $national_number = preg_replace( '/[^0-9]/', '', $national_number );
                        $national_number = substr( $national_number, 0, 14 );

                        if ( $national_number ) {
                                $phone = new PhoneWithType(
                                        'HOME',
                                        new Phone( $national_number )
                                );
                        }
                }

PayPal orders may not go through because of this conflict.
It is better to have support for E.164 standard to have reliable SMS notifications for shipping.

Expected Behavior

Support E.164 and PayPal orders would go through.

Actual Behavior

PayPal orders are not going through because of incomplete billing phone validation.

Environment

  • WordPress Version: latest
  • WooCommerce Version: latest
  • Plugin Version: latest
  • Browser [e.g. Chrome, Safari] and Version: Chrome, Safari, all latest
  • Any other plugins installed: many including International Phone Number Format plugin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request third-party Issues relating to third-party plugins
Projects
None yet
Development

No branches or pull requests

2 participants