-
Notifications
You must be signed in to change notification settings - Fork 135
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
Write-up proposal for shipping address fields #6
Comments
I still have some ideas about this. @rsolomakhin would you prefer it as a PR or commentary here? |
@halindrome Let's discuss your ideas here first. |
My Proposal |
@mountielee Please express your proposal in WebIDL format for ease of reading. A few questions:
|
my proposal was referenced by IETF ECML (https://tools.ietf.org/html/rfc4112) example of prefix and suffix are "Mr.", "Mrs.", "Dr.", "님" these are not added by user himself normally. for address format , number of lines and other country cases presentation of shipping address is very culture/country sensitive. |
I'm afraid that splitting the name into multiple fields will be prescriptive to user agent's UI. It's easy to combine multiple input fields into a single string for the API. However, it's difficult to correctly split a single input field into prefix, first name, middle name, last name, and suffix. Therefore, having multiple name parts in the API is likely to force the user agent UI to show multiple input fields for the name. In Chrome we try to avoid presenting multiple input fields for the name. "Mr. James J. Bond Jr." is easier to type in one go than the following multiple steps (1) select Mr. from dropdown, (2) type "James", (3) press Tab, (4) type "J", (5) press Tab, (6) type "Bond", (7) select Jr. from dropdown. |
I tend to agree that multiple input fields for a name is bad UI design. On Thu, Mar 3, 2016 at 12:30 PM, Rouslan Solomakhin <
Shane McCarron |
@halindrome I propose that the merchant use their own heuristics to split this data up. I would prefer to avoid such heuristics in the user agent. |
I am fine with that. On Thu, Mar 3, 2016 at 12:40 PM, Rouslan Solomakhin <
Shane McCarron |
@mountielee + @halindrome One last question. libaddressinput provides the language of the address, which is used for formatting the address. For example, jp-JP address has country on top, but jp-Latn address has country on bottom. Do you think merchants will find the "language" field useful? |
Now I am confused... and I know I can (and will) look at the draft again. But is this data input to the payment request from the merchant, input to the payment method from the user agent, output from one or more of those, or all of the above? If it is data that is being sent from the user agent to the merchant, then sure - the language is something that will be helpful. If it is being sent from the merchant (because they KNOW who you are and you have selected a shipping address on that end) or sent from the user agent to the payment method, then.... I don't think I care very much. It can't hurt to include it. I would ensure it was optional though. On a related note, I know that according to old issue 28 I am on the hook to do WebIDL for the PostalAddress from Schema.org and/or xAL. I am working on that now. |
This. User agents provides the shipping address to the merchant. |
Based on these discussions, here's @mountielee's proposal in WebIDL form. Three questions:
interface ShippingAddress {
readonly DOMString name;
readonly DOMString company;
readonly sequence<DOMString> streetLines;
readonly DOMString dependentLocality;
readonly DOMString city;
readonly DOMString stateProv;
readonly DOMString postalCode;
readonly DOMString sortingCode;
readonly DOMString countryCode;
readonly DOMString phone;
readonly DOMString email;
};
dictionary PaymentOptions {
boolean requestShipping = false;
boolean requestPhone = false;
boolean requestEmail = false;
}; |
as Non-Native English User, On Fri, Mar 4, 2016 at 9:40 AM, Rouslan Solomakhin <notifications@github.com
Mountie Lee PayGate |
language field is useful. I'm sure. do we also need to consider encodings? for example, On Fri, Mar 4, 2016 at 4:16 AM, Rouslan Solomakhin <notifications@github.com
Mountie Lee PayGate |
Everyone on the web is using UTF-8. (If not, they should be.) Let's stick with UTF-8 everywhere. |
Updated based on @mountielee's comments: interface ShippingAddress {
readonly DOMString name;
readonly DOMString company;
readonly sequence<DOMString> streetLines;
readonly DOMString subLocality;
readonly DOMString city;
readonly DOMString stateProvince;
readonly DOMString postalCode;
readonly DOMString sortingCode;
readonly DOMString countryCode;
readonly DOMString phone;
readonly DOMString email;
};
dictionary PaymentOptions {
boolean requestShipping = false;
boolean requestPhone = false;
boolean requestEmail = false;
}; I'm OK with this proposal. @zkoch , do you have any opinions on phone/email here? |
http://www.gmarket.co.kr/ is one of biggest marketplace in Korea subsidiary http://www.rakuten.co.jp/ is one of biggest marketplace in Japan. http://www.taobao.com/ is one of biggest marketplace in China. switching encoding is very sensitive. if we insist to use UTF-8 only, many merchants will lost opportunity using On Sat, Mar 5, 2016 at 2:33 AM, Rouslan Solomakhin <notifications@github.com
Mountie Lee PayGate |
That's a really good point. Are you proposing that the API platform somehow transform the data from the end user's encoding of choice to the merchant's encoding of choice? I mean, I suppose that happens today, but in a very subtle way. The information is stored in the user agent in UTF-8, but the merchant-provided form is in whatever encoding the merchant chose. So when auto-filling a form, a user agent is perforce converting to the merchant's encoding. Such conversion is not typically done in JSON however. The returned data is almost always in UTF-8. It is just sort of expected. Can anyone comment on my supposition that user agents that autofill are just dealing with this today? And if so, how are they doing it? |
I think payment mediator will pass message to payment app ASIS. just add encoding parameter as optional to message WebIDL. regards On Sat, Mar 5, 2016 at 1:09 PM, Shane McCarron notifications@github.com
Mountie Lee PayGate |
And should the default value for encoding be the encoding of the web page the request was made from? Hmm. I can't decide if that violates the "principle of least surprise" or not [1]. On the one hand, if I am a naive web merchant and I have not internationalized my site, my encoding is likely to be something silly. On the other hand, if I am such a merchant I am probably using some sort of off the shelf shopping cart module on my site, and that module is going to expect UTF-8. If we are going to go down this road, my inclination would be to have the default be the encoding of the page from which the request was made, and that the field is always populated in the response to tell the consumer of the returned data the encoding of that data. I would also be open to the default always being "UTF-8". The requestor can override that with an optional parameter. And the response should always indicate the encoding of the response. That way the receiving library can always pick apart the message regardless. Thoughts? [1] https://en.wikipedia.org/wiki/Principle_of_least_astonishment |
I'm thinking
if payment app is domain bounded, encoding will follow service provider's still we are discussing same-origin policy of payment app. one of basic approaches I agree is regards On Sun, Mar 6, 2016 at 1:52 AM, Shane McCarron notifications@github.com
Mountie Lee PayGate |
Reading up on this topic indicates that we do not have to worry about encoding for our API. Speaking JavaScript states that browsers follow the web-page's encoding when loading JavaScript:
This makes sense, because I do not recall any JavaScript APIs that let you customize text encoding. Also please note that payment apps are not specified to deal with shipping addresses. For example, Chrome is likely to provide autofill addresses that it already stores. |
Regards your last point... I think I have to disagree. We have not specified the scope of a payment app, but in particular as the verifiable claims work expands I envision payment apps providing all sorts of information to the merchant via the user agent. Digital coupons, loyalty cards, addresses. Actually, if you think about it, it happens today already. Consider "paypal". On any merchant site I use that accepts paypal, if I click that link it invokes paypal (the payment app) to authorize the transaction. Paypal returns the confirmation and my shipping address to the merchant. We cannot preclude this sort of implementation. The user agent can become the trusted conduit, but we cannot require that it be the only source of any of the information. |
👍 |
@halindrome Good point. Since no such payment apps exist yet, can we require them to use unicode for communication to the user agent? |
Absolutely! UTF-8 only? I don't remember my ISO 10646 all that well. Is On Mon, Mar 7, 2016 at 2:54 PM, Rouslan Solomakhin <notifications@github.com
Shane McCarron |
@adrianba For Windows question.
|
Web IDL is clear on the definition of DOMString. JavaScript strings are treated as UTF-16. Any encoding after that is up to whatever code is doing serialisation. |
I guess Web IDL just makes me sad then :( I think null makes more sense than an empty string. An empty string is an actual value, whereas null indicates "no value". |
Sounds good. |
If we wanted to we could create a method that returns a dictionary instead of an attribute that has an interface but I'm not sure it is a good idea (it would need to be a method to indicate that the dictionary instance would be different every time you call it). The reason I think having an interface is better is because it is possible to detect the presence of attributes in the interface and if we add new things in future you can feature detect if they are supported. I think attributes that can be |
Also note that dictionaries cannot be nullable, so |
@adrianba Can you explain the reasoning for not using a dictionary? I don't really follow what you said above. I understand the value of checking for the presence of attributes as a crude feature detection but isn't this a return object that the website will simply consume and develop logic around for the generation of the payment request? |
Checking for attributes isn't crude feature detection - it's most likely the best type of feature detection. By having an interface in the type system, you can interrogate the presence of attributes at run time. A dictionary returned by a method is indistinguishable from a JavaScript object (in our implementation it is simply a JavaScript object) and you can't infer anything from it. So if we add new attributes in future and I want to be able to tell if my code is running in a browser that supports those new attributes then I need an interface to interrogate. |
My comment wasn't really about whether this method of feature detection is crude or not but more about whether this object is the right one for developers to use for feature detection. What this thread suggests is that developers using the payments API must initiate a payment request and request shipping data collection, then interrogate the shape of the return object that to determine what version of the payments API they are working with. I'm a firm -1 on that.
I agree that feature detection is required but I'm not sure that the shape of this object is the right place to facilitate it. |
Via email @rsolomakhin said:
We need to get some finality on this to allow implementers to start experimenting with the API. As long as they cater for all jurisdictional peculiarities (which seems likely as they are both international standards) I'd recommend we use whatever the browser vendors are most familiar with as this will allow them to leverage the stored addresses they already have to streamline this data collection process. I also assume that the vendors feel comfortable with rendering an appropriate input control for different jurisdicitions and mapping this back to this standardized return format. PROPOSALWe have heard that OASIS xAL based names are already used by one browser vendor so I propose we standardize on these and PR is submitted to the API spec that expresses this format using WebIDL. |
You don't have to generate a request to interrogate the shape of a type - that's actually why it being an interface is necessary. You can't interrogate a dictionary because it is just a JavaScript object.
That's how almost all reliable feature detection is done. |
@adrianhopebailie wrote:
This should not be a problem. If a vendor does not feel comfortable rendering the input contorls, they can use libaddressinput for this purpose. Chrome is using it internally. The Apache 2.0 license should be permissive enough to use any part of libaddressinput in both open and closed source projects. The version that I linked has C++ and Java implementations. There're PHP and Python forks out there as well. |
I don't believe the actual data consumed by libaddressinput has any explicit license (https://groups.google.com/forum/#!msg/libaddressinput-discuss/kvhArVA2KEQ/jnz1qvEyPR8J), or for that matter is available in a public dump, so it's not as permissive as the client library makes out. I would love to see that data released and/or the license position clarified. Anyway, in the interest of moving this along I think I'm content with OASIS. |
That is correct.
Sorry about that.
I will prod the data maintainers to put a proper license on it.
The (unlicensed) data is available for browsing from https://i18napis.appspot.com/address. Chrome loads the same data in bulk from https://i18napis.appspot.com/ssl-aggregate-address/, for example, the California data is in https://i18napis.appspot.com/ssl-aggregate-address/data/US/CA. Keep in mind that i18napis.appspot.com does not have an SLI. Do not rely on it being there all the time or supporting unlimited QPS. |
If there're no further objections, I will submit the OASIS xAL fields names as a pull request to PaymentRequest draft spec (regionCode, administrativeArea, locality, etc). |
Created the pull request #147. I welcome your suggestions for better wording to describe the field names. |
Fixed by #147. Please file PR with any updated descriptions. |
Thanks! I'm sure it'll be appreciated. |
This issue comes from wicg/paymentrequest#28 and is assigned to @rsolomakhin.
The text was updated successfully, but these errors were encountered: