CodeBaobab
Code reading and design

Map a returns importer before extending it

Problem

A wholesale returns importer supports CSV. You need to add a webhook input without changing the return rules. Draw which components depend on each other, then trace how one duplicate reaches the repository. Explain where you would add the new adapter and which tests should fail before the fix.

What you know

  • CsvReader produces raw rows. ReturnNormalizer maps them to ReturnEvent. ImportService validates and calls ReturnStore.save(event).
  • The store currently creates a new record on every call. The source sends the same return ID in both channels.
  • A supplier correction can reuse a return ID with a higher revision. Older revisions can arrive late.

Checking exercise access…