Class: ActiveMerchant::Billing::PaynetworxGateway

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

Constant Summary collapse

API_VERSION =
'1.0'
SUCCESS_CODE =
%w[00 000 001 002 003 092]
SOFT_DECLINE_CODES =
%w[5 61 65 36 62 75 89 85 80]

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

Methods included from PostsData

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

Constructor Details

#initialize(options = {}) ⇒ PaynetworxGateway

Returns a new instance of PaynetworxGateway.



18
19
20
21
# File 'lib/active_merchant/billing/gateways/paynetworx.rb', line 18

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

Instance Method Details

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



23
24
25
26
27
28
29
30
31
# File 'lib/active_merchant/billing/gateways/paynetworx.rb', line 23

def authorize(amount, payment_method, options = {})
  post = {}
  add_invoice(post, amount, options)
  add_payment_method(post, payment_method, options)
  add_customer_data(post, options)
  add_transaction_descriptor(post, options)
  add_point_of_sale(post, options) if payment_method.is_a?(String)
  commit(post, 'auth')
end

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



51
52
53
54
55
56
57
# File 'lib/active_merchant/billing/gateways/paynetworx.rb', line 51

def capture(amount, authorization, options = {})
  post = {}
  add_invoice(post, amount, options)
  add_customer_data(post, options)
  process_payment(post, authorization)
  commit(post, 'capture')
end

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



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

def purchase(amount, payment_method, options = {})
  post = {}
  add_invoice(post, amount, options)
  add_payment_method(post, payment_method, options)
  add_customer_data(post, options)
  add_transaction_descriptor(post, options)
  add_point_of_sale(post, options) if payment_method.is_a?(String)
  commit(post, 'authcapture')
end

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



43
44
45
46
47
48
49
# File 'lib/active_merchant/billing/gateways/paynetworx.rb', line 43

def refund(amount, authorization, options = {})
  post = {}
  add_invoice(post, amount, options)
  add_customer_data(post, options)
  process_payment(post, authorization)
  commit(post, 'refund')
end

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



59
60
61
62
63
64
65
# File 'lib/active_merchant/billing/gateways/paynetworx.rb', line 59

def void(authorization, options = {})
  post = {}
  add_customer_data(post, options)
  process_payment(post, authorization)
  void_reasons(post, options)
  commit(post, 'void')
end