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?
#expdate, #format, #strftime_yyyymm
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
Returns a new instance of PaymillGateway.
15
16
17
18
|
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 15
def initialize(options = {})
requires!(options, :public_key, :private_key)
super
end
|
Instance Method Details
#authorize(money, payment_method, options = {}) ⇒ Object
24
25
26
|
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 24
def authorize(money, payment_method, options = {})
action_with_token(:authorize, money, payment_method, options)
end
|
#capture(money, authorization, options = {}) ⇒ Object
28
29
30
31
32
33
34
35
36
|
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 28
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
20
21
22
|
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 20
def purchase(money, payment_method, options = {})
action_with_token(:purchase, money, payment_method, options)
end
|
#refund(money, authorization, options = {}) ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 38
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
63
64
65
66
67
68
|
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 63
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
50
51
52
53
54
55
56
57
|
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 50
def store(credit_card, options = {})
options[:currency] = 'USD'
options[:money] = 100
save_card(credit_card, options)
end
|
#supports_scrubbing ⇒ Object
59
60
61
|
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 59
def supports_scrubbing
true
end
|
#verify_credentials ⇒ Object
70
71
72
73
74
75
76
77
78
|
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 70
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
46
47
48
|
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 46
def void(authorization, options = {})
commit(:delete, "preauthorizations/#{preauth(authorization)}")
end
|