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

feat: add card type of jcb and diners club #61

Merged
merged 1 commit into from
Feb 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Supported tag:


**Payment :**
* Credit Card Type (VISA, MASTERCARD, AMERICAN EXPRESS, DISCOVER)
* Credit Card Type (VISA, MASTERCARD, AMERICAN EXPRESS, DISCOVER, JCB, DINERS CLUB)
* Credit Card Number

**Address :**
Expand Down
4 changes: 3 additions & 1 deletion payment.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ 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}},
"jcb": {"JCB", 16, []int{3528, 3538, 3548, 3558, 3568, 3578, 3588}},
"diners club": {"Diners Club", 14, []int{36, 38, 39}},
}

var pay Render
Expand Down Expand Up @@ -69,7 +71,7 @@ func (p Payment) cctype() string {
}

// CreditCardType returns one of the following credit values:
// VISA, MasterCard, American Express and Discover
// VISA, MasterCard, American Express, Discover, JCB and Diners Club
func (p Payment) CreditCardType(v reflect.Value) (interface{}, error) {
return p.cctype(), nil
}
Expand Down