Source code for ascetic_ddd.seedwork.domain.values.money.currency
import typing
from enum import Enum
[docs]
class Currency(str, Enum):
"""Currency"""
USD = "USD"
EUR = "EUR"
RUB = "RUB"
GBP = "GBP"
[docs]
def to_symbol(self) -> str:
"""Get the currency symbol"""
mapping = {
Currency.USD: "$",
Currency.EUR: "€",
Currency.RUB: "₽",
Currency.GBP: "£",
}
return mapping[self]
[docs]
def export(self, setter: typing.Callable[[str], None]) -> None:
setter(self.value)