Mercedes Ordering: Decisions
This page records the choices the Mercedes implementation in
services/ai_ordering/.../oem/mercedes/ makes. It records only decisions specific to Mercedes.
The cross-OEM architecture is in the ordering platform ADRs.
1. Every run modifies an existing order
A Mercedes run modifies dealer orders already in NetSTAR. Each target is one modifiable
order, named by its PO number. The attempt's order_id is that PO number. No Mercedes
run places a new order.
The pilot model list
A run modifies only orders whose model code is on the pilot model list,
oem/mercedes/pilot_models.json. One list applies to every dealer and every model year.
The DTEC lookup (pull_dtec_models) is made for each order's own model code and model
year. A change to the list takes effect when the ordering service is deployed.
2. The builds of a modification attempt
Each attempt records the builds of ADR-007:
| Build | Read from | source | raw |
|---|---|---|---|
original | pull_order_detail for the PO, before the cure | netstar:order-detail | OrderDetail |
cured | the configuration NetSTAR returns for the modified order | netstar:modified-configuration | ModifiedConfiguration |
submit records no final. An attempt is SUCCESS when NetSTAR accepts the order
update, and submit does not read the order back. The report shows cured. A
SIMULATED attempt makes no NetSTAR call, so it has no builds. Its report card shows the
candidate's options (see The report card).
The option_codes of both builds are catalog feature codes in the <type>:<code>
form that features_from_config produces. Type 2 is paint and type 4 is upholstery.
features_from_candidate maps the recommendation into the same codes.
3. The requested changes are configurable
The cure requests only the changes get_configurable_diff returns:
- it adds a recommended feature only when
consolidated/featuresmarks itis_configurable; - it removes a feature only when the feature is configurable and not an
ACCESSORY.
A non-configurable code that the recommendation lists and the order lacks is therefore not a
requested change. The report's not_kept list
(ADR-018) is computed against this diff. Computed
against the whole recommendation, it would list every such code as a change NetSTAR did
not keep.
4. The report card
- Headline rows: paint (
2:), upholstery (4:), trim (INTERIOR_TRIM) and wheels (WHEEL). The remaining configurable features of the card's build are itsoptions. A feature thatconsolidated/featuresmarks not configurable is standard equipment, and the card does not list it among theoptions. Nor does it list a feature that a package of the same build contains. The package's price includes that feature's price. - The report shows each code without its type prefix, as NetSTAR shows it to the dealer.
- Names and prices come from the
consolidated/featuresrows of the attempt's model code and model year. The live and simulated compositions read the same table. - The MSRP is a base price plus the
consolidated/featuresprices of the build's configurable features, headline rows included. It leaves out the price of a feature that a package of the build contains. The warehouse is not the OMS, so the build setsmsrp_is_estimated. - The model name comes from
consolidated/models. - A live attempt's card shows its
curedbuild, with thebase_priceof the curedModifiedConfiguration, and lists its changes to theoriginalbuild. An attempt without both builds gets no card. - A simulated attempt never reaches NetSTAR, so it has neither build. Its card shows the
candidate's options, with the
msrpofconsolidated/modelsas the base price, and lists no changes. A model with nomsrpgets a card with no MSRP. The attempt'smodel_codeholds the candidate'smodel_id, so the card reads its model code fromconsolidated/models. report_datareadsconsolidated/featuresonly for the model years of attempts that get a card. A model missing fromconsolidated/models, or whose model year has noconsolidated/featuresrows, gets no rows. The workflow still sends the rows of the other models. Ifreport_dataraised, the workflow would not runsend_run_summary, and it would send no report.- The card's image is a COSY render of its build. The render needs the candidate's
baumuster_codeand the build's paint and upholstery. COSY renders a model in one of two code forms. A model that COSY has migrated takes the paint code with aUsuffix and the upholstery code with anAsuffix. Any other model takes both codes unchanged. No field of the model says which form it takes. Both forms occur within one model year.exterior_image_urlstherefore returns both URLs, the migrated form first. The report fetches the second URL only when the first returns no image.
5. The session's dealer
A NetSTAR session acts for the dealer its user currently has selected. A user with access
to several dealers can switch dealers on the same session. A run for one dealer could then
modify another dealer's orders. Before construct_targets builds any target, a live run
reads the session's currentDealerCode from GET /user-api/users/current:
| Response | Error | Exit reason |
|---|---|---|
currentDealerCode is another dealer | SessionConflict | SESSION_CONFLICT |
401 or 403, or no user.currentDealerCode | AuthExpired | AUTH_EXPIRED |
Both errors are non-retryable. A simulated run makes no NetSTAR call, so it does not check the session's dealer.
A user can also switch dealers later in the run. NetSTAR returns only the inventory of the
session's current dealer. submit pulls that inventory before each order update. When the
target order is missing from it, submit reads currentDealerCode again and raises the
error that the table above lists for the response. When the session's current dealer is
the run's dealer, submit returns an attempt that fails with OrderingNotPermitted and
sets target_invalidated. When the target order is in the inventory, submit does not
read currentDealerCode.
6. A refused candidate
| NetSTAR's answer | validate_and_cure | The run |
|---|---|---|
| 401 or 403 to any request | raises AuthExpired | ends |
500 with a message in _MODEL_PRODUCT_DATA_ERRORS to pull_product_data | refuses with target_invalidated | moves on to its next target |
| another HTTP error to any request | refuses the candidate | tries the slot's next candidate |
a cured build that fails validate_cured_candidate | refuses the candidate | tries the slot's next candidate |
An HTTP error's refusal reason is NetSTAR's error message. pull_product_data names only
the target's model and build day. For some models, NetSTAR answers it with an HTTP 500
whose message, such as "There is a Pricing error on this vehicle", every candidate of the
slot gets. _MODEL_PRODUCT_DATA_ERRORS lists those messages. Any other error refuses only
the candidate, so the slot's next candidate makes the request again.
A cured build's refusal reason ends with the messages of NetSTAR's /analysis
responses, which say why NetSTAR did not add or keep a code. It holds at most
_MAX_REFUSAL_MESSAGES distinct messages, each truncated to
_MAX_REFUSAL_MESSAGE_CHARS characters. submit refuses a cured build the same way.