Class: ActiveMerchant::Billing::NabTransactGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::NabTransactGateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/nab_transact.rb
Overview
The National Australia Bank provide a payment gateway that seems to be a rebadged Securepay Australia service, though some differences exist.
Constant Summary
collapse
- API_VERSION =
'xml-4.2'
- PERIODIC_API_VERSION =
"spxml-4.2"
- TRANSACTIONS =
Transactions currently accepted by NAB Transact XML API
{
:purchase => 0, :refund => 4, :void => 6, :unmatched_refund => 666, :authorization => 10, :capture => 11 }
- PERIODIC_TYPES =
{
:addcrn => 5,
:editcrn => 5,
:deletecrn => 5,
:trigger => 8
}
- SUCCESS_CODES =
[ '00', '08', '11', '16', '77' ]
Constants inherited
from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS, Gateway::RECURRING_DEPRECATION_MESSAGE
Instance Attribute Summary
Attributes inherited from Gateway
#options
Instance Method Summary
collapse
-
#authorize(money, credit_card, options = {}) ⇒ Object
-
#capture(money, authorization, options = {}) ⇒ Object
-
#credit(money, credit_card, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ NabTransactGateway
constructor
A new instance of NabTransactGateway.
-
#purchase(money, credit_card_or_stored_id, options = {}) ⇒ Object
-
#refund(money, authorization, options = {}) ⇒ Object
-
#store(creditcard, options = {}) ⇒ Object
-
#unstore(identification, options = {}) ⇒ Object
Methods inherited from Gateway
#card_brand, card_brand, #generate_unique_id, inherited, supported_countries, #supported_countries, supported_countries=, supports?, #test?
#format
Constructor Details
Returns a new instance of NabTransactGateway.
46
47
48
49
|
# File 'lib/active_merchant/billing/gateways/nab_transact.rb', line 46
def initialize(options = {})
requires!(options, :login, :password)
super
end
|
Instance Method Details
#authorize(money, credit_card, options = {}) ⇒ Object
70
71
72
|
# File 'lib/active_merchant/billing/gateways/nab_transact.rb', line 70
def authorize(money, credit_card, options = {})
commit :authorization, build_purchase_request(money, credit_card, options)
end
|
#capture(money, authorization, options = {}) ⇒ Object
74
75
76
|
# File 'lib/active_merchant/billing/gateways/nab_transact.rb', line 74
def capture(money, authorization, options = {})
commit :capture, build_reference_request(money, authorization, options)
end
|
#credit(money, credit_card, options = {}) ⇒ Object
62
63
64
|
# File 'lib/active_merchant/billing/gateways/nab_transact.rb', line 62
def credit(money, credit_card, options = {})
commit :unmatched_refund, build_purchase_request(money, credit_card, options)
end
|
#purchase(money, credit_card_or_stored_id, options = {}) ⇒ Object
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/active_merchant/billing/gateways/nab_transact.rb', line 51
def purchase(money, credit_card_or_stored_id, options = {})
if credit_card_or_stored_id.respond_to?(:number)
commit :purchase, build_purchase_request(money, credit_card_or_stored_id, options)
else
options[:billing_id] = credit_card_or_stored_id.to_s
commit_periodic build_periodic_item(:trigger, money, nil, options)
end
end
|
#refund(money, authorization, options = {}) ⇒ Object
66
67
68
|
# File 'lib/active_merchant/billing/gateways/nab_transact.rb', line 66
def refund(money, authorization, options = {})
commit :refund, build_reference_request(money, authorization, options)
end
|
#store(creditcard, options = {}) ⇒ Object
78
79
80
81
|
# File 'lib/active_merchant/billing/gateways/nab_transact.rb', line 78
def store(creditcard, options = {})
requires!(options, :billing_id, :amount)
commit_periodic(build_periodic_item(:addcrn, options[:amount], creditcard, options))
end
|
#unstore(identification, options = {}) ⇒ Object
83
84
85
86
|
# File 'lib/active_merchant/billing/gateways/nab_transact.rb', line 83
def unstore(identification, options = {})
options[:billing_id] = identification
commit_periodic(build_periodic_item(:deletecrn, options[:amount], nil, options))
end
|