Class: Gateway::Beanstream

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

Instance Method Summary collapse

Instance Method Details

#capture(transaction, creditcard, gateway_options) ⇒ Object



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

def capture(transaction, creditcard, gateway_options)
  beanstream_gateway.capture((transaction.amount*100).round, transaction.response_code, gateway_options)
end

#create_profile(payment) ⇒ Object



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

def create_profile(payment)
  creditcard = payment.source
  if creditcard.gateway_customer_profile_id.nil?
    options = options_for_create_customer_profile(creditcard, {})
    verify_creditcard_name!(creditcard)
    result = provider.store(creditcard, options)
    if result.success?
      creditcard.update_attributes(:gateway_customer_profile_id => result.params['customerCode'], :gateway_payment_profile_id => result.params['customer_vault_id'])
    else
      payment.send(:gateway_error, result)
    end
  end
end

#credit(amount, creditcard, response_code, gateway_options = {}) ⇒ Object



38
39
40
41
# File 'app/models/spree/gateway/beanstream.rb', line 38

def credit(amount, creditcard, response_code, gateway_options = {})
  amount = (amount * -1) if amount < 0
  beanstream_gateway.credit(amount, response_code, gateway_options)
end

#payment_profiles_supported?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'app/models/spree/gateway/beanstream.rb', line 12

def payment_profiles_supported?
  true
end

#provider_classObject



8
9
10
# File 'app/models/spree/gateway/beanstream.rb', line 8

def provider_class
  ActiveMerchant::Billing::BeanstreamGateway
end

#void(transaction_response, creditcard, gateway_options) ⇒ Object



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

def void(transaction_response, creditcard, gateway_options)
  beanstream_gateway.void(transaction_response, gateway_options)
end