Money

An amount in minor units (cents) and an uppercase ISO 4217 currency.

On this page

Class in sponsorkit.models.

from sponsorkit import Money

Also importable from sponsorkit.models.

@dataclass(frozen=True)
class Money:
    ...

An amount in minor units (cents) and an uppercase ISO 4217 currency.

Constructor#

Money(value: int, currency: str) -> None

Instances are immutable; every field below is a constructor parameter.

Fields#

value#

value: int

Amount in minor units (cents).

currency#

currency: str

Uppercase ISO 4217 code, e.g. USD.

Methods#

from_dict()#

@classmethod
def from_dict(cls, d: Mapping[str, Any]) -> Money

Parse the JSON form.

to_dict()#

def to_dict(self) -> dict[str, Any]

The JSON form.