mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-13 04:00:21 +00:00
Merge pull request #11290 from cyrillefr/Orders_in_confirmation_state_cannot_be_completed_by_hub_or_shop
Fix Orders in confirmation state cannot be completed by hub or shop
This commit is contained in:
@@ -67,7 +67,7 @@ module Spree
|
||||
end
|
||||
|
||||
def actions
|
||||
%w{capture void credit resend_authorization_email}
|
||||
%w{capture_and_complete_order void credit resend_authorization_email}
|
||||
end
|
||||
|
||||
def can_resend_authorization_email?(payment)
|
||||
@@ -75,7 +75,7 @@ module Spree
|
||||
end
|
||||
|
||||
# Indicates whether its possible to capture the payment
|
||||
def can_capture?(payment)
|
||||
def can_capture_and_complete_order?(payment)
|
||||
return false if payment.requires_authorization?
|
||||
|
||||
payment.pending? || payment.checkout?
|
||||
|
||||
@@ -47,6 +47,11 @@ module Spree
|
||||
end
|
||||
end
|
||||
|
||||
def capture_and_complete_order!
|
||||
OrderWorkflow.new(order).complete!
|
||||
capture!
|
||||
end
|
||||
|
||||
def void_transaction!
|
||||
return true if void?
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@ module Spree
|
||||
class PaymentMethod
|
||||
class Check < Spree::PaymentMethod
|
||||
def actions
|
||||
%w{capture void}
|
||||
%w{capture_and_complete_order void}
|
||||
end
|
||||
|
||||
# Indicates whether its possible to capture the payment
|
||||
def can_capture?(payment)
|
||||
def can_capture_and_complete_order?(payment)
|
||||
['checkout', 'pending'].include?(payment.state)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user