Class: Gateway::PinGateway

Inherits:
Gateway
  • Object
show all
Defined in:
app/models/spree/gateway/pin_gateway.rb

Instance Method Summary collapse

Instance Method Details

#auto_capture?Boolean

Pin does not appear to support authorizing transactions yet

Returns:

  • (Boolean)


30
31
32
# File 'app/models/spree/gateway/pin_gateway.rb', line 30

def auto_capture?
  true
end

#create_profile(payment) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/models/spree/gateway/pin_gateway.rb', line 14

def create_profile(payment)
  if payment.source.gateway_customer_profile_id.nil?
    response = provider.store(payment.source, options_for_payment(payment))
    
    if response.success?
      payment.source.update_attributes!(:gateway_customer_profile_id => response.authorization)

      cc = response.params['response']['card']
      payment.source.update_attributes!(:gateway_payment_profile_id => cc['token']) if cc
    else
      payment.send(:gateway_error, response.message)
    end
  end
end

#payment_profiles_supported?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'app/models/spree/gateway/pin_gateway.rb', line 34

def payment_profiles_supported?
  true
end

#provider_classObject



6
7
8
# File 'app/models/spree/gateway/pin_gateway.rb', line 6

def provider_class
  ActiveMerchant::Billing::PinGateway
end

#purchase(money, creditcard, options = {}) ⇒ Object



10
11
12
# File 'app/models/spree/gateway/pin_gateway.rb', line 10

def purchase(money, creditcard, options = {})
  super(money, creditcard.try(:gateway_customer_profile_id) || creditcard.try(:gateway_payment_profile_id) || creditcard, options)
end