Method: ICAP.calculate_icap
- Defined in:
- lib/icap.rb
.calculate_icap(bban) ⇒ Object
Calculates the ICAP from BBAN
Example:
>> ICAP::calculate_icap ICAP::calculate_bban "0x000072B1A5F4864C2BA2b14471e48Cc118264794"
=> "XE43 9JD3 UD9B FMRC RDS1 IC6B S5MT AQ38"
Arguments:
bban: (String)
58 59 60 61 62 63 64 65 66 |
# File 'lib/icap.rb', line 58 def self.calculate_icap bban country_code = "XE" checksum = calculate_iban_checksum country_code, bban result = "#{country_code}#{checksum}#{bban}" result.gsub!(/(.{4})(?=.)/, '\1 \2') return result end |