Sha256: 3154fa30f5ef9cf82f8fd6a0a0d383a8478dfab44cd1e2f032b388174167a480
Contents?: true
Size: 625 Bytes
Versions: 6
Compression:
Stored size: 625 Bytes
Contents
module Spree CheckoutController.class_eval do before_filter :sufficient_loyalty_points, only: [:update], if: -> { params[:state] == 'payment' } private def sufficient_loyalty_points payment_method_ids = params[:order][:payments_attributes].collect do |payment| payment["payment_method_id"] end if Spree::PaymentMethod.loyalty_points_id_included?(payment_method_ids) && !@order.user.has_sufficient_loyalty_points?(@order) flash[:error] = Spree.t(:insufficient_loyalty_points) redirect_to checkout_state_path(@order.state) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems