Sha256: 6940c8dbdcbb47224acb98d4ccb46ac78d4143b3dd93a755cc9665a757a229c2

Contents?: true

Size: 711 Bytes

Versions: 62

Compression:

Stored size: 711 Bytes

Contents

module Workarea
  module Storefront
    class FulfillmentMailerPreview < ActionMailer::Preview
      def shipped
        fulfillment = Fulfillment.all.detect { |f| f.packages.present? }

        FulfillmentMailer.shipped(
          fulfillment.id,
          fulfillment.packages.first.tracking_number
        )
      end

      def canceled
        fulfillment = Fulfillment.all.detect { |f| f.canceled_items.present? }

        quantities = fulfillment.canceled_items.map do |item|
          [
            BSON::ObjectId.from_string(item.order_item_id),
            item.quantity_canceled
          ]
        end.to_h

        FulfillmentMailer.canceled(fulfillment.id, quantities)
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-storefront-3.4.27 lib/workarea/mailer_previews/storefront/fulfillment_mailer_preview.rb
workarea-storefront-3.5.4 lib/workarea/mailer_previews/storefront/fulfillment_mailer_preview.rb
workarea-storefront-3.4.26 lib/workarea/mailer_previews/storefront/fulfillment_mailer_preview.rb
workarea-storefront-3.5.3 lib/workarea/mailer_previews/storefront/fulfillment_mailer_preview.rb
workarea-storefront-3.4.25 lib/workarea/mailer_previews/storefront/fulfillment_mailer_preview.rb
workarea-storefront-3.5.2 lib/workarea/mailer_previews/storefront/fulfillment_mailer_preview.rb
workarea-storefront-3.4.24 lib/workarea/mailer_previews/storefront/fulfillment_mailer_preview.rb
workarea-storefront-3.5.1 lib/workarea/mailer_previews/storefront/fulfillment_mailer_preview.rb
workarea-storefront-3.4.23 lib/workarea/mailer_previews/storefront/fulfillment_mailer_preview.rb
workarea-storefront-3.4.22 lib/workarea/mailer_previews/storefront/fulfillment_mailer_preview.rb
workarea-storefront-3.5.0 lib/workarea/mailer_previews/storefront/fulfillment_mailer_preview.rb
workarea-storefront-3.4.21 lib/workarea/mailer_previews/storefront/fulfillment_mailer_preview.rb
workarea-storefront-3.5.0.beta.1 lib/workarea/mailer_previews/storefront/fulfillment_mailer_preview.rb
workarea-storefront-3.4.20 lib/workarea/mailer_previews/storefront/fulfillment_mailer_preview.rb
workarea-storefront-3.4.19 lib/workarea/mailer_previews/storefront/fulfillment_mailer_preview.rb
workarea-storefront-3.4.18 lib/workarea/mailer_previews/storefront/fulfillment_mailer_preview.rb
workarea-storefront-3.4.17 lib/workarea/mailer_previews/storefront/fulfillment_mailer_preview.rb
workarea-storefront-3.4.16 lib/workarea/mailer_previews/storefront/fulfillment_mailer_preview.rb
workarea-storefront-3.4.15 lib/workarea/mailer_previews/storefront/fulfillment_mailer_preview.rb
workarea-storefront-3.4.14 lib/workarea/mailer_previews/storefront/fulfillment_mailer_preview.rb