w3c / payment-request

Payment Request API
https://www.w3.org/TR/payment-request/
Other
488 stars 135 forks source link

Add support for merchant validation #751

Closed marcoscaceres closed 6 years ago

marcoscaceres commented 6 years ago

closes #646

The following tasks have been completed:

Implementation commitment:

Impact on Payment Handler spec?


Preview | Diff

marcoscaceres commented 6 years ago

Blocking on @aestes review/feedback. This is primarily to align with Apple Pay so really need someone from Apple to approve it.

marcoscaceres commented 6 years ago

Gecko tracking bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1474499

marcoscaceres commented 6 years ago

WebKit implementation: https://trac.webkit.org/changeset/226766

marcoscaceres commented 6 years ago

Added tests for constructor and for onmerchantvalidation attribute: https://github.com/web-platform-tests/wpt/pull/12424 and https://github.com/web-platform-tests/wpt/pull/12423

marcoscaceres commented 6 years ago

@aestes, wrote:

This looks good, although I was surprised to see that MerchantValidationEvent.validationURL can be initialized from the eventInitDict. Is that there for payment handlers' sake?

It's not handler related - but could be used there too, I guess: It used to be a requirement in the DOM Spec that there be a 1:1 relationship between initialization dictionary members and Event interface attributes.

@domenic, I see this has now changed in the inner event creation steps. It seems that requirement was loosened up a bit:

For each member → value in dictionary, if event has an attribute whose identifier is member, then initialize that attribute to value.

Or does the 1:1 relationship rule still hold?

@aestes, the .complete() still rely on .isTrusted - so IMO it would still be good to define how URLs are resolved when the MerchantValidationEvent is constructed (even if constructed unsafely in JS).

marcoscaceres commented 6 years ago

@domenic requesting prioritization on this when you have time, as currently I'm working on an implementation in Gecko - so would really appreciate your review.

domenic commented 6 years ago

The idea is still to have 1:1, but there are a few legacy exceptions we worked to accomodate with that clause.

Will do a full review tomorrow!

marcoscaceres commented 6 years ago

@domenic, hopefully better now :/

marcoscaceres commented 6 years ago

Third time lucky 🤞