Class: ActiveMerchant::Billing::UsaEpayTransactionGateway

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

Constant Summary collapse

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
# File 'lib/active_merchant/billing/gateways/usa_epay_transaction.rb', line 20

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

Instance Method Details

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



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

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



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

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

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

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



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

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



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

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

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

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



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

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