Class: ActiveMerchant::Billing::PaymillGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::PaymillGateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/paymill.rb
Constant Summary
Constants inherited
from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS
Instance Attribute Summary
Attributes inherited from Gateway
#options
Instance Method Summary
collapse
Methods inherited from Gateway
#card_brand, card_brand, inherited, supports?, #test?
#format
Constructor Details
Returns a new instance of PaymillGateway.
14
15
16
17
|
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 14
def initialize(options = {})
requires!(options, :public_key, :private_key)
super
end
|
Instance Method Details
#authorize(money, payment_method, options = {}) ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 31
def authorize(money, payment_method, options = {})
case payment_method
when String
authorize_with_token(money, payment_method, options)
else
MultiResponse.run do |r|
r.process { save_card(payment_method) }
r.process { authorize_with_token(money, r.authorization, options) }
end
end
end
|
#capture(money, authorization, options = {}) ⇒ Object
43
44
45
46
47
48
49
50
|
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 43
def capture(money, authorization, options = {})
post = {}
add_amount(post, money, options)
post[:preauthorization] = preauth(authorization)
post[:description] = options[:description]
commit(:post, 'transactions', post)
end
|
#purchase(money, payment_method, options = {}) ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 19
def purchase(money, payment_method, options = {})
case payment_method
when String
purchase_with_token(money, payment_method, options)
else
MultiResponse.run do |r|
r.process { save_card(payment_method) }
r.process { purchase_with_token(money, r.authorization, options) }
end
end
end
|
#refund(money, authorization, options = {}) ⇒ Object
52
53
54
55
56
57
58
|
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 52
def refund(money, authorization, options={})
post = {}
post[:amount] = amount(money)
post[:description] = options[:description]
commit(:post, "refunds/#{transaction_id(authorization)}", post)
end
|
#store(credit_card, options = {}) ⇒ Object
60
61
62
|
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 60
def store(credit_card, options={})
save_card(credit_card)
end
|