Sha256: 759fba3e5515195335f6718dc5ed1d7b7936d8c3ca336fe9ba859a85529b5af5

Contents?: true

Size: 1.2 KB

Versions: 56

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

module RockRMS
  class Client
    module RecurringDonationDetail
      def create_recurring_donation_detail(
        recurring_donation_id:,
        fee_coverage_amount: nil,
        fund_id:,
        amount:
      )
        options = {
          'AccountId' => fund_id,
          'Amount' => amount,
          'ScheduledTransactionId' => recurring_donation_id
        }

        options['FeeCoverageAmount'] = fee_coverage_amount if fee_coverage_amount

        post(recurring_donation_detail_path, options)
      end

      def delete_recurring_donation_detail(id)
        delete(recurring_donation_detail_path(id))
      end

      def update_recurring_donation_detail(id, fund_id: nil, amount: nil, fee_coverage_amount: nil)
        options = {}
        options['AccountId'] = fund_id if fund_id
        options['Amount']    = amount  if amount
        options['FeeCoverageAmount'] = fee_coverage_amount if fee_coverage_amount

        patch(recurring_donation_detail_path(id), options)
      end

      private

      def recurring_donation_detail_path(id = nil)
        id ? "FinancialScheduledTransactionDetails/#{id}" : 'FinancialScheduledTransactionDetails'
      end
    end
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
rock_rms-9.13.0 lib/rock_rms/resources/recurring_donation_detail.rb
rock_rms-9.12.0 lib/rock_rms/resources/recurring_donation_detail.rb
rock_rms-9.11.0 lib/rock_rms/resources/recurring_donation_detail.rb
rock_rms-9.10.0 lib/rock_rms/resources/recurring_donation_detail.rb
rock_rms-9.9.0 lib/rock_rms/resources/recurring_donation_detail.rb
rock_rms-9.8.0 lib/rock_rms/resources/recurring_donation_detail.rb
rock_rms-9.7.0 lib/rock_rms/resources/recurring_donation_detail.rb
rock_rms-9.6.0 lib/rock_rms/resources/recurring_donation_detail.rb
rock_rms-9.5.0 lib/rock_rms/resources/recurring_donation_detail.rb
rock_rms-9.4.0 lib/rock_rms/resources/recurring_donation_detail.rb
rock_rms-9.3.0 lib/rock_rms/resources/recurring_donation_detail.rb
rock_rms-9.2.0 lib/rock_rms/resources/recurring_donation_detail.rb
rock_rms-9.1.0 lib/rock_rms/resources/recurring_donation_detail.rb
rock_rms-9.0.0 lib/rock_rms/resources/recurring_donation_detail.rb
rock_rms-8.23.0 lib/rock_rms/resources/recurring_donation_detail.rb
rock_rms-8.22.0 lib/rock_rms/resources/recurring_donation_detail.rb
rock_rms-8.21.0 lib/rock_rms/resources/recurring_donation_detail.rb
rock_rms-8.20.0 lib/rock_rms/resources/recurring_donation_detail.rb
rock_rms-8.19.0 lib/rock_rms/resources/recurring_donation_detail.rb
rock_rms-8.18.0 lib/rock_rms/resources/recurring_donation_detail.rb