[w3c/payment-handler] Specify how to construct PaymentRequestDetailsUpdate from PaymentDetailsUpdate (#376)

The "paymentmethodchange" event allow a payment handler to communicate with the merchant before the payment request completes. It involves the following interfaces:

1. Payment handler side:
```webidl
partial interface PaymentRequestEvent {
  Promise<PaymentRequestDetailsUpdate?> changePaymentMethod(DOMString methodName, optional object? methodDetails = null);
}
```
2. Merchant side:

```webidl
partial interface PaymentRequestUpdateEvent : Event {
  void updateWith(Promise<PaymentDetailsUpdate> detailsPromise);
};
```

The Payment Handler API  spec is unspecific about how to turn the `PaymentDetailsUpdate` object the merchant provides to the `PaymentRequestDetailsUpdate` object the payment handler receives. Section 7.2 Change Payment Method Algorithm [1] simply says:

```
5. Construct and return a PaymentRequestDetailsUpdate from the detailsPromise in event.updateWith(detailsPromise).
```

Proposal:
I think we should either merge the two object definition, or specify clearly how to convert one object from another. We should also do the same for the "shippingaddresschange" and "shippingoptionchange" events.

[1] https://w3c.github.io/payment-handler/#dfn-change-payment-method-algorithm


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/payment-handler/issues/376

Received on Friday, 17 July 2020 14:58:08 UTC