Sha256: f6ebab62f057129ac07bd11b536d3598748a614d4117fc86f20c80ce574de6ad

Contents?: true

Size: 873 Bytes

Versions: 37

Compression:

Stored size: 873 Bytes

Contents

module Spree
  class MailerPreviews
    class OrderPreview < ActionMailer::Preview
      def confirm
        order = Order.complete.last
        raise "Your database needs at least one completed order to render this preview" unless order
        OrderMailer.confirm_email(order)
      end

      def cancel
        order = Order.with_state(:canceled).last
        raise "Your database needs at least one cancelled order to render this preview" unless order
        OrderMailer.cancel_email(order)
      end

      def inventory_cancellation
        order = Spree::Order.joins(:inventory_units).merge(Spree::InventoryUnit.canceled).last
        raise "Your database needs at least one order with a canceled inventory unit to render this preview" unless order
        OrderMailer.inventory_cancellation_email(order, [order.inventory_units.first])
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
solidus_core-2.5.2 lib/spree/mailer_previews/order_preview.rb
solidus_core-2.5.1 lib/spree/mailer_previews/order_preview.rb
solidus_core-2.5.0 lib/spree/mailer_previews/order_preview.rb
solidus_core-2.5.0.rc1 lib/spree/mailer_previews/order_preview.rb
solidus_core-2.5.0.beta2 lib/spree/mailer_previews/order_preview.rb
solidus_core-2.5.0.beta1 lib/spree/mailer_previews/order_preview.rb
solidus_core-2.4.2 lib/spree/mailer_previews/order_preview.rb
solidus_core-2.3.1 lib/spree/mailer_previews/order_preview.rb
solidus_core-2.4.1 lib/spree/mailer_previews/order_preview.rb
solidus_core-2.2.2 lib/spree/mailer_previews/order_preview.rb
solidus_core-2.1.1 lib/spree/mailer_previews/order_preview.rb
solidus_core-2.0.3 lib/spree/mailer_previews/order_preview.rb
solidus_core-1.4.2 lib/spree/mailer_previews/order_preview.rb
solidus_core-2.4.0 lib/spree/mailer_previews/order_preview.rb
solidus_core-2.4.0.rc1 lib/spree/mailer_previews/order_preview.rb
solidus_core-2.4.0.beta1 lib/spree/mailer_previews/order_preview.rb
solidus_core-2.3.0 lib/spree/mailer_previews/order_preview.rb
solidus_core-2.3.0.rc3 lib/spree/mailer_previews/order_preview.rb
solidus_core-2.3.0.rc2 lib/spree/mailer_previews/order_preview.rb
solidus_core-2.3.0.rc1 lib/spree/mailer_previews/order_preview.rb