Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Commit

Permalink
chore: remove duplicate creditCard definitions. (#53)
Browse files Browse the repository at this point in the history
chore: remove duplicate creditCard definitions.
  • Loading branch information
Michael McAllister authored and bxcodec committed Jan 31, 2019
1 parent 16dcad9 commit 6b3ea06
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions payment.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"math/rand"
"reflect"
"strconv"
"strings"
)

const (
Expand All @@ -22,10 +23,6 @@ var creditCards = map[string]creditCard{
"mastercard": {"MasterCard", 16, []int{51, 52, 53, 54, 55}},
"american express": {"American Express", 15, []int{34, 37}},
"discover": {"Discover", 16, []int{6011}},
"VISA": {"VISA", 16, []int{4539, 4556, 4916, 4532, 4929, 40240071, 4485, 4716, 4}},
"MasterCard": {"MasterCard", 16, []int{51, 52, 53, 54, 55}},
"American Express": {"American Express", 15, []int{34, 37}},
"Discover": {"Discover", 16, []int{6011}},
}

var pay Render
Expand Down Expand Up @@ -80,7 +77,7 @@ func (p Payment) CreditCardType(v reflect.Value) (interface{}, error) {
func (p Payment) ccnumber() string {
ccType := p.cctype()
cacheCreditCard = ccType
card := creditCards[ccType]
card := creditCards[strings.ToLower(ccType)]
prefix := strconv.Itoa(card.prefixes[rand.Intn(len(card.prefixes))])

num := prefix
Expand Down

0 comments on commit 6b3ea06

Please sign in to comment.