lib/active_merchant/billing/gateways/paymill.rb in activemerchant-1.32.0 vs lib/active_merchant/billing/gateways/paymill.rb in activemerchant-1.32.1
- old
+ new
@@ -14,21 +14,31 @@
def initialize(options = {})
requires!(options, :public_key, :private_key)
super
end
- def purchase(money, credit_card, options = {})
- MultiResponse.run do |r|
- r.process { save_card(credit_card) }
- r.process { purchase_with_token(money, r.authorization, options) }
+ 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
- def authorize(money, credit_card, options = {})
- MultiResponse.run do |r|
- r.process { save_card(credit_card) }
- r.process { authorize_with_token(money, r.authorization, options) }
+ 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
def capture(money, authorization, options = {})
post = {}
@@ -43,9 +53,13 @@
post = {}
post[:amount] = amount(money)
post[:description] = options[:description]
commit(:post, "refunds/#{transaction_id(authorization)}", post)
+ end
+
+ def store(credit_card, options={})
+ save_card(credit_card)
end
private
def add_credit_card(post, credit_card)