@@ -41,6 +41,16 @@ class CreditCard < Base
4141 # @return [String, nil]
4242 attr_accessor :bank_phone_number
4343
44+ # The two character ISO 3166-1 alpha-2 country code where the issuer of
45+ # the card is located. This may be passed instead of {::issuer_id_number}
46+ # if you do not wish to pass partial account numbers, or if your payment
47+ # processor does not provide them.
48+ #
49+ # @see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
50+ #
51+ # @return [String, nil]
52+ attr_accessor :country
53+
4454 # A token uniquely identifying the card. The token should consist of
4555 # non-space printable ASCII characters. If the token is all digits, it
4656 # must be more than 19 characters long. The token must not be a primary
@@ -96,6 +106,7 @@ def last_4_digits=(last4)
96106 # correspond to one of the available attributes.
97107 def initialize ( params = { } )
98108 @bank_phone_country_code = params [ :bank_phone_country_code ]
109+ @country = params [ :country ]
99110 @issuer_id_number = params [ :issuer_id_number ]
100111 @last_digits = params [ :last_digits ] || params [ :last_4_digits ]
101112 @bank_name = params [ :bank_name ]
@@ -114,6 +125,7 @@ def validate
114125 return if !Minfraud . enable_validation
115126
116127 validate_telephone_country_code ( 'bank_phone_country_code' , @bank_phone_country_code )
128+ validate_country_code ( 'country' , @country )
117129 validate_regex ( 'issuer_id_number' , /\A (?:[0-9]{6}|[0-9]{8})\z / , @issuer_id_number )
118130 validate_regex ( 'last_digits' , /\A (?:[0-9]{2}|[0-9]{4})\z / , @last_digits )
119131 validate_string ( 'bank_name' , 255 , @bank_name )
0 commit comments