666
666
< var > paymentMethod</ var > .< a data-lt =
667
667
"PaymentMethodData.supportedMethods "> supportedMethods</ a > .
668
668
If it returns false, then throw a < a > RangeError</ a >
669
- exception and terminate this algorithm. Optionally, inform
670
- the developer that the payment method identifier is
671
- invalid.
669
+ exception. Optionally, inform the developer that the
670
+ payment method identifier is invalid.
672
671
</ li >
673
672
< li > If the < a data-lt ="PaymentMethodData.data "> data</ a >
674
673
member of < var > paymentMethod</ var > is missing, let
842
841
< li > Set < var > request</ var > .< a > [[\serializedMethodData]]</ a > to < var >
843
842
serializedMethodData</ var > .
844
843
</ li >
844
+ < li > Set < var > request</ var > .< a > [[\response]]</ a > to null.
845
+ </ li >
845
846
< li > Set the value of < var > request</ var > 's < a data-lt =
846
847
"PaymentRequest.shippingOption "> shippingOption</ a > attribute to < var >
847
848
selectedShippingOption</ var > .
900
901
< ol class ="algorithm ">
901
902
< li data-tests =
902
903
"payment-request-show-method-manual.https.html, show-method-postmessage-manual.https.html ">
903
- If the method was not < a > triggered by user activation</ a > , return a
904
- promise rejected with a "< a > SecurityError</ a > " < a > DOMException </ a >
905
- and terminate this algorithm .
904
+ If the method was not < a > triggered by user activation</ a > , return < a >
905
+ a promise rejected with</ a > with a "< a > SecurityError</ a > "
906
+ < a > DOMException </ a > .
906
907
</ li >
907
908
< li > Let < var > request</ var > be the < a > context object</ a > .
908
909
</ li >
@@ -1120,10 +1121,14 @@ <h2>
1120
1121
< ol class ="algorithm ">
1121
1122
< li > Let < var > request</ var > be the < a > context object</ a > .
1122
1123
</ li >
1124
+ < li > If < var > request</ var > .< a > [[\response]]</ a > is not null, and < var >
1125
+ request</ var > .< a > [[\response]]</ a > .< a > [[\retryPromise]]</ a > is not
1126
+ null, return < a > a promise rejected with</ a > an
1127
+ "< a > InvalidStateError</ a > " < a > DOMException</ a > .
1128
+ </ li >
1123
1129
< li > If the value of < var > request</ var > .< a > [[\state]]</ a > is not
1124
- "< a > interactive</ a > " then return a promise rejected with a
1125
- "< a > InvalidStateError</ a > " < a > DOMException</ a > and terminate this
1126
- algorithm.
1130
+ "< a > interactive</ a > " then return < a > a promise rejected with</ a > an
1131
+ "< a > InvalidStateError</ a > " < a > DOMException</ a > .
1127
1132
</ li >
1128
1133
< li > Let < var > promise</ var > be < a > a new promise</ a > .
1129
1134
</ li >
@@ -1180,8 +1185,9 @@ <h2>
1180
1185
then return < a > a promise rejected with</ a > an
1181
1186
"< a > InvalidStateError</ a > " < a > DOMException</ a > .
1182
1187
</ li >
1183
- < li > Optionally, at the < a > user agent</ a > 's discretion, return a
1184
- promise rejected with a "< a > NotAllowedError</ a > " < a > DOMException</ a > .
1188
+ < li > Optionally, at the < a > user agent</ a > 's discretion, return < a > a
1189
+ promise rejected with</ a > a "< a > NotAllowedError</ a > "
1190
+ < a > DOMException</ a > .
1185
1191
< p class ="note " data-link-for ="PaymentRequest ">
1186
1192
This allows user agents to apply heuristics to detect and prevent
1187
1193
abuse of the < a > canMakePayment()</ a > method for fingerprinting
@@ -1443,6 +1449,15 @@ <h2>
1443
1449
accepts the payment request.
1444
1450
</ td >
1445
1451
</ tr >
1452
+ < tr >
1453
+ < td >
1454
+ < dfn > [[\response]]</ dfn >
1455
+ </ td >
1456
+ < td >
1457
+ Null, or the < a > PaymentResponse</ a > instantiated by this
1458
+ < a > PaymentRequest</ a > .
1459
+ </ td >
1460
+ </ tr >
1446
1461
</ table >
1447
1462
</ section >
1448
1463
</ section >
@@ -3150,12 +3165,83 @@ <h2>
3150
3165
readonly attribute DOMString? payerPhone;
3151
3166
3152
3167
Promise<void> complete(optional PaymentComplete result = "unknown");
3168
+ Promise<void> retry();
3153
3169
};
3154
3170
</ pre >
3155
3171
< p class ="note ">
3156
3172
A < a > PaymentResponse</ a > is returned when a user has selected a payment
3157
3173
method and approved a payment request.
3158
3174
</ p >
3175
+ < section >
3176
+ < h2 >
3177
+ < dfn > retry()</ dfn > method
3178
+ </ h2 >
3179
+ < p data-tests ="payment-response/retry-method-manual.https.html ">
3180
+ The < a > retry()</ a > method MUST act as follows:
3181
+ </ p >
3182
+ < ol class ="algorithm ">
3183
+ < li > Let < var > response</ var > be the < a > context object</ a > .
3184
+ </ li >
3185
+ < li > Let < var > request</ var > be
3186
+ < var > response</ var > .< a > [[\request]]</ a > .
3187
+ </ li >
3188
+ < li > Let < var > document</ var > be < var > request</ var > 's < a data-cite =
3189
+ "!HTML#concept-relevant-global "> relevant global object</ a > 's
3190
+ < a data-cite ="!HTML#concept-document-window "> associated Document</ a > .
3191
+ </ li >
3192
+ < li data-tests =
3193
+ "payment-response/rejects_if_not_active-manual.https.html "> If
3194
+ < var > document</ var > is not < a data-cite ="!HTML#fully-active "> fully
3195
+ active</ a > , then return < a > a promise rejected with</ a > an
3196
+ "< a > AbortError</ a > " < a > DOMException</ a > .
3197
+ </ li >
3198
+ < li > If < var > response</ var > .< a > [[\complete]]</ a > is true, return < a > a
3199
+ promise rejected with</ a > an "< a > InvalidStateError</ a > "
3200
+ < a > DOMException</ a > .
3201
+ </ li >
3202
+ < li > If < var > response</ var > .< a > [[\retryPromise]]</ a > is not null,
3203
+ return < a > a promise rejected with</ a > an "< a > InvalidStateError</ a > "
3204
+ < a > DOMException</ a > .
3205
+ </ li >
3206
+ < li > Set < var > request</ var > .< a > [[\state]]</ a > to "< a > interactive</ a > ".
3207
+ </ li >
3208
+ < li > Let < var > retryPromise</ var > be < a > a new promise</ a > .
3209
+ </ li >
3210
+ < li > Set < var > response</ var > .< a > [[\retryPromise]]</ a > to
3211
+ < var > retryPromise</ var > .
3212
+ </ 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.
3215
+ </ li >
3216
+ < li data-tests =
3217
+ "payment-request/payment-response/rejects_if_not_active-manual.https.html ">
3218
+ If < var > document</ var > stops being < a data-cite ="!HTML#fully-active ">
3219
+ fully active</ a > while the user interface is being shown, or no
3220
+ longer is by the time this step is reached, then:
3221
+ < ol >
3222
+ < li > Close down the user interface.
3223
+ </ li >
3224
+ < li > Set the < a > user agent</ a > 's < a > payment request is showing</ a >
3225
+ boolean to false.
3226
+ </ li >
3227
+ < li > Reject < var > retryPromise</ var > with an "< a > AbortError</ a > "
3228
+ < a > DOMException</ a > .
3229
+ </ li >
3230
+ </ ol >
3231
+ </ li >
3232
+ < li > Finally, when < var > retryPromise</ var > settles, set
3233
+ < var > response</ var > .< a > [[\retryPromise]]</ a > to null.
3234
+ </ li >
3235
+ < li > Return < var > retryPromise</ var > .
3236
+ < p class ="note ">
3237
+ The < var > retryPromise</ var > will later be resolved or rejected by
3238
+ either the < a > user accepts the payment request algorithm</ a > or
3239
+ the < a > user aborts the payment request algorithm</ a > , which are
3240
+ triggered through interaction with the user interface.
3241
+ </ p >
3242
+ </ li >
3243
+ </ ol >
3244
+ </ section >
3159
3245
< section >
3160
3246
< h2 >
3161
3247
< dfn > toJSON()</ dfn > method
@@ -3321,19 +3407,27 @@ <h2>
3321
3407
</ li >
3322
3408
< li > Let < var > promise</ var > be < a > a new promise</ a > .
3323
3409
</ li >
3324
- < li > If < var > response</ var > .< a > [[\completeCalled]]</ a > is true, reject
3410
+ < li > If < var > response</ var > .< a > [[\complete]]</ a > is true, reject < var >
3411
+ promise</ var > with an "< a > InvalidStateError</ a > "
3412
+ < a > DOMException</ a > .
3413
+ </ li >
3414
+ < li data-tests =
3415
+ "payment-request/payment-response/retry-method-manual.https.html "> If
3416
+ < var > response</ var > .< a > [[\retryPromise]]</ a > is not null, reject
3325
3417
< var > promise</ var > with an "< a > InvalidStateError</ a > "
3326
3418
< a > DOMException</ a > .
3327
3419
</ li >
3328
- < li > Otherwise, set < var > response</ var > .< a > [[\completeCalled]]</ a > to
3329
- true.
3420
+ < li > Otherwise, set < var > response</ var > .< a > [[\complete]]</ a > to true.
3330
3421
</ li >
3331
3422
< li > Return < var > promise</ var > and perform the remaining steps < a > in
3332
3423
parallel</ a > .
3333
3424
</ li >
3334
3425
< li > Close down any remaining user interface. The < a > user agent</ a >
3335
3426
MAY use the value < var > result</ var > to influence the user experience.
3336
3427
</ li >
3428
+ < li > Set the < a > user agent</ a > 's < a > payment request is showing</ a >
3429
+ boolean to false.
3430
+ </ li >
3337
3431
< li > Resolve < var > promise</ var > with undefined.
3338
3432
</ li >
3339
3433
</ ol >
@@ -3357,11 +3451,30 @@ <h2>
3357
3451
</ tr >
3358
3452
< tr >
3359
3453
< td >
3360
- < dfn > [[\completeCalled ]]</ dfn >
3454
+ < dfn > [[\complete ]]</ dfn >
3361
3455
</ td >
3362
3456
< td >
3363
- true if the < a data-lt ="PaymentResponse.complete "> complete</ a >
3364
- method has been called and false otherwise.
3457
+ Is true if that the request for payment has completed, or false
3458
+ otherwise.
3459
+ </ td >
3460
+ </ tr >
3461
+ < tr >
3462
+ < td >
3463
+ < dfn > [[\request]]</ dfn >
3464
+ </ td >
3465
+ < td >
3466
+ The < a > PaymentRequest</ a > instance that instantiated this
3467
+ < a > PaymentResponse</ a > .
3468
+ </ td >
3469
+ </ tr >
3470
+ < tr >
3471
+ < td >
3472
+ < dfn > [[\retryPromise]]</ dfn >
3473
+ </ td >
3474
+ < td >
3475
+ Null, or a < a > Promise</ a > that resolves when a < a > user accepts
3476
+ the payment request</ a > or rejects if the < a > user aborts the
3477
+ payment request</ a > .
3365
3478
</ td >
3366
3479
</ tr >
3367
3480
</ table >
@@ -3878,21 +3991,40 @@ <h2>
3878
3991
further action. The < a > user agent</ a > SHOULD ensure that this never
3879
3992
occurs.
3880
3993
</ li >
3881
- < li > Let < var > response</ var > be a new < a > PaymentResponse</ a > .
3994
+ < li > Let < var > isRetry</ var > be true if
3995
+ < var > request</ var > .< a > [[\response]]</ a > is not null, false otherwise.
3882
3996
</ li >
3883
- < li > Set the < a data-lt ="PaymentResponse.requestId "> requestId</ a >
3884
- attribute value of < var > response</ var > to the value of
3885
- < var > request</ var > .< a > [[\details]]</ a > .< a data-lt =
3886
- "PaymentDetailsInit.id "> id</ a > .
3997
+ < li > Let < var > response</ var > be
3998
+ < var > request</ var > .< a > [[\response]]</ a > if < var > isRetry</ var > is
3999
+ true, or a new < a > PaymentResponse</ a > otherwise.
3887
4000
</ li >
3888
- < li > Set the < a data-lt ="PaymentResponse.methodName "> methodName</ a >
3889
- attribute value of < var > response</ var > to the < a > payment method
3890
- identifier</ a > for the < a > payment method</ a > that the user selected
3891
- to accept the payment.
4001
+ < li > If < var > isRetry</ var > if false, initialize the newly created
4002
+ < var > response</ var > :
4003
+ < ol >
4004
+ < li > Set < var > response</ var > .< a > [[\request]]</ a > to
4005
+ < var > request</ var > .
4006
+ </ li >
4007
+ < li > Set < var > response</ var > .< a > [[\retryPromise]]</ a > to null.
4008
+ </ li >
4009
+ < li > Set < var > response</ var > .< a > [[\complete]]</ a > to false.
4010
+ </ li >
4011
+ < li > Set the < a data-lt ="PaymentResponse.requestId "> requestId</ a >
4012
+ attribute value of < var > response</ var > to the value of
4013
+ < var > request</ var > .< a > [[\details]]</ a > .< a data-lt =
4014
+ "PaymentDetailsInit.id "> id</ a > .
4015
+ </ li >
4016
+ < li > Set < var > request</ var > .< a > [[\response]]</ a > to
4017
+ < var > response</ var > .
4018
+ </ li >
4019
+ </ ol >
3892
4020
</ li >
3893
4021
< li > Let < var > handler</ var > be the < a > payment handler</ a > selected by
3894
4022
the user.
3895
4023
</ li >
4024
+ < li > Set the < a data-lt ="PaymentResponse.methodName "> methodName</ a >
4025
+ attribute value of < var > response</ var > to the < a > payment method
4026
+ identifier</ a > of < var > handler</ var > .
4027
+ </ li >
3896
4028
< li > Set the < a data-lt ="PaymentResponse.details "> details</ a >
3897
4029
attribute value of < var > response</ var > to an object resulting from
3898
4030
running the < var > handler</ var > 's < a > steps to respond to a payment
@@ -3951,17 +4083,13 @@ <h2>
3951
4083
"PaymentResponse.payerPhone "> payerPhone</ a > value, the user agent
3952
4084
SHOULD format the phone number to adhere to [[!E.164]].
3953
4085
</ li >
3954
- < li > Set < var > response</ var > .< a > [[\completeCalled]]</ a > to false.
4086
+ < li > If < var > isRetry</ var > is true, resolve
4087
+ < var > response</ var > .< a > [[\retryPromise]]</ a > with undefined.
4088
+ Otherwise, resolve < var > request</ var > .< a > [[\acceptPromise]]</ a > with
4089
+ < var > response</ var > .
3955
4090
</ li >
3956
4091
< li > Set < var > request</ var > .< a > [[\state]]</ a > to "< a > closed</ a > ".
3957
4092
</ li >
3958
- < li > Set the < a > user agent</ a > 's < a > payment request is showing</ a >
3959
- boolean to false.
3960
- </ li >
3961
- < li > Resolve the pending promise
3962
- < var > request</ var > .< a > [[\acceptPromise]]</ a > with
3963
- < var > response</ var > .
3964
- </ li >
3965
4093
</ ol >
3966
4094
</ section >
3967
4095
< section >
@@ -3993,8 +4121,21 @@ <h2>
3993
4121
< li > Set the < a > user agent</ a > 's < a > payment request is showing</ a >
3994
4122
boolean to false.
3995
4123
</ li >
3996
- < li > Reject the promise < var > request</ var > .< a > [[\acceptPromise]]</ a >
3997
- with an "< a > AbortError</ a > " < a > DOMException</ a > .
4124
+ < li > Let < var > error</ var > be an "< a > AbortError</ a > "
4125
+ < a > DOMException</ a > .
4126
+ </ li >
4127
+ < li > Let < var > response</ var > be
4128
+ < var > request</ var > .< a > [[\response]]</ a > .
4129
+ </ li >
4130
+ < li > If < var > response</ var > not null:
4131
+ < ol >
4132
+ < li > Reject < var > response</ var > .< a > [[\retryPromise]]</ a > with
4133
+ < var > error</ var >
4134
+ </ li >
4135
+ </ ol >
4136
+ </ li >
4137
+ < li > Otherwise, reject < var > request</ var > .< a > [[\acceptPromise]]</ a >
4138
+ with < var > error</ var > .
3998
4139
</ li >
3999
4140
</ ol >
4000
4141
</ section >
0 commit comments