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::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

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

Methods included from CreditCardFormatting

#expdate, #format, #strftime_yyyymm

Methods included from PostsData

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

Constructor Details

#initialize(options = {}) ⇒ PaywayGateway

Returns a new instance of PaywayGateway.



86
87
88
89
90
91
92
93
# 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'
end

Instance Method Details

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



95
96
97
98
99
100
101
102
# File 'lib/active_merchant/billing/gateways/payway.rb', line 95

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



104
105
106
107
108
109
110
111
# File 'lib/active_merchant/billing/gateways/payway.rb', line 104

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



113
114
115
116
117
118
119
120
# File 'lib/active_merchant/billing/gateways/payway.rb', line 113

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



122
123
124
125
126
127
128
129
# File 'lib/active_merchant/billing/gateways/payway.rb', line 122

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



140
141
142
143
144
# File 'lib/active_merchant/billing/gateways/payway.rb', line 140

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

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

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



131
132
133
134
135
136
137
138
# File 'lib/active_merchant/billing/gateways/payway.rb', line 131

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