Issue metadata
Sign in to add a comment
|
PaymentRequest: Format phone number before sending to merchant |
||||||||||||||||||||||||
Issue descriptionThe 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.
,
Dec 13 2016
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.
,
Dec 13 2016
https://developer.android.com/reference/android/telephony/PhoneNumberUtils.html#formatNumber(java.lang.String, java.lang.String) is the function that you need to use.
,
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
,
Dec 15 2016
Let's go with international for now.
,
Dec 16 2016
Can you give some examples about what going with international would mean?
,
Dec 16 2016
I still feel like the answer here is to strip everything except for a + if it exists
,
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
,
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?
,
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.
,
Dec 16 2016
sgtm
,
Dec 16 2016
I opened http://crbug.com/674978 and http://crbug.com/674976 to resolve these issues. Thanks.
,
Jun 27 2017
|
|||||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||||
Comment 1 by se...@chromium.org
, Dec 13 2016