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 MerchantValidationEvent.prototype.methodName #776

Merged
merged 3 commits into from
Sep 13, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
66 changes: 49 additions & 17 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3819,10 +3819,21 @@ <h2>
[Constructor(DOMString type, optional MerchantValidationEventInit eventInitDict),
SecureContext, Exposed=Window]
interface MerchantValidationEvent : Event {
readonly attribute DOMString methodName;
readonly attribute USVString validationURL;
void complete(Promise&lt;any&gt; merchantSessionPromise);
};
</pre>
<section>
<h2>
<dfn>methodName</dfn> attribute
</h2>
<p data-link-for="MerchantValidationEventInit">
When getting, returns the value it was initialized with. See
<a>methodName</a> member of <a>MerchantValidationEventInit</a> for
more information.
</p>
</section>
<section>
<h3>
<dfn data-lt=
Expand All @@ -3842,14 +3853,10 @@ <h3>
settings object</a>’s <a data-cite=
"!html/multipage/webappapis.html#api-base-url">API base URL</a>.
</li>
<li>Let <var>input</var> be the empty string.
</li>
<li>If <var>eventInitDict</var> was passed, set <var>input</var> to
the value of <var>eventInitDict</var>["<a>validationURL</a>"].
</li>
<li data-link-for="MerchantValidationEventInit">Let
<var>validationURL</var> be the result of <a data-cite=
"!url#concept-url-parser">URL parsing</a> <var>input</var> and
"!url#concept-url-parser">URL parsing</a>
<var>eventInitDict</var>["<a>validationURL</a>"] and
<var>base</var>.
</li>
<li>If <var>validationURL</var> is failure, throw a
Expand All @@ -3858,6 +3865,17 @@ <h3>
<li>Initialize <var>event</var>.<a>validationURL</a> attribute to
<var>validationURL</var>.
</li>
<li>If <var>eventInitDict</var>["<a>methodName</a>"] is not the
empty string, run the steps to <a data-cite=
"payment-method-id#dfn-validate-a-payment-method-identifier">validate
a payment method identifier</a> with
<var>eventInitDict</var>["<a>methodName</a>"]. If it returns false,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm always unsure how much validation we should be doing in event constructors, i.e. should they be dumb property bags that hold whatever you pass in, or should they enforce domain logic constraints. But this is good for now, and consistent.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, thought about the same. Consistency allows us to treat both implementers and user-land code as potentially invalid, which I think is a good thing.

then throw a <a>RangeError</a> exception. Optionally, inform the
developer that the payment method identifier is invalid.
</li>
<li>Initialize <var>event</var>.<a>methodName</a> attribute to
<var>eventInitDict</var>["<a>methodName</a>"].
</li>
<li>Initialize <var>event</var>.<a data-lt=
"mechvalidation.waitForUpdate">[[\waitForUpdate]]</a> to false.
</li>
Expand Down Expand Up @@ -3956,18 +3974,26 @@ <h3>
</h3>
<pre class="idl">
dictionary MerchantValidationEventInit : EventInit {
DOMString methodName = "";
USVString validationURL = "";
};
</pre>
<section>
<h4>
<dl>
<dt>
<dfn>methodName</dfn> member
</dt>
<dd>
A <a>payment method identifier</a> representing the <a>payment
handler</a> that is requiring <a>merchant validation</a>.
</dd>
<dt>
<dfn>validationURL</dfn> member
</h4>
<p>
</dt>
<dd>
A URL from which a developer would fetch <a>payment
handler</a>-specific verification data.
</p>
</section>
</dd>
</dl>
</section>
</section>
<section data-dfn-for="PaymentMethodChangeEvent" data-link-for=
Expand Down Expand Up @@ -4018,7 +4044,7 @@ <h3>
<dfn>methodName</dfn> member
</dt>
<dd>
A DOMString representing the <a>payment method identifier</a>.
A string representing the <a>payment method identifier</a>.
</dd>
<dt>
<dfn>methodDetails</dfn> member
Expand Down Expand Up @@ -4253,10 +4279,14 @@ <h2>
developer can fetch <a>payment handler</a>-specific verification
data.
</li>
<li>Let <var>methodName</var> be the <a>payment method identifier</a>
for the <a>payment handler</a> that is requiring <a>merchant
validation</a>.
</li>
<li>
<a>Queue a task</a> on the <a>user interaction task source</a> to
run the following steps:
<ol>
<ol data-link-for="MerchantValidationEventInit">
<li>Assert: <var>request</var>.<a>[[\updating]]</a> is false.
</li>
<li>Assert: <var>request</var>.<a>[[\state]]</a> is
Expand All @@ -4265,9 +4295,11 @@ <h2>
<li>Let <var>eventInitDict</var> be an new
<a>MerchantValidationEventInit</a> dictionary.
</li>
<li data-link-for="MerchantValidationEventInit">Set
<var>eventInitDict</var>["<a>validationURL</a>"] to
<var>validationURL</var>.
<li>Set <var>eventInitDict</var>["<a>validationURL</a>"] to <var>
validationURL</var>.
</li>
<li>Set <var>eventInitDict</var>["<a>methodName</a>"] to
<var>methodName</var>.
</li>
<li>Let <var>event</var> be the result of <a data-cite=
"dom#concept-event-constructor">constructing</a> a
Expand Down