Class: RockRMS::Response::RecurringDonation

Inherits:
Base
  • Object
show all
Defined in:
lib/rock_rms/response/recurring_donation.rb

Constant Summary collapse

MAP =
{
  active: 'IsActive',
  financial_gateway_id: 'FinancialGatewayId',
  frequency: 'TransactionFrequencyValueId',
  end_date: 'EndDate',
  gateway_schedule_id: 'GatewayScheduleId',
  next_payment_date: 'NextPaymentDate',
  payment_details: 'FinancialPaymentDetail',
  person_id: 'AuthorizedPersonAliasId',
  previous_gateway_schedule_ids: 'PreviousGatewayScheduleIdsJson',
  start_date: 'StartDate',
  transaction_details: 'ScheduledTransactionDetails',
  transaction_code: 'TransactionCode',
  transaction_type_id: 'TransactionTypeValueId',
  summary: 'Summary',
  status: 'Status',
  status_message: 'StatusMessage',
}.freeze

Constants inherited from Base

Base::BASE_MAPPING

Instance Attribute Summary

Attributes inherited from Base

#data

Instance Method Summary collapse

Methods inherited from Base

format, #format, #format_attributes, #initialize, #to_h

Constructor Details

This class inherits a constructor from RockRMS::Response::Base

Instance Method Details

#find_frequency_by_id(type_id) ⇒ Object



31
32
33
# File 'lib/rock_rms/response/recurring_donation.rb', line 31

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

#format_single(data) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/rock_rms/response/recurring_donation.rb', line 23

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