|
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 | 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 | 3525 | li>
|
3524 | 3526 | ol>
|
3525 | 3527 | section>
|
| 3528 | + <section data-dfn-for="PaymentResponse" data-link-for="PaymentResponse"> |
| 3529 | + <h2> |
| 3530 | + <dfn>onpayerdetailchangedfn> attribute |
| 3531 | + h2> |
| 3532 | + <p> |
| 3533 | + Allows a developer to handle "<a>payerdetailchangea>" events. |
| 3534 | + p> |
| 3535 | + section> |
3526 | 3536 | <section>
|
3527 | 3537 | <h2>
|
3528 | 3538 | Internal Slots
|
|
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 | 3626 | <td>
|
3614 | 3627 | The user provides a new shipping address.
|
3615 | 3628 | td>
|
| 3629 | + <td> |
| 3630 | + <a>PaymentRequesta> |
| 3631 | + td> |
3616 | 3632 | tr>
|
3617 | 3633 | <tr>
|
3618 | 3634 | <td>
|
|
3624 | 3640 | <td>
|
3625 | 3641 | The user chooses a new shipping option.
|
3626 | 3642 | td>
|
| 3643 | + <td> |
| 3644 | + <a>PaymentRequesta> |
| 3645 | + td> |
| 3646 | + tr> |
| 3647 | + <tr> |
| 3648 | + <td> |
| 3649 | + <code><dfn>payerdetailchangedfn>code> |
| 3650 | + td> |
| 3651 | + <td> |
| 3652 | + <a>PaymentRequestUpdateEventa> |
| 3653 | + td> |
| 3654 | + <td> |
| 3655 | + The user changes the payer name, the payer email, or the payer |
| 3656 | + phone (see <a>payer detail changed algorithma>). |
| 3657 | + td> |
| 3658 | + <td> |
| 3659 | + <a>PaymentResponsea> |
| 3660 | + td> |
3627 | 3661 | tr>
|
3628 | 3662 | <tr>
|
3629 | 3663 | <td>
|
|
3812 | 3846 | <li>If <var>eventvar>.<a>[[\waitForUpdate]]a> is true, then <a>
|
3813 | 3847 | throwa> an "<a>InvalidStateErrora>" <a>DOMExceptiona>.
|
3814 | 3848 | li>
|
3815 |
| - <li>Let <var>requestvar> be the value of <var>eventvar>'s |
3816 |
| - <a data-cite="DOM#event-target">targeta>. |
| 3849 | + <li>If <var>eventvar>'s <a data-cite= |
| 3850 | + "DOM#event-target">targeta> is an instance of |
| 3851 | + <a>PaymentResponsea>, let <var>requestvar> be |
| 3852 | + <var>eventvar>'s <a data-cite= |
| 3853 | + "DOM#event-target">targeta>.<a>[[\request]]a>. |
| 3854 | + li> |
| 3855 | + <li>Otherwise, let <var>requestvar> be the value of |
| 3856 | + <var>eventvar>'s <a data-cite="DOM#event-target">targeta>. |
3817 | 3857 | li>
|
3818 | 3858 | <li>Assert: <var>requestvar> is an instance of
|
3819 | 3859 | <a>PaymentRequesta>.
|
|
3989 | 4029 | <a>Queue a taska> on the <a>user interaction task sourcea> to
|
3990 | 4030 | run the following steps:
|
3991 | 4031 | <ol>
|
3992 |
| - <li>If the <var>requestvar>.<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 agenta> SHOULD |
3995 |
| - ensure that this never occurs. |
| 4032 | + <li>Assert: <var>requestvar>.<a>[[\updating]]a> is false. |
| 4033 | + Only one update can take place at a time. |
3996 | 4034 | li>
|
3997 |
| - <li>If the <var>requestvar>.<a>[[\state]]a> is not set to |
3998 |
| - "<a>interactivea>", then terminate this algorithm and take no |
3999 |
| - further action. The <a>user agenta> user interface SHOULD |
4000 |
| - ensure that this never occurs. |
| 4035 | + <li>Assert: <var>requestvar>.<a>[[\state]]a> is |
| 4036 | + "<a>interactivea>". |
4001 | 4037 | li>
|
4002 | 4038 | <li data-link-for="PaymentMethodChangeEvent">
|
4003 | 4039 | <a>Fire an eventa> named "<a>paymentmethodchangea>" at
|
|
4021 | 4057 | with an event name of <var>namevar>:
|
4022 | 4058 | p>
|
4023 | 4059 | <ol class="algorithm">
|
4024 |
| - <li>If the <var>requestvar>.<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 agenta> SHOULD ensure that |
4027 |
| - this never occurs. |
| 4060 | + <li>Assert: <var>requestvar>.<a>[[\updating]]a> is false. Only |
| 4061 | + one update can take place at a time. |
4028 | 4062 | li>
|
4029 |
| - <li>If the <var>requestvar>.<a>[[\state]]a> is not set to |
4030 |
| - "<a>interactivea>", then terminate this algorithm and take no |
4031 |
| - further action. The <a>user agenta> user interface SHOULD ensure |
4032 |
| - that this never occurs. |
| 4063 | + <li>Assert: <var>requestvar>.<a>[[\state]]a> is |
| 4064 | + "<a>interactivea>". |
4033 | 4065 | li>
|
4034 | 4066 | <li>Let <var>eventvar> be the result of <a data-cite=
|
4035 |
| - "!DOM#concept-event-create">creating an eventa> using |
4036 |
| - <a>PaymentRequestUpdateEventa>. |
| 4067 | + "!DOM#concept-event-create">creating an eventa> using the |
| 4068 | + <a>PaymentRequestUpdateEventa> interface. |
4037 | 4069 | li>
|
4038 | 4070 | <li>Initialize <var>eventvar>'s <code><a data-cite=
|
4039 | 4071 | "!DOM#dom-event-type">typea>code> attribute to <var>namevar>.
|
|
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 algorithmdfn> |
| 4090 | + when the user changes the <var>payer namevar>, or the <var>payer |
| 4091 | + emailvar>, or the <var>payer phonevar> in the user interface: |
| 4092 | + p> |
| 4093 | + <ol class="algorithm"> |
| 4094 | + <li>Let <var>requestvar> be the <a>PaymentRequesta> object that |
| 4095 | + the user is interacting with. |
| 4096 | + li> |
| 4097 | + <li>If <var>requestvar>.<a>[[\response]]a> is null, return. |
| 4098 | + li> |
| 4099 | + <li>Let <var>responsevar> be |
| 4100 | + <var>requestvar>.<a>[[\response]]a>. |
| 4101 | + li> |
| 4102 | + <li> |
| 4103 | + <a>Queue a taska> on the <a>user interaction task sourcea> to |
| 4104 | + run the following steps: |
| 4105 | + <ol data-link-for="PaymentResponse"> |
| 4106 | + <li>Assert: <var>requestvar>.<a>[[\updating]]a> is false. |
| 4107 | + li> |
| 4108 | + <li>Assert: <var>requestvar>.<a>[[\state]]a> is |
| 4109 | + "<a>interactivea>". |
| 4110 | + li> |
| 4111 | + <li>Let <var>optionsvar> be |
| 4112 | + <var>requestvar>.<a>[[\options]]a>. |
| 4113 | + li> |
| 4114 | + <li>If <var>payer namevar> changed and |
| 4115 | + <var>optionsvar>.<a data-link-for= |
| 4116 | + "PaymentOptions">requestPayerNamea> is true: |
| 4117 | + <ol> |
| 4118 | + <li>Set <var>responsevar>'s <a>payerNamea> attribute to |
| 4119 | + <var>payer namevar>. |
| 4120 | + li> |
| 4121 | + ol> |
| 4122 | + li> |
| 4123 | + <li>If <var>payer emailvar> changed and |
| 4124 | + <var>optionsvar>.<a data-link-for= |
| 4125 | + "PaymentOptions">requestPayerEmaila> is true: |
| 4126 | + <ol> |
| 4127 | + <li>Set <var>responsevar>'s <a>payerEmaila> attribute to |
| 4128 | + <var>payer emailvar>. |
| 4129 | + li> |
| 4130 | + ol> |
| 4131 | + li> |
| 4132 | + <li>If <var>payer phonevar> changed and |
| 4133 | + <var>optionsvar>.<a data-link-for= |
| 4134 | + "PaymentOptions">requestPayerPhonea> is true: |
| 4135 | + <ol> |
| 4136 | + <li>Set <var>responsevar>'s <a>payerPhonea> attribute to |
| 4137 | + <var>payer phonevar>. |
| 4138 | + li> |
| 4139 | + ol> |
| 4140 | + li> |
| 4141 | + <li>Let <var>eventvar> be the result of <a data-cite= |
| 4142 | + "!DOM#concept-event-create">creating an eventa> using |
| 4143 | + <a>PaymentRequestUpdateEventa>. |
| 4144 | + li> |
| 4145 | + <li>Initialize <var>eventvar>'s <code><a data-cite= |
| 4146 | + "!DOM#dom-event-type">typea>code> attribute to |
| 4147 | + "<a>payerdetailchangea>". |
| 4148 | + li> |
| 4149 | + <li> |
| 4150 | + <a data-cite="!DOM#concept-event-dispatch">Dispatcha> |
| 4151 | + <var>eventvar> at <var>responsevar>. |
| 4152 | + li> |
| 4153 | + <li data-link-for="PaymentRequestUpdateEvent">If |
| 4154 | + <var>eventvar>.<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