New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 673777 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 674976
Owner:
Closed: Dec 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

PaymentRequest: Format phone number before sending to merchant

Project Member Reported by se...@chromium.org, Dec 13 2016

Issue description

The phone numbers are currently send the way they are saved on our side:
1(555) 555-5555
15555555555
1-555-555-5555

We should always send them to the merchant in the same format.
 

Comment 1 by se...@chromium.org, Dec 13 2016

Cc: rouslan@chromium.org zkoch@chromium.org
We could use libphonenumber to format the phone numbers correcty?

https://cs.chromium.org/chromium/src/third_party/libphonenumber/dist/cpp/src/phonenumbers/phonenumberutil.h?l=286
You can also use the built-in Android phone number formatter, which saves you from having to write JNI glue.

https://cs.chromium.org/chromium/src/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/EditorView.java?rcl=0&l=138

Beware that instantiating the formatter reads data from disk, so it should not be done in UI thread.

Comment 4 by se...@chromium.org, Dec 15 2016

After investigation, the built in Android formatted will not work because it does not give consistent results depending on OS version.

LibPhoneNumber could be used instead.

There is one big question to address in this case, how do we choose whether to format the number in it's national or international version. See examples here
https://cs.chromium.org/chromium/src/third_party/libphonenumber/dist/resources/phonenumber.proto?q=phonenumber.proto&sq=package:chromium&dr&l=106
Let's go with international for now.

Comment 6 by zkoch@chromium.org, Dec 16 2016

Can you give some examples about what going with international would mean?

Comment 7 by zkoch@chromium.org, Dec 16 2016

I still feel like the answer here is to strip everything except for a + if it exists

Comment 8 by se...@chromium.org, Dec 16 2016

Here are some examples:

Google MTV, +1 650-253-0000
Google Paris, +33 (0)1 42 68 53 00
Google Beijing, +86-10-62503000

Comment 9 by zkoch@chromium.org, Dec 16 2016

What's the benefit of formatting the phone number for a machine? We format for users. For machines, shouldn't we optimize for consistency?

Comment 10 by se...@chromium.org, Dec 16 2016

I tend to agree with you.

My only concern is that it would be possible to send an "incomplete" phone number. As we check only very simply if the phone number is "valid". We use the Android PhoneNumberUtils' IsGlobalPhoneNumber which has a very loose sense of validity. For example, "55" is a valid phone number.

Here is what I propose:

1- Return Raw number (just numbers, maybe keep the "+")
2- Be more strict when deciding if a phone number is valid.

Comment 11 by zkoch@chromium.org, Dec 16 2016

sgtm

Comment 12 by se...@chromium.org, Dec 16 2016

Mergedinto: 674976
Status: Duplicate (was: Started)
I opened http://crbug.com/674978 and http://crbug.com/674976 to resolve these issues. Thanks.
Components: -UI>Browser>Autofill>Payments UI>Browser>Payments

Sign in to add a comment