lib/active_merchant/billing/gateways/webpay.rb in activemerchant-1.43.0 vs lib/active_merchant/billing/gateways/webpay.rb in activemerchant-1.43.1
- old
+ new
@@ -12,18 +12,19 @@
self.homepage_url = 'https://webpay.jp/'
self.display_name = 'WebPay'
def capture(money, authorization, options = {})
- post = {:amount => localized_amount(money)}
+ post = {}
+ add_amount(post, money, options)
add_application_fee(post, options)
commit(:post, "charges/#{CGI.escape(authorization)}/capture", post)
end
def refund(money, identification, options = {})
- post = {:amount => localized_amount(money)}
-
+ post = {}
+ add_amount(post, money, options)
MultiResponse.run do |r|
r.process { commit(:post, "charges/#{CGI.escape(identification)}/refund", post, options) }
return r unless options[:refund_fee_amount]
@@ -32,18 +33,9 @@
end
end
def refund_fee(identification, options, meta)
raise NotImplementedError.new
- end
-
- def localized_amount(money, currency = self.default_currency)
- non_fractional_currency?(currency) ? (amount(money).to_f / 100).floor : amount(money)
- end
-
- def add_amount(post, money, options)
- post[:currency] = (options[:currency] || currency(money)).downcase
- post[:amount] = localized_amount(money, post[:currency].upcase)
end
def add_customer(post, creditcard, options)
post[:customer] = options[:customer] if options[:customer] && !creditcard.respond_to?(:number)
end