- From: Marcos Cáceres <notifications@github.com>
- Date: Fri, 23 Mar 2018 05:38:14 +0000 (UTC)
- To: w3c/payment-request <payment-request@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Friday, 23 March 2018 05:39:08 UTC
So, as I'm spec'ing this out, I realized that it might be more consistent to put a nullable `paymentMethod` attribute on `PaymentRequest`.
So:
```JS
partial interface PaymentRequest {
readonly attribute PaymentMethod? paymentMethod;
attribute EventHandler onpaymentmethodchanged;
};
interface PaymentMethod {
readonly attribute USVString methodName;
object details; // payment method specific
};
```
And so:
```js
request.onpaymentmethodchanged = ev => {
const { paymentMethod } = ev.target;
// recalculate based on either methodName and/or on the details
const newTotal = recalculateCosts(paymentMethod);
ev.updateWith({ total: newTotal });
}
```
--
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/662#issuecomment-375550711
Received on Friday, 23 March 2018 05:39:08 UTC