Class: ActiveMerchant::Billing::PaywayGateway

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

Constant Summary collapse

SUMMARY_CODES =
{
  '0' => 'Approved',
  '1' => 'Declined',
  '2' => 'Erred',
  '3' => 'Rejected'
}
RESPONSE_CODES =
{
  '00' => 'Completed Successfully',
  '01' => 'Refer to card issuer',
  '03' => 'Invalid merchant',
  '04' => 'Pick-up card',
  '05' => 'Do not honour',
  '08' => 'Honour only with identification',
  '12' => 'Invalid transaction',
  '13' => 'Invalid amount',
  '14' => 'Invalid card number (no such number)',
  '30' => 'Format error',
  '36' => 'Restricted card',
  '41' => 'Lost card',
  '42' => 'No universal card',
  '43' => 'Stolen card',
  '51' => 'Not sufficient funds',
  '54' => 'Expired card',
  '61' => 'Exceeds withdrawal amount limits',
  '62' => 'Restricted card',
  '65' => 'Exceeds withdrawal frequency limit',
  '91' => 'Issuer or switch is inoperative',
  '92' => 'Financial institution or intermediate network facility cannot be found for routing',
  '94' => 'Duplicate transmission',
  'Q1' => 'Unknown Buyer',
  'Q2' => 'Transaction Pending',
  'Q3' => 'Payment Gateway Connection Error',
  'Q4' => 'Payment Gateway Unavailable',
  'Q5' => 'Invalid Transaction',
  'Q6' => 'Duplicate Transaction - requery to determine status',
  'QA' => 'Invalid parameters or Initialisation failed',
  'QB' => 'Order type not currently supported',
  'QC' => 'Invalid Order Type',
  'QD' => 'Invalid Payment Amount - Payment amount less than minimum/exceeds maximum allowed limit',
  'QE' => 'Internal Error',
  'QF' => 'Transaction Failed',
  'QG' => 'Unknown Customer Order Number',
  'QH' => 'Unknown Customer Username or Password',
  'QI' => 'Transaction incomplete - contact Westpac to confirm reconciliation',
  'QJ' => 'Invalid Client Certificate',
  'QK' => 'Unknown Customer Merchant',
  'QL' => 'Business Group not configured for customer',
  'QM' => 'Payment Instrument not configured for customer',
  'QN' => 'Configuration Error',
  'QO' => 'Missing Payment Instrument',
  'QP' => 'Missing Supplier Account',
  'QQ' => 'Invalid Credit Card Verification Number',
  'QR' => 'Transaction Retry',
  'QS' => 'Transaction Successful',
  'QT' => 'Invalid currency',
  'QU' => 'Unknown Customer IP Address',
  'QV' => 'Invalid Original Order Number specified for Refund, Refund amount exceeds capture amount, or Previous capture was not approved',
  'QW' => 'Invalid Reference Number',
  'QX' => 'Network Error has occurred',
  'QY' => 'Card Type Not Accepted',
  'QZ' => 'Zero value transaction'
}
TRANSACTIONS =
{
  :authorize  => 'preauth',
  :purchase   => 'capture',
  :capture    => 'captureWithoutAuth',
  :status     => 'query',
  :refund     => 'refund',
  :store      => 'registerAccount'
}

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?

Methods included from CreditCardFormatting

#format

Constructor Details

#initialize(options = {}) ⇒ PaywayGateway

Returns a new instance of PaywayGateway.



86
87
88
89
90
91
92
93
94
95
96
# File 'lib/active_merchant/billing/gateways/payway.rb', line 86

def initialize(options={})
  @options = options

  options[:merchant] ||= 'TEST' if test?

  requires!(options, :username, :password, :merchant, :pem)

  @options[:eci]      ||= 'SSL'

  super
end

Instance Method Details

#authorize(amount, payment_method, options = {}) ⇒ Object



98
99
100
101
102
103
104
105
# File 'lib/active_merchant/billing/gateways/payway.rb', line 98

def authorize(amount, payment_method, options={})
  requires!(options, :order_id)

  post = {}
  add_payment_method(post, payment_method)
  add_order(post, amount, options)
  commit(:authorize, post)
end

#capture(amount, authorization, options = {}) ⇒ Object



107
108
109
110
111
112
113
114
# File 'lib/active_merchant/billing/gateways/payway.rb', line 107

def capture(amount, authorization, options={})
  requires!(options, :order_id)

  post = {}
  add_reference(post, authorization)
  add_order(post, amount, options)
  commit(:capture, post)
end

#purchase(amount, payment_method, options = {}) ⇒ Object



116
117
118
119
120
121
122
123
# File 'lib/active_merchant/billing/gateways/payway.rb', line 116

def purchase(amount, payment_method, options={})
  requires!(options, :order_id)

  post = {}
  add_payment_method(post, payment_method)
  add_order(post, amount, options)
  commit(:purchase, post)
end

#refund(amount, authorization, options = {}) ⇒ Object



125
126
127
128
129
130
131
132
# File 'lib/active_merchant/billing/gateways/payway.rb', line 125

def refund(amount, authorization, options={})
  requires!(options, :order_id)

  post = {}
  add_reference(post, authorization)
  add_order(post, amount, options)
  commit(:refund, post)
end

#status(options = {}) ⇒ Object



143
144
145
146
147
# File 'lib/active_merchant/billing/gateways/payway.rb', line 143

def status(options={})
  requires!(options, :order_id)

  commit(:status, 'customer.orderNumber' => options[:order_id])
end

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



134
135
136
137
138
139
140
141
# File 'lib/active_merchant/billing/gateways/payway.rb', line 134

def store(credit_card, options={})
  requires!(options, :billing_id)

  post = {}
  add_payment_method(post, credit_card)
  add_payment_method(post, options[:billing_id])
  commit(:store, post)
end