diff options
author | Alessandro Desantis <desa.alessandro@gmail.com> | 2020-09-24 14:05:05 +0200 |
---|---|---|
committer | Alessandro Desantis <desa.alessandro@gmail.com> | 2020-09-24 14:48:37 +0200 |
commit | 19cd3c9e95d880b55a3a67fb4c3258becee31920 (patch) | |
tree | e0ff2e2645a8b8bca209fd8b68cb389b41686008 /app | |
parent | 9ab99ab24fc36805eac3c1fefef85aafe90cf7b8 (diff) |
Use `.configure`/`.configuration` standard for config management
Diffstat (limited to 'app')
6 files changed, 14 insertions, 14 deletions
diff --git a/app/controllers/solidus_subscriptions/api/v1/subscriptions_controller.rb b/app/controllers/solidus_subscriptions/api/v1/subscriptions_controller.rb index 8db616d..8c37c25 100644 --- a/app/controllers/solidus_subscriptions/api/v1/subscriptions_controller.rb +++ b/app/controllers/solidus_subscriptions/api/v1/subscriptions_controller.rb @@ -45,6 +45,6 @@ class SolidusSubscriptions::Api::V1::SubscriptionsController < Spree::Api::BaseC end def line_item_attributes - SolidusSubscriptions::Config.subscription_line_item_attributes - [:subscribable_id] + [:id] + SolidusSubscriptions.configuration.subscription_line_item_attributes - [:subscribable_id] + [:id] end end diff --git a/app/jobs/solidus_subscriptions/process_installments_job.rb b/app/jobs/solidus_subscriptions/process_installments_job.rb index ba54fa8..6048ee6 100644 --- a/app/jobs/solidus_subscriptions/process_installments_job.rb +++ b/app/jobs/solidus_subscriptions/process_installments_job.rb @@ -3,7 +3,7 @@ module SolidusSubscriptions class ProcessInstallmentsJob < ActiveJob::Base - queue_as Config.processing_queue + queue_as SolidusSubscriptions.configuration.processing_queue # Process a collection of installments # diff --git a/app/models/solidus_subscriptions/installment.rb b/app/models/solidus_subscriptions/installment.rb index 1cad63e..c5b4f6c 100644 --- a/app/models/solidus_subscriptions/installment.rb +++ b/app/models/solidus_subscriptions/installment.rb @@ -126,8 +126,8 @@ module SolidusSubscriptions end def next_actionable_date - return if Config.reprocessing_interval.nil? - (DateTime.current + Config.reprocessing_interval).beginning_of_minute + return if SolidusSubscriptions.configuration.reprocessing_interval.nil? + (DateTime.current + SolidusSubscriptions.configuration.reprocessing_interval).beginning_of_minute end end end diff --git a/app/models/solidus_subscriptions/subscription.rb b/app/models/solidus_subscriptions/subscription.rb index 9839773..3eb449a 100644 --- a/app/models/solidus_subscriptions/subscription.rb +++ b/app/models/solidus_subscriptions/subscription.rb @@ -133,7 +133,7 @@ module SolidusSubscriptions # pending cancellation will still be processed. def can_be_canceled? return true if actionable_date.nil? - (actionable_date - Config.minimum_cancellation_notice).future? + (actionable_date - SolidusSubscriptions.configuration.minimum_cancellation_notice).future? end def skip(check_skip_limits: true) @@ -226,17 +226,17 @@ module SolidusSubscriptions private def check_successive_skips_exceeded - return unless Config.maximum_successive_skips + return unless SolidusSubscriptions.configuration.maximum_successive_skips - if successive_skip_count >= Config.maximum_successive_skips + if successive_skip_count >= SolidusSubscriptions.configuration.maximum_successive_skips errors.add(:successive_skip_count, :exceeded) end end def check_total_skips_exceeded - return unless Config.maximum_total_skips + return unless SolidusSubscriptions.configuration.maximum_total_skips - if skip_count >= Config.maximum_total_skips + if skip_count >= SolidusSubscriptions.configuration.maximum_total_skips errors.add(:skip_count, :exceeded) end end diff --git a/app/services/solidus_subscriptions/checkout.rb b/app/services/solidus_subscriptions/checkout.rb index 3457435..244cb0b 100644 --- a/app/services/solidus_subscriptions/checkout.rb +++ b/app/services/solidus_subscriptions/checkout.rb @@ -31,13 +31,13 @@ module SolidusSubscriptions return if installments.empty? if checkout - Config.success_dispatcher_class.new(installments, order).dispatch + SolidusSubscriptions.configuration.success_dispatcher_class.new(installments, order).dispatch return order end # A new order will only have 1 payment that we created if order.payments.any?(&:failed?) - Config.payment_failed_dispatcher_class.new(installments, order).dispatch + SolidusSubscriptions.configuration.payment_failed_dispatcher_class.new(installments, order).dispatch installments.clear nil end @@ -45,7 +45,7 @@ module SolidusSubscriptions # Any installments that failed to be processed will be reprocessed unfulfilled_installments = installments.select(&:unfulfilled?) if unfulfilled_installments.any? - Config.failure_dispatcher_class. + SolidusSubscriptions.configuration.failure_dispatcher_class. new(unfulfilled_installments, order).dispatch end end @@ -100,7 +100,7 @@ module SolidusSubscriptions # They will be reprocessed later @installments -= unfulfilled_installments if unfulfilled_installments.any? - Config.out_of_stock_dispatcher_class.new(unfulfilled_installments).dispatch + SolidusSubscriptions.configuration.out_of_stock_dispatcher_class.new(unfulfilled_installments).dispatch end return if installments.empty? diff --git a/app/services/solidus_subscriptions/subscription_line_item_builder.rb b/app/services/solidus_subscriptions/subscription_line_item_builder.rb index 9dc0960..19660c4 100644 --- a/app/services/solidus_subscriptions/subscription_line_item_builder.rb +++ b/app/services/solidus_subscriptions/subscription_line_item_builder.rb @@ -14,7 +14,7 @@ module SolidusSubscriptions def subscription_params params.require(:subscription_line_item).permit( - SolidusSubscriptions::Config.subscription_line_item_attributes + SolidusSubscriptions.configuration.subscription_line_item_attributes ) end end |