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



32
33
34
# File 'app/models/spree/gateway/beanstream.rb', line 32

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

#create_profile(payment) ⇒ Object



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

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



40
41
42
43
# File 'app/models/spree/gateway/beanstream.rb', line 40

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)


14
15
16
# File 'app/models/spree/gateway/beanstream.rb', line 14

def payment_profiles_supported?
  true
end

#provider_classObject



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

def provider_class
  ActiveMerchant::Billing::BeanstreamGateway
end

#void(transaction_response, creditcard, gateway_options) ⇒ Object



36
37
38
# File 'app/models/spree/gateway/beanstream.rb', line 36

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