Skip to content

Commit f0018f9

Browse files
add PaymentAddress.regionCode attribute (#690)
1 parent 1ace2a5 commit f0018f9

File tree

1 file changed

+138
-7
lines changed

1 file changed

+138
-7
lines changed

index.html

Lines changed: 138 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2148,6 +2148,7 @@ <h2>
21482148
readonly attribute DOMString postalCode;
21492149
readonly attribute DOMString recipient;
21502150
readonly attribute DOMString region;
2151+
readonly attribute DOMString regionCode;
21512152
readonly attribute DOMString sortingCode;
21522153
readonly attribute FrozenArray&lt;DOMString&gt; addressLine;
21532154
};
@@ -2184,7 +2185,8 @@ <h2>
21842185
<li>If <var>details</var> was not passed, return
21852186
<var>address</var>.
21862187
</li>
2187-
<li>If <var>details</var>["<a>country</a>"] is present:
2188+
<li>If <var>details</var>["<a>country</a>"] is present and not the
2189+
empty string:
21882190
<ol>
21892191
<li>Set <var>country</var> the result of <a>strip leading and
21902192
trailing ASCII whitespace</a> from
@@ -2199,6 +2201,83 @@ <h2>
21992201
</li>
22002202
</ol>
22012203
</li>
2204+
<li>If <var>details</var>["<a>regionCode</a>"] is present and not
2205+
the empty string:
2206+
<ol>
2207+
<li>Let <var>regionCode</var> be the result of <a>strip leading
2208+
and trailing ASCII whitespace</a> from
2209+
<var>details</var>["<a>regionCode</a>"] and then
2210+
<a data-cite="!INFRA#ascii-uppercase">ASCII uppercasing</a>
2211+
the result.
2212+
</li>
2213+
<li>Let <var>putativeCountrySubdivisionCodeElement</var> be the
2214+
concatenation of <var>address</var>.<a>[[\country]]</a>, a
2215+
single U+002D (-) <a>code point</a>, and <var>regionCode</var>.
2216+
</li>
2217+
<li>
2218+
<p>
2219+
If <var>putativeCountrySubdivisionCodeElement</var> is not
2220+
a valid <a>country subdivision code element</a> as per
2221+
[[!ISO3166-2]]'s section 5.2 "Structure of country
2222+
subdivision code elements" (non-normative details below),
2223+
throw a <a>RangeError</a> exception.
2224+
</p>
2225+
<div class="note" title=
2226+
"Structure of country subdivision code elements">
2227+
<p>
2228+
<strong>Do not implement from this note.</strong> The
2229+
structure of a <a>country subdivision code element</a> is
2230+
formally defined in [[!ISO3166-2]] (section 5.2).
2231+
Although the structure is not expected to change at the
2232+
time of writing, implementers are expected to track
2233+
updates to [[!ISO3166-2]] directly from ISO.
2234+
</p>
2235+
<p>
2236+
As [[!ISO3166-2]] is not freely available to the general
2237+
public, the structure of a <a>country subdivision code
2238+
element</a> at the time of publication is as follows:
2239+
</p>
2240+
<ul>
2241+
<li>Two <a>code points</a> that match an [[!ISO3166-1]]
2242+
alpha-2 country code.
2243+
</li>
2244+
<li>A single U+002D (-) <a>code point</a>.
2245+
</li>
2246+
<li>One, two, or three <a data-cite=
2247+
"INFRA#ascii-alphanumeric">ASCII alphanumeric</a> code
2248+
points, in any order.
2249+
</li>
2250+
</ul>
2251+
</div>
2252+
</li>
2253+
<li>Set <var>address</var>.<a>[[\regionCode]]</a> to
2254+
<var>regionCode</var>.
2255+
</li>
2256+
<li>If <var>details</var>["<a>region</a>"] is not present:
2257+
<ol>
2258+
<li>Let <var>region</var> be the corresponding <a>country
2259+
subdivision name</a> for <var>regionCode</var>. Where
2260+
[[!ISO3166-2]] defines multiple <a>country subdivision
2261+
names</a> for a <var>regionCode</var>, it is RECOMMENDED
2262+
the user agent select one by matching on:
2263+
<ol>
2264+
<li>The <a data-cite="!HTML#language">language</a> of
2265+
<a data-cite="HTML#the-body-element-2">the body
2266+
element</a>.
2267+
</li>
2268+
<li>The user's preferred languages.
2269+
</li>
2270+
<li>Any other criteria the user agent deems suitable.
2271+
</li>
2272+
</ol>
2273+
</li>
2274+
<li>Set <var>details</var>["<a>region</a>"] to
2275+
<var>region</var>.
2276+
</li>
2277+
</ol>
2278+
</li>
2279+
</ol>
2280+
</li>
22022281
<li>If <var>details</var>["<a>languageCode</a>"] is present:
22032282
<ol>
22042283
<li>If <a data-cite=
@@ -2316,6 +2395,17 @@ <h2>
23162395
internal slot.
23172396
</p>
23182397
</section>
2398+
<section>
2399+
<h2>
2400+
<dfn>regionCode</dfn> attribute
2401+
</h2>
2402+
<p data-link-for="">
2403+
Represents the <a>region</a> of the address as a code element of an
2404+
[[!ISO3166-2]] country subdivision name (e.g., "CA" for California,
2405+
USA). When getting, returns the value of the
2406+
<a>PaymentAddress</a>'s <a>[[\regionCode]]</a> internal slot.
2407+
</p>
2408+
</section>
23192409
<section>
23202410
<h2>
23212411
<dfn>city</dfn> attribute
@@ -2434,9 +2524,22 @@ <h2>
24342524
<dfn>[[\region]]</dfn>
24352525
</td>
24362526
<td>
2437-
A <a>region</a> as a country subdivision name or the empty
2438-
string, such as "Victoria", representing the state of Victoria
2439-
in Australia.
2527+
A <a>region</a> as a <a>country subdivision name</a> or the
2528+
empty string, such as "Victoria", representing the state of
2529+
Victoria in Australia.
2530+
</td>
2531+
</tr>
2532+
<tr>
2533+
<td>
2534+
<dfn>[[\regionCode]]</dfn>
2535+
</td>
2536+
<td>
2537+
The empty string, or one to three code points that represent a
2538+
<a>region</a> as the code element of an [[!ISO3166-2]] country
2539+
subdivision name (i.e., the characters after the hyphen in an
2540+
ISO3166-2 <a>country subdivision code element</a>, such as "CA"
2541+
for the state of California in the USA, or "11" for the Lisbon
2542+
district of Portugal).
24402543
</td>
24412544
</tr>
24422545
<tr>
@@ -2516,6 +2619,7 @@ <h2>
25162619
DOMString country;
25172620
sequence&lt;DOMString&gt; addressLine;
25182621
DOMString region;
2622+
DOMString regionCode;
25192623
DOMString city;
25202624
DOMString dependentLocality;
25212625
DOMString postalCode;
@@ -2550,6 +2654,17 @@ <h2>
25502654
<dd>
25512655
A <a>region</a>.
25522656
</dd>
2657+
<dt>
2658+
<dfn>regionCode</dfn> member
2659+
</dt>
2660+
<dd>
2661+
The empty string, or one to three code points that represent a
2662+
<a>region</a> as the code element of an [[!ISO3166-2]] country
2663+
subdivision name (i.e., the characters after the hyphen in an
2664+
ISO3166-2 <a>country subdivision code element</a>, such as "CA" for
2665+
the state of California in the USA, or "11" for the Lisbon district
2666+
of Portugal).
2667+
</dd>
25532668
<dt>
25542669
<dfn>city</dfn> member
25552670
</dt>
@@ -2684,9 +2799,17 @@ <h2>
26842799
<var>details</var>["<a>recipient</a>"] to the user-provided recipient
26852800
of the transaction, or to the empty string if none was provided.
26862801
</li>
2687-
<li>If "region" is not in <var>redactList</var>, set
2688-
<var>details</var>["<a>region</a>"] to the user-provided region, or
2689-
to the empty string if none was provided.
2802+
<li>If "region" is not in <var>redactList</var>:
2803+
<ol>
2804+
<li>Set <var>details</var>["<a>region</a>"] to the user-provided
2805+
region, or to the empty string if none was provided.
2806+
</li>
2807+
<li>If <var>details</var>["<a>region</a>"] has a corresponding
2808+
<a>country subdivision code element</a>, set
2809+
<var>details</var>["<a>regionCode</a>"] to that <a>country
2810+
subdivision code element</a>.
2811+
</li>
2812+
</ol>
26902813
</li>
26912814
<li>If "sortingCode" is not in <var>redactList</var>, set
26922815
<var>details</var>["<a>sortingCode</a>"] to the user-provided sorting
@@ -3923,6 +4046,14 @@ <h2>
39234046
This specification relies on several other underlying specifications.
39244047
</p>
39254048
<dl data-sort="">
4049+
<dt>
4050+
ISO 3366-2
4051+
</dt>
4052+
<dd>
4053+
<dfn data-lt="country subdivision names">Country subdivision
4054+
name</dfn> and <dfn>country subdivision code element</dfn> are
4055+
defined in [[!ISO3166-2]].
4056+
</dd>
39264057
<dt>
39274058
Infra
39284059
</dt>

0 commit comments

Comments
 (0)