Class: ActiveMerchant::Billing::FederatedCanadaGateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/federated_canada.rb

Constant Summary collapse

URL =

Same URL for both test and live, testing is done by using the test username (demo) and password (password).

'https://secure.federatedgateway.com/api/transact.php'

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

#card_brand, card_brand, inherited, supports?

Methods included from Utils

#deprecated, generate_unique_id

Methods included from CreditCardFormatting

#format

Methods included from RequiresParameters

#requires!

Methods included from PostsData

included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request

Constructor Details

#initialize(options = {}) ⇒ FederatedCanadaGateway

Returns a new instance of FederatedCanadaGateway.



23
24
25
26
27
# File 'lib/active_merchant/billing/gateways/federated_canada.rb', line 23

def initialize(options = {})
  requires!(options, :login, :password)
  @options = options
  super
end

Instance Method Details

#authorize(money, creditcard, options = {}) ⇒ Object



38
39
40
41
42
43
44
45
# File 'lib/active_merchant/billing/gateways/federated_canada.rb', line 38

def authorize(money, creditcard, options = {})
  post = {}
  add_invoice(post, options)
  add_creditcard(post, creditcard)
  add_address(post, options)
  add_customer_data(post, options)
  commit('auth', money, post)
end

#capture(money, authorization, options = {}) ⇒ Object



47
48
49
50
# File 'lib/active_merchant/billing/gateways/federated_canada.rb', line 47

def capture(money, authorization, options = {})
  options[:transactionid] = authorization
  commit('capture', money, options)
end

#credit(money, authorization, options = {}) ⇒ Object



61
62
63
64
# File 'lib/active_merchant/billing/gateways/federated_canada.rb', line 61

def credit(money, authorization, options = {})
  deprecated CREDIT_DEPRECATION_MESSAGE
  refund(money, authorization, options)
end

#purchase(money, creditcard, options = {}) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/active_merchant/billing/gateways/federated_canada.rb', line 29

def purchase(money, creditcard, options = {})
  post = {}
  add_invoice(post, options)
  add_creditcard(post, creditcard)
  add_address(post, options)
  add_customer_data(post, options)
  commit('sale', money, post)
end

#refund(money, authorization, options = {}) ⇒ Object



57
58
59
# File 'lib/active_merchant/billing/gateways/federated_canada.rb', line 57

def refund(money, authorization, options = {})
  commit('refund', money, options.merge(:transactionid => authorization))
end

#void(authorization, options = {}) ⇒ Object



52
53
54
55
# File 'lib/active_merchant/billing/gateways/federated_canada.rb', line 52

def void(authorization, options = {})
  options[:transactionid] = authorization
  commit('void', nil, options)
end