Skip to content

Commit 634a8a8

Browse files
teach retry() about payerErrors (#721)
1 parent 1b92607 commit 634a8a8

File tree

1 file changed

+94
-4
lines changed

1 file changed

+94
-4
lines changed

index.html

Lines changed: 94 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3165,7 +3165,7 @@

31653165
readonly attribute DOMString? payerPhone;
31663166

31673167
Promise<void> complete(optional PaymentComplete result = "unknown");
3168-
Promise<void> retry();
3168+
Promise<void> retry(PaymentValidationErrors errorFields);
31693169
};
31703170
pre>
31713171
<p class="note">
@@ -3177,7 +3177,8 @@

31773177
<dfn>retry()dfn> method
31783178
h2>
31793179
<p data-tests="payment-response/retry-method-manual.https.html">
3180-
The <a>retry()a> method MUST act as follows:
3180+
The <code>retry(<var>errorFieldsvar>)code> method MUST act as
3181+
follows:
31813182
p>
31823183
<ol class="algorithm">
31833184
<li>Let <var>responsevar> be the <a>context objecta>.
@@ -3210,8 +3211,12 @@

32103211
<li>Set <var>responsevar>.<a>[[\retryPromise]]a> to
32113212
<var>retryPromisevar>.
32123213
li>
3213-
<li>In the payments UI, indicate to the end-user that something is
3214-
wrong with the user-provided data of the payment response.
3214+
<li>By matching the members of <var>errorFieldsvar> to input fields
3215+
in the user agent's UI, indicate to the end-user that something is
3216+
wrong with the data of the payment response. For example, a user
3217+
agent might draw the user's attention to the erroneous
3218+
<var>errorFieldsvar> in the browser's UI and display the value of
3219+
each field in a manner that helps the user fix each error.
32153220
li>
32163221
<li data-tests=
32173222
"payment-request/payment-response/rejects_if_not_active-manual.https.html">
@@ -3241,6 +3246,91 @@

32413246
p>
32423247
li>
32433248
ol>
3249+
<section data-dfn-for="PaymentValidationErrors" data-link-for=
3250+
"PaymentValidationErrors">
3251+
<h3>
3252+
<dfn>PaymentValidationErrorsdfn> dictionary
3253+
h3>
3254+
<pre class="idl">
3255+
dictionary PaymentValidationErrors {
3256+
PayerErrorFields payerErrors;
3257+
AddressErrorFields shippingAddressErrors;
3258+
};
3259+
pre>
3260+
<dl>
3261+
<dt>
3262+
<dfn>payerErrorsdfn> member
3263+
dt>
3264+
<dd>
3265+
Validation errors related to the <a>payer detailsa>.
3266+
dd>
3267+
<dt>
3268+
<dfn>shippingAddressErrorsdfn> member
3269+
dt>
3270+
<dd data-link-for="PaymentResponse">
3271+
Represents validation errors with the <a>PaymentResponsea>'s
3272+
<a>shippingAddressa>.
3273+
dd>
3274+
dl>
3275+
section>
3276+
<section data-dfn-for="PayerErrorFields" data-link-for=
3277+
"PayerErrorFields">
3278+
<h3>
3279+
<dfn>PayerErrorFieldsdfn> dictionary
3280+
h3>
3281+
<pre class="idl">
3282+
dictionary PayerErrorFields {
3283+
DOMString payerEmailError;
3284+
DOMString payerNameError;
3285+
DOMString payerPhoneError;
3286+
};
3287+
pre>
3288+
<p>
3289+
The <a>PayerErrorFieldsa> is used to represent validation errors
3290+
with one or more <a>payer detailsa>.
3291+
p>
3292+
<p>
3293+
<dfn>Payer detailsdfn> are any of the payer's name, payer's phone
3294+
number, and payer's email.
3295+
p>
3296+
<dl data-link-for="PaymentResponse">
3297+
<dt>
3298+
<dfn>payerEmailErrordfn> member
3299+
dt>
3300+
<dd>
3301+
Denotes that the payer's email suffers from a validation error.
3302+
In the user agent's UI, this member corresponds to the input
3303+
field that provided the <a>PaymentResponsea>'s
3304+
<a>payerEmaila> attribute's value.
3305+
dd>
3306+
<dt>
3307+
<dfn>payerNameErrordfn> member
3308+
dt>
3309+
<dd>
3310+
Denotes that the payer's name suffers from a validation error. In
3311+
the user agent's UI, this member corresponds to the input field
3312+
that provided the <a>PaymentResponsea>'s <a>payerNamea>
3313+
attribute's value.
3314+
dd>
3315+
<dt>
3316+
<dfn>payerPhoneErrordfn> member
3317+
dt>
3318+
<dd>
3319+
Denotes that the payer's phone number suffers from a validation
3320+
error. In the user agent's UI, this member corresponds to the
3321+
input field that provided the <a>PaymentResponsea>'s
3322+
<a>payerPhonea> attribute's value.
3323+
dd>
3324+
dl>
3325+
<pre class="example js" title="Payer-related validation errors">
3326+
const payerErrors = {
3327+
payerEmailError: "The domain is invalid.",
3328+
payerPhoneError: "Unknown country code.",
3329+
payerNameError: "Not in database",
3330+
};
3331+
await response.retry({ payerErrors });
3332+
pre>
3333+
section>
32443334
section>
32453335
<section>
32463336
<h2>

0 commit comments

Comments
 (0)