Phase 3.2 — Implementation Plan
This page splits Phase 3.2 into issues for jodapp-api and jodapp-web, in build order.
- The issues implement Billing D17 — A Careers job post buys a job posting, paid by a direct consume.
- Careers pays through the Billing interface of Billing D18 — Product domains spend credits only through SpendService.
- Every flow is described step by step on Use Cases.
- An existing
Careers::Jobis aCareers::Jobcreated before Billing Phase 3.2 ships, which has noCareers::JobPosting.
Endpoints that Phase 3.2 adds or changes
Phase 3.2 adds 10 endpoints and changes 4 that exist today, all in jodapp-api.
| Endpoint | New or changed | What it does in Phase 3.2 | Plan item |
|---|---|---|---|
GET /team/careers/job_posting_prices | New | Lists every Careers::JobPostingPrice for Sales | API-2 |
POST /team/careers/job_posting_prices | New | Sales creates a Careers::JobPostingPrice | API-2 |
GET /team/careers/job_posting_prices/:id | New | Shows one Careers::JobPostingPrice | API-2 |
PATCH /team/careers/job_posting_prices/:id | New | Sales edits name, duration_days and unit_cost | API-2 |
PATCH /team/careers/job_posting_prices/:id/activate | New | Sales sets is_active: true | API-2 |
PATCH /team/careers/job_posting_prices/:id/deactivate | New | Sales sets is_active: false | API-2 |
GET /team/careers/jobs/*slug | New | Shows one Careers::Job with its Careers::JobPosting rows, read-only | API-9 |
GET /team/careers/job_postings/:id | New | Shows one Careers::JobPosting and the slug of its Careers::Job, for the ledger link | API-10 |
GET /employers/careers/job_posting_prices | New | Lists the active prices for the job form and the renew dialog | API-2 |
POST /employers/careers/jobs | Changed | Takes careers_job_posting_price_uuid and a required idempotency_key, and pays with consume_now | API-4 |
GET /employers/careers/jobs | Changed | Adds posting_ends_at and job_postings_count to each Careers::Job | API-4 |
GET /employers/careers/jobs/*slug | Changed | Adds posting_ends_at and job_postings_count | API-4 |
PATCH /employers/careers/jobs/*slug | Changed | Checks Careers::JobPosting.ends_at before open or hidden, blocks every company change, and refuses draft | API-5, API-11 |
POST /employers/careers/jobs/*slug/renew | New | Buys one more Careers::JobPosting with careers_job_posting_price_uuid and job_postings_count, and refuses an existing Careers::Job | API-6 |
GET /employers/billing/entitlement-balancesexists, and the job form reads the balance from it with no change.- No Billing endpoint changes.
Where the code goes
Phase 3 is not on main yet, and Phase 3.2 has its own feature branch in each repo.
| Repo | Base branch for Phase 3.2 PRs | It starts from |
|---|---|---|
jodapp-api | feature/backend-billing-phase-3-2 | feature/backend-billing-phase-3 |
jodapp-web | feature/frontend-billing-phase-3-2 | feature/frontend-billing-phase-3 |
Phase 3.2 uses Billing::SpendService and Billing::SpendValidator, which exist only on the Phase 3 api branch.
- So each Phase 3.2 branch starts from the Phase 3 branch of its repo.
- Billing fixes still merge into
feature/backend-billing-phase-3. - A sync merges
maininto the Phase 3 branch, then the Phase 3 branch into the Phase 3.2 branch. - Phase 3.2 ships to
mainwith the rest of Phase 3. - jodapp-api#2301 is merged: a second
consume_nowfor one deliverable raises, before the balance check. consume_nowalready raises forunitsof 0 or less.- API-3 starts after jodapp-api#2305 merges, because it adds the last rule of
consume_now.- The rule: a spend counts only the lots that have not expired.
Build order
Legend: lavender = jodapp-api, grey = jodapp-web.
API-4 and WEB-2 must ship together.
- Otherwise the job form sends no
careers_job_posting_price_uuid, and every post fails.
API-5, API-6, API-7 and WEB-3 must ship together.
- Otherwise
Careers::Jobs::CloseJobcloses an endedCareers::Job, and the employer has no way to renew it.
API-11 and WEB-6 must ship together.
- Otherwise the job edit form offers "Draft", and the update fails with a 422.
API-12 and API-13 run in the same deploy as Billing Phase 3.2.
- Otherwise no price is active, or most companies have 0 credits, and no company can post its first job.
WEB-4 ships after WEB-5, API-9 and API-10.
- Otherwise the ledger text links to a page that does not exist.
jodapp-api issues
API-1 — The tables careers_job_posting_prices and careers_job_postings
- Add both tables to the file
jodapp-api/docs/db/careers.dbml, as the Design Plan shows.- jod-app/jodapp-api#2315 plans both tables in the DBML, with each new table marked
PLANNED:. - Its tables must match the block on the Design Plan, with no free row, with
idempotency_keyand withorg_company_id. careers_job_posting_prices.instrumentis a string with the default'placement', and it has no foreign key.
- jod-app/jodapp-api#2315 plans both tables in the DBML, with each new table marked
- Name
Careers::JobPostingin the note ofbilling_ledger_entries.source_typein the filejodapp-api/docs/db/billing.dbml. - Write the migrations with the tag
ActiveRecord::Migration[8.1]. - Each new table has
uuid string [not null, unique], with a unique index. - Add the models
Careers::JobPostingPriceandCareers::JobPosting.Careers::JobPostingPricehas the scopeactive.Careers::JobPostingPricehas the Rails enuminstrument, with onlyplacement, andprefix: :instrument.Careers::JobPostinghas the constantBILLING_LEDGER_ENTRY_DESCRIPTIONS, with the keys:postand:renew.
- Add a foreign key on each
ref:column, witht.referencesand the default delete rule:careers_job_postings.careers_job_id,careers_job_posting_price_idandorg_company_id.
- Add the unique index on
careers_job_postings (careers_job_id, starts_at). - Add the index on
careers_job_postings (careers_job_id, ends_at), to find the latestCareers::JobPosting.ends_atof aCareers::Job. - Add the unique index on
careers_job_postings (org_company_id, idempotency_key), andidempotency_keyis null for a renew.- The index is unique per company, because the client makes the key.
- Add to
Careers::Jobthe associationhas_many :job_postings, withclass_name: 'Careers::JobPosting'andforeign_key: :careers_job_id. - Add the CHECK constraints:
careers_job_posting_prices.duration_days > 0andcareers_job_posting_prices.unit_cost > 0;careers_job_postings.ends_at > careers_job_postings.starts_at;careers_job_postings.unit_cost_snapshot > 0.
careers_job_postings.careers_job_posting_price_idis NOT NULL.- Run
bin/dbml_check, and check that it reports no difference for the new tables.
API-2 — Careers::JobPostingPrice endpoints
- The managers, validators and serializers live in
app/domains/careers/job_posting_prices/. - On create, the database sets
instrumentto its default,'placement', and Sales does not edit it. - Team endpoints, built like
Team::Ads::PlacementPricesController:GET /team/careers/job_posting_prices;POST /team/careers/job_posting_prices;GET,PATCH /team/careers/job_posting_prices/:id;PATCH /team/careers/job_posting_prices/:id/activateand/deactivate.
- Employer endpoint
GET /employers/careers/job_posting_priceslists the active prices, ordered byduration_days. - Every employer response names a price by its
uuid, never itsid, because employer endpoints are public. - The Team endpoints name a price by its
id, because only Jod staff use them. - A Team price response holds
id,name,duration_days,unit_cost,instrumentandis_active.- It follows
Ads::PlacementPriceSerializer, withunit_costin place ofcredit_costandinstrumentadded, and it has nouuid.
- It follows
- Add the routes to the Bruno collection.
API-3 — Careers::JobPostings::Shared::CreateService
- Inputs:
careers_job:,careers_job_posting_price:,created_by:,description_key:andidempotency_key:.description_key:is:postor:renew.idempotency_key:is the key of the job form for a post, andnilfor a renew.
- Lock the
careers_jobsrow. - Set
starts_atto the latestCareers::JobPosting.ends_atof theCareers::Jobwhen that is in the future, and toTime.currentotherwise. - Set
ends_attostarts_at + duration_days.days. - Create the
Careers::JobPostingwith these fields:org_company_id, copied fromcareers_job.org_company_id;created_by_typeandcreated_by_id;duration_days_snapshotandunit_cost_snapshot;idempotency_key;starts_atandends_at.
- Call
Billing::SpendService.consume_nowas the Design Plan shows:org_company: careers_job.org_companyandinstrument: careers_job_posting_price.instrument.to_sym;units: unit_cost_snapshotanddeliverable:the newCareers::JobPosting;description:fromBILLING_LEDGER_ENTRY_DESCRIPTIONS.fetch(description_key), with the job title and the price name.
- The caller owns the transaction, and
consume_nowraises when none is open. - No code creates a
Careers::JobPostingrow without this service. - Careers names no Billing class except
Billing::SpendServiceandBilling::SpendValidator, and rescues noBilling::Error. - Tests cover these cases:
- a new
Careers::Jobgets a period from now; - a running
Careers::Jobgets a period from its latestCareers::JobPosting.ends_at; - an ended
Careers::Jobgets a period from now; - two calls for one
Careers::Jobat the same moment run one after the other, because of the row lock; - the ledger entry has the text "Job post:
<title>,<price name>" for a post and "Job renew: ..." for a renew; - too few credits raises
Billing::InsufficientCreditsError, and noCareers::JobPostingrow is left.
- a new
API-4 — Posting a job pays with credits
EmployersCreateRequestacceptscareers_job_posting_price_uuid, and requiresidempotency_key.- A post with no key fails with a 422.
- The manager finds the price by
uuidonce, and uses itsidafter that.
EmployersCreateManagerlooks for theidempotency_keybefore it runs the validator.- It reads
careers_job_postingsby(org_company_id, idempotency_key), so it reads only the rows of the same company. - When it finds a row, the manager answers with the
Careers::Jobof that row, and writes nothing. - So a repeated post gets the first
Careers::Jobback, even when the credits are now too low.
- It reads
- Two posts with one key at the same moment both pass that check.
- The unique index on
careers_job_postings (org_company_id, idempotency_key)stops the second insert, and its transaction rolls back. - The manager rescues
ActiveRecord::RecordNotUniqueoutside the transaction, because PostgreSQL refuses every query after a failed one inside it. - It rescues only the error of that index, and then reads the first
Careers::Jobof the same company. - It raises every other unique error, such as the one on
careers_jobs.slugor onbilling_ledger_entries.idempotency_key.
- The unique index on
EmployersCreateValidatoradds these checks, with the messages from UC-2:- the price exists and is active;
Billing::SpendValidatorwith the price'sinstrumentandunit_cost, and the validator merges its errors.
EmployersCreateManagercallsCareers::JobPostings::Shared::CreateServicewithdescription_key: :post, inside the existing transaction.EmployersJobDetailSerializerandEmployersJobListSerializeraddposting_ends_atandjob_postings_count.posting_ends_atisnullfor an existingCareers::Job.- The manager loads both values for each
Careers::Job, so the serializer runs no query.
- The trial gate and
TrialService.start_trialdo not change.
API-5 — Updating a job: period check and company lock
- An update of a
Careers::Jobnever pays. - When the request sets
statustoopenorhidden, the validator checks theCareers::Job:- a
Careers::Jobwith aCareers::JobPostingneeds its latestCareers::JobPosting.ends_atin the future; - an existing
Careers::Jobthat isopenorhiddenpasses, because no period rule applies to it; - an existing
Careers::Jobthat isclosedfails, becauseclosedis its end state.
- a
- A failed check returns the message from UC-4.
- On every update of every
Careers::Job, the validator blocks a company change.- This includes an existing
Careers::Jobwith noCareers::JobPosting. - The message is "You cannot move this job to another company. Post a new job for the other company."
- This includes an existing
- Closing and other field edits work as today.
API-6 — Renew endpoint
POST /employers/careers/jobs/*slug/renew, withcareers_job_posting_price_uuidandjob_postings_count.job_postings_countis the number ofCareers::JobPostingrows that the job detail returned.
EmployersRenewValidatorruns these checks, in this order:- the
Careers::Jobhas at least oneCareers::JobPosting, so an existingCareers::Jobfails first; - the trial gate lets the company post;
- the API-4 checks on the price and the credits.
- the
EmployersRenewManagerruns one transaction:- it locks the
careers_jobsrow and counts theCareers::JobPostingrows of theCareers::Job; - when the count differs from
job_postings_count, it fails with a 422 and writes nothing; - it calls
Careers::JobPostings::Shared::CreateServicewithdescription_key: :renew; - when the period had ended, it sets
status: :open; - it syncs the
Careers::JobwithCareers::Jobs::SyncService.
- it locks the
- The 422 messages come from UC-5:
- "This job cannot be renewed. Post a new job to hire again." for an existing
Careers::Job; - "This job is already renewed until
<posting end>." for an old count.
- "This job cannot be renewed. Post a new job to hire again." for an existing
- Tests cover these cases:
- a renew with the right count creates one
Careers::JobPosting; - a second renew with the same count fails, and the account pays once;
- a renew of an existing
Careers::Jobfails with a 422, writes noCareers::JobPostingand pays nothing.
- a renew with the right count creates one
- The response is the job detail, with the new
posting_ends_at. - Add the route to the Bruno collection.
API-7 — The hourly Sidekiq job Careers::Jobs::CloseJob
Careers::Jobs::CloseJobruns every hour insidekiq-scheduler.- It finds
Careers::Jobrows withstatusopenorhiddenwhose latestCareers::JobPostinghasends_atin the past.- An existing
Careers::Jobhas noCareers::JobPosting, so the query never selects it.
- An existing
- For each
Careers::Job, it locks thecareers_jobsrow and reads the latestCareers::JobPosting.ends_atagain.- It closes the
Careers::Jobonly when thatends_atis still in the past.
- It closes the
- It sets each
Careers::Jobtostatus: :closedand syncs it to Listings. - One
Careers::Jobthat fails does not stop the others, and the failure goes to Sentry. - Tests cover these cases:
- an ended open
Careers::Jobcloses; - an ended hidden
Careers::Jobcloses; - a
Careers::Jobwhose period runs until tomorrow stays open; - an existing
Careers::Jobthat is open stays open; - an existing
Careers::Jobthat is hidden stays hidden; - a
Careers::Jobthat a renew pays for after the query stays open.
- an ended open
API-9 — Team endpoint: one Careers job with its Careers::JobPosting rows
GET /team/careers/jobs/*slug, built like the Team Ads campaign show.- The request finds the
Careers::Jobbycareers_jobs.slug, and a missingCareers::Jobreturns a 404. - The response has the
Careers::Job:slug,title, the company name,statusandposting_ends_at. - The response has every
Careers::JobPostingof theCareers::Job, neweststarts_atfirst:id,starts_atandends_at;- the price name;
unit_cost_snapshotandduration_days_snapshot;created_by_typeandcreated_by_id.
- The manager loads the
Careers::JobPostingrows and their prices withincludes, so the serializer runs no query. - Add the route to the Bruno collection.
API-10 — Team endpoint: one Careers::JobPosting
GET /team/careers/job_postings/:id, built likeGET /team/ads/campaign_placements/:id.- The
idisbilling_ledger_entries.source_id, so the route takes the numeric id. - The response has the
Careers::JobPostingand theslugof itsCareers::Job, which the deliverable route needs. - A missing
Careers::JobPostingreturns a 404. - Add the route to the Bruno collection.
API-11 — careers_jobs.status has three values
- Remove
draftfrom thestatusenum and fromDISPLAY_STATUS_MAPinapp/domains/careers/job.rb. - Change the default of
careers_jobs.statusfrom'draft'to'open', in a migration and indocs/db/careers.dbml. - Production has no draft row, so the migration only changes the default, with no check for draft rows.
- An update with
status: draftfails with a 422, because the validator accepts only the enum keys. - WEB-6 removes "Draft" from the web, and ships together with API-11.
- Just before the deploy, a person checks by hand that production has no draft
Careers::Jobrow.
API-12 — A seed file creates the first two prices
- Add
db/seeds/singles/<timestamp>_seed_careers_job_posting_prices.rb, built like20260130135900_seed_ads_placements.rb. - It creates "1 Month" (30 days, 50 credits) and "3 Months" (90 days, 100 credits) with
find_or_create_by!(name:).- A second run creates nothing.
- It never changes a price that exists, so a price that Sales edited keeps its values.
- The deploy runs it in each environment with
bin/rails db:seed:single SEED_FILE=.... - Sales practises entering and editing prices in QA.
API-13 — Free placement credits for each company
- A Billing service grants the free credits to one company, as the Design Plan says.
- It creates one
Billing::CreditActionwithaction_type: :trial_grantand 50 placement credits. admin_created_by_idis theIdentities::AdminnamedSystem, andreasonis "Sign up free credits".- It does nothing for a company with
careers_access_status: :blocked.
- It creates one
- A rake task calls the service for each existing company, with
DRY_RUN=truefor a report.- It gives one company the free credits once only, also when it runs twice.
- The sign-up path calls the service for a new company, in the transaction that creates its own account.
- Still open for Ali: when the credits expire, companies synced from JodGig, and which paths count as a sign-up.
jodapp-web issues
WEB-1 — Team Portal: Careers::JobPostingPrice pages
WEB-1 has one issue for each page, so each page follows the API endpoint it uses.
| Page | Route | API endpoint |
|---|---|---|
| List | /team/careers/job-posting-prices | GET /team/careers/job_posting_prices |
| Detail | /team/careers/job-posting-prices/:id | GET /team/careers/job_posting_prices/:id |
| Create form | /team/careers/job-posting-prices/new | POST /team/careers/job_posting_prices |
| Edit form | /team/careers/job-posting-prices/:id/edit | PATCH /team/careers/job_posting_prices/:id |
| Activate and deactivate | A button on the detail page | PATCH /team/careers/job_posting_prices/:id/activate and /deactivate |
- Build the pages like the Team billing product pages, in
app/routes/team/billing-products/andapp/domains/billing-product/. - The forms have
name,duration_daysandunit_cost, and the create and edit forms share one form and one schema. - The list page adds a "Job Posting Prices" link in the Careers section of
app/layouts/team/team-sidebar-config.js. - The "Deactivate" confirm dialog warns about the last active price, because then no company can post a job.
WEB-2 — Employer Dashboard: the job form shows the periods, the cost and the balance
- Read the active prices from
GET /employers/careers/job_posting_prices. - Read the balance from
GET /employers/billing/entitlement-balances. - Show the prices as a picker, for example "1 Month, 50 credits" and "3 Months, 100 credits".
- Make one
idempotency_keywhen the form opens. - Send
careers_job_posting_price_uuidand theidempotency_keywith the post. - Show the cost, the balance and "Posted until" with the end date under the form.
- Open a confirm dialog with the cost and the end date on submit.
- When the balance is lower than the cost, show the "Insufficient Placement Credits" alert and disable the submit.
- Copy the alert from
employers-ads-campaigns-detail-page.jsx. - Its
WhatsappButtonsays "Chat with us to top up credits", with a message that names the cost and the balance.
- Copy the alert from
- When no price is active, show "Posting a job is not available right now. Please contact Jod support." and disable the submit.
WEB-3 — Employer Dashboard: posted until and the renew dialog
- The job list and the job page show "Posted until" with
posting_ends_at.- They show "Posting ended" when
posting_ends_atis in the past. - An existing
Careers::Jobhasposting_ends_at: null, and it shows neither text.
- They show "Posting ended" when
- Each job with a
Careers::JobPostinghas a "Renew" button. - An existing
Careers::Jobshows the renew button as disabled, with the text "Cannot renew".- The page reads
posting_ends_at: nullfor this, so it needs no new field.
- The page reads
- The renew dialog shows the active prices, the cost, the balance and the new end date.
- The new end date starts from
posting_ends_atwhen it is in the future, and from today otherwise.
- The new end date starts from
- The renew dialog shows the same alert and WhatsApp button as WEB-2 when credits are too low.
- When no price is active, the renew dialog shows "Posting a job is not available right now. Please contact Jod support." and disables the renew.
- The renew dialog calls
POST /employers/careers/jobs/*slug/renew, with thejob_postings_countof the job detail.- On the 422 "This job is already renewed until ...", the dialog shows the message and reloads the job.
- When the period has ended and the HQ manager opens the job, the page shows the API error.
- The page also shows the "Renew" button.
WEB-4 — Team Portal: the ledger shows the Careers::Job of a Careers::JobPosting
- Add
Careers::JobPostingtoBILLING_LEDGER_ENTRY_SOURCE_TYPEand to the source filter options, with the label "Job Posting". - The source cell shows
billing_ledger_entries.descriptionfor aCareers::JobPosting, as it does for an Ads placement. - Build on jod-app/jodapp-web#1535, which shows the description for an Ads placement, and is merged into
feature/frontend-billing-phase-3. - The text links to
/team/careers/job-postings/<source_id>, in a new tab, like an Ads placement. - Add the deliverable route
/team/careers/job-postings/:id, built liketeam-ads-campaign-placements-redirect-page.jsx.- Its
clientLoadercallsGET /team/careers/job_postings/:id. - It redirects to
/team/careers/jobs/<slug>. - The module keeps an empty default export, so React Router does not treat it as a resource route.
- Its
WEB-5 — Team Portal: the Careers job page
- A read-only page at
/team/careers/jobs/*, because the slug of aCareers::Jobhas slashes. - The
clientLoadercallsGET /team/careers/jobs/*slug. - The page shows the
Careers::Job: title, company,statusand the latestCareers::JobPosting.ends_at. - The page shows one table of
Careers::JobPostingrows:starts_atandends_at;- the price name;
- the credit cost;
- who created it.
- The "Jobs" entry in
app/layouts/team/team-sidebar-config.jsstays disabled, because there is no list page.
WEB-6 — Employer Dashboard: the job status has no "Draft", and the company is read-only
- Remove the
draftentry fromCAREERS_JOB_STATUSinapp/domains/careers-job/careers-job-constant.js. - The job edit form in
careers-job-form-fields.jsxand the job filter incareers-job-filter-form.jsxthen offer only "Open", "Closed" and "Hidden". careers-job-org-detail-view.jsxandemployers-careers-jobs-list-page.jsxalso readCAREERS_JOB_STATUS.- They show "N/A" for a status that the list does not hold.
- WEB-6 ships together with API-11.
- Otherwise an HQ manager can pick "Draft", and the update fails with a 422.
- The job edit form shows the company of the
Careers::Jobas read-only, because aCareers::Jobnever changes company.- The job create form still shows the company select, so a parent HQ manager can post for a child company.
Manual test plan
Setup: the seed file of API-12 created two active prices.
- P1 "1 Month" is 30 days for 50 credits.
- P3 "3 Months" is 90 days for 100 credits.
- Company A has
careers_access_status: :trial, and the rake task of API-13 gave it 50 free credits. - Company A has an existing
Careers::JobJ0, withstatus: :closedand noCareers::JobPosting. - Company A has an existing
Careers::JobJ9, withstatus: :open. - Company C is a child company of company B, and C has 100 credits on its own account.
| # | Step | Expected |
|---|---|---|
| 1 | Run Careers::Jobs::CloseJob | J9 stays open, because an existing Careers::Job has no Careers::JobPosting |
| 2 | Hide J9 as A, then open it again | J9 is open with no Careers::JobPosting, and A still has 50 credits |
| 2a | Open the job list and the edit form of J9 as A | No "Posted until" and no "Posting ended", the renew button is disabled with "Cannot renew", the status select has no "Draft", and the company is read-only |
| 2b | In Bruno, change the company of J9 | Fails with "You cannot move this job to another company. Post a new job for the other company." |
| 3 | Deactivate P1 and P3, then open the job form as A | "Posting a job is not available right now. Please contact Jod support.", and submit is disabled |
| 4 | Activate P1 and P3, then open the job form as A | The form shows both periods, the cost, the balance of 50 and the end date |
| 5 | Post a job J1 as A with P1 | J1 is open until 30 days from now, J1 has one Careers::JobPosting, and A has 0 credits |
| 6 | In Bruno, send the post of step 5 again with the same idempotency_key | The response is J1, the system created no second Careers::Job, and A still has 0 credits |
| 7 | Open A's ledger in the Team Portal | One consume entry of 50 credits, with "Job post: <J1 title>, 1 Month" in the source cell |
| 8 | Click the source text of that entry | A new tab opens the Team page of J1, with one Careers::JobPosting of 50 credits |
| 9 | Open the job form for a second job as A | The "Insufficient Placement Credits" alert shows, submit is disabled, and the WhatsApp button opens a chat |
| 10 | Hide J1, close it, then open it again | No new Careers::JobPosting, "Posted until" shows the same date as in step 5, and A still has 0 credits |
| 11 | In Bruno, change the company of J1 | Fails with "You cannot move this job to another company. Post a new job for the other company." |
| 12 | Open J0 as A, then hide it | Both fail with "This job is closed. Post a new job to hire again." |
| 13 | Grant A 200 credits, then renew J1 with P3 | The latest Careers::JobPosting.ends_at of J1 moves 90 days later, and A has 100 credits |
| 14 | In Bruno, send the renew of step 13 again with the same job_postings_count | Fails with "This job is already renewed until <date>", and A still has 100 credits |
| 15 | In Bruno, renew J0 with P1 and job_postings_count: 0 | Fails with "This job cannot be renewed. Post a new job to hire again.", and A still has 100 credits |
| 16 | Post a job J2 as A with P1, then in the console set starts_at of its Careers::JobPosting to 30 days and 1 minute ago, and ends_at to 1 minute ago, then run Careers::Jobs::CloseJob | J2 is closed, it is gone from the job search, and A has 50 credits |
| 17 | Edit P1 to 60 credits | Every Careers::JobPosting created before the edit still says 50 credits |
| 18 | Log in as B's HQ manager, and in Bruno post a job for C with P1 and the idempotency_key of step 5 | The system creates a new Careers::Job for C, C's account goes from 100 to 40, and B's account does not change |
| 19 | Set A to careers_access_status: blocked, then post a job and renew J1 | Both fail with "Company trial period has ended" |
Risks
| Risk | What we do |
|---|---|
| Billing Phase 3.2 ships with no active price, so no company can post | The deploy runs the seed file of API-12, and a person checks both prices in the Team Portal |
| A company that paid by invoice has no credits on the day Billing Phase 3.2 ships | Its existing Careers::Job rows stay open with no end date, and the free credits given when Billing Phase 3.2 ships pay one Careers::JobPosting |
Careers::Jobs::CloseJob closes an existing Careers::Job | The query selects only a Careers::Job that has a Careers::JobPosting, and a test covers an existing Careers::Job that is open and one that is hidden |
A database has a draft Careers::Job row after API-11 | Before API-11 merges, a person counts the draft rows on QA, and checks production by hand just before the deploy |
Careers::Jobs::CloseJob fails, and ended Careers::Job rows stay posted for free | Sentry reports the failure, and the next hourly run closes them |
| Sales changes a price while an employer has the form open | The Careers::JobPosting uses the price on submit, and the confirm dialog showed the old cost |