forked from sorentwo/braintree-elixir
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for nested credit card creation
- Loading branch information
Showing
7 changed files
with
213 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
defmodule Braintree.CreditCard do | ||
|
||
@type timestamp :: {{integer, integer, integer}, {integer, integer, integer}} | ||
|
||
@type t :: %__MODULE__{ | ||
bin: String.t, | ||
card_type: String.t, | ||
cardholder_name: String.t, | ||
commercial: String.t, | ||
country_of_issuance: String.t, | ||
customer_id: String.t, | ||
customer_location: String.t, | ||
debit: String.t, | ||
default: String.t, | ||
durbin_regulated: String.t, | ||
expiration_month: String.t, | ||
expiration_year: String.t, | ||
expired: String.t, | ||
healthcare: String.t, | ||
image_url: String.t, | ||
issuing_bank: String.t, | ||
last_4: String.t, | ||
payroll: String.t, | ||
prepaid: String.t, | ||
token: String.t, | ||
unique_number_identifier: String.t, | ||
created_at: timestamp, | ||
updated_at: timestamp, | ||
venmo_sdk: boolean, | ||
subscriptions: [], | ||
verifications: [] | ||
} | ||
|
||
defstruct bin: nil, | ||
card_type: nil, | ||
cardholder_name: nil, | ||
commercial: "Unknown", | ||
country_of_issuance: "Unknown", | ||
customer_id: nil, | ||
customer_location: nil, | ||
debit: "Unknown", | ||
default: false, | ||
durbin_regulated: "Unknown", | ||
expiration_month: nil, | ||
expiration_year: nil, | ||
expired: nil, | ||
healthcare: "Unknown", | ||
image_url: nil, | ||
issuing_bank: "Unknown", | ||
last_4: nil, | ||
payroll: "Unknown", | ||
prepaid: "Unknown", | ||
token: nil, | ||
unique_number_identifier: nil, | ||
created_at: nil, | ||
updated_at: nil, | ||
venmo_sdk: "Unknown", | ||
subscriptions: [], | ||
verifications: [] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
defmodule Braintree.Test.CreditCardNumbers do | ||
@moduledoc """ | ||
# The functions contained in the Braintree.Test.CreditCardNumbers module | ||
# provide credit card numbers that should be used when working in the sandbox | ||
# environment. The sandbox will not accept any credit card numbers other than | ||
# the ones listed below. | ||
# | ||
# See http://www.braintreepayments.com/docs/ruby/reference/sandbox | ||
""" | ||
|
||
def all do | ||
am_exes ++ | ||
carte_blanches ++ | ||
diners_clubs ++ | ||
discovers ++ | ||
jcbs ++ | ||
master_cards ++ | ||
unknowns ++ | ||
visas | ||
end | ||
|
||
def am_exes do | ||
~w(378282246310005 371449635398431 378734493671000) | ||
end | ||
|
||
def carte_blanches do | ||
~w(30569309025904) | ||
end | ||
|
||
def diners_clubs do | ||
~w(38520000023237) | ||
end | ||
|
||
def discovers do | ||
~w(6011111111111117 6011000990139424) | ||
end | ||
|
||
def jcbs do | ||
~w(3530111333300000 3566002020360505) | ||
end | ||
|
||
def master_cards do | ||
~w(5105105105105100 5555555555554444) | ||
end | ||
|
||
def unknowns do | ||
~w(1000000000000008) | ||
end | ||
|
||
def visas do | ||
~w(4009348888881881 4012888888881881 4111111111111111 4000111111111115 4500600000000061) | ||
end | ||
|
||
defmodule FailsSandboxVerification do | ||
@moduledoc """ | ||
These are vendor specific numbers that will always fail verification. | ||
""" | ||
|
||
def all do | ||
[am_ex, discover, master_card, visa] | ||
end | ||
|
||
def am_ex do | ||
"378734493671000" | ||
end | ||
|
||
def discover do | ||
"6011000990139424" | ||
end | ||
|
||
def master_card do | ||
"5105105105105100" | ||
end | ||
|
||
def visa do | ||
"4000111111111115" | ||
end | ||
end | ||
end |