@@ -21,14 +21,12 @@ class CreditCard < Base
2121 # @return [String, nil]
2222 attr_accessor :last_digits
2323
24- # The last digits of the credit card number. This is the last 4
25- # digits if the issuer ID number is 6 digits, or the last 2 digits
26- # if the issuer ID number is 8 digits.
24+ # The last four digits of the credit card number.
2725 #
2826 # @deprecated Use {::last_digits} instead.
2927 #
3028 # @return [String, nil]
31- alias last_4_digits last_digits
29+ attr_accessor : last_4_digits
3230
3331 # The name of the issuing bank as provided by the end user.
3432 #
@@ -89,6 +87,7 @@ def initialize(params = {})
8987 @bank_phone_country_code = params [ :bank_phone_country_code ]
9088 @issuer_id_number = params [ :issuer_id_number ]
9189 @last_digits = params [ :last_digits ] || params [ :last_4_digits ]
90+ @last_4_digits = @last_digits
9291 @bank_name = params [ :bank_name ]
9392 @bank_phone_number = params [ :bank_phone_number ]
9493 @avs_result = params [ :avs_result ]
@@ -107,6 +106,7 @@ def validate
107106 validate_telephone_country_code ( 'bank_phone_country_code' , @bank_phone_country_code )
108107 validate_regex ( 'issuer_id_number' , /\A (?:[0-9]{6}|[0-9]{8})\z / , @issuer_id_number )
109108 validate_regex ( 'last_digits' , /\A (?:[0-9]{2}|[0-9]{4})\z / , @last_digits )
109+ validate_regex ( 'last_4_digits' , /\A (?:[0-9]{2}|[0-9]{4})\z / , @last_4_digits )
110110 validate_string ( 'bank_name' , 255 , @bank_name )
111111 validate_string ( 'bank_phone_number' , 255 , @bank_phone_number )
112112 validate_string ( 'avs_result' , 1 , @avs_result )
0 commit comments