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 CreditCardFormatting

#expdate, #format

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.



16
17
18
19
# File 'lib/active_merchant/billing/gateways/pay_conex.rb', line 16

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

Instance Method Details

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



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

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



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

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)


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

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



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

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



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

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

#scrub(transcript) ⇒ Object



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

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



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

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)


74
75
76
# File 'lib/active_merchant/billing/gateways/pay_conex.rb', line 74

def supports_scrubbing?
  true
end

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



61
62
63
# File 'lib/active_merchant/billing/gateways/pay_conex.rb', line 61

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

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



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

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