Class: ActiveMerchant::Billing::NabTransactGateway
- 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"
- TEST_URL =
'https://transact.nab.com.au/test/xmlapi/payment'
- LIVE_URL =
'https://transact.nab.com.au/live/xmlapi/payment'
- TEST_PERIODIC_URL =
"https://transact.nab.com.au/xmlapidemo/periodic"
- LIVE_PERIODIC_URL =
"https://transact.nab.com.au/xmlapi/periodic"
- TRANSACTIONS =
Transactions currently accepted by NAB Transact XML API
{ :purchase => 0, #Standard Payment :credit => 4, #Refund :void => 6, #Client Reversal (Void) :authorization => 10, #Preauthorise :capture => 11 #Preauthorise Complete (Advice) }
- 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
Instance Attribute Summary
Attributes inherited from Gateway
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ NabTransactGateway
constructor
A new instance of NabTransactGateway.
- #purchase(money, credit_card_or_stored_id, options = {}) ⇒ Object
- #store(creditcard, options = {}) ⇒ Object
- #test? ⇒ Boolean
- #unstore(identification, options = {}) ⇒ Object
Methods inherited from Gateway
#card_brand, card_brand, inherited, supports?
Methods included from CreditCardFormatting
Constructor Details
#initialize(options = {}) ⇒ NabTransactGateway
Returns a new instance of NabTransactGateway.
51 52 53 54 55 |
# File 'lib/active_merchant/billing/gateways/nab_transact.rb', line 51 def initialize( = {}) requires!(, :login, :password) @options = super end |
Instance Method Details
#purchase(money, credit_card_or_stored_id, options = {}) ⇒ Object
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/active_merchant/billing/gateways/nab_transact.rb', line 61 def purchase(money, credit_card_or_stored_id, = {}) if credit_card_or_stored_id.is_a?(ActiveMerchant::Billing::CreditCard) #Credit card for instant payment commit :purchase, build_purchase_request(money, credit_card_or_stored_id, ) else #Triggered payment for an existing stored credit card [:billing_id] = credit_card_or_stored_id.to_s commit_periodic build_periodic_item(:trigger, money, nil, ) end end |
#store(creditcard, options = {}) ⇒ Object
72 73 74 75 |
# File 'lib/active_merchant/billing/gateways/nab_transact.rb', line 72 def store(creditcard, = {}) requires!(, :billing_id, :amount) commit_periodic(build_periodic_item(:addcrn, [:amount], creditcard, )) end |
#test? ⇒ Boolean
57 58 59 |
# File 'lib/active_merchant/billing/gateways/nab_transact.rb', line 57 def test? @options[:test] || super end |
#unstore(identification, options = {}) ⇒ Object
77 78 79 80 |
# File 'lib/active_merchant/billing/gateways/nab_transact.rb', line 77 def unstore(identification, = {}) [:billing_id] = identification commit_periodic(build_periodic_item(:deletecrn, [:amount], nil, )) end |