Class: ActiveMerchant::Billing::PaymillGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::PaymillGateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/paymill.rb
Defined Under Namespace
Classes: ResponseParser
Constant Summary
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, payment_method, options = {}) ⇒ Object
-
#capture(money, authorization, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ PaymillGateway
constructor
A new instance of PaymillGateway.
-
#purchase(money, payment_method, options = {}) ⇒ Object
-
#refund(money, authorization, options = {}) ⇒ Object
-
#scrub(transcript) ⇒ Object
-
#store(credit_card, options = {}) ⇒ Object
-
#supports_scrubbing ⇒ Object
-
#verify_credentials ⇒ 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?, #supports_scrubbing?, #test?
#fetch_version, included
#expdate, #format, #strftime_yyyymm, #strftime_yyyymmdd_last_day
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
Returns a new instance of PaymillGateway.
17
18
19
20
|
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 17
def initialize(options = {})
requires!(options, :public_key, :private_key)
super
end
|
Instance Method Details
#authorize(money, payment_method, options = {}) ⇒ Object
26
27
28
|
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 26
def authorize(money, payment_method, options = {})
action_with_token(:authorize, money, payment_method, options)
end
|
#capture(money, authorization, options = {}) ⇒ Object
30
31
32
33
34
35
36
37
38
|
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 30
def capture(money, authorization, options = {})
post = {}
add_amount(post, money, options)
post[:preauthorization] = preauth(authorization)
post[:description] = options[:order_id]
post[:source] = 'active_merchant'
commit(:post, 'transactions', post)
end
|
#purchase(money, payment_method, options = {}) ⇒ Object
22
23
24
|
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 22
def purchase(money, payment_method, options = {})
action_with_token(:purchase, money, payment_method, options)
end
|
#refund(money, authorization, options = {}) ⇒ Object
40
41
42
43
44
45
46
|
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 40
def refund(money, authorization, options = {})
post = {}
post[:amount] = amount(money)
post[:description] = options[:order_id]
commit(:post, "refunds/#{transaction_id(authorization)}", post)
end
|
#scrub(transcript) ⇒ Object
65
66
67
68
69
70
|
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 65
def scrub(transcript)
transcript.
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
gsub(/(account.number=)(\d*)/, '\1[FILTERED]').
gsub(/(account.verification=)(\d*)/, '\1[FILTERED]')
end
|
#store(credit_card, options = {}) ⇒ Object
52
53
54
55
56
57
58
59
|
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 52
def store(credit_card, options = {})
options[:currency] = 'USD'
options[:money] = 100
save_card(credit_card, options)
end
|
#supports_scrubbing ⇒ Object
61
62
63
|
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 61
def supports_scrubbing
true
end
|
#verify_credentials ⇒ Object
72
73
74
75
76
77
78
79
80
|
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 72
def verify_credentials
begin
ssl_get(live_url + 'transactions/nonexistent', )
rescue ResponseError => e
return false if e.response.code.to_i == 401
end
true
end
|
#void(authorization, options = {}) ⇒ Object
48
49
50
|
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 48
def void(authorization, options = {})
commit(:delete, "preauthorizations/#{preauth(authorization)}")
end
|