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

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



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

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)

  commit('preauth', post)
end

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



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

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”



72
73
74
75
76
77
78
79
80
81
# File 'lib/active_merchant/billing/gateways/qvalent.rb', line 72

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
35
# 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)

  commit('capture', post)
end

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



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

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'

  commit('refund', post)
end

#scrub(transcript) ⇒ Object



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

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



92
93
94
95
96
97
98
# File 'lib/active_merchant/billing/gateways/qvalent.rb', line 92

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)


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

def supports_scrubbing?
  true
end

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



83
84
85
86
87
88
89
90
# File 'lib/active_merchant/billing/gateways/qvalent.rb', line 83

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

  commit('reversal', post)
end