Skip to content

Commit

Permalink
add reimbursement email preview
Browse files Browse the repository at this point in the history
  • Loading branch information
kennyadsl committed May 14, 2016
1 parent fdad15b commit 5bbc194
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/lib/spree/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,4 @@ class DestroyWithOrdersError < StandardError; end

require 'spree/mailer_previews/order_preview'
require 'spree/mailer_previews/carton_preview'
require 'spree/mailer_previews/reimbursement_preview'
9 changes: 9 additions & 0 deletions core/lib/spree/mailer_previews/reimbursement_preview.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Spree
class MailerPreviews
class ReimbursementPreview < ActionMailer::Preview
def reimbursement
ReimbursementMailer.reimbursement_email(Reimbursement.first)
end
end
end
end
21 changes: 21 additions & 0 deletions sample/db/samples/reimbursements.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Spree::Sample.load_sample("orders")

order = Spree::Order.last
inventory_unit = order.inventory_units.first
stock_location = inventory_unit.find_stock_item.stock_location

return_item = Spree::ReturnItem.create(inventory_unit: inventory_unit)

return_item.exchange_variant = return_item.eligible_exchange_variants.last
return_item.build_exchange_inventory_unit
return_item.accept!

customer_return = Spree::CustomerReturn.create(
stock_location: stock_location,
return_items: [return_item]
)

order.reimbursements.create(
customer_return: customer_return,
return_items: [return_item]
)
1 change: 1 addition & 0 deletions sample/lib/spree_sample.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def self.load_samples

Spree::Sample.load_sample("orders")
Spree::Sample.load_sample("payments")
Spree::Sample.load_sample("reimbursements")
end
end
end

0 comments on commit 5bbc194

Please sign in to comment.