Sha256: c5cb705e1b5158fb2147417b56c909d28ee81e9fa6b8dd07d9145332ba725552

Contents?: true

Size: 876 Bytes

Versions: 8

Compression:

Stored size: 876 Bytes

Contents

module RockRMS
  class Client
    module PaymentMethod
      def list_payment_methods(options = {})
        res = get(payment_method_path, options)
        Response::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

      def delete_payment_method(id)
        delete(payment_method_path(id))
      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

8 entries across 8 versions & 1 rubygems

Version Path
rock_rms-3.9.0 lib/rock_rms/resources/payment_method.rb
rock_rms-3.8.0 lib/rock_rms/resources/payment_method.rb
rock_rms-3.7.0 lib/rock_rms/resources/payment_method.rb
rock_rms-3.6.3 lib/rock_rms/resources/payment_method.rb
rock_rms-3.6.2 lib/rock_rms/resources/payment_method.rb
rock_rms-3.6.1 lib/rock_rms/resources/payment_method.rb
rock_rms-3.6.0 lib/rock_rms/resources/payment_method.rb
rock_rms-3.5.0 lib/rock_rms/resources/payment_method.rb