Class: Bambora::Builders::BatchPaymentCSV

Inherits:
Object
  • Object
show all
Defined in:
lib/bambora/builders/batch_payment_csv.rb

Class Method Summary collapse

Class Method Details

.build(transactions) ⇒ String

Return a CSV with one transaction per row.

Examples:

Bambora::Builders::BatchPaymentCSV.build([{
  super_type: 'E',
  transaction_type: 'D',
  institution_number: 12345,
  transit_number: 123,
  account_number: 1223456789,
  amount: 10000
  reference_nubmer: 1234,
  recipient_name: 'Hup Podling',
  customer_code: '02355E2e58Bf488EAB4EaFAD7083dB6A',
  dynamic_description: 'The Skeksis',
}])

# => "E,D,12345,123,123456789,10000,1234,Hup Podling,02355E2e58Bf488EAB4EaFAD7083dB6A,The Skeksis\n"

Parameters:

  • transactions (Array)

    an array of transaciton hashes.

Returns:

  • (String)

    , a CSV as a string

See Also:



31
32
33
34
35
36
37
# File 'lib/bambora/builders/batch_payment_csv.rb', line 31

def build(transactions)
  CSV.generate(row_sep: "\r\n") do |csv|
    transactions.each do |transaction|
      csv << transaction.values
    end
  end
end