@@ -3152,7 +3152,7 @@ <h2>
3152
3152
</ h2 >
3153
3153
< pre class ="idl ">
3154
3154
[SecureContext, Exposed=Window]
3155
- interface PaymentResponse {
3155
+ interface PaymentResponse : EventTarget {
3156
3156
[Default] object toJSON();
3157
3157
3158
3158
readonly attribute DOMString requestId;
@@ -3166,6 +3166,8 @@ <h2>
3166
3166
3167
3167
Promise<void> complete(optional PaymentComplete result = "unknown");
3168
3168
Promise<void> retry(PaymentValidationErrors errorFields);
3169
+
3170
+ attribute EventHandler onpayerdetailchange;
3169
3171
};
3170
3172
</ pre >
3171
3173
< p class ="note ">
@@ -3523,6 +3525,14 @@ <h2>
3523
3525
</ li >
3524
3526
</ ol >
3525
3527
</ section >
3528
+ < section data-dfn-for ="PaymentResponse " data-link-for ="PaymentResponse ">
3529
+ < h2 >
3530
+ < dfn > onpayerdetailchange</ dfn > attribute
3531
+ </ h2 >
3532
+ < p >
3533
+ Allows a developer to handle "< a > payerdetailchange</ a > " events.
3534
+ </ p >
3535
+ </ section >
3526
3536
< section >
3527
3537
< h2 >
3528
3538
Internal Slots
@@ -3602,6 +3612,9 @@ <h2>
3602
3612
< th >
3603
3613
Dispatched when…
3604
3614
</ th >
3615
+ < th >
3616
+ Target
3617
+ </ th >
3605
3618
</ tr >
3606
3619
< tr >
3607
3620
< td >
@@ -3613,6 +3626,9 @@ <h2>
3613
3626
< td >
3614
3627
The user provides a new shipping address.
3615
3628
</ td >
3629
+ < td >
3630
+ < a > PaymentRequest</ a >
3631
+ </ td >
3616
3632
</ tr >
3617
3633
< tr >
3618
3634
< td >
@@ -3624,6 +3640,24 @@ <h2>
3624
3640
< td >
3625
3641
The user chooses a new shipping option.
3626
3642
</ td >
3643
+ < td >
3644
+ < a > PaymentRequest</ a >
3645
+ </ td >
3646
+ </ tr >
3647
+ < tr >
3648
+ < td >
3649
+ < code > < dfn > payerdetailchange</ dfn > </ code >
3650
+ </ td >
3651
+ < td >
3652
+ < a > PaymentRequestUpdateEvent</ a >
3653
+ </ td >
3654
+ < td >
3655
+ The user changes the payer name, the payer email, or the payer
3656
+ phone (see < a > payer detail changed algorithm</ a > ).
3657
+ </ td >
3658
+ < td >
3659
+ < a > PaymentResponse</ a >
3660
+ </ td >
3627
3661
</ tr >
3628
3662
< tr >
3629
3663
< td >
@@ -3812,8 +3846,14 @@ <h2>
3812
3846
< li > If < var > event</ var > .< a > [[\waitForUpdate]]</ a > is true, then < a >
3813
3847
throw</ a > an "< a > InvalidStateError</ a > " < a > DOMException</ a > .
3814
3848
</ li >
3815
- < li > Let < var > request</ var > be the value of < var > event</ var > 's
3816
- < a data-cite ="DOM#event-target "> target</ a > .
3849
+ < li > If < var > event</ var > 's < a data-cite =
3850
+ "DOM#event-target "> target</ a > is an instance of
3851
+ < a > PaymentResponse</ a > , let < var > request</ var > be
3852
+ < var > event</ var > 's < a data-cite =
3853
+ "DOM#event-target "> target</ a > .< a > [[\request]]</ a > .
3854
+ </ li >
3855
+ < li > Otherwise, let < var > request</ var > be the value of
3856
+ < var > event</ var > 's < a data-cite ="DOM#event-target "> target</ a > .
3817
3857
</ li >
3818
3858
< li > Assert: < var > request</ var > is an instance of
3819
3859
< a > PaymentRequest</ a > .
@@ -3989,15 +4029,11 @@ <h2>
3989
4029
< a > Queue a task</ a > on the < a > user interaction task source</ a > to
3990
4030
run the following steps:
3991
4031
< ol >
3992
- < li > If the < var > request</ var > .< a > [[\updating]]</ a > is true, then
3993
- terminate this algorithm and take no further action. Only one
3994
- update may take place at a time. The < a > user agent</ a > SHOULD
3995
- ensure that this never occurs.
4032
+ < li > Assert: < var > request</ var > .< a > [[\updating]]</ a > is false.
4033
+ Only one update can take place at a time.
3996
4034
</ li >
3997
- < li > If the < var > request</ var > .< a > [[\state]]</ a > is not set to
3998
- "< a > interactive</ a > ", then terminate this algorithm and take no
3999
- further action. The < a > user agent</ a > user interface SHOULD
4000
- ensure that this never occurs.
4035
+ < li > Assert: < var > request</ var > .< a > [[\state]]</ a > is
4036
+ "< a > interactive</ a > ".
4001
4037
</ li >
4002
4038
< li data-link-for ="PaymentMethodChangeEvent ">
4003
4039
< a > Fire an event</ a > named "< a > paymentmethodchange</ a > " at
@@ -4021,19 +4057,15 @@ <h2>
4021
4057
with an event name of < var > name</ var > :
4022
4058
</ p >
4023
4059
< ol class ="algorithm ">
4024
- < li > If the < var > request</ var > .< a > [[\updating]]</ a > is true, then
4025
- terminate this algorithm and take no further action. Only one update
4026
- may take place at a time. The < a > user agent</ a > SHOULD ensure that
4027
- this never occurs.
4060
+ < li > Assert: < var > request</ var > .< a > [[\updating]]</ a > is false. Only
4061
+ one update can take place at a time.
4028
4062
</ li >
4029
- < li > If the < var > request</ var > .< a > [[\state]]</ a > is not set to
4030
- "< a > interactive</ a > ", then terminate this algorithm and take no
4031
- further action. The < a > user agent</ a > user interface SHOULD ensure
4032
- that this never occurs.
4063
+ < li > Assert: < var > request</ var > .< a > [[\state]]</ a > is
4064
+ "< a > interactive</ a > ".
4033
4065
</ li >
4034
4066
< li > Let < var > event</ var > be the result of < a data-cite =
4035
- "!DOM#concept-event-create "> creating an event</ a > using
4036
- < a > PaymentRequestUpdateEvent</ a > .
4067
+ "!DOM#concept-event-create "> creating an event</ a > using the
4068
+ < a > PaymentRequestUpdateEvent</ a > interface .
4037
4069
</ li >
4038
4070
< li > Initialize < var > event</ var > 's < code > < a data-cite =
4039
4071
"!DOM#dom-event-type "> type</ a > </ code > attribute to < var > name</ var > .
@@ -4049,6 +4081,84 @@ <h2>
4049
4081
</ li >
4050
4082
</ ol >
4051
4083
</ section >
4084
+ < section >
4085
+ < h2 >
4086
+ Payer detail changed algorithm
4087
+ </ h2 >
4088
+ < p >
4089
+ The user agent MUST run the < dfn > payer detail changed algorithm</ dfn >
4090
+ when the user changes the < var > payer name</ var > , or the < var > payer
4091
+ email</ var > , or the < var > payer phone</ var > in the user interface:
4092
+ </ p >
4093
+ < ol class ="algorithm ">
4094
+ < li > Let < var > request</ var > be the < a > PaymentRequest</ a > object that
4095
+ the user is interacting with.
4096
+ </ li >
4097
+ < li > If < var > request</ var > .< a > [[\response]]</ a > is null, return.
4098
+ </ li >
4099
+ < li > Let < var > response</ var > be
4100
+ < var > request</ var > .< a > [[\response]]</ a > .
4101
+ </ li >
4102
+ < li >
4103
+ < a > Queue a task</ a > on the < a > user interaction task source</ a > to
4104
+ run the following steps:
4105
+ < ol data-link-for ="PaymentResponse ">
4106
+ < li > Assert: < var > request</ var > .< a > [[\updating]]</ a > is false.
4107
+ </ li >
4108
+ < li > Assert: < var > request</ var > .< a > [[\state]]</ a > is
4109
+ "< a > interactive</ a > ".
4110
+ </ li >
4111
+ < li > Let < var > options</ var > be
4112
+ < var > request</ var > .< a > [[\options]]</ a > .
4113
+ </ li >
4114
+ < li > If < var > payer name</ var > changed and
4115
+ < var > options</ var > .< a data-link-for =
4116
+ "PaymentOptions "> requestPayerName</ a > is true:
4117
+ < ol >
4118
+ < li > Set < var > response</ var > 's < a > payerName</ a > attribute to
4119
+ < var > payer name</ var > .
4120
+ </ li >
4121
+ </ ol >
4122
+ </ li >
4123
+ < li > If < var > payer email</ var > changed and
4124
+ < var > options</ var > .< a data-link-for =
4125
+ "PaymentOptions "> requestPayerEmail</ a > is true:
4126
+ < ol >
4127
+ < li > Set < var > response</ var > 's < a > payerEmail</ a > attribute to
4128
+ < var > payer email</ var > .
4129
+ </ li >
4130
+ </ ol >
4131
+ </ li >
4132
+ < li > If < var > payer phone</ var > changed and
4133
+ < var > options</ var > .< a data-link-for =
4134
+ "PaymentOptions "> requestPayerPhone</ a > is true:
4135
+ < ol >
4136
+ < li > Set < var > response</ var > 's < a > payerPhone</ a > attribute to
4137
+ < var > payer phone</ var > .
4138
+ </ li >
4139
+ </ ol >
4140
+ </ li >
4141
+ < li > Let < var > event</ var > be the result of < a data-cite =
4142
+ "!DOM#concept-event-create "> creating an event</ a > using
4143
+ < a > PaymentRequestUpdateEvent</ a > .
4144
+ </ li >
4145
+ < li > Initialize < var > event</ var > 's < code > < a data-cite =
4146
+ "!DOM#dom-event-type "> type</ a > </ code > attribute to
4147
+ "< a > payerdetailchange</ a > ".
4148
+ </ li >
4149
+ < li >
4150
+ < a data-cite ="!DOM#concept-event-dispatch "> Dispatch</ a >
4151
+ < var > event</ var > at < var > response</ var > .
4152
+ </ li >
4153
+ < li data-link-for ="PaymentRequestUpdateEvent "> If
4154
+ < var > event</ var > .< a > [[\waitForUpdate]]</ a > is true, disable any
4155
+ part of the user interface that could cause another change to the
4156
+ payer details to be fired.
4157
+ </ li >
4158
+ </ ol >
4159
+ </ li >
4160
+ </ ol >
4161
+ </ section >
4052
4162
< section >
4053
4163
< h2 >
4054
4164
User accepts the payment request algorithm
0 commit comments