Sha256: 2e2bec1170cd134e895a5fddca79c9681e450d5fe8a2b3f8311af979f1b94551

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

module RockRMS
  module Response
    class RecurringDonation < Base
      MAP = {
        id: 'Id',
        active: 'IsActive',
        financial_gateway_id: 'FinancialGatewayId',
        foreign_key: 'ForeignKey',
        frequency: 'TransactionFrequencyValueId',
        gateway_schedule_id: 'GatewayScheduleId',
        next_payment_date: 'NextPaymentDate',
        payment_details: 'FinancialPaymentDetail',
        person_id: 'AuthorizedPersonAliasId',
        start_date: 'StartDate',
        transaction_details: 'ScheduledTransactionDetails',
        transaction_code: 'TransactionCode',
        transaction_type_id: 'TransactionTypeValueId',
        summary: 'Summary'
      }.freeze

      def format_single(data)
        result = to_h(MAP, data)
        result[:frequency]           = find_frequency_by_id(result[:frequency])
        result[:transaction_details] = RecurringDonationDetails.format(result[:transaction_details])
        result[:payment_details]     = PaymentDetail.format(result[:payment_details])
        result
      end

      def find_frequency_by_id(type_id)
        RecurringFrequencies::RECURRING_FREQUENCIES.key(type_id)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rock_rms-5.14.0 lib/rock_rms/response/recurring_donation.rb
rock_rms-5.13.0 lib/rock_rms/response/recurring_donation.rb
rock_rms-5.12.0 lib/rock_rms/response/recurring_donation.rb
rock_rms-5.11.0 lib/rock_rms/response/recurring_donation.rb