lib/active_merchant/billing/gateways/balanced.rb in activemerchant-1.29.3 vs lib/active_merchant/billing/gateways/balanced.rb in activemerchant-1.30.0

- old
+ new

@@ -89,12 +89,12 @@ # ==== Options # # * <tt>:login</tt> -- The Balanced API Secret (REQUIRED) def initialize(options = {}) requires!(options, :login) - initialize_marketplace(options[:marketplace] || load_marketplace) super + initialize_marketplace(options[:marketplace] || load_marketplace) end # Performs an authorization (Hold in Balanced nonclementure), which # reserves the funds on the customer's credit card, but does not charge # the card. An authorization is valid until the `expires_at` field in @@ -195,10 +195,11 @@ def capture(money, authorization, options = {}) post = {} post[:hold_uri] = authorization post[:amount] = money if money post[:description] = options[:description] if options[:description] + post[:on_behalf_of_uri] = options[:on_behalf_of_uri] if options[:on_behalf_of_uri] create_transaction(:post, @debits_uri, post) rescue Error => ex failed_response(ex.response) end @@ -232,14 +233,19 @@ # ==== Options # # * <tt>`:amount`<tt> -- specify an amount if you want to perform a # partial refund. This value will default to the total amount of the # debit that has not been refunded so far. - def refund(debit_uri, options = {}) + def refund(amount, debit_uri = "deprecated", options = {}) + if(debit_uri == "deprecated" || debit_uri.kind_of?(Hash)) + deprecated "Calling the refund method without an amount parameter is deprecated and will be removed in a future version." + return refund(options[:amount], amount, options) + end + requires!(debit_uri) post = {} post[:debit_uri] = debit_uri - post[:amount] = options[:amount] if options[:amount] + post[:amount] = amount post[:description] = options[:description] create_transaction(:post, @refunds_uri, post) rescue Error => ex failed_response(ex.response) end