Skip to content

feat(affiliates): admin management and convert earnings to account balance - #15

Merged
Panelica merged 3 commits into
Panelica:mainfrom
hedon77:feat/affiliates
Sep 4, 2026
Merged

feat(affiliates): admin management and convert earnings to account balance#15
Panelica merged 3 commits into
Panelica:mainfrom
hedon77:feat/affiliates

Conversation

@hedon77

@hedon77 hedon77 commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Admin affiliate management (list, detail, edit) plus converting an affiliate's earnings into account balance.

@Panelica

Copy link
Copy Markdown
Owner

Nice consolidation, and thanks for updating all the route references and tests. One correctness note: convertToCredit() moves money in three steps (affiliate balance, withdrawn, client credit) plus a Transaction row without a surrounding DB::transaction(). A failure mid-way could desync the balances — please wrap it (and ideally lock the row) so it's atomic.

@hedon77

hedon77 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

Fixed — convertToCredit() now runs inside a DB::transaction() with lockForUpdate() on the affiliate row, so the balance/withdrawn/credit updates and the Transaction row are atomic.

@Panelica

Panelica commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Thank you — and thanks for wrapping convertToCredit() in a DB::transaction() with lockForUpdate(), exactly right. We just merged the first clean batch into main: #16 (client delete), #24 (invoice number display), #13 (Tpay), #22 (addon settings framework) and #14 (tax rewrite). This currently conflicts with main because it overlaps the config controller and admin routes we touched. Could you rebase it on the updated main? Then it's good to go.

@hedon77

hedon77 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

*Zrebasowane na aktualny \main* — czyste, gotowe do merga.

Potwierdzam też poprawkę z Twojej uwagi: \convertToCredit()\ od początku tej wersji działa wewnątrz \DB::transaction()\ i blokuje wiersz przez \lockForUpdate()\ (\�pp/Services/AffiliateService.php:85-86), więc update'owanie salda affiliate + withdrawn + kredytu klienta + wpis \Transaction\ jest atomowe.

@Panelica

Panelica commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Thank you — and thanks again for making convertToCredit() transactional. We merged #9, #20 and #21, which overlap this on the config, routes and invoice files, so it now conflicts with main. A quick rebase and it's ready to merge.

@hedon77

hedon77 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

*Zrebasowane na aktualny \main* (po zmergowaniu #9/#20/#21) — gałąź merguje się teraz czysto. Atomowość \convertToCredit()\ bez zmian (\DB::transaction()\ + \lockForUpdate()). Gotowe do merga.

@Panelica

Panelica commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Thank you — we merged #19 (company lookup, now gated behind the addon) and #17 (billing email). This one now conflicts with main again on the shared admin views/config. One more rebase on the updated main and it is ready to merge. Appreciated, and sorry for the repeated rebases — the invoicing cluster overlaps a lot.

…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
@Panelica
Panelica merged commit 59410e7 into Panelica:main Sep 4, 2026
1 check passed
Panelica pushed a commit that referenced this pull request Sep 4, 2026
…affiliate merge

The affiliate PR (#15) added zh strings for admin.php, client.php.affiliates and
messages.php.success in a different key order/nesting than English, so the
Simplified Chinese mirror test failed. Rebuild the zh files to English's exact
structure, keeping every existing Chinese translation. Parity stays green.
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.

2 participants