20 lines
2.3 KiB
Markdown
20 lines
2.3 KiB
Markdown
# V19 – Optional flat per-product processing
|
||||
|
|
|
|||
|
|
- Admin > Billing > Create/Edit plan > Processing mode: **Choose outputs** (default) or **Per product**.
|
|||
|
|
- Per product accepts a fractional cost with at most 4 decimal places, e.g. `0.3750` credits per product. No separate title/description/SEO choices appear for customers assigned this plan.
|
|||
|
|
- Customers on this plan select products, choose **Product processing**, and see their total credits before confirmation. That action submits title + description + SEO metadata in one enhance job. The actual debit uses the same flat rate.
|
|||
|
|
- Plans without a `plan_processing_costs` row with `feature_name='product_ai'` retain the three independent output costs.
|
|||
|
|
- Creating a new plan and selecting Per product adds the record; switching back to Choose outputs deletes it. Legacy plans are not switched automatically.
|
|||
|
|
- For plans using Per product, an optional company-level `product_ai` rate takes priority over the plan rate. It does not activate Per product mode on a plan that does not opt in.
|
|||
|
|
- No database migration is required; the existing processing cost tables introduced in migration 049 and numeric precision introduced in 053 are reused. Those migrations must already be applied.
|
|||
|
|
- Existing completed jobs and their charges are unchanged. Future processing (including API jobs) uses the active plan's current pricing mode. If you change a plan while jobs are pending, those jobs may use the newly configured price when debited; avoid switching plans mid-batch.
|
|||
|
|
- Deploy the frontend, API, and worker together.
|
|||
|
|
|
|||
|
|
## Acceptance test
|
|||
|
|
|
|||
|
|
1. Create a new test plan; default should be Choose outputs. Verify three independent options in Product Management.
|
|||
|
|
2. Edit the plan, switch to Per product, price `0.375`. Reopen the popup: mode and price should persist.
|
|||
|
|
3. Assign it to a test company and refresh the customer dashboard. Verify one Product processing action, with 10 items displaying 3.75 credits.
|
|||
|
|
4. Run a test job and verify one `0.375` credit debit per successfully processed product. Verify title, description, and SEO result fields.
|
|||
|
|
5. Switch back to Choose outputs; verify the three options reappear and the old per-output rates are preserved.
|
|||
|
|
6. Test API processing under the same plan, confirming the flat rate is used without a client-side billing bypass.
|