Skip to content

feat(e-billing): customer attribution via buyer identifier - #1026

Merged
jbagsik merged 6 commits into
mainfrom
feature/customer-attribution
Aug 7, 2026
Merged

feat(e-billing): customer attribution via buyer identifier#1026
jbagsik merged 6 commits into
mainfrom
feature/customer-attribution

Conversation

@jbagsik

@jbagsik jbagsik commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Attribute e-billing documents to Customer by buyer identifier (EN 16931 BT-46 / customer_number), persist that field on invoices, and derive reporting-only company_id from the customer's company assignment.
  • Corroborate attributed customers against buyer master data (name, VAT, country, address); mismatches only flag needs_review and never clear attribution.
  • Add manual attribution and explicit rematch from Filament (attribution_source auto|manual), with unified company name matching in CompanyNameMatcher).

Packages

  • moox/e-billing — matcher, corroborator, Filament actions, config, docs
  • moox/invoicecustomer_number column / model / builder / draft / factory

Test plan

  • Ingest a domestic PDF whose buyer identifier matches exactly one active customer → customer_id set, attribution_source=auto, clean validation path still reachable
  • Soft-deleted / inactive customer match → attributed but customer_number = needs_review
  • No match / missing identifier → customer_id null; name fallback may set company_id only
  • Corroboration divergence (name/VAT/country/address) → needs_review only; customer_id unchanged
  • Manual set-attribution from invoice detail → attribution_source=manual; auto rematch does not overwrite manual
  • Rematch from detail/list → resets review status, re-runs field validation; confirmed/validated docs refuse automatic overwrite as documented
  • Changing attribution after HumanConfirmed/Validated clears attestation back to DbValidated
  • Republish e-billing + invoice config/migrations and run package tests

Closes mooxphp/e-billing#23
Closes mooxphp/e-billing#24
Closes mooxphp/e-billing#25
Closes mooxphp/e-billing#27

@jbagsik
jbagsik force-pushed the feature/customer-attribution branch from d68487e to 64fa04c Compare August 7, 2026 11:00
@sonarqubecloud

sonarqubecloud Bot commented Aug 7, 2026

Copy link
Copy Markdown

@jbagsik
jbagsik merged commit 4af5090 into main Aug 7, 2026
11 of 18 checks passed
@jbagsik
jbagsik deleted the feature/customer-attribution branch August 7, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant