class ActiveMerchant::Billing::BeanstreamInteracGateway

Public Class Methods

confirm(transaction) click to toggle source

Confirm a transaction posted back from the bank to Beanstream. Confirming a transaction does not require any credentials, and in an application with many merchants sharing a funded URL the application may not yet know which merchant the post back is for until the response of the confirmation is received, which contains the order number.

# File lib/active_merchant/billing/gateways/beanstream_interac.rb, line 20
def self.confirm(transaction)
  gateway = new(login: '')
  gateway.confirm(transaction)
end

Public Instance Methods

confirm(transaction) click to toggle source

Confirm a transaction posted back from the bank to Beanstream.

# File lib/active_merchant/billing/gateways/beanstream_interac.rb, line 40
def confirm(transaction)
  post(transaction)
end
purchase(money, options = {}) click to toggle source
# File lib/active_merchant/billing/gateways/beanstream_interac.rb, line 25
def purchase(money, options = {})
  post = {}
  add_amount(post, money)
  add_invoice(post, options)
  add_address(post, options)
  add_interac_details(post, options)
  add_transaction_type(post, :purchase)
  commit(post)
end
success?(response) click to toggle source
# File lib/active_merchant/billing/gateways/beanstream_interac.rb, line 35
def success?(response)
  response[:responseType] == 'R' || response[:trnApproved] == '1' || response[:responseCode] == '1'
end

Private Instance Methods

add_interac_details(post, options) click to toggle source
# File lib/active_merchant/billing/gateways/beanstream_interac.rb, line 46
def add_interac_details(post, options)
  address = options[:billing_address] || options[:address] || {}
  post[:trnCardOwner] = address[:name]
  post[:paymentMethod] = 'IO'
end
build_response(*args) click to toggle source
# File lib/active_merchant/billing/gateways/beanstream_interac.rb, line 52
def build_response(*args)
  BeanstreamInteracResponse.new(*args)
end