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_network_tokenization?, #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.



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[:description]
  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[:description]
  commit(:post, "refunds/#{transaction_id(authorization)}", post)
end

#store(credit_card, options = {}) ⇒ Object



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

def store(credit_card, options={})
  save_card(credit_card)
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