Phase 3.1 — Overview
Phase 3.1 makes every company, a child company included, spend only its own credits.
- Today a child company spends its parent company's credits.
- After Phase 3.1, a child company spends the credits on its own
Billing::Account. - So one division can never use credits that another division paid for.
The decision behind this phase is Billing D16 — A company spends only its own billing account, never its parent's.
- This folder is the work record for building it.
Words this phase uses
| Word | Meaning |
|---|---|
The model Org::Company | An organisation that uses Jod, and it can have a parent company in org_companies.parent_company_id |
| Root company | An Org::Company with no parent, for example NTUC FairPrice |
| Child company | An Org::Company with a parent, for example NTUC FairPrice Supermarkets (North) |
The model Billing::Account | The record that holds a company's credits, invoices and credit actions |
| Own account | The Billing::Account whose billing_accounts.org_company_id is the company |
Why we're building this
Phase 3 gives each company credits it can spend on Ads placements.
- A later fix made every child company spend its parent's account, so a child's Ads campaign no longer fails.
- That fix puts all children of one parent into one shared pool of credits.
The shared pool does not match how our largest clients buy credits.
- In JodGig, NTUC FairPrice tops up each division on its own.
- Supermarkets (North) tops up 1,000 credits.
- Supermarkets (East) tops up 2,000 credits.
- With one shared pool, all 3,000 credits sit on the parent's account.
- North submits Ads campaigns that cost 1,500 credits, and the submit passes.
- North has now spent 500 credits that East paid for, and nothing shows it.
User stories
- US-1: As Finance, I want North's invoice to grant credits only to North, so each division's balance is exact.
- US-2: As FairPrice North's HQ manager, I want to spend only North's credits, so North never uses East's credits.
- US-3: As FairPrice North's HQ manager, I want to see North's own balance, so I know what North can spend.
- US-4: As Sales, I want every company synced from JodGig to have an account, so each division can buy credits.
- US-5: As a Jod engineer, I want one rule for the account a company spends, so every credit path agrees.
Scope
| In this phase | Not in this phase |
|---|---|
Every company spends only its own Billing::Account | Moving credits between two accounts, which a later phase plans |
| The JodGig company sync creates an account for a child company too | Org::LegalEntity, a later grouping of companies under one registered legal entity |
| A backfill creates the account for each existing company that has none | A parent HQ manager's combined view of every division's balance |
| The Team Portal and the Employer Dashboard show the company's own account | Outlet budgets (billing_outlet_budgets), which stay a gig-only design |
| Careers job credit charge and trial credits on sign-up, which Phase 4 builds |
What does not change
Billing::EntitlementLotServicedoes not change.- Consume and release already follow the account on the reserve ledger entry.
- No Billing table changes.
- Each Billing table already carries
billing_account_id.
- Each Billing table already carries
- A root company with no children works exactly as it does today.
- A company created in Jod already gets its own account when it is created.
Pages in this folder
- Design Plan: the rules, the design, the code that changes and the rollout.
- Use Cases: every flow step by step, with a FairPrice worked example.
- Implementation Plan: the issues for
jodapp-apiandjodapp-web, in build order, and a manual test plan.