Skip to content

credit.created

Direction: server → modules. External Moleculer event name: credit.created.

Source and occurrence

C++ payload: CreditCreatedRecord (wraps the published TradeCalcRecord). Internal EventBus name: credit.created. Event code: EV_RECORD_ADD (0).

The event is emitted by CoreApiAdapter::publishTradeEvent when the calculation runtime reports an applied credit-in operation (cmd 7, OP_CREDIT_IN). It is raised on every path that applies a credit; no workflow rule is involved:

Command Who applies the credit
CreditIn, CreditInSync Manager, admin or dealer with set_accounts_balance
Plugin CreditIn Server plugin
MngApproveFinanceRequest CRM manager approving a finance request with cmd 7; published once the request is executed

Nothing is published for:

This is asynchronous fire-and-forget publication. It does not confirm delivery or processing by a module.

This event is separate from two other contracts that can describe the same credit:

  • trade.add is unchanged. Under the shared rules it includes financial ADD records in OPEN_NORMAL; if a credit reaches it, one credit produces both events. trade.add carries no credit amount or comment.
  • The workflow trigger credit.created fires at the same moment and has the same name, but it is internal to workflow rules. Its email action publishes customer.email_template.delivery_requested without the credit amount.

JSON payload

{
  "event_id": "3f1c9a7e5b2d4c6f8a0b1c2d3e4f5a6b",
  "event_code": 0,
  "occurred_at": 1789639050,
  "schema_version": 2,
  "brand": "ion4",
  "order": 500245,
  "login": 7777853,
  "amount": 500.0,
  "comment": "Welcome credit"
}
Field Type Meaning
brand string Brand resolved from the account during formatting; empty if the account lookup fails
order integer Finance operation order
login integer Trading account login
amount number Credited amount in the account currency
comment string Operation comment from the stored record; empty if the record is not found

occurred_at is the record's update_time, or its close_time when update_time is 0; a zero source time remains zero. reason, api_data, the gateway fields (gw_order, gw_source, gw_uuid) and position fields are not published. The event has no customer identifier, email or name: a consumer resolves them by login.

Mailer and SMS triggers

A trigger with "event": "credit.created" fires on every applied credit. The mailer resolves the recipient and the account currency by login, so the template can show amount.

Configure only one source for a credit email. A trigger on trade.add matching cmd 7 or a workflow rule on credit.created with customer.email_template.request_delivery sends a second email for the same credit.

See shared outbound rules for metadata, queue limits and delivery guarantees.