ORE Studio 0.0.4
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | List of all members
trade_status_service Class Reference

Resolves trade status transitions via the FSM. More...

#include <trade_status_service.hpp>

Collaboration diagram for trade_status_service:
Collaboration graph

Public Types

using context = ores::database::context
 

Static Public Member Functions

static boost::uuids::uuid resolve_status (context ctx, const std::string &activity_type_code, std::optional< boost::uuids::uuid > current_status_id)
 Resolves the new status_id for a trade.
 

Detailed Description

Resolves trade status transitions via the FSM.

Given an activity_type_code and the trade's current status_id, determines the resulting status_id by looking up the FSM transition linked to the activity type. Throws std::logic_error if the transition is not allowed from the current status.

Member Function Documentation

◆ resolve_status()

boost::uuids::uuid resolve_status ( context  ctx,
const std::string &  activity_type_code,
std::optional< boost::uuids::uuid >  current_status_id 
)
static

Resolves the new status_id for a trade.

Given an activity_type_code and the trade's current status_id (std::nullopt for brand-new trades not yet in the database), returns the resulting status_id after applying the FSM transition linked to the activity type.

If the activity type has no linked FSM transition, the current status_id is returned unchanged (nil UUID for new trades).

Exceptions
std::invalid_argumentif the activity_type_code is unknown.
std::logic_errorif the transition is invalid from the current status.