Feature: #916 - Cancellations and returns with lines 

See Issue 916

Description 

Ordered products can be canceled before they are shipped and returned after they are shipped, both for a part of the ordered count. This change adds the data model, like Feature: #902 - Shipments with lines did for shipments. Creating cancellations and returns, the quantities, deriving the shipping status, restocking and the backend UI follow separately.

  • tx_cart_domain_model_order_return: order item, type (cancellation or return), status, reason, return number, received date, the reason why a product was canceled or returned although it is not cancelable or not returnable, and a note.
  • tx_cart_domain_model_order_return_product: the products of a cancellation or return, the count of an ordered product, whether it is restocked and its condition (new, used or damaged).

Cancellations and returns are stored in one table, because they share their fields and their products; "return" alone is a reserved word in PHP and MySQL. They are no Extbase models. The readonly objects \Extcode\Cart\Domain\Order\Fulfillment\OrderReturn and \Extcode\Cart\Domain\Order\Fulfillment\OrderReturnProduct are read and stored by \Extcode\Cart\Domain\Order\Fulfillment\OrderReturnRepository. The type is the enum \Extcode\Cart\Domain\Order\Fulfillment\OrderReturnType, the condition the enum \Extcode\Cart\Domain\Order\Fulfillment\ItemCondition. The TCA of both tables is read only, the cancellations and returns are shown in the order item record.

New status (see Payment and shipping status):

  • The new type cancellation with the status requested, accepted and rejected (\Extcode\Cart\Domain\Order\Fulfillment\CancellationStatus).
  • The new type return with the status requested, received, accepted and rejected (\Extcode\Cart\Domain\Order\Fulfillment\ReturnStatus).
  • The shipping status canceled (all ordered products are canceled).

Impact 

The database schema has to be updated. Nothing changes for existing orders.

The select of the shipping status in the backend module offers the new status canceled. Own shipping status which are registered after shipped are listed after canceled now.

\Extcode\Cart\Domain\Order\Status\ServiceType has the new cases Cancellation and Return. Code that matches all cases of the enum has to handle them.