w3c / payment-request

Payment Request API
https://www.w3.org/TR/payment-request-1.1/
Other
482 stars 183 forks source link

Define concepts for converting and validating `.data` #977

Closed stephenmcgruer closed 1 year ago

stephenmcgruer commented 2 years ago

This PR introduces two new definitions (dfn) for both the IDL type that PaymentMethodData/data should be converted into, and for the validation steps that a payment method will perform on it. This allows payment method specs to define these in a way that is cross-linkable to the PaymentRequest specification.

This change is mostly editorial, except that it allows for arbitrary error types to be thrown during validation (previously only TypeError would be thrown).


Preview | Diff

stephenmcgruer commented 2 years ago

@marcoscaceres - fyi this is my suggestion for adding a dfn for https://github.com/w3c/payment-request/pull/976, to make it easier for other specifications to define their behaviour for it.

stephenmcgruer commented 2 years ago

cc @ianbjacobs as landing this blocks https://github.com/w3c/secure-payment-confirmation/issues/194

The build is currently failing because the upstream of this PR (https://github.com/w3c/payment-request/pull/976) is behind HEAD and needs updated to include https://github.com/w3c/payment-request/commit/34c206fdb8f88728ba1e9198d6bceb08860ed29f

stephenmcgruer commented 1 year ago

Noting this makes a couple of normative changes... in particular, it no longer exclusively throws a TypeError during the processing steps.

Good catch - thanks for noticing this! I've updated the PR description and title (along with addressing your other comments) to reflect that new errors may be thrown.