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, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

#card_brand, card_brand, #generate_unique_id, inherited, non_fractional_currency?, #scrub, supported_countries, #supported_countries, supported_countries=, supports?, #supports_scrubbing?, #test?

Methods included from CreditCardFormatting

#expdate, #format

Methods included from PostsData

included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request

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
35
# 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]
  post[:source] = 'active_merchant'
  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



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

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



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

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

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



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

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