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.13 lib/workarea/mailer_previews/storefront/fulfillment_mailer_preview.rb
workarea-storefront-3.4.12 lib/workarea/mailer_previews/storefront/fulfillment_mailer_preview.rb