Class: ActiveMerchant::Billing::MaxipagoGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::MaxipagoGateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/maxipago.rb
Constant Summary
collapse
- API_VERSION =
'3.1.1.15'
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
-
#authorize(money, creditcard, options = {}) ⇒ Object
-
#capture(money, authorization, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ MaxipagoGateway
constructor
A new instance of MaxipagoGateway.
-
#purchase(money, creditcard, options = {}) ⇒ Object
-
#refund(money, authorization, options = {}) ⇒ Object
-
#scrub(transcript) ⇒ Object
-
#supports_scrubbing? ⇒ Boolean
-
#verify(creditcard, options = {}) ⇒ Object
-
#void(authorization, options = {}) ⇒ Object
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?
#expdate, #format
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
Returns a new instance of MaxipagoGateway.
18
19
20
21
|
# File 'lib/active_merchant/billing/gateways/maxipago.rb', line 18
def initialize(options = {})
requires!(options, :login, :password)
super
end
|
Instance Method Details
#authorize(money, creditcard, options = {}) ⇒ Object
29
30
31
32
33
|
# File 'lib/active_merchant/billing/gateways/maxipago.rb', line 29
def authorize(money, creditcard, options = {})
commit(:auth) do |xml|
add_auth_purchase(xml, money, creditcard, options)
end
end
|
#capture(money, authorization, options = {}) ⇒ Object
35
36
37
38
39
40
41
42
43
|
# File 'lib/active_merchant/billing/gateways/maxipago.rb', line 35
def capture(money, authorization, options = {})
commit(:capture) do |xml|
add_order_id(xml, authorization)
add_reference_num(xml, options)
xml.payment do
add_amount(xml, money, options)
end
end
end
|
#purchase(money, creditcard, options = {}) ⇒ Object
23
24
25
26
27
|
# File 'lib/active_merchant/billing/gateways/maxipago.rb', line 23
def purchase(money, creditcard, options = {})
commit(:sale) do |xml|
add_auth_purchase(xml, money, creditcard, options)
end
end
|
#refund(money, authorization, options = {}) ⇒ Object
52
53
54
55
56
57
58
59
60
|
# File 'lib/active_merchant/billing/gateways/maxipago.rb', line 52
def refund(money, authorization, options = {})
commit(:return) do |xml|
add_order_id(xml, authorization)
add_reference_num(xml, options)
xml.payment do
add_amount(xml, money, options)
end
end
end
|
#scrub(transcript) ⇒ Object
73
74
75
76
77
78
|
# File 'lib/active_merchant/billing/gateways/maxipago.rb', line 73
def scrub(transcript)
transcript.
gsub(%r((<merchantKey>)[^<]*(</merchantKey>))i, '\1[FILTERED]\2').
gsub(%r((<number>)[^<]*(</number>))i, '\1[FILTERED]\2').
gsub(%r((<cvvNumber>)[^<]*(</cvvNumber>))i, '\1[FILTERED]\2')
end
|
#supports_scrubbing? ⇒ Boolean
69
70
71
|
# File 'lib/active_merchant/billing/gateways/maxipago.rb', line 69
def supports_scrubbing?
true
end
|
#verify(creditcard, options = {}) ⇒ Object
62
63
64
65
66
67
|
# File 'lib/active_merchant/billing/gateways/maxipago.rb', line 62
def verify(creditcard, options = {})
MultiResponse.run(:use_first_response) do |r|
r.process { authorize(100, creditcard, options) }
r.process(:ignore_result) { void(r.authorization, options) }
end
end
|
#void(authorization, options = {}) ⇒ Object
45
46
47
48
49
50
|
# File 'lib/active_merchant/billing/gateways/maxipago.rb', line 45
def void(authorization, options = {})
_, transaction_id = split_authorization(authorization)
commit(:void) do |xml|
xml.transactionID transaction_id
end
end
|