Closed marcoscaceres closed 6 years ago
Only indirectly and in a backwards compatibile way. I hope to have a draft ready for review tomorrow.
No rush! Just checking.
Basic card integration https://github.com/w3c/payment-method-basic-card/pull/53
Sent tests for review https://github.com/w3c/web-platform-tests/pull/10912
Realized that when other events fire (e.g., onshippingaddresschange
) or generally things happen on the user interaction task source (e.g., user aborts, request.abort()
), the methodDetails
needs to be reset to null... same with methodName
.
Hmmm... having spec'ed this out, now I don't know if I like this design anymore 😓 Doesn't feel right that the only thing that changes .methodName
and .methodData
is this event.
Maybe this should switch back to having special event for this, as per https://github.com/w3c/payment-request/issues/662#issuecomment-359038775
The name paymentmethodchange
is also super ambiguous tho, because it's really a "Instrument change" of a payment method. So, I I'm kind thinking "instrumentchange" is more appropriate as an event name.
I think I'd like to change this to:
PaymentMethodChangeEvent : PaymentRequestUpdateEvent {
readonly attribute DOMString methodName;
readonly attribute object? methodDetails;
}
So that:
request.oninstrumentchange = ev => {
const { type: cardType } = ev.methodDetails;
if (ev.methodName === "https://apple.com/apple-pay") {
switch (cardType) {
case "store":
// do Apple Pay specific handling for store card...
break;
}
}
// finally...
ev.updateWith(newStuff);
};
@aestes wdyt?
Updated this to match https://github.com/w3c/payment-request/pull/695#issuecomment-387978220
Updated WPTests to match updated spec.
@domenic, this one too should now be good to go (🤞).
@domenic, I think I've addressed all the feedback 🤞
Added link to Firefox tracking bug.
Added developer documentation. Please review. https://developer.mozilla.org/en-US/docs/Web/API/PaymentRequest/onpaymentmethodchange
PaymentMethodChangeEvent is now in Firefox Nightly behind a pref. We don't currently have any plans to fire it for Basic Card, but other payment handlers could theoretically make use of it.
closes #662
The following tasks have been completed:
Implementation commitment:
Preview | Diff