From d24b5cfdac2596596023b7cd69931bf9bc976c3d Mon Sep 17 00:00:00 2001
From: Rouslan Solomakhin
+ The PaymentMethodChangeResponse contains the udpated total + (optionally with modifiers) and possible errors resulting from user + selecting an payment method within a payment handler. +
++ dictionary PaymentMethodChangeResponse { + DOMString error; + PaymentItem total; + FrozenArray<PaymentDetailsModifier> modifiers; + AddressErrors billingAddressErrors; + }; ++
+ A human readable string that explains why the payment method cannot + be used. +
++ Updated total based on the changed payment method. This can change, + for example, in VAT calculations based on the billing address + associated with the payment method. +
++ Updated modifiers based on the changed payment method. These change + change, for example, in VAT calculations based on the billing + address associated with the payment method. +
++ Validation errors for the billing address of the payment method, if + any. +
++ The value of PaymentOptions.requestBillingAddress + in the PaymentRequest. +
++ This method is used by the payment handler to get updated total + given such payment method details as the billing address. When + called, it runs the change payment method algorithm. +
++ When this algorithm is invoked with methodName and + methodDetails parameters, the user agent MUST run the + following steps: +
+null
.
+ - Updated modifiers based on the changed payment method. These change + Updated modifiers based on the changed payment method. These can change, for example, in VAT calculations based on the billing address associated with the payment method.
- Validation errors for the billing address of the payment method, if - any. + Validation errors for the payment method, if any.
- The PaymentMethodChangeResponse contains the udpated total
- (optionally with modifiers) and possible errors resulting from user
- selecting an payment method within a payment handler.
+ The PaymentMethodChangeResponse
contains the updated
+ total (optionally with modifiers) and possible errors resulting from
+ user selection of a payment method within a payment handler.
dictionary PaymentMethodChangeResponse { @@ -1183,9 +1183,9 @@total member
- Updated total based on the changed payment method. This can change, - for example, in VAT calculations based on the billing address - associated with the payment method. + Updated total based on the changed payment method. The total can + change, for example, because the billing address of the payment + method selected by the user changes the Value Added Tax (VAT).
@@ -1193,9 +1193,10 @@ modifiers member
- Updated modifiers based on the changed payment method. These can - change, for example, in VAT calculations based on the billing - address associated with the payment method. + Updated modifiers based on the changed payment method. For example, + if the overall total has increased by €1.00 based on the billing + address, then the totals specified in each of the modifiers should + also increase by €1.00.
From 2c698623961c1186cdbcbd1ae8493d486e32469c Mon Sep 17 00:00:00 2001 From: Rouslan Solomakhin Date: Wed, 12 Sep 2018 15:40:52 -0400 Subject: [PATCH 4/6] Use PaymentCurrencyAmount type total --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 5793106..16148af 100644 --- a/index.html +++ b/index.html @@ -1164,7 +1164,7 @@
dictionary PaymentMethodChangeResponse { DOMString error; - PaymentItem total; + PaymentCurrencyAmount total; FrozenArray<PaymentDetailsModifier> modifiers; object paymentMethodErrors; }; @@ -1226,7 +1226,7 @@readonly attribute USVString paymentRequestOrigin; readonly attribute DOMString paymentRequestId; readonly attribute FrozenArray<PaymentMethodData> methodData; - readonly attribute object total; + readonly attribute PaymentCurrencyAmount total; readonly attribute FrozenArray<PaymentDetailsModifier> modifiers; readonly attribute DOMString instrumentKey; readonly attribute bool requestBillingAddress; From f25d42f0efe9b6df757b8e7db7ecf94daa1416df Mon Sep 17 00:00:00 2001 From: Rouslan Solomakhin
Date: Thu, 13 Sep 2018 10:31:15 -0400 Subject: [PATCH 5/6] Do not use a dictionary as an attribute. --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 16148af..e569668 100644 --- a/index.html +++ b/index.html @@ -1226,7 +1226,7 @@ readonly attribute USVString paymentRequestOrigin; readonly attribute DOMString paymentRequestId; readonly attribute FrozenArray<PaymentMethodData> methodData; - readonly attribute PaymentCurrencyAmount total; + readonly attribute object total; readonly attribute FrozenArray<PaymentDetailsModifier> modifiers; readonly attribute DOMString instrumentKey; readonly attribute bool requestBillingAddress; From 3525c7a9aba9f5ddf1358448e9fb12acb9086cac Mon Sep 17 00:00:00 2001 From: Rouslan Solomakhin
Date: Thu, 13 Sep 2018 10:31:58 -0400 Subject: [PATCH 6/6] Make methodDetails optional. --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index e569668..780dd57 100644 --- a/index.html +++ b/index.html @@ -1231,7 +1231,7 @@ readonly attribute DOMString instrumentKey; readonly attribute bool requestBillingAddress; Promise<WindowClient?> openWindow(USVString url); - Promise<PaymentMethodChangeResponse?> changePaymentMethod(DOMString methodName, object? methodDetails); + Promise<PaymentMethodChangeResponse?> changePaymentMethod(DOMString methodName, optional object? methodDetails = null); void respondWith(Promise<PaymentHandlerResponse>handlerResponsePromise); };