Included Modules

Class Index [+]

Quicksearch

ActiveMerchant::Billing::BeanstreamGateway

This class implements the Canadian Beanstream payment gateway. It is also named TD Canada Trust Online Mart payment gateway. To learn more about the specification of Beanstream gateway, please read the OM_Direct_Interface_API.pdf, which you can get from your Beanstream account or get from me by email.

 

Supported transaction types by Beanstream:

 

Secure Payment Profiles:

BeanStream supports payment profiles (vaults). This allows you to store cc information with BeanStream and process subsequent transactions with a customer id. Secure Payment Profiles must be enabled on your account (must be done over the phone). Your API Access Passcode must be set in Administration => account settings => order settings. To learn more about storing credit cards with the Beanstream gateway, please read the BEAN_Payment_Profiles.pdf (I had to phone BeanStream to request it.)

Notes

 
 Example authorization (Beanstream PA transaction type):
 
  twenty = 2000
  gateway = BeanstreamGateway.new(
    :login => '100200000',
    :user => 'xiaobozz',
    :password => 'password'
  )
  
  credit_card = CreditCard.new(
    :number => '4030000010001234',
    :month => 8,
    :year => 2011,
    :first_name => 'xiaobo',
    :last_name => 'zzz',
    :verification_value => 137
  )
  response = gateway.authorize(twenty, credit_card,
    :order_id => '1234',
    :billing_address => {
      :name => 'xiaobo zzz',
      :phone => '555-555-5555',
      :address1 => '1234 Levesque St.',
      :address2 => 'Apt B',
      :city => 'Montreal',
      :state => 'QC',
      :country => 'CA',
      :zip => 'H2C1X8'
    },
    :email => 'xiaobozzz@example.com',
    :subtotal => 800,
    :shipping => 100,
    :tax1 => 100,
    :tax2 => 100,
    :custom => 'reference one'
  )

Public Instance Methods

authorize(money, source, options = {}) click to toggle source
    # File lib/active_merchant/billing/gateways/beanstream.rb, line 68
68:       def authorize(money, source, options = {})
69:         post = {}
70:         add_amount(post, money)
71:         add_invoice(post, options)
72:         add_source(post, source)        
73:         add_address(post, options)
74:         add_transaction_type(post, :authorization)
75:         commit(post)
76:       end
delete(vault_id) click to toggle source

can’t actually delete a secure profile with the supplicaed API. This function sets the status of the profile to closed (C). Closed profiles will have to removed manually.

     # File lib/active_merchant/billing/gateways/beanstream.rb, line 114
114:       def delete(vault_id)
115:         update(vault_id, false, {:status => "C"})
116:       end
Also aliased as: unstore
interac() click to toggle source
     # File lib/active_merchant/billing/gateways/beanstream.rb, line 98
 98:       def interac
 99:         @interac ||= BeanstreamInteracGateway.new(@options)
100:       end
purchase(money, source, options = {}) click to toggle source
    # File lib/active_merchant/billing/gateways/beanstream.rb, line 78
78:       def purchase(money, source, options = {})
79:         post = {}
80:         add_amount(post, money) 
81:         add_invoice(post, options)
82:         add_source(post, source)
83:         add_address(post, options)
84:         add_transaction_type(post, purchase_action(source))
85:         commit(post)
86:       end
store(credit_card, options = {}) click to toggle source

To match the other stored-value gateways, like TrustCommerce, store and unstore need to be defined

     # File lib/active_merchant/billing/gateways/beanstream.rb, line 104
104:       def store(credit_card, options = {})
105:         post = {}        
106:         add_address(post, options)
107:         add_credit_card(post, credit_card)      
108:         add_secure_profile_variables(post,options)
109:         commit(post, true)
110:       end
unstore(vault_id) click to toggle source
Alias for: delete
update(vault_id, credit_card, options = {}) click to toggle source

Update the values (such as CC expiration) stored at the gateway. The CC number must be supplied in the CreditCard object.

     # File lib/active_merchant/billing/gateways/beanstream.rb, line 123
123:       def update(vault_id, credit_card, options = {})
124:         post = {}
125:         add_address(post, options)
126:         add_credit_card(post, credit_card)
127:         options.merge!({:vault_id => vault_id, :operation => secure_profile_action(:modify)})
128:         add_secure_profile_variables(post,options)
129:         commit(post, true)
130:       end
void(authorization, options = {}) click to toggle source
    # File lib/active_merchant/billing/gateways/beanstream.rb, line 88
88:       def void(authorization, options = {})
89:         reference, amount, type = split_auth(authorization)
90:         
91:         post = {}
92:         add_reference(post, reference)
93:         add_original_amount(post, amount)
94:         add_transaction_type(post, void_action(type))
95:         commit(post)
96:       end

Private Instance Methods

build_response(*args) click to toggle source
     # File lib/active_merchant/billing/gateways/beanstream.rb, line 133
133:       def build_response(*args)
134:         Response.new(*args)
135:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.