{"id":16108682,"url":"https://github.com/aliosm/credit_debit_card_number_validator","last_synced_at":"2025-09-11T22:35:49.943Z","repository":{"id":62556380,"uuid":"68313494","full_name":"AliOsm/credit_debit_card_number_validator","owner":"AliOsm","description":"A simple way to validate credit/debit card number using ruby","archived":false,"fork":false,"pushed_at":"2018-09-30T10:23:42.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-09T05:08:25.942Z","etag":null,"topics":["creditcard-validator","luhn-algorithm","ruby-gem"],"latest_commit_sha":null,"homepage":"http://cdcnv.herokuapp.com","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AliOsm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-15T16:58:20.000Z","updated_at":"2018-09-30T10:23:44.000Z","dependencies_parsed_at":"2022-11-03T05:45:46.698Z","dependency_job_id":null,"html_url":"https://github.com/AliOsm/credit_debit_card_number_validator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AliOsm/credit_debit_card_number_validator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AliOsm%2Fcredit_debit_card_number_validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AliOsm%2Fcredit_debit_card_number_validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AliOsm%2Fcredit_debit_card_number_validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AliOsm%2Fcredit_debit_card_number_validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AliOsm","download_url":"https://codeload.github.com/AliOsm/credit_debit_card_number_validator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AliOsm%2Fcredit_debit_card_number_validator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274718924,"owners_count":25337236,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-11T02:00:13.660Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["creditcard-validator","luhn-algorithm","ruby-gem"],"created_at":"2024-10-09T19:27:51.122Z","updated_at":"2025-09-11T22:35:49.917Z","avatar_url":"https://github.com/AliOsm.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CreditDebitCardNumberValidator\nOur gem check any credit/debit card number by determining its brand using IIN Ranges and validate it using Luhn algorithm.\n\nTry it now! from [here](http://cdcnv.herokuapp.com/).\n\n### More about BIN numbers and IIN Ranges:\n- http://en.wikipedia.org/wiki/Payment_card_number\n- http://www.iinbase.com\n\n### More about Luhn algorithm:\n- https://en.wikipedia.org/wiki/Luhn_algorithm\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'credit_debit_card_number_validator'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install credit_debit_card_number_validator\n\n## Accepted Brands\n\n- American Express\n- Bankcard\n- CARDGUARD\n- China UnionPay\n- Dancord\n- Diners Club Carte Blanche\n- Diners Club enRoute\n- Diners Club International\n- Discover Card\n- Hipercard\n- InstaPayment\n- InterPayment\n- JCB\n- Laser\n- Maestro\n- Master Card\n- RuPay\n- Solo\n- Switch\n- UATP\n- Verve\n- Visa Electron\n- Visa\n- Voyager\n\n## Usage\n\n#### Example using `Validator` class\n\n##### class method \u003e all_information_about\n\n```ruby\nmy_card = CreditDebitCardNumberValidator::Validator.all_information_about('348998173777802')\n\nmy_card.card_number   # 348998173777802\n# my_card.card_number contain card number\n\nmy_card.is_valid      # true\n# my_card.is_valid contain luhn algorithm result\n\nmy_card.mod_10_result # 0\n# my_card.mod_10_result contain mod 10 result from luhn algorithm\n\nmy_card.iin           # 34\n# my_card.iin contain IIN Range\n\nmy_card.brand         # American Express\n# my_card.brand contain card brand\n\nmy_card.check_digit   # 2\n# my_card.check_digit contain the next check digit of card number\n\nmy_card.length        # 15\n# my_card.length contain card number length\n```\n\nGathering every information about card number and return them in object of type `Information` class.\n\nReturn type: `Information` class object.\n\n----------\n\n##### class method \u003e validate\n\n```ruby\nmy_validation = CreditDebitCardNumberValidator::Validator.validate('6264185212922132067')\n\nmy_validation[0] # true\n# my_validation[0] contain luhn algorithm result\n\nmy_validation[1] # 0\n# my_validation[1] contain mod 10 result from luhn algorithm\n```\n\nValidate card number using Luhn algorithm and return array contain true if the number pass the test or false otherwise with mod 10 result.\n\nReturn type: `Array`.\n\n----------\n\n##### class method \u003e luhn_test\n\n```ruby\nmy_luhn_test_result = CreditDebitCardNumberValidator::Validator.luhn_test('5019717010103742')\n\nmy_luhn_test_result # true\n# my_luhn_test_result contain luhn algorithm result\n```\n\nValidate card number using luhn algorithm and return true if the number pass the test or false otherwise.\n\nReturn type: `Boolean`.\n\n----------\n\n##### class method \u003e mod_10_result\n\n```ruby\nmy_mod_10_result = CreditDebitCardNumberValidator::Validator.mod_10_result('30350713037359')\n\nmy_mod_10_result # 0\n# my_mod_10_result contain mod 10 result from luhn algorithm\n```\n\nValidate card number using luhn algorithm and return mod 10 result.\n\nReturn type: `Integer`.\n\n----------\n\n##### class method \u003e determine_iin_and_brand\n\n```ruby\nmy_determine = CreditDebitCardNumberValidator::Validator.determine_iin_and_brand('6011622563605042')\n\nmy_determine[0] # 6011\n# my_determine[0] contain IIN Range\n\nmy_determine[1] # Discover Card\n# my_determine[1] contain card brand\n```\n\nDetermine card brand using IIN Ranges and return array contain the IIN of the card number and the brand name.\n\nReturn type: `Array`.\n\n----------\n\n##### class method \u003e determine_iin\n\n```ruby\nmy_determine = CreditDebitCardNumberValidator::Validator.determine_iin('3841005899088180330')\n\nmy_determine # 384\n# my_determine contain IIN Range\n```\n\nDetermine card IIN Ranges and return it.\n\nReturn type: `Integer`.\n\n----------\n\n##### class method \u003e determine_brand\n\n```ruby\nmy_determine = CreditDebitCardNumberValidator::Validator.determine_brand('6380654534552139')\n\nmy_determine # InstaPayment\n# my_determine contain card brand\n```\n\nDetermine card brand using IIN Ranges and return it.\n\nReturn type: `String`.\n\n----------\n\n##### class method \u003e next_check_digit\n\n```ruby\nmy_next_check_digit = CreditDebitCardNumberValidator::Validator.next_check_digit('3337910604152361')\n\nmy_next_check_digit # 3\n# my_next_check_digit contain the next check digit of card number\n```\n\nCalculate the next check digit of card number and return it.\n\nReturn type: `String`.\n\n----------\n\n##### class method \u003e next_check_digits\n\n```ruby\nmy_next_check_digits = CreditDebitCardNumberValidator::Validator.next_check_digits('6304445859171404', 5)\n\nmy_next_check_digits # 91834\n# my_next_check_digits contain the next check digits of card number\n```\n\nCalculate the next check digits of card number and return them.\n\nReturn type: `String`.\n\n----------\n\n##### class method \u003e number_length\n\n```ruby\nmy_card_number_length = CreditDebitCardNumberValidator::Validator.number_length('6799990100000000019')\n\nmy_card_number_length # 19\n# my_card_number_length contain card number length\n```\n\nCalculate and return card number length.\n\nReturn type: `Integer`.\n\n----------\n\n#### Example using `Information` class\n\nYou don't need to use `Information` class! only use the object returned from `all_information_about` class method from `Validator` class.\n\n## Contributing\nBug reports and pull requests are welcome on GitHub at https://github.com/AliOsm/credit_debit_card_number_validator.\n\n## License\nThe project is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faliosm%2Fcredit_debit_card_number_validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faliosm%2Fcredit_debit_card_number_validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faliosm%2Fcredit_debit_card_number_validator/lists"}