File tree Expand file tree Collapse file tree 3 files changed +11
-24
lines changed
Expand file tree Collapse file tree 3 files changed +11
-24
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,8 @@ def validate
115115
116116 validate_telephone_country_code ( 'bank_phone_country_code' , @bank_phone_country_code )
117117 validate_regex ( 'issuer_id_number' , /\A (?:[0-9]{6}|[0-9]{8})\z / , @issuer_id_number )
118- validate_last_digits ( 'last_digits' , @last_digits , @issuer_id_number )
118+ validate_regex ( 'last_digits' , /\A (?:[0-9]{2}|[0-9]{4})\z / , @last_digits )
119+ validate_regex ( 'last_4_digits' , /\A (?:[0-9]{2}|[0-9]{4})\z / , @last_4_digits )
119120 validate_string ( 'bank_name' , 255 , @bank_name )
120121 validate_string ( 'bank_phone_number' , 255 , @bank_phone_number )
121122 validate_string ( 'avs_result' , 1 , @avs_result )
Original file line number Diff line number Diff line change @@ -70,18 +70,6 @@ def validate_credit_card_token(field, value)
7070 end
7171 end
7272
73- def validate_last_digits ( field , value , iin )
74- return if !value
75-
76- if !value . to_s . match ( /\A (?:[0-9]{2}|[0-9]{4})\z / )
77- raise InvalidInputError , "The #{ field } value is not valid. It must be two or four digits."
78- end
79-
80- if iin . length == 8 && value . length != 2
81- raise InvalidInputError , "The #{ field } value is not valid. It must be two digits when using an eight digit issuer_id_number."
82- end
83- end
84-
8573 def validate_custom_input_value ( field , value )
8674 return if !value
8775
Original file line number Diff line number Diff line change 4848 end . to raise_exception ( Minfraud ::InvalidInputError )
4949 end
5050
51- it 'raises an exception for invalid values (eight digit issuer_id_number + 4 digit last_digits)' do
52- expect do
53- Minfraud ::Components ::CreditCard . new (
54- issuer_id_number : '12345678' ,
55- last_digits : '1234' ,
56- token : 'abcd' ,
57- was_3d_secure_successful : true ,
58- )
59- end . to raise_exception ( Minfraud ::InvalidInputError )
60- end
61-
6251 it 'does not raise an exception for valid values (deprecated last_4_digits)' do
6352 @cc = Minfraud ::Components ::CreditCard . new (
6453 issuer_id_number : '123456' ,
7059 expect ( @cc . last_digits ) . to be ( '1234' )
7160 end
7261
62+ it 'does not raise an exception for valid values (eight digit issuer_id_number)' do
63+ Minfraud ::Components ::CreditCard . new (
64+ issuer_id_number : '12345678' ,
65+ last_4_digits : '1234' ,
66+ token : 'abcd' ,
67+ was_3d_secure_successful : true ,
68+ )
69+ end
70+
7371 it 'does not raise an exception for valid values (two digit last_digits)' do
7472 @cc = Minfraud ::Components ::CreditCard . new (
7573 issuer_id_number : '12345678' ,
You can’t perform that action at this time.
0 commit comments