Class: ActiveMerchant::Billing::PayConexGateway

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

Constant Summary

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, #supported_countries, supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #test?

Methods included from Versionable

#fetch_version, included

Methods included from CreditCardFormatting

#expdate, #format, #strftime_yyyymm, #strftime_yyyymmdd_last_day

Methods included from PostsData

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

Constructor Details

#initialize(options = {}) ⇒ PayConexGateway

Returns a new instance of PayConexGateway.



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

def initialize(options = {})
  requires!(options, :account_id, :api_accesskey)
  super
end

Instance Method Details

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



29
30
31
32
33
# File 'lib/active_merchant/billing/gateways/pay_conex.rb', line 29

def authorize(money, payment_method, options = {})
  post = {}
  add_auth_purchase_params(post, money, payment_method, options)
  commit('AUTHORIZATION', post)
end

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



35
36
37
38
39
40
# File 'lib/active_merchant/billing/gateways/pay_conex.rb', line 35

def capture(money, authorization, options = {})
  post = {}
  add_reference_params(post, authorization, options)
  add_amount(post, money, options)
  commit('CAPTURE', post)
end

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

Raises:

  • (ArgumentError)


55
56
57
58
59
60
61
# File 'lib/active_merchant/billing/gateways/pay_conex.rb', line 55

def credit(money, payment_method, options = {})
  raise ArgumentError, 'Reference credits are not supported. Please supply the original credit card or use the #refund method.' if payment_method.is_a?(String)

  post = {}
  add_auth_purchase_params(post, money, payment_method, options)
  commit('CREDIT', post)
end

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



23
24
25
26
27
# File 'lib/active_merchant/billing/gateways/pay_conex.rb', line 23

def purchase(money, payment_method, options = {})
  post = {}
  add_auth_purchase_params(post, money, payment_method, options)
  commit('SALE', post)
end

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



42
43
44
45
46
47
# File 'lib/active_merchant/billing/gateways/pay_conex.rb', line 42

def refund(money, authorization, options = {})
  post = {}
  add_reference_params(post, authorization, options)
  add_amount(post, money, options)
  commit('REFUND', post)
end

#scrub(transcript) ⇒ Object



80
81
82
83
84
85
86
87
# File 'lib/active_merchant/billing/gateways/pay_conex.rb', line 80

def scrub(transcript)
  force_utf8(transcript).
    gsub(%r((api_accesskey=)\w+), '\1[FILTERED]').
    gsub(%r((card_number=)\w+), '\1[FILTERED]').
    gsub(%r((card_verification=)\w+), '\1[FILTERED]').
    gsub(%r((bank_account_number=)\w+), '\1[FILTERED]').
    gsub(%r((bank_routing_number=)\w+), '\1[FILTERED]')
end

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



67
68
69
70
71
72
73
74
# File 'lib/active_merchant/billing/gateways/pay_conex.rb', line 67

def store(payment_method, options = {})
  post = {}
  add_credentials(post)
  add_payment_method(post, payment_method)
  add_address(post, options)
  add_common_options(post, options)
  commit('STORE', post)
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


76
77
78
# File 'lib/active_merchant/billing/gateways/pay_conex.rb', line 76

def supports_scrubbing?
  true
end

#verify(payment_method, options = {}) ⇒ Object



63
64
65
# File 'lib/active_merchant/billing/gateways/pay_conex.rb', line 63

def verify(payment_method, options = {})
  authorize(0, payment_method, options)
end

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



49
50
51
52
53
# File 'lib/active_merchant/billing/gateways/pay_conex.rb', line 49

def void(authorization, options = {})
  post = {}
  add_reference_params(post, authorization, options)
  commit('REVERSAL', post)
end