diff options
author | cesartalves <cesartalvez@gmail.com> | 2021-05-05 09:33:45 -0300 |
---|---|---|
committer | cesartalves <cesartalvez@gmail.com> | 2021-05-05 09:37:25 -0300 |
commit | 42caa88a89748767555a9d284cdd7b7c53191dcb (patch) | |
tree | c61253c69bd05288bf0b92f5adf58520af0c8d9c /lib/solidus_subscriptions | |
parent | 9f87d809e339d459aa29c6aa62f3033a7c978ee7 (diff) |
Installment OrderCreator configuration: keep extra attributes inside the OrderCreator class and remove it from the configuration.
Diffstat (limited to 'lib/solidus_subscriptions')
-rw-r--r-- | lib/solidus_subscriptions/checkout.rb | 3 | ||||
-rw-r--r-- | lib/solidus_subscriptions/configuration.rb | 10 | ||||
-rw-r--r-- | lib/solidus_subscriptions/order_creator.rb | 9 |
3 files changed, 12 insertions, 10 deletions
diff --git a/lib/solidus_subscriptions/checkout.rb b/lib/solidus_subscriptions/checkout.rb index 15f1a26..7bed823 100644 --- a/lib/solidus_subscriptions/checkout.rb +++ b/lib/solidus_subscriptions/checkout.rb @@ -32,8 +32,7 @@ module SolidusSubscriptions private def create_order - extra_attributes = SolidusSubscriptions.configuration.order_creation_extra_attributes - SolidusSubscriptions.configuration.order_creation_class.new(installment, extra_attributes).call + SolidusSubscriptions.configuration.order_creator_class.new(installment).call end def populate_order(order) diff --git a/lib/solidus_subscriptions/configuration.rb b/lib/solidus_subscriptions/configuration.rb index 5b9aed9..9d6c3d2 100644 --- a/lib/solidus_subscriptions/configuration.rb +++ b/lib/solidus_subscriptions/configuration.rb @@ -4,14 +4,14 @@ module SolidusSubscriptions class Configuration attr_accessor( :maximum_total_skips, :maximum_reprocessing_time, :churn_buster_account_id, - :churn_buster_api_key, :clear_past_installments, :processing_error_handler, :order_creation_extra_attributes + :churn_buster_api_key, :clear_past_installments, :processing_error_handler ) attr_writer( :success_dispatcher_class, :failure_dispatcher_class, :payment_failed_dispatcher_class, :out_of_stock_dispatcher, :maximum_successive_skips, :reprocessing_interval, :minimum_cancellation_notice, :processing_queue, :subscription_line_item_attributes, - :subscription_attributes, :subscribable_class, :order_creation_class + :subscription_attributes, :subscribable_class, :order_creator_class ) def success_dispatcher_class @@ -82,9 +82,9 @@ module SolidusSubscriptions churn_buster_account_id.present? && churn_buster_api_key.present? end - def order_creation_class - @order_creation_class ||= 'SolidusSubscriptions::OrderCreator' - @order_creation_class.constantize + def order_creator_class + @order_creator_class ||= 'SolidusSubscriptions::OrderCreator' + @order_creator_class.constantize end end end diff --git a/lib/solidus_subscriptions/order_creator.rb b/lib/solidus_subscriptions/order_creator.rb index 97b858a..edb68e4 100644 --- a/lib/solidus_subscriptions/order_creator.rb +++ b/lib/solidus_subscriptions/order_creator.rb @@ -2,9 +2,8 @@ module SolidusSubscriptions class OrderCreator - def initialize(installment, extra_attributes) + def initialize(installment) @installment = installment - @extra_attributes = (extra_attributes || {}).symbolize_keys end def call @@ -21,6 +20,10 @@ module SolidusSubscriptions protected - attr_reader :installment, :extra_attributes + def extra_attributes + {} + end + + attr_reader :installment end end |