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

#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, #strftime_yyyymm

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)
  super
end

Instance Method Details

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



38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/active_merchant/billing/gateways/qvalent.rb', line 38

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_stored_credential_data(post, payment_method, options)
  add_customer_data(post, options)
  add_soft_descriptors(post, options)
  add_customer_reference(post, options)

  commit('preauth', post)
end

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



52
53
54
55
56
57
58
59
60
61
# File 'lib/active_merchant/billing/gateways/qvalent.rb', line 52

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)
  add_customer_reference(post, options)

  commit('captureWithoutAuth', post)
end

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

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



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

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)
  add_customer_reference(post, options)

  commit('refund', post)
end

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



24
25
26
27
28
29
30
31
32
33
34
35
36
# 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_stored_credential_data(post, payment_method, options)
  add_customer_data(post, options)
  add_soft_descriptors(post, options)
  add_customer_reference(post, options)

  commit('capture', post)
end

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



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

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)
  post['order.ECI'] = options[:eci] || 'SSL'
  add_customer_reference(post, options)

  commit('refund', post)
end

#scrub(transcript) ⇒ Object



110
111
112
113
114
115
# File 'lib/active_merchant/billing/gateways/qvalent.rb', line 110

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



98
99
100
101
102
103
104
# File 'lib/active_merchant/billing/gateways/qvalent.rb', line 98

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

  commit('registerAccount', post)
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


106
107
108
# File 'lib/active_merchant/billing/gateways/qvalent.rb', line 106

def supports_scrubbing?
  true
end

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



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

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

  commit('reversal', post)
end