Class: Gateway::Beanstream

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

Constant Summary

Constants inherited from PaymentMethod

PaymentMethod::DISPLAY

Instance Method Summary collapse

Methods inherited from Gateway

current, #method_missing, #method_type, #options, #payment_source_class, #provider

Methods inherited from PaymentMethod

active?, available, current, #destroy, find_with_destroyed, #method_type, #payment_source_class, providers, register, #source_required?

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Gateway

Instance Method Details

#capture(transaction, creditcard, gateway_options) ⇒ Object



30
31
32
# File 'app/models/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



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

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
      creditcard.gateway_error(result) if creditcard.respond_to? :gateway_error
      creditcard.source.gateway_error(result)
    end
  end
end

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



38
39
40
41
# File 'app/models/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)


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

def payment_profiles_supported?
  true
end

#provider_classObject



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

def provider_class
  ActiveMerchant::Billing::BeanstreamGateway
end

#void(transaction_response, creditcard, gateway_options) ⇒ Object



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

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