lib/ibandit/local_details_cleaner.rb in ibandit-1.1.0.1 vs lib/ibandit/local_details_cleaner.rb in ibandit-1.2.0
- old
+ new
@@ -87,20 +87,22 @@
account_number: account_number,
}
end
def self.clean_ca_details(local_details)
- return {} if local_details[:account_number].length < 7 # minimum length
+ account_number = local_details[:account_number].tr("-", "")
+ return {} if account_number.length < 7 # minimum length
+
bank_code = if local_details[:bank_code].length == 3
local_details[:bank_code].rjust(4, "0")
else
local_details[:bank_code]
end
{
- account_number: local_details[:account_number].rjust(12, "0"),
+ account_number: account_number.rjust(12, "0"),
bank_code: bank_code,
}
end
def self.clean_us_details(local_details)
@@ -510,10 +512,10 @@
# by SWIFT, or a single 26 digit string.
if local_details[:bank_code]
bank_code = local_details[:bank_code]
account_number = local_details[:account_number]
else
- cleaned_acct_number = local_details[:account_number].gsub(/[\s]/, "")
+ cleaned_acct_number = local_details[:account_number].gsub(/\s/, "")
bank_code = cleaned_acct_number.slice(2, 8)
account_number = cleaned_acct_number[10..-1]
end