Class: ActiveMerchant::Billing::UsaEpayTransactionGateway

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

Constant Summary collapse

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

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

Methods included from CreditCardFormatting

#format

Constructor Details

#initialize(options = {}) ⇒ UsaEpayTransactionGateway

Returns a new instance of UsaEpayTransactionGateway.



20
21
22
23
24
# File 'lib/active_merchant/billing/gateways/usa_epay_transaction.rb', line 20

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

Instance Method Details

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



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

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



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

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

  add_amount(post, money)
  commit(:capture, post)
end

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



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

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

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



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

def refund(money, authorization, options = {})
  post = { :refNum => authorization }

  add_amount(post, money)
  commit(:refund, post)
end

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



64
65
66
67
# File 'lib/active_merchant/billing/gateways/usa_epay_transaction.rb', line 64

def void(authorization, options = {})
  post = { :refNum => authorization }
  commit(:void, post)
end