66 lines
4.1 KiB
Markdown
66 lines
4.1 KiB
Markdown
# Descrybe v20 — credit reference value and import languages
|
|
|
|
## Admin — value of one credit
|
|
|
|
Open **Admin → Billing → Reference value of one credit (EUR)**.
|
|
|
|
- `GET /api/admin/credit-value-eur` (platform administrator only) returns `eur_per_credit`, `currency`, and an explanatory note.
|
|
- `PUT /api/admin/credit-value-eur` with `{ "eur_per_credit": 0.5 }` sets a reference valuation in EUR, with up to six decimal places.
|
|
- Unconfigured returns `null`, rather than inventing a platform-wide credit price.
|
|
- This is **not a Stripe product price or an invoice charge**. Credit value depends on the monthly subscription and optional purchased credit packs. Actual invoices remain Stripe's authority. The admin setting must not be used to multiply past credit charges into legally issued invoices.
|
|
|
|
Current hardcoded one-time top-up pack prices in `apps/api/internal/billing/credit_packs.go` vary from roughly **€1.16/credit (25-credit pack)** to **€0.375/credit (8,000-credit pack)**. These are reference prices from code, not verified current Stripe prices. Updating the EUR reference rate does not update them. Plan-specific processing *debits* continue to be configured in the plan popup.
|
|
|
|
## Language-selectable imports
|
|
|
|
Supported: `en fr de es it nl pt pl cs sk hu ro bg hr sl sv da fi el et lv lt mt ga ja`.
|
|
|
|
**Dashboard**
|
|
|
|
- **Feeds → Create/Edit**: choose Feed content language for XML, CSV, or JSON source data.
|
|
- **Categories → Import CSV / JSON URL**: choose Upload language / Import language.
|
|
- **Attributes → Import CSV / JSON URL**: same.
|
|
- Product feeds sync through **Feeds**, not a separate Product Management JSON importer.
|
|
|
|
**API catalog uploads**
|
|
|
|
- `POST /api/categories/import?language=sl`
|
|
- `POST /api/attributes/import?language=hr`
|
|
- `POST /api/products/import?language=de`
|
|
|
|
For `multipart/form-data`, use `file` plus `language=sl` (query parameter or multipart field).
|
|
|
|
For JSON URL import:
|
|
|
|
```json
|
|
{
|
|
"url": "https://supplier.example/products?format=json",
|
|
"format": "json",
|
|
"language": "sl",
|
|
"request_headers": {}
|
|
}
|
|
```
|
|
|
|
Import language may be omitted to use the company's primary language. Invalid language codes return HTTP 400. Only import routes accessible to an authorized company admin/API actor can be called.
|
|
|
|
**Feed create/edit API:** set `content_language` when posting to `/api/feeds` or updating `/api/feeds/{id}`. The public `POST /api/v1/feeds` API-key endpoint also accepts `content_language` for URL and multipart sources. Existing feeds without this field retain company-primary behavior. Changing feed language causes a fresh sync instead of treating old mapping hashes as unchanged.
|
|
|
|
**Data integrity**
|
|
|
|
- Category labels/descriptions are saved in `categories.localized_fields[language]`.
|
|
- Attribute names are saved in `attributes.localized_fields[language]`.
|
|
- Raw and catalog product source translations are saved in `source_localizations[language]`.
|
|
- Primary-language columns remain compatible with older consumers. When a new item first arrives only in a non-primary language, that language's title serves as the initial fallback until primary-language data is supplied.
|
|
- For categories and attributes, GET list or category detail with `?language=sl` to display that language when present, with fallback otherwise. Full `localized_fields` maps are also returned.
|
|
- Product detail APIs expose `source_localizations`. This is **supplier source data**, separate from `localized_content` containing AI-generated output.
|
|
- No translation is performed automatically by this import feature: selecting a language labels the supplied text accurately.
|
|
|
|
## Deployment
|
|
|
|
1. Commit to the canonical Git repo, do not extract ZIP files over the production checkout.
|
|
2. Apply migration `054_catalog_import_languages.sql` using `npm run migrate` (or your existing `rb` deploy).
|
|
3. Deploy API, worker, and frontend together.
|
|
4. Test one SKU and one category in two languages before enabling scheduled imports on production catalogs.
|
|
|
|
The new migration adds JSONB fields without rewriting existing supplier content. Existing imported product records are not automatically translated or relabeled.
|