mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-02 21:57:17 +00:00
Set terms and conditions accepted when completing checkout
This commit is contained in:
@@ -44,6 +44,7 @@ class SplitCheckoutController < ::BaseController
|
||||
return unless summary_step? && @order.confirmation?
|
||||
return unless validate_summary! && @order.errors.empty?
|
||||
|
||||
@order.customer.touch :terms_and_conditions_accepted_at
|
||||
@order.confirm!
|
||||
end
|
||||
|
||||
@@ -81,6 +82,7 @@ class SplitCheckoutController < ::BaseController
|
||||
|
||||
def validate_summary!
|
||||
return true if params[:accept_terms]
|
||||
return true unless TermsOfService.required?(@order.distributor)
|
||||
|
||||
@order.errors.add(:terms_and_conditions, t("split_checkout.errors.terms_not_accepted"))
|
||||
end
|
||||
|
||||
@@ -11,6 +11,10 @@ class TermsOfService
|
||||
end
|
||||
end
|
||||
|
||||
def self.required?(distributor)
|
||||
platform_terms_required? || distributor_terms_required?(distributor)
|
||||
end
|
||||
|
||||
def self.platform_terms_required?
|
||||
Spree::Config.shoppers_require_tos
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user