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

Add regionCode attribute to PaymentAddress (1.1) #836

Closed
wants to merge 6 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
162 changes: 142 additions & 20 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,24 @@ <h3>
Changes since last publication
</h3>
<p>
Substantive changes to the Payment Request API since the 9 July 2018
version are as follows. The complete list of changes, including all
editorial changes, is viewable in the <a href=
The complete list of changes, including all editorial changes, are
viewable in the <a href=
"https://github.com/w3c/payment-request/commits/gh-pages">commit
history</a>. Key set of changes are viewable in the <a href=
"#changelog">Changelog</a>.
</p>
<p>
Substantive changes to the Payment Request API since the 16 April
2019 version are as follows.
</p>
<ol>
<li>Again added <a>regionCode</a> to <a>PaymentAddress</a>.
</li>
</ol>
<p>
Substantive changes to the Payment Request API since the 9 July 2018
version are as follows.
</p>
<ul>
<li>Added support for notification when the user selects a payment
handler, but before confirming payment. This allows merchant to
Expand Down Expand Up @@ -2349,6 +2360,7 @@ <h2>
readonly attribute DOMString postalCode;
readonly attribute DOMString recipient;
readonly attribute DOMString region;
readonly attribute DOMString regionCode;
readonly attribute DOMString sortingCode;
readonly attribute FrozenArray&lt;DOMString&gt; addressLine;
};
Expand All @@ -2357,20 +2369,6 @@ <h2>
The {{PaymentAddress}} interface represents a <a>physical
address</a>.
</p>
<aside class="note" title="What happened to regionCode?">
<p>
This specification once included a <code>regionCode</code>
attribute that provided developers with a [[?ISO3166-2]] country
subdivision code element representation of an address' region
(e.g., "CA" for California). Unfortunately, the attribute was
removed due to lack of implementations. The Web Payments Working
Group fully recognizes the importance of the
<code>regionCode</code> attribute and is <a href=
"https://github.com/w3c/payment-request/issues/663">committed to
bringing the attribute back</a> in a future revision of this
specification.
</p>
</aside>
<section>
<h2>
Internal constructor
Expand Down Expand Up @@ -2405,6 +2403,79 @@ <h2>
</li>
</ol>
</li>
<li>If |details|["<a>regionCode</a>"] is present and not the empty
string:
<ol>
<li>Let |regionCode| be the result of <a>strip leading and
trailing ASCII whitespace</a> from
|details|["<a>regionCode</a>"] and then <a data-lt=
"ASCII uppercase">ASCII uppercasing</a> the result.
</li>
<li>Let |putativeCountrySubdivisionCodeElement| be the
concatenation of |address|.<a>[[\country]]</a>, a single U+002D
(-) <a>code point</a>, and |regionCode|.
</li>
<li>
<p>
If |putativeCountrySubdivisionCodeElement| is not a valid
<a>country subdivision code element</a> as per
[[ISO3166-2]]'s section 5.2 "Structure of country
subdivision code elements" (non-normative details below),
throw a <a>RangeError</a> exception.
</p>
<div class="note" title=
"Structure of country subdivision code elements">
<p>
<strong>Do not implement from this note.</strong> The
structure of a <a>country subdivision code element</a> is
formally defined in [[ISO3166-2]] (section 5.2). Although
the structure is not expected to change at the time of
writing, implementers are expected to track updates to
[[ISO3166-2]] directly from ISO.
</p>
<p>
As [[ISO3166-2]] is not freely available to the general
public, the structure of a <a>country subdivision code
element</a> at the time of publication is as follows:
</p>
<ul>
<li>Two <a data-lt="code point">code points</a> that
match an [[ISO3166-1]] alpha-2 country code.
</li>
<li>A single U+002D (-) <a>code point</a>.
</li>
<li>One, two, or three <a>ASCII alphanumeric</a> code
points, in any order.
</li>
</ul>
</div>
</li>
<li>Set |address|.<a>[[\regionCode]]</a> to |regionCode|.
</li>
<li>If |details|["<a>region</a>"] is not present:
<ol>
<li>Let |region| be the corresponding <a>country
subdivision name</a> for |regionCode|. Where [[ISO3166-2]]
defines multiple <a>country subdivision names</a> for a
|regionCode|, it is RECOMMENDED the user agent select one
by matching on:
<ol>
<li>The <a data-cite="HTML#language">language</a> of
<a data-cite="HTML#the-body-element-2">the body
element</a>.
</li>
<li>The user's preferred languages.
</li>
<li>Any other criteria the user agent deems suitable.
</li>
</ol>
</li>
<li>Set |details|["<a>region</a>"] to |region|.
</li>
</ol>
</li>
</ol>
</li>
<li>Let |cleanAddressLines:list| be an empty list.
</li>
<li>If |details|.{{AddressInit/addressLine}} is present, then for
Expand Down Expand Up @@ -2493,6 +2564,17 @@ <h2>
internal slot.
</p>
</section>
<section>
<h2>
<dfn>regionCode</dfn> attribute
</h2>
<p data-link-for="">
Represents the <a>region</a> of the address as a code element of an
[[ISO3166-2]] country subdivision name (e.g., "CA" for California,
USA). When getting, returns the value of the
<a>PaymentAddress</a>'s <a>[[\regionCode]]</a> internal slot.
</p>
</section>
<section>
<h2>
<dfn>city</dfn> attribute
Expand Down Expand Up @@ -2606,6 +2688,19 @@ <h2>
Victoria in Australia.
</td>
</tr>
<tr>
<td>
<dfn>[[\regionCode]]</dfn>
</td>
<td>
The empty string, or one to three code points that represent a
<a>region</a> as the code element of an [[ISO3166-2]] country
subdivision name (i.e., the characters after the hyphen in an
ISO3166-2 <a>country subdivision code element</a>, such as "CA"
for the state of California in the USA, or "11" for the Lisbon
district of Portugal).
</td>
</tr>
<tr>
<td>
<dfn>[[\city]]</dfn>
Expand Down Expand Up @@ -2674,6 +2769,7 @@ <h2>
DOMString country = "";
sequence&lt;DOMString&gt; addressLine = [];
DOMString region = "";
DOMString regionCode = "";
DOMString city = "";
DOMString dependentLocality = "";
DOMString postalCode = "";
Expand Down Expand Up @@ -2707,6 +2803,17 @@ <h2>
<dd>
A <a>region</a>.
</dd>
<dt>
<dfn>regionCode</dfn> member
</dt>
<dd>
The empty string, or one to three code points that represent a
<a>region</a> as the code element of an [[ISO3166-2]] country
subdivision name (i.e., the characters after the hyphen in an
ISO3166-2 <a>country subdivision code element</a>, such as "CA" for
the state of California in the USA, or "11" for the Lisbon district
of Portugal).
</dd>
<dt>
<dfn>city</dfn> member
</dt>
Expand Down Expand Up @@ -2769,6 +2876,7 @@ <h2>
DOMString postalCode;
DOMString recipient;
DOMString region;
DOMString regionCode;
DOMString sortingCode;
};
</pre>
Expand Down Expand Up @@ -2868,6 +2976,16 @@ <h2>
provided the {{PaymentAddress}}'s {{PaymentAddress/region}}
attribute's value.
</dd>
<dt>
<dfn>regionCode</dfn> member
</dt>
<dd>
Denotes that the region code representation of the <a>region</a>
has a validation error. In the user agent's UI, this member
corresponds to the input field that provided the
<a>PaymentAddress</a>'s <a data-link-for=
"PaymentAddress">regionCode</a> attribute's value.
</dd>
<dt>
<dfn>sortingCode</dfn> member
</dt>
Expand Down Expand Up @@ -2981,14 +3099,18 @@ <h2>
address for a particular country, it might not provide a field
for the user to input a <a>region</a>. In such cases, the user
agent returns an empty string for both {{PaymentAddress}}'s
{{PaymentAddress/region}} attribute - but the address can still
serve its intended purpose (e.g., be valid for shipping or
billing purposes).
{{PaymentAddress/region}} and {{PaymentAddress/regionCode}}
attributes - but the address can still serve its intended purpose
(e.g., be valid for shipping or billing purposes).
</p>
<ol>
<li>Set |details|.{{AddressInit/region}} to the user-provided
region.
</li>
<li>If |details|["<a>region</a>"] has a corresponding <a>country
subdivision code element</a>, set |details|["<a>regionCode</a>"]
to that <a>country subdivision code element</a>.
</li>
</ol>
</li>
<li>If "sortingCode" is not in |redactList|, set
Expand Down