Sha256: 13202e61fe25e2bf04a9b7d41df4d0ac2b20f187642cb0d0e772daa1a3350296

Contents?: true

Size: 591 Bytes

Versions: 2

Compression:

Stored size: 591 Bytes

Contents

module Faker
  module Russian
    module CorrespondentAccount
      def correspondent_account(options = {})
        options.assert_valid_keys(:sequence_number, :bik)

        sequence = find_sequence(options[:sequence_number])
        member_number = find_member_number(options[:bik], sequence)

        '301' + sprintf("%014d", sequence.rand(1_000_000_000)) + member_number
      end

    private

      def find_member_number(bik, sequence)
        if bik && bik.length > 3
          bik[-3..-1]
        else
          "%03d" % sequence.rand(1_000)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
faker-russian-0.0.6 lib/faker/russian/correspondent_account.rb
faker-russian-0.0.5 lib/faker/russian/correspondent_account.rb