Skip to content

ritvikroy/golang-credit-card

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Golang-credit-card

It validates credit card details, display credit card types and reduces human error using the Luhn algorithm with REST APIs.

MIT License Go Doc Go Report Card

Basic credit card validation using the Luhn algorithm

Currently identifies the following credit card companies:

  • American Express
  • MasterCard
  • Visa
  • Visa Electron

Installation

$ git clone git@github.com:bitcyber/golang-credit-card.git

OR

$ go get github.com/bitcyber/golang-credit-card

Downloads

Download all go-gettable dependencies for your project.

$ go get -d ./... 

Quick Start

Run this command on Terminal after installation

$ go run main.go

Once the application is running, navigate to http://localhost:3000 in your browser. If all went well, you should see level 1 header text Welcome to the Credit Card Validation displayed.

REST API: Show Credit Card Validation

Returns json data about a single credit card.

  • URL

    http://localhost:3000/card-scheme/verify/:cardNumber
  • Method:

    GET

  • URL Params

    Required:

    cardNumber=[integer]

  • Data Params

    None

  • Success Response:

    • Code: 200
      Content: { "success" : "true", "valid": "true", "scheme": "AMEX/VISA/MASTERCARD" }

      OR

    • Code: 200
      Content: { "INVALID CARD NUMBER" }

  • Error Response:

    • Code: 404 NOT FOUND
      Content: { 404 page not found }
  • Sample Request:

    http://localhost:3000/card-scheme/verify/373473833566829
  • Sample Response:

      {
      "success": "true",
      "valid": "true",
      "scheme": "AMEX"
      }

Contributing ✨

Any help and suggestions are very welcome and appreciated.

About

A credit card validator in golang with REST APIs

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published