Skip to content

Currency / PublicAPI / ValueObjects

Purpose

The ValueObjects folder contains lightweight, immutable data structures used by the Currency system.

These types represent structured data (such as costs and bundles) passed into service calls and helpers.


Important Notes

  • These types contain data only
  • No behaviour beyond validation is included
  • They do not depend on internal systems
  • Changes to underlying collections may affect wrapped data

What Lives Here

CostLine

  • Represents a single currency requirement
  • Contains:

  • CurrencyId

  • Money amount
  • Validates:

  • currency identifier

  • positive amount

CostBundle

  • Wrapper around a collection of CostLine
  • Used for:

  • multi-currency costs

  • rewards and grants
  • affordability checks
  • Does not copy the underlying collection

Usage Guidance

Mental model

  • These are simple value containers
  • They are passed into higher-level helpers and services
  • They do not implement business logic

Example:

  • "Spend 100 gold and 5 gems" → CostBundle

Internal Use Only

These types are part of the public API surface.

Do not:

  • Add behaviour or logic
  • Depend on internal representations

Safe to Remove

This folder may be removed if multi-currency helpers are not required.

Currency will continue to operate using direct service calls.


  • PublicAPI / Transactions — uses CostBundle
  • PublicAPI / Helpers — affordability helpers
  • Abstractions — CurrencyId, Money