Sha256: 7c151e13c98b38ee81858dbc76b02a47afe227e3051ba994daf51035d8520dd8

Contents?: true

Size: 640 Bytes

Versions: 6

Compression:

Stored size: 640 Bytes

Contents

# frozen_string_literal: true

module SolidusSubscriptions
  class OrderCreator
    def initialize(installment)
      @installment = installment
    end

    def call
      ::Spree::Order.create(
        user: installment.subscription.user,
        email: installment.subscription.user.email,
        store: installment.subscription.store || ::Spree::Store.default,
        subscription_order: true,
        subscription: installment.subscription,
        currency: installment.subscription.currency,
        **extra_attributes
      )
    end

    private

    def extra_attributes
      {}
    end

    attr_reader :installment
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
solidus_subscriptions-2.0.2 lib/solidus_subscriptions/order_creator.rb
solidus_subscriptions-2.0.1 lib/solidus_subscriptions/order_creator.rb
solidus_subscriptions-2.0.0 lib/solidus_subscriptions/order_creator.rb
solidus_subscriptions-1.1.0 lib/solidus_subscriptions/order_creator.rb
solidus_subscriptions-1.0.1 lib/solidus_subscriptions/order_creator.rb
solidus_subscriptions-1.0.0 lib/solidus_subscriptions/order_creator.rb