Class: ActiveMerchant::Billing::UsaEpayGateway

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

Constant Summary collapse

URL =
'https://www.usaepay.com/gate.php'
TRANSACTIONS =
{
  :authorization => 'authonly',
  :purchase => 'sale',
  :capture => 'capture'
}

Constants inherited from Gateway

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?, #test?

Methods included from Utils

generate_unique_id

Methods included from CreditCardFormatting

#format

Methods included from RequiresParameters

#requires!

Methods included from PostsData

included, #ssl_get, #ssl_post

Constructor Details

#initialize(options = {}) ⇒ UsaEpayGateway

Returns a new instance of UsaEpayGateway.



18
19
20
21
22
# File 'lib/active_merchant/billing/gateways/usa_epay.rb', line 18

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

Instance Method Details

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



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

def authorize(money, credit_card, options = {})
  post = {}
  
  add_amount(post, money)
  add_invoice(post, options)
  add_credit_card(post, credit_card)        
  add_address(post, credit_card, options)        
  add_customer_data(post, options)
  
  commit(:authorization, post)
end

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



48
49
50
51
52
53
54
55
# File 'lib/active_merchant/billing/gateways/usa_epay.rb', line 48

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

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



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

def purchase(money, credit_card, options = {})
  post = {}
  
  add_amount(post, money)
  add_invoice(post, options)
  add_credit_card(post, credit_card)        
  add_address(post, credit_card, options)   
  add_customer_data(post, options)
       
  commit(:purchase, post)
end