Skip to content

Commit 8c45522

Browse files
Define concepts for converting and validating .data (#977)
This makes it easier for other specifications to clearly indicate their defined steps to convert and validate the data member.
1 parent 5337037 commit 8c45522

File tree

1 file changed

+42
-14
lines changed

1 file changed

+42
-14
lines changed

index.html

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,31 @@

148148
method.
149149
li>
150150
ul>
151+
<p>
152+
A payment method defines:
153+
p>
154+
<dl>
155+
<dt>
156+
An optional <dfn data-dfn-for="Payment Method">additional data typedfn>
157+
dt>
158+
<dd>
159+
Optionally, an IDL type that the <a>payment methoda> expects
160+
to receive as the {{PaymentMethodData}}'s {{PaymentMethodData/data}}
161+
member. If not specified for a given payment method, no conversion to
162+
IDL is done and the payment method will receive
163+
{{PaymentMethodData/data}} as JSON.
164+
dd>
165+
<dt>
166+
<dfn>Steps to validate payment method datadfn>
167+
dt>
168+
<dd>
169+
Algorithmic steps that specify how a <a>payment methoda> validates
170+
the {{PaymentMethodData/data}} member of the {{PaymentMethodData}},
171+
after it is converted to the payment method's
172+
[=Payment Method/additional data type=]. If not specified for a given
173+
payment method, no validation is done.
174+
dd>
175+
dl>
151176
<p>
152177
The details of how to fulfill a payment request for a given <a>payment
153178
methoda> is an implementation detail of a <dfn data-export="">payment
@@ -573,9 +598,10 @@

573598
|paymentMethod|.{{PaymentMethodData/data}} into a string.
574599
Rethrow any exceptions.
575600
li>
576-
<li>If |serializedData| is not null, and if required by the
577-
specification that defines the
578-
|paymentMethod|.{{PaymentMethodData/supportedMethods}}:
601+
<li>If |serializedData| is not null, and if the specification
602+
that defines the
603+
|paymentMethod|.{{PaymentMethodData/supportedMethods}}
604+
specifies an [=Payment Method/additional data type=]:
579605
<ol>
580606
<li>Let |object| be the result of <a data-cite=
581607
"ECMASCRIPT#sec-json.parse">JSON-parsinga>
@@ -585,15 +611,16 @@

585611
<p>
586612
Let |idl| be the result of [=converted to an IDL
587613
value|converting=] |object| to an IDL value of the
588-
type specified by the specification that defines the
589-
|paymentMethod|.{{PaymentMethodData/supportedMethods}}.
590-
Rethrow any exceptions.
614+
[=Payment Method/additional data type=]. Rethrow any
615+
exceptions.
591616
p>
617+
li>
618+
<li>
592619
<p>
593-
If required by the specification that defines the
594-
|paymentMethod|.{{PaymentMethodData/supportedMethods}},
595-
validate the members of |idl|. If a member's value is
596-
invalid, throw a {{TypeError}}.
620+
Run the <a>steps to validate payment method dataa>,
621+
if any, from the specification that defines the
622+
|paymentMethod|.{{PaymentMethodData/supportedMethods}}
623+
on |object|. Rethrow any exceptions.
597624
p>
598625
<p class="note">
599626
These step assures that any IDL type conversion and
@@ -855,10 +882,11 @@

855882
"ECMASCRIPT#sec-json.parse">JSON-parsinga> the second element
856883
in the |paymentMethod| tuple.
857884
li>
858-
<li>If required by the specification that defines the
859-
|identifier|, then [=converted to an IDL value|convert=] |data|
860-
to an IDL value of the type specified there. Otherwise,
861-
[=converted to an IDL value|convert=] to {{object}}.
885+
<li>If the specification that defines the |identifier| specifies
886+
an [=Payment Method/additional data type=], then [=converted to an
887+
IDL value|convert=] |data| to an IDL value of that type.
888+
Otherwise, [=converted to an IDL value|convert=] |data| to
889+
{{object}}.
862890
li>
863891
<li>If conversion results in an <a>exceptiona> |error|:
864892
<ol>

0 commit comments

Comments
 (0)