Skip to content

Commit

Permalink
Unshadow payment amount method
Browse files Browse the repository at this point in the history
The paramenter `amount` is renamed to avoid shadowing the method with
the same name in `Spree::Payment`, which includes this module.
  • Loading branch information
spaghetticode committed Sep 15, 2020
1 parent 765a248 commit 3aa00c7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions core/app/models/spree/payment/processing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,20 @@ def purchase!
# Takes the amount in cents to capture.
# Can be used to capture partial amounts of a payment, and will create
# a new pending payment record for the remaining amount to capture later.
def capture!(amount = nil)
def capture!(capture_amount = nil)
return true if completed?
return false unless self.amount.positive?
return false unless amount.positive?

amount ||= money.money.cents
capture_amount ||= money.money.cents
started_processing!
protect_from_connection_error do
# Standard ActiveMerchant capture usage
response = payment_method.capture(
amount,
capture_amount,
response_code,
gateway_options
)
money = ::Money.new(amount, currency)
money = ::Money.new(capture_amount, currency)
capture_events.create!(amount: money.to_d)
update!(amount: captured_amount)
handle_response(response, :complete, :failure)
Expand Down

0 comments on commit 3aa00c7

Please sign in to comment.