Class: ActiveMerchant::Billing::QvalentGateway

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

Constant Summary collapse

CVV_CODE_MAPPING =
{
  'S' => 'D'
}

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

#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 = {}) ⇒ QvalentGateway

Returns a new instance of QvalentGateway.



19
20
21
22
# File 'lib/active_merchant/billing/gateways/qvalent.rb', line 19

def initialize(options={})
  requires!(options, :username, :password, :merchant, :pem, :pem_password)
  super
end

Instance Method Details

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



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/active_merchant/billing/gateways/qvalent.rb', line 36

def authorize(amount, payment_method, options={})
  post = {}
  add_invoice(post, amount, options)
  add_order_number(post, options)
  add_payment_method(post, payment_method)
  add_verification_value(post, payment_method)
  add_customer_data(post, options)
  add_soft_descriptors(post, options)

  commit('preauth', post)
end

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



48
49
50
51
52
53
54
55
56
# File 'lib/active_merchant/billing/gateways/qvalent.rb', line 48

def capture(amount, authorization, options={})
  post = {}
  add_invoice(post, amount, options)
  add_reference(post, authorization, options)
  add_customer_data(post, options)
  add_soft_descriptors(post, options)

  commit('captureWithoutAuth', post)
end

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

Credit requires the merchant account to be enabled for “Adhoc Refunds”



69
70
71
72
73
74
75
76
77
78
# File 'lib/active_merchant/billing/gateways/qvalent.rb', line 69

def credit(amount, payment_method, options={})
  post = {}
  add_invoice(post, amount, options)
  add_order_number(post, options)
  add_payment_method(post, payment_method)
  add_customer_data(post, options)
  add_soft_descriptors(post, options)

  commit('refund', post)
end

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



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/active_merchant/billing/gateways/qvalent.rb', line 24

def purchase(amount, payment_method, options={})
  post = {}
  add_invoice(post, amount, options)
  add_order_number(post, options)
  add_payment_method(post, payment_method)
  add_verification_value(post, payment_method)
  add_customer_data(post, options)
  add_soft_descriptors(post, options)

  commit('capture', post)
end

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



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

def refund(amount, authorization, options={})
  post = {}
  add_invoice(post, amount, options)
  add_reference(post, authorization, options)
  add_customer_data(post, options)
  add_soft_descriptors(post, options)

  commit('refund', post)
end

#scrub(transcript) ⇒ Object



101
102
103
104
105
106
# File 'lib/active_merchant/billing/gateways/qvalent.rb', line 101

def scrub(transcript)
  transcript.
    gsub(%r((&?customer.password=)[^&]*), '\1[FILTERED]').
    gsub(%r((&?card.PAN=)[^&]*), '\1[FILTERED]').
    gsub(%r((&?card.CVN=)[^&]*), '\1[FILTERED]')
end

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



89
90
91
92
93
94
95
# File 'lib/active_merchant/billing/gateways/qvalent.rb', line 89

def store(payment_method, options = {})
  post = {}
  add_payment_method(post, payment_method)
  add_card_reference(post)

  commit('registerAccount', post)
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


97
98
99
# File 'lib/active_merchant/billing/gateways/qvalent.rb', line 97

def supports_scrubbing?
  true
end

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



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

def void(authorization, options={})
  post = {}
  add_reference(post, authorization, options)
  add_customer_data(post, options)
  add_soft_descriptors(post, options)

  commit('reversal', post)
end