Skip to content

Instantly share code, notes, and snippets.

@kenton
Last active December 19, 2015 09:48
Show Gist options
  • Save kenton/5935191 to your computer and use it in GitHub Desktop.
Save kenton/5935191 to your computer and use it in GitHub Desktop.

For RS-2265, a ReturnAuth should allow selection of a warehouse, defaulting to SF

My intended workflow would have been something like this:

  • add a warehouse_id column to ReturnAuthorizations
  • include spec for validations that a ReturnAuth marked as "accepted" has to have a warehouse_id present
  • ReturnAuthorization#process_return calls ReturnAuthorization#return_inventory_units
  • ReturnAuthorization#return_inventory_units calls InventoryUnit#return! on each of the ReturnAuth's inventory_units
  • InventoryUnit#return! is a state transition that has a callback function, InventoryUnit#restock_variants
  • InventoryUnit#restock_variants increments the variant count to restock that item
  • This should also be where the warehouse is set for that variant, but you need to be able to pass in the warehouse object to the #return! method used for the state transition. This can be done with a block, but requries reimplementing the state machine found in Spree::InventoryUnit in the spree/trr-deploy branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment