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

Define concepts for converting and validating .data #977

Merged
merged 2 commits into from
Jul 7, 2022
Merged
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
56 changes: 42 additions & 14 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,31 @@ <h2>
method.
</li>
</ul>
<p>
A payment method defines:
</p>
<dl>
<dt>
An optional <dfn data-dfn-for="Payment Method">additional data type</dfn>
</dt>
<dd>
Optionally, an IDL type that the <a>payment method</a> expects
to receive as the {{PaymentMethodData}}'s {{PaymentMethodData/data}}
member. If not specified for a given payment method, no conversion to
IDL is done and the payment method will receive
{{PaymentMethodData/data}} as JSON.
</dd>
<dt>
<dfn>Steps to validate payment method data</dfn>
</dt>
<dd>
Algorithmic steps that specify how a <a>payment method</a> validates
the {{PaymentMethodData/data}} member of the {{PaymentMethodData}},
after it is converted to the payment method's
[=Payment Method/additional data type=]. If not specified for a given
payment method, no validation is done.
</dd>
</dl>
<p>
The details of how to fulfill a payment request for a given <a>payment
method</a> is an implementation detail of a <dfn data-export="">payment
Expand Down Expand Up @@ -573,9 +598,10 @@ <h2>
|paymentMethod|.{{PaymentMethodData/data}} into a string.
Rethrow any exceptions.
</li>
<li>If |serializedData| is not null, and if required by the
specification that defines the
|paymentMethod|.{{PaymentMethodData/supportedMethods}}:
<li>If |serializedData| is not null, and if the specification
that defines the
|paymentMethod|.{{PaymentMethodData/supportedMethods}}
specifies an [=Payment Method/additional data type=]:
<ol>
<li>Let |object| be the result of <a data-cite=
"ECMASCRIPT#sec-json.parse">JSON-parsing</a>
Expand All @@ -585,15 +611,16 @@ <h2>
<p>
Let |idl| be the result of [=converted to an IDL
value|converting=] |object| to an IDL value of the
type specified by the specification that defines the
|paymentMethod|.{{PaymentMethodData/supportedMethods}}.
Rethrow any exceptions.
[=Payment Method/additional data type=]. Rethrow any
exceptions.
</p>
</li>
<li>
<p>
If required by the specification that defines the
|paymentMethod|.{{PaymentMethodData/supportedMethods}},
validate the members of |idl|. If a member's value is
invalid, throw a {{TypeError}}.
Run the <a>steps to validate payment method data</a>,
if any, from the specification that defines the
|paymentMethod|.{{PaymentMethodData/supportedMethods}}
on |object|. Rethrow any exceptions.
</p>
<p class="note">
These step assures that any IDL type conversion and
Expand Down Expand Up @@ -855,10 +882,11 @@ <h2>
"ECMASCRIPT#sec-json.parse">JSON-parsing</a> the second element
in the |paymentMethod| tuple.
</li>
<li>If required by the specification that defines the
|identifier|, then [=converted to an IDL value|convert=] |data|
to an IDL value of the type specified there. Otherwise,
[=converted to an IDL value|convert=] to {{object}}.
<li>If the specification that defines the |identifier| specifies
an [=Payment Method/additional data type=], then [=converted to an
IDL value|convert=] |data| to an IDL value of that type.
Otherwise, [=converted to an IDL value|convert=] |data| to
{{object}}.
</li>
<li>If conversion results in an <a>exception</a> |error|:
<ol>
Expand Down