From 92bea2981651be0b82e5942678ca55870bebcf5e Mon Sep 17 00:00:00 2001 From: Ali Asadi Date: Wed, 19 Aug 2026 14:50:42 +0330 Subject: [PATCH] FEATURE(wallets): rename WALLET_RIAL/WALLET_REWARD and add WALLET_PROMOTION WALLET_RIAL -> WALLET_RIAL_DEPOSIT, WALLET_REWARD -> WALLET_USER_BILLBOARD_VISIT_INCOME to match the naming used for the same wallet-service UUIDs in the advertising/settlement repos. Also introduces WALLET_PROMOTION as this service's own pool and routes Promotion.promote()'s payer_wallet through it instead of reusing the payee's WALLET_REWARD value. Co-Authored-By: Claude Sonnet 5 --- README.md | 4 +++- apps/promotions/models.py | 6 +++--- main/settings.py | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 80f157a..ceda48a 100644 --- a/README.md +++ b/README.md @@ -313,7 +313,9 @@ Non-secret values only — pulled from `main/settings.py` and this checkout's ow | `OAUTH2_PROVIDER_PUBLIC_URL` / `_PRIVATE_URL` | Central accounts service's OAuth2 endpoints (token issuance, introspection). Points at the accounts service's staging environment — see this checkout's own `.env` for the actual hostname. | | `ACCOUNTS_BASE_PUBLIC_URL` | Accounts service REST API (user/application profile reads). | | `WALLET_BASE_PUBLIC_URL` | Wallet service REST API (deposit submit/verify). | -| `WALLET_RIAL` / `WALLET_REWARD` | UUIDs of specific `Wallet` (currency pool) rows in the wallet service — not amounts. `WALLET_REWARD` is the pool promotions pays out of; passed as both the deposit's `payer_wallet` and its `payee_wallet`, since payer (this app's pool) and payee (the user) share one currency. | +| `WALLET_RIAL_DEPOSIT` | UUID of the rial currency pool row in the wallet service. Not currently referenced by any code path in this checkout. | +| `WALLET_USER_BILLBOARD_VISIT_INCOME` | UUID of the reward-type wallet on the user's side — the `payee_wallet` for every promotion deposit. Same UUID/naming as the identically-named var in `advertising`/`settlement`; despite the name, it's the generic reward-currency wallet type, not billboard-specific. | +| `WALLET_PROMOTION` | UUID of this service's own pool — the `payer_wallet` for every promotion deposit. Previously shared the `WALLET_REWARD` value with the payee side; now a distinct wallet dedicated to promotions. | | `NOTIFICATIONS_BASE_PUBLIC_URL` | Notifications service REST API. | | `OAUTH2_CLIENT_ID` / `_SECRET` / `_SCOPES` | This service's own client-credentials identity, used for every outbound call above via `login_as_client_credentials()` (token cached under the key `promotions_access_token`). | diff --git a/apps/promotions/models.py b/apps/promotions/models.py index 6f9a661..5f93469 100644 --- a/apps/promotions/models.py +++ b/apps/promotions/models.py @@ -489,7 +489,7 @@ class Promotion(BaseModel): "uuid": payment_uuid, "payee": str(self.user_uuid), "payee_type": 1, - "payee_wallet": settings.WALLET_REWARD, + "payee_wallet": settings.WALLET_USER_BILLBOARD_VISIT_INCOME, "amount": self.promotion_amount, "details": { 'description': str(_(self.recipient.label)), @@ -499,7 +499,7 @@ class Promotion(BaseModel): } try: - submit_response = deposit_to_user_wallet_submit(settings.WALLET_REWARD, data) + submit_response = deposit_to_user_wallet_submit(settings.WALLET_PROMOTION, data) if not submit_response.uuid: raise Exception('Failed to submit promotion. 1') @@ -515,7 +515,7 @@ class Promotion(BaseModel): raise Exception('Failed to submit promotion. 2') try: - verify_response = deposit_to_user_wallet_verify(settings.WALLET_REWARD, submit_response.uuid) + verify_response = deposit_to_user_wallet_verify(settings.WALLET_PROMOTION, submit_response.uuid) if not verify_response.uuid: raise Exception('Failed to verify promotion. 1') diff --git a/main/settings.py b/main/settings.py index ddc2513..b32c500 100644 --- a/main/settings.py +++ b/main/settings.py @@ -385,7 +385,8 @@ CELERY_RESULT_BACKEND = REDIS_BASE_URL ACCOUNTS_BASE_PUBLIC_URL = config('ACCOUNTS_BASE_PUBLIC_URL', default=None, cast=str) WALLET_BASE_PUBLIC_URL = config('WALLET_BASE_PUBLIC_URL', default=None, cast=str) -WALLET_RIAL = config('WALLET_RIAL', cast=str) -WALLET_REWARD = config('WALLET_REWARD', cast=str) +WALLET_RIAL_DEPOSIT = config('WALLET_RIAL_DEPOSIT', cast=str) +WALLET_USER_BILLBOARD_VISIT_INCOME = config('WALLET_USER_BILLBOARD_VISIT_INCOME', cast=str) +WALLET_PROMOTION = config('WALLET_PROMOTION', cast=str) NOTIFICATIONS_BASE_PUBLIC_URL = config('NOTIFICATIONS_BASE_PUBLIC_URL', default=None, cast=str) -- 2.45.3