Class: ActiveMerchant::Billing::QvalentGateway

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

Constant Summary

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::DEBIT_CARDS, 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.



15
16
17
18
# File 'lib/active_merchant/billing/gateways/qvalent.rb', line 15

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

Instance Method Details

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



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/active_merchant/billing/gateways/qvalent.rb', line 32

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



44
45
46
47
48
49
50
51
52
# File 'lib/active_merchant/billing/gateways/qvalent.rb', line 44

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”



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

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



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/active_merchant/billing/gateways/qvalent.rb', line 20

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



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

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



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

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



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

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)


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

def supports_scrubbing?
  true
end

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



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

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

  commit("reversal", post)
end