Sha256: 054a66e9702e2d3f352870fbd16f21809be24fde374e7e60315edb1b39d078b1

Contents?: true

Size: 788 Bytes

Versions: 9

Compression:

Stored size: 788 Bytes

Contents

module RockRMS
  class Client
    module PaymentMethod
      def list_payment_methods(options = {})
        res = get(payment_method_path, options)
        RockRMS::PaymentMethod.format(res)
      end

      def create_payment_method(payment_type:, foreign_key: nil)
        options = {
          'CurrencyTypeValueId' => cast_payment_type(payment_type),
          'ForeignKey' => foreign_key
        }

        post(payment_method_path, options)
      end

      private

      def cast_payment_type(payment_type)
        case payment_type
        when 'card'
          156
        when 'bank account', 'ach'
          157
        end
      end

      def payment_method_path(id = nil)
        id ? "FinancialPaymentDetails/#{id}" : 'FinancialPaymentDetails'
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rock_rms-3.1.0 lib/rock_rms/resources/payment_method.rb
rock_rms-3.0.2 lib/rock_rms/resources/payment_method.rb
rock_rms-3.0.1 lib/rock_rms/resources/payment_method.rb
rock_rms-3.0.0 lib/rock_rms/resources/payment_method.rb
rock_rms-2.0.0 lib/rock_rms/resources/payment_method.rb
rock_rms-1.3.0 lib/rock_rms/resources/payment_method.rb
rock_rms-1.2.0 lib/rock_rms/resources/payment_method.rb
rock_rms-1.1.0 lib/rock_rms/resources/payment_method.rb
rock_rms-1.0.1 lib/rock_rms/resources/payment_method.rb