[w3c/payment-request] Consider adding some means of getting the details out of a payment request (#592)

The API requires "playing ping pong" with the UI by continuously updating the "details" of a payment request. This means that details either needs to be curried, constantly passed around, or (parents, please, avert your children's eyes) set as a global! 🙀

As such, we should consider adding a convenience method to pull the latest derived "details" from a payment request. 

Something like: 

```JS
request.onshippingoptionchange = function (ev) {
   const details = this.getDetails();
   ev.updateWith({ ...details, total: updateTotal(this.shippingOption) });
};

request.onshippingaddresschange = function (ev) {
   const details = this.getDetails();
   ev.updateWith({ ...details, total: updateTotal(this.shippingAddress) });
};
```


-- 
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-request/issues/592

Received on Wednesday, 23 August 2017 02:04:26 UTC