Class: ActiveMerchant::Billing::PaymillGateway

Inherits:
Gateway
  • Object
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::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?

Methods included from CreditCardFormatting

#format

Constructor Details

#initialize(options = {}) ⇒ PaymillGateway

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



23
24
25
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 23

def authorize(money, payment_method, options = {})
  action_with_token(:authorize, money, payment_method, options)
end

#capture(money, authorization, options = {}) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 27

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
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 19

def purchase(money, payment_method, options = {})
  action_with_token(:purchase, money, payment_method, options)
end

#refund(money, authorization, options = {}) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 36

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



48
49
50
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 48

def store(credit_card, options={})
  save_card(credit_card)
end

#void(authorization, options = {}) ⇒ Object



44
45
46
# File 'lib/active_merchant/billing/gateways/paymill.rb', line 44

def void(authorization, options={})
  commit(:delete, "preauthorizations/#{preauth(authorization)}")
end