Sha256: b4eaf2534319bda3d12f90915797b24b1663a7327becc111d7b8e5f46c138509
Contents?: true
Size: 754 Bytes
Versions: 3
Compression:
Stored size: 754 Bytes
Contents
module RockRMS module Response class Transaction < Base MAP = { id: 'Id', date: 'TransactionDateTime', person_id: 'AuthorizedPersonAliasId', batch_id: 'BatchId', recurring_donation_id: 'ScheduledTransactionId', summary: 'Summary', transaction_code: 'TransactionCode', details: 'TransactionDetails' }.freeze def format_single(data) response = to_h(MAP, data) response[:details] = TransactionDetail.format(response[:details]) response[:amount] = calculate_total(response[:details]) response end def calculate_total(details) details.reduce(0) { |sum, td| sum + td[:amount] } end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rock_rms-3.0.2 | lib/rock_rms/response/transaction.rb |
rock_rms-3.0.1 | lib/rock_rms/response/transaction.rb |
rock_rms-3.0.0 | lib/rock_rms/response/transaction.rb |