Skip to content

Commit

Permalink
Extract a comment-method so the code conveys it's purpose
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt-Yorkley committed Feb 15, 2022
1 parent b017420 commit 8084ad0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/models/spree/payment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def ensure_correct_adjustment
adjustment.originator = payment_method
adjustment.label = adjustment_label
adjustment.save
elsif amount.positive? && payment_method.present?
elsif !processing_refund? && payment_method.present?
payment_method.create_adjustment(adjustment_label, self, true)
adjustment.reload
end
Expand All @@ -163,6 +163,10 @@ def clear_authorization_url

private

def processing_refund?
amount.negative?
end

# Don't charge fees for invalid or failed payments.
# This is called twice for failed payments, because the persistence of the 'failed'
# state is acheived through some trickery using an after_rollback callback on the
Expand Down

0 comments on commit 8084ad0

Please sign in to comment.