Class: ActiveMerchant::Billing::SecurePayAuGateway

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

Constant Summary collapse

API_VERSION =
'xml-4.2'
PERIODIC_API_VERSION =
'spxml-3.0'
TRANSACTIONS =

0 Standard Payment 4 Refund 6 Client Reversal (Void) 10 Preauthorise 11 Preauth Complete (Advice)

{
  :purchase => 0,
  :authorization => 10,
  :capture => 11,
  :void => 6,
  :refund => 4
}
PERIODIC_ACTIONS =
{
  :add_triggered    => "add",
  :remove_triggered => "delete",
  :trigger          => "trigger"
}
PERIODIC_TYPES =
{
  :add_triggered    => 4,
  :remove_triggered => nil,
  :trigger          => nil
}
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, Gateway::STANDARD_ERROR_CODE

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

#card_brand, card_brand, #generate_unique_id, inherited, non_fractional_currency?, #scrub, supported_countries, #supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #test?

Methods included from CreditCardFormatting

#format

Methods included from PostsData

included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request

Constructor Details

#initialize(options = {}) ⇒ SecurePayAuGateway

Returns a new instance of SecurePayAuGateway.



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

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

Instance Method Details

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



74
75
76
77
# File 'lib/active_merchant/billing/gateways/secure_pay_au.rb', line 74

def authorize(money, credit_card, options = {})
  requires!(options, :order_id)
  commit :authorization, build_purchase_request(money, credit_card, options)
end

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



79
80
81
# File 'lib/active_merchant/billing/gateways/secure_pay_au.rb', line 79

def capture(money, reference, options = {})
  commit :capture, build_reference_request(money, reference)
end

#credit(money, reference, options = {}) ⇒ Object



87
88
89
90
# File 'lib/active_merchant/billing/gateways/secure_pay_au.rb', line 87

def credit(money, reference, options = {})
  ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
  refund(money, reference)
end

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



64
65
66
67
68
69
70
71
72
# File 'lib/active_merchant/billing/gateways/secure_pay_au.rb', line 64

def purchase(money, credit_card_or_stored_id, options = {})
  if credit_card_or_stored_id.respond_to?(:number)
    requires!(options, :order_id)
    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, reference, options = {}) ⇒ Object



83
84
85
# File 'lib/active_merchant/billing/gateways/secure_pay_au.rb', line 83

def refund(money, reference, options = {})
  commit :refund, build_reference_request(money, reference)
end

#store(creditcard, options = {}) ⇒ Object



96
97
98
99
# File 'lib/active_merchant/billing/gateways/secure_pay_au.rb', line 96

def store(creditcard, options = {})
  requires!(options, :billing_id, :amount)
  commit_periodic(build_periodic_item(:add_triggered, options[:amount], creditcard, options))
end

#unstore(identification, options = {}) ⇒ Object



101
102
103
104
# File 'lib/active_merchant/billing/gateways/secure_pay_au.rb', line 101

def unstore(identification, options = {})
  options[:billing_id] = identification
  commit_periodic(build_periodic_item(:remove_triggered, options[:amount], nil, options))
end

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



92
93
94
# File 'lib/active_merchant/billing/gateways/secure_pay_au.rb', line 92

def void(reference, options = {})
  commit :void, build_reference_request(nil, reference)
end