Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behavior for multiple modifiers for the same payment method is not defined #309

Closed
nickjshearer opened this issue Nov 14, 2016 · 5 comments · Fixed by #581
Closed

Behavior for multiple modifiers for the same payment method is not defined #309

nickjshearer opened this issue Nov 14, 2016 · 5 comments · Fixed by #581
Assignees
Milestone

Comments

@nickjshearer
Copy link

Currently the specification defines a PaymentDetailsModifier sequence which can be used to apply modifications to the total and display items as appropriate for the currently selected payment method:

https://w3c.github.io/browser-payment-api/#dom-paymentdetailsmodifier

However, the specification does not define the user agent behavior in the case where this sequence contains multiple PaymentDetailsModifier objects for the same payment method. This needs to be defined, otherwise user agents risk implementing differing behaviors that could result in incorrect amounts being charged.

I would suggest since this is a sequence stating the first entry to match a payment method will be used as its modifier.

Alternatively, we could say supplying multiple modifiers for a single payment instrument is not allowed and throw a TypeError.

@tommythorsen
Copy link
Member

I would vote for the last one, throwing a TypeError for the case where there are multiple modifiers for one payment method. It seems to be the simplest way avoid confusion and to get correct and consistent behavior.

@rsolomakhin
Copy link
Collaborator

I'm OK either way.

@ianbjacobs
Copy link
Collaborator

How does the spec address similar questions of "multiple instances"? In discussion about basic card filters (cf Zach's proposal [1], which is partially implemented, the expectation is set taht
the mediator will take a "first match wins" approach.

Ian

[1] https://github.com/w3c/webpayments/blob/gh-pages/proposals/zach-pmi.md

@zkoch zkoch added this to the CR milestone Mar 15, 2017
@zkoch
Copy link
Contributor

zkoch commented Mar 29, 2017

I would prefer we don't throw. @domenic is it conventional to take the first match or the last match?

@domenic
Copy link
Collaborator

domenic commented Mar 30, 2017

I can't find too many precedents, but I think first match wins is reasonable.

Most precedents I can find (e.g. referrer policy headers, CSS) are about "last supported value" semantics. See e.g. https://w3c.github.io/webappsec-referrer-policy/#unknown-policy-values. But that doesn't apply here; the problem is differently structured.

@marcoscaceres marcoscaceres self-assigned this May 16, 2017
marcoscaceres added a commit that referenced this issue Aug 10, 2017
* Validate supportedMethods (closes #464)
* Defines behavior for duplicate PMIs in contructor and updateWith() (closes #309)
marcoscaceres added a commit that referenced this issue Aug 18, 2017
* Validate supportedMethods (closes #464)
* Defines behavior for duplicate PMIs in contructor and updateWith() (closes #309)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants