Class: ActiveMerchant::Billing::VisanetPeruGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::VisanetPeruGateway
show all
- Includes:
- Empty
- Defined in:
- lib/active_merchant/billing/gateways/visanet_peru.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?
#expdate, #format
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
Returns a new instance of VisanetPeruGateway.
16
17
18
19
|
# File 'lib/active_merchant/billing/gateways/visanet_peru.rb', line 16
def initialize(options={})
requires!(options, :access_key_id, :secret_access_key, :merchant_id)
super
end
|
Instance Method Details
#authorize(amount, payment_method, options = {}) ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/active_merchant/billing/gateways/visanet_peru.rb', line 28
def authorize(amount, payment_method, options={})
params = {}
add_invoice(params, amount, options)
add_payment_method(params, payment_method)
add_antifraud_data(params, options)
params[:email] = options[:email] || '[email protected]'
params[:createAlias] = false
commit("authorize", params)
end
|
#capture(authorization, options = {}) ⇒ Object
40
41
42
43
44
|
# File 'lib/active_merchant/billing/gateways/visanet_peru.rb', line 40
def capture(authorization, options={})
params = {}
add_auth_order_id(params, authorization, options)
commit("deposit", params)
end
|
#purchase(amount, payment_method, options = {}) ⇒ Object
21
22
23
24
25
26
|
# File 'lib/active_merchant/billing/gateways/visanet_peru.rb', line 21
def purchase(amount, payment_method, options={})
MultiResponse.run() do |r|
r.process { authorize(amount, payment_method, options) }
r.process { capture(r.authorization, options) }
end
end
|
#refund(amount, authorization, options = {}) ⇒ Object
52
53
54
55
56
|
# File 'lib/active_merchant/billing/gateways/visanet_peru.rb', line 52
def refund(amount, authorization, options={})
params = {}
add_auth_order_id(params, authorization, options)
commit("cancelDeposit", params)
end
|
#scrub(transcript) ⇒ Object
69
70
71
72
73
74
|
# File 'lib/active_merchant/billing/gateways/visanet_peru.rb', line 69
def scrub(transcript)
transcript.
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
gsub(%r((\"cardNumber\\\":\\\")\d+), '\1[FILTERED]').
gsub(%r((\"cvv2Code\\\":\\\")\d+), '\1[FILTERED]')
end
|
#supports_scrubbing? ⇒ Boolean
65
66
67
|
# File 'lib/active_merchant/billing/gateways/visanet_peru.rb', line 65
def supports_scrubbing?
true
end
|
#verify(credit_card, options = {}) ⇒ Object
58
59
60
61
62
63
|
# File 'lib/active_merchant/billing/gateways/visanet_peru.rb', line 58
def verify(credit_card, options={})
MultiResponse.run(:use_first_response) do |r|
r.process { authorize(100, credit_card, options) }
r.process(:ignore_result) { void(r.authorization, options) }
end
end
|
#void(authorization, options = {}) ⇒ Object
46
47
48
49
50
|
# File 'lib/active_merchant/billing/gateways/visanet_peru.rb', line 46
def void(authorization, options={})
params = {}
add_auth_order_id(params, authorization, options)
commit("void", params)
end
|