Sha256: 7860ddc7ef238e06b53118be1d0b39dd2864d913fd03fabe6b6f049b1ccb1976

Contents?: true

Size: 696 Bytes

Versions: 1

Compression:

Stored size: 696 Bytes

Contents

# Once an order is finalized its subscriptions line items should be converted
# into active subscritptions. This hooks into Spree::Order#finalize! and
# passes all subscription_line_items present on the order to the Subscription
# generator which will build and persist the subscriptions
module Spree
  module Orders
    module FinalizeCreatesSubscriptions
      def finalize!
        SolidusSubscriptions::SubscriptionGenerator.group(subscription_line_items).each do |line_items|
          SolidusSubscriptions::SubscriptionGenerator.activate(line_items)
        end

        super
      end
    end
  end
end

Spree::Order.prepend Spree::Orders::FinalizeCreatesSubscriptions

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_subscriptions-alpha-0.0.4 app/decorators/spree/orders/finalize_creates_subscriptions.rb