Sha256: 115911e16a31b12ccec7b120bdbb4a821ad5328d76f88ad0141a46863e79d320
Contents?: true
Size: 1 KB
Versions: 4
Compression:
Stored size: 1 KB
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', payment_details: 'FinancialPaymentDetail', payment_detail_id: 'FinancialPaymentDetailId', transaction_type_id: 'TransactionTypeValueId' }.freeze def format_single(data) response = to_h(MAP, data) response[:details] = TransactionDetail.format(response[:details]) response[:payment_details] = PaymentMethod.format(response[:payment_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
4 entries across 4 versions & 1 rubygems