mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
use scope on payment model
This commit is contained in:
@@ -49,6 +49,7 @@ module Spree
|
||||
scope :pending, -> { with_state('pending') }
|
||||
scope :failed, -> { with_state('failed') }
|
||||
scope :valid, -> { where('state NOT IN (?)', %w(failed invalid)) }
|
||||
scope :authorization_action_required, -> { where.not(cvv_response_message: nil) }
|
||||
|
||||
# order state machine (see http://github.com/pluginaweek/state_machine/tree/master for details)
|
||||
state_machine initial: :checkout do
|
||||
|
||||
@@ -6,8 +6,8 @@ class PaymentsRequiringAction
|
||||
end
|
||||
|
||||
def query
|
||||
Spree::Payment.joins(order: [:user]).where.not(cvv_response_message: nil).
|
||||
where("spree_users.id = ?", user.id)
|
||||
Spree::Payment.joins(order: [:user]).where("spree_users.id = ?", user.id).
|
||||
authorization_action_required
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user