When a cancellation is created, should a reimburse...
# support
b
When a cancellation is created, should a reimbursement be created as well so that the
Spree::Order#outstanding_balance
doesn't include the cancelled item? Or is the calculation of
payment_total
supposed to change to remove cancelled items? https://github.com/solidusio/solidus/blob/main/core/app/models/spree/order.rb#L366 Right now, I have some code that has to reinvent the wheel a bit. When a shipment is cancelled, it cancels all of the inventory units and the shipment. It creates adjustments that cancel out adjustments related to the shipment and its line items (sales tax for 99% of cases). Finally, it creates a refund for the user with the sum of the shipment cost, line items, and adjustments that were cancelled. Yet it still says there is an outstanding balance. Trying to figure out what to do here.
c
IIRC canceling an item creates an adjustment to subtract the value out of the line item total 🤔 At least if we we are talking about the Cancel Items tab in the admin. We use that for short ships
b
Ah, that's likely what I'm missing. More cancellation adjustments for the shipment and the line items then.
I wasn't sure if the appropriate way in Solidus was to create a reimbursement or a negated adjustment. After looking at the reimbursement code, that didn't seem to be what the class was meant for.
c
You can try it from the admin, but I am pretty sure that's all that does.
There are different ways to do it.
For RMA/Customer Returns the Reimbursement route is used
For short-ship where the item is removed before the order is shipped I think the adjustment route is preferred
I think the distinction there is based on when you're cancelling the item, before or after the order is shipped.
b
Before shipped.
👍🏼 1
Essentially when the vendor has an order and they have to cancel due to an inventory error.
c
Yeah, in that case cancelling the inventory out and creating an adjustment to zero out the line item is probably the way to go
Oh yeah, that's what the Cancel Items tab is meant for 👍🏼
I would just do the same thing as what that controller does. It won't create the refund so you will need to do that part yourself
b
K
k
@Chris Todorov so should we deny people to create cancel item after the order is shipped?
🤔 1
c
@kennyadsl I don't know if that business logic needs to be enforced by Solidus, I am speaking based on how the store I work on does it. I guess it depends how people integrate with their 3PL / ERP and at what point they realize a short-ship has happened. Also some stores capture payment on shipment, so that may be another thing to consider - what happens with the original authorization if the payment hasn't been captured yet.