ascetic_ddd.seedwork.domain.values.money.expression

Classes

Expression()

Interface for monetary expressions.

class ascetic_ddd.seedwork.domain.values.money.expression.Expression[source]

Bases: ABC

Interface for monetary expressions.

This is the core abstraction that allows Money and Sum to be treated uniformly, enabling complex operations like adding different currencies.

abstractmethod reduce(bank, to)[source]

Reduce this expression to a Money object in the target currency.

Parameters:
bank

The bank to use for currency conversion

to

The target currency code

Return type:

Money

Returns:

Money object in the target currency

abstractmethod plus(addend)[source]

Add another expression to this one.

Parameters:
addend

The expression to add

Return type:

Expression

Returns:

A new Expression representing the sum

abstractmethod times(multiplier)[source]

Multiply this expression by a scalar.

Parameters:
multiplier

The multiplier

Return type:

Expression

Returns:

A new Expression representing the product