Sha256: 66c7a5aea422f2ce0141c6998ddbba974bc9fee50e8b95199cb8b80e8b0063e3

Contents?: true

Size: 942 Bytes

Versions: 4

Compression:

Stored size: 942 Bytes

Contents

module RockRMS
  class Client
    module RecurringDonation
      def list_recurring_donations(options = {})
        res = get(recurring_donation_path, options)
        Response::RecurringDonation.format(res)
      end

      def find_recurring_donation(id)
        res = get(recurring_donation_path(id))
        Response::RecurringDonation.format(res)
      end

      def update_recurring_donation(
        id,
        next_payment_date:,
        transaction_code: nil,
        active: nil
      )
        options = { 'NextPaymentDate' => next_payment_date }
        options['TransactionCode'] = transaction_code if transaction_code
        options['IsActive']        = active           if !active.nil?

        patch(recurring_donation_path(id), options)
      end

      private

      def recurring_donation_path(id = nil)
        id ? "FinancialScheduledTransactions/#{id}" : 'FinancialScheduledTransactions'
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rock_rms-3.8.0 lib/rock_rms/resources/recurring_donation.rb
rock_rms-3.7.0 lib/rock_rms/resources/recurring_donation.rb
rock_rms-3.6.3 lib/rock_rms/resources/recurring_donation.rb
rock_rms-3.6.2 lib/rock_rms/resources/recurring_donation.rb