FEATURE(wallet): backfill command for company-side wallet history #2

Closed
ali wants to merge 1 commit from feature/company-wallet-history-backfill into master
Collaborator

Several services (ipg, settlement, advertising, promotions) used to pass a
user wallet (rial/reward) as their company-side wallet because they had no
dedicated company account. They now each do. This adds a one-shot management
command that repoints the company side of historical Transaction rows onto
the new dedicated wallets and corrects the two affected Account.balance
running totals.

  • apps/wallet/management/commands/backfill_company_wallets.py
    dry-run by default; --execute; --service ; --app- override.
    Idempotent (filters on the old account), single atomic + select_for_update.
  • docs/company_wallet_history_backfill.md — full write-up: model, mapping,
    balance-correction logic, consequences, run checklist, source commits.

Not yet run against staging/prod.

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com

Several services (ipg, settlement, advertising, promotions) used to pass a user wallet (rial/reward) as their company-side wallet because they had no dedicated company account. They now each do. This adds a one-shot management command that repoints the company side of historical Transaction rows onto the new dedicated wallets and corrects the two affected Account.balance running totals. - apps/wallet/management/commands/backfill_company_wallets.py dry-run by default; --execute; --service <name>; --app-<svc> <uuid> override. Idempotent (filters on the old account), single atomic + select_for_update. - docs/company_wallet_history_backfill.md — full write-up: model, mapping, balance-correction logic, consequences, run checklist, source commits. Not yet run against staging/prod. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ali added 1 commit 2026-09-02 08:04:16 -04:00
Several services (ipg, settlement, advertising, promotions) used to pass a
user wallet (rial/reward) as their company-side wallet because they had no
dedicated company account. They now each do. This adds a one-shot management
command that repoints the company side of historical Transaction rows onto
the new dedicated wallets and corrects the two affected Account.balance
running totals.

- apps/wallet/management/commands/backfill_company_wallets.py
  dry-run by default; --execute; --service <name>; --app-<svc> <uuid> override.
  Idempotent (filters on the old account), single atomic + select_for_update.
- docs/company_wallet_history_backfill.md — full write-up: model, mapping,
  balance-correction logic, consequences, run checklist, source commits.

Not yet run against staging/prod.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Ghasemi closed this pull request 2026-09-06 10:09:32 -04:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: addwin/wallet#2
No description provided.