Don't offer to void a refund

This commit is contained in:
Maikel Linke
2026-03-16 12:37:52 +11:00
parent 53c2ef53d5
commit 9961578fc1
2 changed files with 4 additions and 3 deletions

View File

@@ -26,7 +26,9 @@ module Spree
end
def can_void?(payment)
payment.state == "completed"
# The source can be another payment. Then this is an offset payment
# like a credit record. We can't void a refund.
payment.source == self && payment.state == "completed"
end
def can_credit?(payment)

View File

@@ -76,8 +76,7 @@ RSpec.describe "Admin -> Order -> Payments" do
# Our payment system creates a new payment to show the credit.
within row_containing("$-9.75") do
# TODO: don't offer to void a credited amount.
expect(page).to have_link "Void"
expect(page).not_to have_link "Void"
end
end
end