Class: ActiveMerchant::Billing::AprovaFacilGateway

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

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ AprovaFacilGateway

Returns a new instance of AprovaFacilGateway.



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/active_merchant/billing/gateways/aprova_facil.rb', line 23

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

  AprovaFacil::Config.usuario = @options[:login]
  
  if @options[:test]
    AprovaFacil::Config.teste = true
  end
end

Instance Method Details

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



35
36
37
38
39
40
41
42
# File 'lib/active_merchant/billing/gateways/aprova_facil.rb', line 35

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

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



53
54
55
56
# File 'lib/active_merchant/billing/gateways/aprova_facil.rb', line 53

def capture(money, authorization, options = {})
  post = {:transaction => authorization}
  commit('capture', money, post)
end

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



44
45
46
47
48
49
50
51
# File 'lib/active_merchant/billing/gateways/aprova_facil.rb', line 44

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

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



58
59
60
61
# File 'lib/active_merchant/billing/gateways/aprova_facil.rb', line 58

def void(authorization, options = {})
  post = {:transaction => authorization}
  commit('void', nil, post)
end