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

Validate PMIs, ignore duplicates #581

Merged
merged 5 commits into from
Aug 31, 2017
Merged

Conversation

marcoscaceres
Copy link
Member

@marcoscaceres marcoscaceres commented Aug 10, 2017


Preview | Diff

@marcoscaceres
Copy link
Member Author

Working on tests... will update OP as I send them to the WPT repo.

@adrianhopebailie
Copy link
Collaborator

adrianhopebailie commented Aug 11, 2017

@zkoch and @adrianba can you confirm that this matches the implementation on Edge and Chrome.

I read the proposed text to not allow this:

new PaymentRequest(
  [
    {
      supportedMethods: "basic-card",
      data: {
        supportedTypes: ["debit"],
        supportedNetworks: ["visa", "amex"],
      }
    },
    {
      supportedMethods: "basic-card",
      data: {
         supportedTypes: ["credit"],
      }
    },
  ],
  details
);

...implying, I accept credit cards from all networks but debit cards only from VISA and Mastercard.

I think that is a mistake.

@ianbjacobs
Copy link
Collaborator

If @adrianhopebailie is correct, then I agree there is an issue because that is behavior we sought to enable.

@marcoscaceres
Copy link
Member Author

Please see also: w3c/payment-method-basic-card#36 (comment)

@marcoscaceres
Copy link
Member Author

Questions is, how often does @adrianhopebailie's straw-person occur? and, given that .data is acting as a hint, should the merchant in that case just accept all things in a network (both credit and debit). If it's rare (e.g. 1% of the time), I'm still inclined to "use first matching".

I've never encountered this in the wild - so I'm curious.

@ianbjacobs
Copy link
Collaborator

@mattsaxon, @mountainhippo, @lyverovski, could you provide information about the scenario @adrianhopebailie describes, something like "I accept credit cards from all networks but debit cards only from VISA and Mastercard."

Thanks!

Ian

@marcoscaceres
Copy link
Member Author

@zkoch, opinions? What are you seeing on the Chrome side or hearing from merchants? Is the situation in #581 (comment) rare?

Copy link
Collaborator

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EDITORIALLY, lgtm with nits. It seems like people are still discussing the behavior from a normative perspective.

index.html Outdated
@@ -519,8 +519,35 @@
then <a>throw</a> a <a>TypeError</a>, optionally informing the
developer that at least one <a>payment method</a> is required.
</li>
<li>Let <var>seenPMIs</var> be an emtpy list.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: "empty" misspelled

index.html Outdated
the developer that the payment method identifier is
invalid.
</li>
<li>If <a>seenPMIs</a> contains
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<a> -> <var>

index.html Outdated
@@ -2520,6 +2559,20 @@
exception, then <a>abort the update</a> with that
exception.
</li>
<li>If <a>seenPMIs</a> contains
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<a> -> <var>

@marcoscaceres
Copy link
Member Author

@dontcallmedom, seems the IPR bot is stuck again🕵️‍♀️

@dontcallmedom
Copy link
Member

Marked as substantive for IPR from ash-nazg.

@dontcallmedom
Copy link
Member

@marcoscaceres fixed ; if you have other PRs stuck that way, let me know - this was due to the previous temporary breakage.

@marcoscaceres
Copy link
Member Author

Discussed on the editor's call today, we will modify the algorithm to take multiple "supportedNetworks". In the Basic Card spec we will then only use the first matching supportedTypes, followed by supportedNetworks, to avoid ambiguity.

* Validate supportedMethods (closes #464)
* Defines behavior for duplicate PMIs in contructor and updateWith() (closes #309)
@adrianhopebailie
Copy link
Collaborator

Discussed on the editor's call today, we will modify the algorithm to take multiple "supportedNetworks". In the Basic Card spec we will then only use the first matching supportedTypes, followed by supportedNetworks, to avoid ambiguity.

This seems relevant to Basic Card not Payment Request. Does that mean changes are still needed for PR?

@marcoscaceres
Copy link
Member Author

Does that mean changes are still needed for PR?

Yes, but just the validation of the PMI.

@marcoscaceres
Copy link
Member Author

Added missing tests. web-platform-tests/wpt#7021

@marcoscaceres
Copy link
Member Author

Blocked awaiting test review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

validate supportedMethods Behavior for multiple modifiers for the same payment method is not defined
5 participants