From 6ce152bb3d24a149664f9008e2b58fbe17c440a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20C=C3=A1ceres?=
Date: Mon, 21 May 2018 20:04:00 +1000
Subject: [PATCH 01/13] WIP: retry() shell
---
index.html | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/index.html b/index.html
index e51ba726..a7ee2d75 100644
--- a/index.html
+++ b/index.html
@@ -3131,12 +3131,48 @@
readonly attribute DOMString? payerPhone;
Promise<void> complete(optional PaymentComplete result = "unknown");
+ Promise<void> retry();
};
A PaymentResponse is returned when a user has selected a payment
method and approved a payment request.
+
+
+ retry() method
+
+
+ - Let response be the context object.
+
+ - Let request be response.[[\request]].
+
+ - If response.[[\completeCalled]] is true, throw a
+ "InvalidStateError" DOMException.
+
+ - If request.[[\state]] is not "closed", throw a
+ "InvalidStateError" DOMException.
+
+ - Set request.[[\state]] to "interactive".
+
+ - Set request.[[\retrying]] to true.
+
+ - Let promiseToRetry be a newly created promise.
+
+ - In parallel:
+
+ - If the user accepts the retry, resolve promiseToRetry
+ with undefined.
+
+ - If the user aborts the retry, reject promiseToRetry
+ with an "AbortError" DOMException.
+
+
+
+ - Return promiseToRetry.
+
+
+
toJSON() method
@@ -3746,6 +3782,8 @@
Let response be a new PaymentResponse.
+ Let response.[[\request]] be request.
+
Set the requestId
attribute value of response to the value of
request.[[\details]].
Date: Tue, 22 May 2018 15:05:59 +1000
Subject: [PATCH 02/13] define aborting and retrying
---
index.html | 191 +++++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 164 insertions(+), 27 deletions(-)
diff --git a/index.html b/index.html
index a7ee2d75..55337778 100644
--- a/index.html
+++ b/index.html
@@ -3143,33 +3143,40 @@
retry() method
- - Let response be the context object.
+
- Let response be the context object.
+
+ - Let request be
+ response.[[\request]].
- - Let request be response.[[\request]].
+
- If response.[[\complete]] is true, throw a
+ "InvalidStateError" DOMException.
- - If response.[[\completeCalled]] is true, throw a
- "InvalidStateError" DOMException.
+
- If request.[[\retrying]] is true, throw a
+ "InvalidStateError" DOMException.
- - If request.[[\state]] is not "closed", throw a
- "InvalidStateError" DOMException.
+
- If request.[[\state]] is not "closed",
+ throw a "InvalidStateError" DOMException.
- - Set request.[[\state]] to "interactive".
+
- Set response.[[\retrying]] to true.
- - Set request.[[\retrying]] to true.
+
- Set request.[[\state]] to "interactive".
- - Let promiseToRetry be a newly created promise.
+
- Set request.[[\retryPromise]] to a newly
+ created promise.
- - In parallel:
+
-
+ In parallel:
- - If the user accepts the retry, resolve promiseToRetry
- with undefined.
+
- Indicate to the end-user that something is wrong with the
+ data of the payment response.
+
- - If the user aborts the retry, reject promiseToRetry
- with an "AbortError" DOMException.
+
- Wait for the user to either retry the payment or
+ abort retrying.
- - Return promiseToRetry.
+
- Return request.[[\retryPromise]].
@@ -3338,12 +3345,11 @@
Let promise be a new promise.
- If response.[[\completeCalled]] is true, reject
- promise with an "InvalidStateError"
- DOMException.
+ If response.[[\complete]] is true, reject
+ promise with an "InvalidStateError"
+ DOMException.
- Otherwise, set response.[[\completeCalled]] to
- true.
+ Otherwise, set response.[[\complete]] to true.
Return promise and perform the remaining steps in
parallel.
@@ -3351,6 +3357,9 @@
Close down any remaining user interface. The user agent
MAY use the value result to influence the user experience.
+ Set the user agent's payment request is showing
+ boolean to false.
+
Resolve promise with undefined.
@@ -3374,15 +3383,146 @@
- [[\completeCalled]]
+ [[\complete]]
+ |
+
+ true if that the request for payment has completed, or false
+ otherwise.
+ |
+
+
+
+ [[\request]]
+ |
+
+ The PaymentRequest instance that instantiated this
+ PaymentResponse.
+ |
+
+
+
+ [[\retryPromise]]
|
- true if the complete
- method has been called and false otherwise.
+ A Promise resolves when a user retries the payment or rejects if the
+ user aborts retrying.
+ |
+
+
+
+ [[\retrying]]
+ |
+
+ When true, the developer has signaled that the payment response
+ suffers from validation errors that the user needs to correct in
+ the user agent's UI.
|
+
+
+ PaymentResponse
algorithms
+
+
+
+
From ee8afdc77c0bd99fb49bfa116a751fb9a8124b0c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20C=C3=A1ceres?=
Date: Tue, 22 May 2018 16:26:35 +1000
Subject: [PATCH 04/13] complete() throws if retrying
---
index.html | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/index.html b/index.html
index 9cd24fa9..a6991ae6 100644
--- a/index.html
+++ b/index.html
@@ -3352,6 +3352,10 @@ If response.[[\retrying]] is true, reject
+ promise with an "InvalidStateError"
+ DOMException.
+
Otherwise, set response.[[\complete]] to true.
Return promise and perform the remaining steps in
From 33277258b01beef920b710d97e8059bb5c6c52a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20C=C3=A1ceres?=
Date: Tue, 22 May 2018 16:37:06 +1000
Subject: [PATCH 05/13] Link to initial tests
---
index.html | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/index.html b/index.html
index a6991ae6..3a78ee1f 100644
--- a/index.html
+++ b/index.html
@@ -3142,6 +3142,9 @@
retry() method
+
+ The retry() method MUST act as follows:
+
- Let response be the context object.
@@ -3352,9 +3355,11 @@
- If response.[[\retrying]] is true, reject
- promise with an "InvalidStateError"
- DOMException.
+ If
+ response.[[\retrying]] is true, reject
+ promise with an "InvalidStateError"
+ DOMException.
Otherwise, set response.[[\complete]] to true.
From 60740ee21839bd1fbfdf0bcd6f796702d5f3bd76 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20C=C3=A1ceres?=
Date: Tue, 22 May 2018 16:59:15 +1000
Subject: [PATCH 06/13] Guard against calling request.abort() again
---
index.html | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/index.html b/index.html
index 3a78ee1f..19647ab1 100644
--- a/index.html
+++ b/index.html
@@ -834,6 +834,8 @@
Set request.[[\serializedMethodData]] to
serializedMethodData.
+ Set request.[[\response]] to null.
+
Set the value of request's shippingOption attribute to
selectedShippingOption.
@@ -1112,9 +1114,14 @@
Let response be a new PaymentResponse.
- Let response.[[\request]] be request.
+ Let response.[[\request]] be
+ request.
+
+ Set request.[[\response]] to
+ response.
Set the requestId
attribute value of response to the value of
From cb0e60e8dccf50ba194f8181bf44aa341fc347c7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20C=C3=A1ceres?=
Date: Tue, 22 May 2018 17:00:49 +1000
Subject: [PATCH 07/13] fix typo
---
index.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/index.html b/index.html
index 19647ab1..5c5c6651 100644
--- a/index.html
+++ b/index.html
@@ -1116,8 +1116,8 @@
If request.[[\response]] is not null, and
request.[[\response]].[[\retrying]] is true,
- return a newly created promise an "InvalidStateError"
- DOMException.
+ return a newly created promise rejected with an
+ "InvalidStateError" DOMException.
If the value of request.[[\state]] is not
"interactive" then return a newly created promise rejected
From ccd2ffd2def5b30a40c5128719f08bcee274555f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20C=C3=A1ceres?=
Date: Tue, 22 May 2018 17:18:08 +1000
Subject: [PATCH 08/13] Refactor pasta
---
index.html | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/index.html b/index.html
index 5c5c6651..e6cae459 100644
--- a/index.html
+++ b/index.html
@@ -3183,8 +3183,8 @@
Set request.[[\state]] to "interactive".
- Set request.[[\retryPromise]] to
- retryPromise.
+ Set request.[[\retryPromise]] to a newly
+ created promise.
In parallel:
@@ -3198,7 +3198,7 @@
- Return retryPromise.
+ Return request.[[\retryPromise]].
From 5fd709c9168873cf099f5e61307496d3e3cae02e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20C=C3=A1ceres?=
Date: Tue, 22 May 2018 20:07:33 +1000
Subject: [PATCH 09/13] Make it clear the UI is shutting down
---
index.html | 3 +++
1 file changed, 3 insertions(+)
diff --git a/index.html b/index.html
index e6cae459..722d3a39 100644
--- a/index.html
+++ b/index.html
@@ -3531,6 +3531,9 @@
further action. The user agent user interface SHOULD ensure
that this never occurs.
+
Try to abort the current user interaction with the payment
+ handler and close down any remaining user interface.
+
Queue a task on the user interaction task source to
perform the following steps:
From 7457256cf9684300b6e050605374c6e86eaa6587 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20C=C3=A1ceres?=
Date: Tue, 22 May 2018 20:14:23 +1000
Subject: [PATCH 10/13] remove redundant checks
---
index.html | 16 ----------------
1 file changed, 16 deletions(-)
diff --git a/index.html b/index.html
index 722d3a39..e960c9e9 100644
--- a/index.html
+++ b/index.html
@@ -3518,22 +3518,6 @@
Let request be the PaymentRequest context
object.
- If the request.[[\retrying]] is false, then
- terminate this algorithm and take no further action. The user
- agent user interface SHOULD ensure that this never occurs.
-
- If the request.[[\updating]] is true, then
- terminate this algorithm and take no further action. The user
- agent user interface SHOULD ensure that this never occurs.
-
- If request.[[\state]] is not
- "interactive", then terminate this algorithm and take no
- further action. The user agent user interface SHOULD ensure
- that this never occurs.
-
- Try to abort the current user interaction with the payment
- handler and close down any remaining user interface.
-
Queue a task on the user interaction task source to
perform the following steps:
From ec150735dc8ef0beb8e9157e5a3d8a99f924eea2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20C=C3=A1ceres?=
Date: Tue, 22 May 2018 20:35:22 +1000
Subject: [PATCH 11/13] Clarify closing, add asserts back in
---
index.html | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/index.html b/index.html
index e960c9e9..2733ab69 100644
--- a/index.html
+++ b/index.html
@@ -3512,12 +3512,26 @@
The user aborts
retrying algorithm runs if the developer has called
retry() and the user aborts the payment request through the
- currently interactive user interface.
+ currently interactive user interface. Aborting closes down any
+ remaining user interface.
- Let request be the PaymentRequest context
object.
+ - If the request.[[\retrying]] is false, then
+ terminate this algorithm and take no further action. The user
+ agent user interface SHOULD ensure that this never occurs.
+
+ - If the request.[[\updating]] is true, then
+ terminate this algorithm and take no further action. The user
+ agent user interface SHOULD ensure that this never occurs.
+
+ - If request.[[\state]] is not
+ "interactive", then terminate this algorithm and take no
+ further action. The user agent user interface SHOULD ensure
+ that this never occurs.
+
-
Queue a task on the user interaction task source to
perform the following steps:
From 37ab32488c82a7e46cad1b6eac784cf403f32871 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20C=C3=A1ceres?=
Date: Wed, 23 May 2018 14:34:53 +1000
Subject: [PATCH 12/13] s/request/reponse typo
---
index.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/index.html b/index.html
index 2733ab69..333a4276 100644
--- a/index.html
+++ b/index.html
@@ -3171,7 +3171,7 @@
promise rejected with an "InvalidStateError"
DOMException.
- - If request.[[\retrying]] is true, return a
+
- If response.[[\retrying]] is true, return a
promise rejected with an "InvalidStateError"
DOMException.
@@ -3519,7 +3519,7 @@
- Let request be the PaymentRequest context
object.
- - If the request.[[\retrying]] is false, then
+
- If the response.[[\retrying]] is false, then
terminate this algorithm and take no further action. The user
agent user interface SHOULD ensure that this never occurs.
From 80f58a2300216ed581cb5bf1d22c4fa9af7c0720 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20C=C3=A1ceres?=
Date: Mon, 28 May 2018 11:18:19 +1000
Subject: [PATCH 13/13] Remove redudant check
---
index.html | 4 ----
1 file changed, 4 deletions(-)
diff --git a/index.html b/index.html
index 333a4276..e7a0bcaa 100644
--- a/index.html
+++ b/index.html
@@ -3175,10 +3175,6 @@
promise rejected with an "InvalidStateError"
DOMException.
-
- If request.[[\state]] is not "closed",
- return a promise rejected with an "InvalidStateError"
- DOMException.
-
- Set response.[[\retrying]] to true.
- Set request.[[\state]] to "interactive".