Skip to content

feat(company-lookup): add NIP company lookup (GUS, MF, CEIDG, OpenBRIS) - #18

Closed
hedon77 wants to merge 25 commits into
Panelica:mainfrom
hedon77:server-deploy
Closed

feat(company-lookup): add NIP company lookup (GUS, MF, CEIDG, OpenBRIS)#18
hedon77 wants to merge 25 commits into
Panelica:mainfrom
hedon77:server-deploy

Conversation

@hedon77

@hedon77 hedon77 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a Company Lookup feature that resolves a Polish NIP across four independent sources, plus a lightweight extension framework to manage and configure it.

Extension framework

  • addon_settings table (encrypted values) + AddonSetting model.
  • AddonManager::settings()/saveSettings() and AddonController::saveSettings().
  • The Addon page (Konfiguracja → Rozszerzenia) now renders and persists each addon's config() fields (text/textarea/password/checkbox).

Company Lookup addon

  • Providers: GUS BIR (SOAP), MF Biała Lista (REST), CEIDG (API v3), OpenBRIS (REST) — each optional and independently fault-tolerant.
  • DataNormalizer merges with per-field priority (GUS → CEIDG → MF → OpenBRIS) and flags discrepancies.
  • NIP validation (checksum), cache (company_lookup:{nip}, configurable TTL), per-source test buttons.
  • Endpoint: POST /api/company/lookup.
  • UI: "Pobierz dane" button next to the NIP field (admin client create/edit).

Notes

  • API keys (GUS/CEIDG/OpenBRIS) are stored encrypted in the DB, never in code or env.
  • Tests: NIP validation, normalizer, and feature tests for the providers/endpoint.

hedon77 added 25 commits August 31, 2026 00:47
- drop the level (Tax 1/Tax 2) column, add is_default to tax_rules
- match tax rules on country/state with the default rule as fallback
- seed Polish VAT rates (23%, 8%, 5%, 0%, ZW, NP) with 23% as default
- add 'set as default' action and default column to the tax screen
- single tax rate per invoice; secondary tax (tax2) no longer calculated
- tax rules are grouped by country and state; each group holds any number of
  rates (name + %) with one marked as default
- list shows country, state and the group's default rate; add/edit manage a
  group's rates in one form
- matching: country+state -> country default -> global default -> 0
- seed standard VAT rates for all European countries and Turkey
- invoice builder offers the client's country rates as a dropdown, defaulting
  to the country's default rate
- persist the rate label on invoice items so invoices and the PDF show the
  descriptive name (VAT 23%, VAT ZW, VAT NP) with tax amount and net base
- summary on invoice views: rate name, tax, net base; Netto moved under VAT
- localize Netto/Brutto labels
- new invoice_products catalog (name, price, unit, VAT) on the products page
  with add/edit/delete and VAT narrowed to the company's country
- catalog products appear in the invoice builder's description autocomplete
  and fill price, unit and their own VAT rate
- add a per-line 'unit' field (Jed.) to invoices and persist it
- pre-select the company default VAT rate when adding a catalog product
- fix en.json overrides so the 'New Hosting Product' button label applies
…lance

- Admin: add existing clients as affiliates, fix table columns and balance display
- Admin & client: convert affiliate balance to client account credit
- Client: fix commission history amounts and referred client names
- Remove duplicate config affiliates page and point menu links at /admin/affiliates
Add an extension framework (addon_settings table, config() form rendering/saving) and a Company Lookup addon that resolves a Polish NIP across GUS BIR, MF white list, CEIDG and OpenBRIS, normalises the result and flags per-field discrepancies.
Add a Test action for each API (GUS, MF, CEIDG, OpenBRIS) on the addon page, prefix the result with the source name, and treat an unconfigured GUS key as a silent skip.
@hedon77

hedon77 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #19 (clean branch with only the company-lookup commits).

@hedon77 hedon77 closed this Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant