liberusoftware / liberusoftware/module-ecommerce-returns

UnexpectedReturnLine covers two opposite conditions, so a race reports as a permanent refusal

Open
#2 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

ReceiveGoods throws UnexpectedReturnLine::notOpenToGoods() when the return is no longer open to goods. That is the same exception class raised for a line the return genuinely does not cover.

The two conditions are opposites:

  • Unauthorised goods — permanent. No quantity on this return can be raised to make that line fit; the parcel needs a new request.
  • No longer open to goods — a race. The return expired, or was inspected, between a page rendering and a button being pressed. The line is plainly covered; the timing is wrong.

A consumer has to tell them apart to answer correctly, and with one class it cannot. The Filament package's amendability() currently labels the race with the permanent message — "no quantity on this return can be raised to make it fit" — for a line the return does cover. The operator advice that falls out happens to be right (start a new request), but it is right by coincidence of class rather than by design, and the explanation given is false.

This is the same shape recorded against Checkout in the migration plan: one exception class published for two opposite conditions, forcing every downstream surface to rebuild the distinction from a message string. Checkout's consumer had to match on the domain's own message factory to answer 409 vs 423. The fix belongs here rather than in each surface — publish two cases.

Note that -api packages are landing against this module now, and an HTTP status is exactly the distinction that cannot be made from one class: unauthorised goods is a 422, a lost race is a 409.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at ReceiveGoods and UnexpectedReturnLine::notOpenToGoods(), then trace the Filament package's amendability() handling and the migration-plan reference to Checkout. Identify how the domain currently exposes the two conditions and verify the -api consumers can distinguish unauthorised goods from a lost race without parsing messages; done means each condition has a distinct public case and the existing consumers can map them correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.