Class: ActiveMerchant::Billing::AnzGateway

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

Constant Summary collapse

GATEWAY_URL =
"https://migs.mastercard.com.au/vpcdps"
VIRTUAL_PAYMENT_CLIENT_API_VERION =
1

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ AnzGateway

Returns a new instance of AnzGateway.



19
20
21
22
23
24
25
26
# File 'lib/active_merchant/billing/gateways/anz.rb', line 19

def initialize(options={})
  requires!(options, :merchant_id, :access_code)
  if options[:mode] && (options[:mode].to_sym == :production || options[:mode].to_sym == :test)
    self.mode = options[:mode]
  end
  @options = options
  super
end

Instance Method Details

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

refunds to the customer’s card. autorization id is required



47
48
49
50
51
52
53
54
55
# File 'lib/active_merchant/billing/gateways/anz.rb', line 47

def credit(money, authorization_number, options = {})
  requires!(options, :username, :password, :order_id)
  params = {}
  add_merchant_transaction_id(params, options[:order_id])
  add_authorization_number(params, authorization_number)
  add_username_password(params, options[:username], options[:password])
  add_amount(params, money)
  process_action('refund', params)
end

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

actual payment



33
34
35
36
37
38
39
40
41
# File 'lib/active_merchant/billing/gateways/anz.rb', line 33

def purchase(money, creditcard, options = {})
  requires!(options, :invoice, :order_id)
  params = {}
  add_credit_card(params, creditcard)
  add_merchant_transaction_id(params, options[:order_id])
  add_invoice_number(params, options[:invoice])
  add_amount(params, money)
  process_action('pay', params)
end

#query(merchant_transaction_id) ⇒ Object

query a past payment, unique merchant transaction ref. is required



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

def query(merchant_transaction_id)
  params = {}
  add_merchant_transaction_id(params, merchant_transaction_id)
  process_action('QueryDR', params)
end