Re: [w3ctag/design-reviews] [Payments] shipping and contact info delegation (#425)

> A few other notes/questions (though I'm more concerned about my previous comment than this one):
> 
> I'm a little curious about how the [proposed `PaymentDelegation` enum](https://github.com/sahel-sh/shipping-contact-delegation/blob/master/Explainer.md#enable-delegations) differs from the [`PaymentOptions` dictionary](https://w3c.github.io/payment-request/#dom-paymentoptions); the former has `shippingAddress` whereas the latter has `billingAddress` and `shipping` (with `request` at the front). How do these correspond? (And [`PaymentHandlerResponse`](https://w3c.github.io/payment-handler/#paymenthandlerresponse-dictionary) is in turn slightly different, with the added `shippingOption`.)

[`PaymentOptions`](https://w3c.github.io/payment-request/#dom-paymentoptions) dictionary is used by merchants to request the additional information they need for the checkout; That's why the dictionary members are all booleans and start with "request".  The proposed [`PaymentDelegation`](https://github.com/sahel-sh/shipping-contact-delegation/blob/master/Explainer.md#enable-delegations) enum specifies the set of possible delegations. Payment handlers can support any subset of it via calling [`enableDelegations`](https://w3c.github.io/payment-handler/#enabledelegations-method) during their installation  (please check the [payment handler registration](https://w3c.github.io/payment-handler/#example-3-payment-handler-registration) example for more details). We are not reusing `PaymentOptions` because "request" does not make sense during payment handler installation when no payment request has created yet.  "billingAddress" is not a member of `PaymentDelegation` enum yet, but it can be added in the future if there is demand for it. [`PaymentHandlerResponse`](https://w3c.github.io/payment-handler/#paymenthandlerresponse-dictionary) is the dictionary that payment handlers use for sending their response to the browser; That's why its members are optional strings as well as `shippingAddress` (with type `AddressInit`)  (e.g. `response.payerName`  received from ExamplePay will be "John Smith" if `request.paymentOptions.requestPayerName` is true and ExamplePay has called `paymentManager.enableDelegations(['payerName'])` during installation . 
> 
> This bit of the explainer:
> 
> > Payment handlers which support shipping delegation should be able to fire shipping[address|option]change events to let the merchant know that the user has selected a different shipping address/option. The browser will then get the updated request details from merchant and forward it to the payment handler after redacting displayItems.
> 
> seems a little confusing to me. I would have expected the second sentence to describe how the browser moves the information from the payment handler to the merchant, not from the merchant to the payment handler. If this is the correct direction, it might help to clarify exactly what's going on here.

Without this change when the user selected a different shipping address on browser's payment sheet, the browser would notify the merchant's website by sending [`shippingaddresschange`](https://www.w3.org/TR/payment-request/#dfn-shippingaddresschange) , and the merchant could in turn notify the browser about updated payment details by calling [`updateWith`](https://www.w3.org/TR/payment-request/#dom-paymentrequestupdateevent-updatewith) . This is for handling the cases like when shipping cost depends on the shipping address, or express shipping option is not available for the country of the shipping address, etc.  Now with this change since the payment handler is responsible for providing shipping address, it should be able to notify the browser about changes in user selected shipping address/option.  `changeShippingAddress()` and 
 `changeShippingOption()` methods added to the `PaymentRequestEvent` make this possible. The proposed changes to `PaymentRequestDetailsUpdate` let the browser forward the updated payment details from the merchant to the payment handler.
I updated the [shipping-addressoption-change-events](https://github.com/sahel-sh/shipping-contact-delegation/blob/master/Explainer.md#shipping-addressoption-change-events) of the explainer to explicitly mention `changeShipping[Address\Option]()`  methods in the text rather than just inside the code block of changes to  `PaymentRequestEvent`.
> 
> The [proposed `supported_delegations` member](https://github.com/sahel-sh/shipping-contact-delegation/blob/master/Explainer.md#edit-just-in-time-jit-installation) in Web App Manifest seems like it should probably have a name that makes it clear it's related to payments, since manifests are more general than just payments. (Also, I think `PayerName` there should probably be lowercased as `payerName` to match the `enum PaymentDelegation` above.)

I updated the [JIT installation section of the explainer](https://github.com/sahel-sh/shipping-contact-delegation/blob/master/Explainer.md#edit-just-in-time-jit-installation) with your recommendations. 



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/425#issuecomment-559352691

Received on Thursday, 28 November 2019 05:54:11 UTC