{"action":"opened","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/26436","repository_url":"https://api.github.com/repos/symfony/symfony","labels_url":"https://api.github.com/repos/symfony/symfony/issues/26436/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/26436/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/26436/events","html_url":"https://github.com/symfony/symfony/issues/26436","id":302996163,"number":26436,"title":"Deprecate CardScheme and Luhn validators in favor of a new Card validator","user":{"login":"javiereguiluz","id":73419,"avatar_url":"https://avatars3.githubusercontent.com/u/73419?v=4","gravatar_id":"","url":"https://api.github.com/users/javiereguiluz","html_url":"https://github.com/javiereguiluz","followers_url":"https://api.github.com/users/javiereguiluz/followers","following_url":"https://api.github.com/users/javiereguiluz/following{/other_user}","gists_url":"https://api.github.com/users/javiereguiluz/gists{/gist_id}","starred_url":"https://api.github.com/users/javiereguiluz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javiereguiluz/subscriptions","organizations_url":"https://api.github.com/users/javiereguiluz/orgs","repos_url":"https://api.github.com/users/javiereguiluz/repos","events_url":"https://api.github.com/users/javiereguiluz/events{/privacy}","received_events_url":"https://api.github.com/users/javiereguiluz/received_events","type":"User","site_admin":false},"labels":[{"id":337186922,"url":"https://api.github.com/repos/symfony/symfony/labels/Deprecation","name":"Deprecation","color":"f1c40f","default":false},{"id":100378,"url":"https://api.github.com/repos/symfony/symfony/labels/Feature","name":"Feature","color":"02e10c","default":false},{"id":99599,"url":"https://api.github.com/repos/symfony/symfony/labels/Validator","name":"Validator","color":"DDDDDD","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-07T07:50:19Z","updated_at":"2018-03-07T07:50:19Z","closed_at":null,"author_association":"MEMBER","body":"| Q                | A\r\n| ---------------- | -----\r\n| Bug report?      | no\r\n| Feature request? | yes\r\n| BC Break report? | no\r\n| RFC?             | no\r\n| Symfony version  | 4.1\r\n\r\nI don't use it often, but today I realized that our credit card validators could be a bit friendlier. In my opinion, they are overengineered (you need to use two different validators: scheme and luhn) and a bit pedantic (because they use the most technically correct term *\"luhn algorithm validator\"* to refer to something that everybody calls *\"credit card number validator\"*).\r\n\r\nI propose to deprecate `CardScheme` and `Luhn` validators and merge them into a new `Card` validator. The \"card\" term is more correct than \"credit card\" (and it's used by experts in the field like Stripe) because there are several types of cards, so `CreditCard` constraint would be confusing for \"debit cards\" for example.\r\n\r\n### Before\r\n\r\n```php\r\nuse Symfony\\Component\\Validator\\Constraints\\CardScheme;\r\nuse Symfony\\Component\\Validator\\Constraints\\Luhn;\r\n\r\nclass Transaction\r\n{\r\n    /**\r\n     * @CardScheme(\r\n     *     schemes={\"VISA\"},\r\n     *     message=\"Only VISA cards are accepted.\"\r\n     * )\r\n     * @Luhn(message=\"The credit card number is wrong.\")\r\n     */\r\n    protected $cardNumber;\r\n}\r\n```\r\n\r\n### After\r\n\r\n```php\r\nuse Symfony\\Component\\Validator\\Constraints\\Card;\r\n\r\nclass Transaction\r\n{\r\n    /**\r\n     * @Card(\r\n     *     schemes={\"VISA\"},\r\n     *     schemeMessage=\"Only VISA cards are accepted.\",\r\n     *     message=\"The credit card number is wrong.\"\r\n     * )\r\n     */\r\n    protected $cardNumber;\r\n}\r\n```\r\n\r\nThe `@Card` constraint would have these options:\r\n\r\n  * `schemes`, same as `CardScheme`\r\n  * `schemeMessage`, equivalent to `message` from `CardScheme`\r\n  * `message`, same as `Luhn`\r\n  * `payload`, same as `CardScheme` and `Luhn`\r\n\r\n-----\r\n\r\nBy the way, in case this proposal is accepted and we want to fix other things, Wikipedia says that our \"schemes\" option is called \"issuers\" (https://en.wikipedia.org/wiki/Payment_card_number) and Stripe calls it \"brands\" (https://stripe.com/docs/testing#cards)."}}
{"actor":{"display_login":"javiereguiluz"}}