class ActiveMerchant::Billing::PaymentMethodDetails

Attributes

payment_method[R]
payment_method_type[R]
vaulted_shopper_id[R]

Public Class Methods

new(payment_method = nil) click to toggle source
# File lib/active_merchant/billing/gateways/blue_snap.rb, line 484
def initialize(payment_method = nil)
  @payment_method = payment_method
  @payment_method_type = nil
  parse(payment_method)
end

Public Instance Methods

alt_transaction?() click to toggle source
# File lib/active_merchant/billing/gateways/blue_snap.rb, line 494
def alt_transaction?
  check?
end
check?() click to toggle source
# File lib/active_merchant/billing/gateways/blue_snap.rb, line 490
def check?
  @payment_method.is_a?(Check) || @payment_method_type == 'check'
end
resource_url() click to toggle source
# File lib/active_merchant/billing/gateways/blue_snap.rb, line 502
def resource_url
  alt_transaction? ? 'alt-transactions' : 'transactions'
end
root_element() click to toggle source
# File lib/active_merchant/billing/gateways/blue_snap.rb, line 498
def root_element
  alt_transaction? ? 'alt-transaction' : 'card-transaction'
end

Private Instance Methods

parse(payment_method) click to toggle source
# File lib/active_merchant/billing/gateways/blue_snap.rb, line 508
def parse(payment_method)
  return unless payment_method

  if payment_method.is_a?(String)
    @vaulted_shopper_id, payment_method_type = payment_method.split('|')
    @payment_method_type = payment_method_type if payment_method_type.present?
  elsif payment_method.is_a?(Check)
    @payment_method_type = payment_method.type
  else
    @payment_method_type = 'credit_card'
  end
end