summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/solidus_subscriptions/installment.rb7
-rw-r--r--app/models/solidus_subscriptions/line_item.rb29
-rw-r--r--app/models/solidus_subscriptions/subscription.rb9
3 files changed, 0 insertions, 45 deletions
diff --git a/app/models/solidus_subscriptions/installment.rb b/app/models/solidus_subscriptions/installment.rb
index 0b5f627..aed1f62 100644
--- a/app/models/solidus_subscriptions/installment.rb
+++ b/app/models/solidus_subscriptions/installment.rb
@@ -31,13 +31,6 @@ module SolidusSubscriptions
unfulfilled.where("#{table_name}.actionable_date <= ?", Time.zone.today)
end)
- # Get the builder for the subscription_line_item. This will be an
- # object that can generate the appropriate line item for the subscribable
- # object
- #
- # @return [SolidusSubscriptions::LineItemBuilder]
- delegate :line_item_builder, to: :subscription
-
# Mark this installment as out of stock.
#
# @return [SolidusSubscriptions::InstallmentDetail] The record of the failed
diff --git a/app/models/solidus_subscriptions/line_item.rb b/app/models/solidus_subscriptions/line_item.rb
index 64e6fb0..2583ecc 100644
--- a/app/models/solidus_subscriptions/line_item.rb
+++ b/app/models/solidus_subscriptions/line_item.rb
@@ -38,34 +38,5 @@ module SolidusSubscriptions
validates :subscribable_id, presence: true
validates :quantity, numericality: { greater_than: 0 }
validates :interval_length, numericality: { greater_than: 0 }, unless: -> { subscription }
-
- def as_json(**options)
- options[:methods] ||= [:dummy_line_item]
- super(options)
- end
-
- # Get a placeholder line item for calculating the values of future
- # subscription orders. It is frozen and cannot be saved
- def dummy_line_item
- li = LineItemBuilder.new([self]).spree_line_items.first
- return unless li
-
- li.order = dummy_order
- li.validate
- li.freeze
- end
-
- private
-
- # Get a placeholder order for calculating the values of future
- # subscription orders. It is a frozen duplicate of the current order and
- # cannot be saved
- def dummy_order
- order = spree_line_item ? spree_line_item.order.dup : ::Spree::Order.create
- order.ship_address = subscription.shipping_address || subscription.user.ship_address if subscription
- order.bill_address = subscription.billing_address || subscription.user.bill_address if subscription
-
- order.freeze
- end
end
end
diff --git a/app/models/solidus_subscriptions/subscription.rb b/app/models/solidus_subscriptions/subscription.rb
index 4168973..15424d8 100644
--- a/app/models/solidus_subscriptions/subscription.rb
+++ b/app/models/solidus_subscriptions/subscription.rb
@@ -203,15 +203,6 @@ module SolidusSubscriptions
actionable_date
end
- # Get the builder for the subscription_line_item. This will be an
- # object that can generate the appropriate line item for the subscribable
- # object
- #
- # @return [SolidusSubscriptions::LineItemBuilder]
- def line_item_builder
- LineItemBuilder.new(line_items)
- end
-
# The state of the last attempt to process an installment associated to
# this subscription
#