world.money

package world.money

Members list

Type members

Classlikes

object Bag

Construction and per-currency totals for Bag.

Construction and per-currency totals for Bag.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Bag.type
final case class Bands

A graduated scale of marginal percentage rates over a monetary base - a PAYE table, a tiered lending rate. The table is the application's configuration; world supplies the arithmetic: the marginal charge per band, and the exact inverse that net-pay contracting works backwards through. That inverse is total because assembly bounds every rate below one hundred percent.

A graduated scale of marginal percentage rates over a monetary base - a PAYE table, a tiered lending rate. The table is the application's configuration; world supplies the arithmetic: the marginal charge per band, and the exact inverse that net-pay contracting works backwards through. That inverse is total because assembly bounds every rate below one hundred percent.

For a scale over a quantity see Blocks; for flat charges by bracket see Charges. Instances via Bands.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Bands

Band construction, validated assembly, and both directions for Bands.

Band construction, validated assembly, and both directions for Bands.

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Bands.type
object Cash

The provenance vocabulary and the recorded rows for Cash.

The provenance vocabulary and the recorded rows for Cash.

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Cash.type
final case class Cash(currency: Currency, digits: Int, increment: Int, mode: Rounding, incrementBy: Provenance, modeBy: Provenance)

A territory's cash-rounding practice for its tender: the currency the row governs, the increment in 10^-digits units of that currency, the midpoint mode, and - separately, because the two genuinely differ in kind - where each of those facts comes from.

A territory's cash-rounding practice for its tender: the currency the row governs, the increment in 10^-digits units of that currency, the midpoint mode, and - separately, because the two genuinely differ in kind - where each of those facts comes from.

Keyed by territory because the practice is the jurisdiction's. Switzerland's increment follows from its denomination set with no rounding provision in any instrument; Denmark's is statutory while its midpoint is stated by nothing; Finland's statute states both. Unstated marks a value no source states, recorded as this library's own documented choice rather than attributed to a rule that does not exist. Instances via Cash.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Charges[C <: Currency & Singleton]

A select-one table of flat charges over a monetary base, each row an inclusive upper bound - delivery fee by order value, a published fee schedule. The table is the application's data; world supplies validated assembly and deterministic containment.

A select-one table of flat charges over a monetary base, each row an inclusive upper bound - delivery fee by order value, a published fee schedule. The table is the application's data; world supplies validated assembly and deterministic containment.

Rows partition the axis above the floor, so no tie-break can arise, and a capped table refuses an amount past its cap rather than extrapolating beyond the authority's own limit. Instances via Charges.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Charges

Row construction, validated assembly, and the charge lookup for Charges.

Row construction, validated assembly, and the charge lookup for Charges.

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Charges.type
object Delivery

Validated construction and the wire pair for Delivery.

Validated construction and the wire pair for Delivery.

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Delivery.type
final case class Delivery

A trade-terms statement as a document carries one: the rule and its named place, as in "CIF Mombasa". The standard itself quotes the pair, since a rule without its named place is incomplete under the ICC's own golden rules. Instances via Delivery.

A trade-terms statement as a document carries one: the rule and its named place, as in "CIF Mombasa". The standard itself quotes the pair, since a rule without its named place is incomplete under the ICC's own golden rules. Instances via Delivery.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Incoterm

Resolution and the annex's own data for Incoterm.

Resolution and the annex's own data for Incoterm.

Attributes

Companion
enum
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Incoterm.type
enum Incoterm

The Incoterms (R) 2020 rule vocabulary, as UN/ECE Recommendation No. 5 codes it (sixth edition, ECE/TRADE/C/CEFACT/2020/10, 2020-02-12, annex "Incoterms (R) 2020"): the eleven three-letter rules, their names, the standard's own transport grouping - seven for any mode, four for sea and inland waterway - and the kind of named place each rule requires, which is the label a capture form puts on the place field. The rule texts themselves are ICC's publication and out of scope; this is the code list an interchange document carries. Resolution via Incoterm.

The Incoterms (R) 2020 rule vocabulary, as UN/ECE Recommendation No. 5 codes it (sixth edition, ECE/TRADE/C/CEFACT/2020/10, 2020-02-12, annex "Incoterms (R) 2020"): the eleven three-letter rules, their names, the standard's own transport grouping - seven for any mode, four for sea and inland waterway - and the kind of named place each rule requires, which is the label a capture form puts on the place field. The rule texts themselves are ICC's publication and out of scope; this is the code list an interchange document carries. Resolution via Incoterm.

Attributes

Companion
object
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Instalment[C <: Currency & Singleton](payment: Money[C], interest: Money[C], principal: Money[C], balance: Money[C])

One period of an amortisation schedule: the payment, its interest share, its principal share, and the closing balance - the row a lending book prints. Instances come from Money's amortisation.

One period of an amortisation schedule: the payment, its interest share, its principal share, and the closing balance - the row a lending book prints. Instances come from Money's amortisation.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Money

Factories, arithmetic, rounding boundaries, and allocation for Money.

Factories, arithmetic, rounding boundaries, and allocation for Money.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Money.type
object Percent

Factories and application for Percent.

Factories and application for Percent.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Percent.type
object Rate

Factories and accessors for Rate.

Factories and accessors for Rate.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Rate.type
final case class Tax

A declared tax structure of named components, each levied on the net (Tax.on), on the net plus other components' charged amounts (Tax.over), or withheld from the payable (Tax.withheld).

A declared tax structure of named components, each levied on the net (Tax.on), on the net plus other components' charged amounts (Tax.over), or withheld from the payable (Tax.withheld).

The structure is the application's configuration: no jurisdiction's rates or bases are curated here. A component's base is referenced as a value, so naming an undeclared component cannot be written, and assembly validates the rest. Instances via Tax.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Tax

Component builders, assembly, application, and the interchange category vocabulary for Tax.

Component builders, assembly, application, and the interchange category vocabulary for Tax.

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Tax.type
final case class Taxed[C <: Currency & Singleton](net: Money[C], components: Vector[(String, Money[C])], withheld: Vector[(String, Money[C])])

A priced document: the net, the charged amount per component in declaration order, and any withheld amounts, with net + tax == gross by construction and the payable derived.

A priced document: the net, the charged amount per component in declaration order, and any withheld amounts, with net + tax == gross by construction and the payable derived.

A reversal negates the amounts recorded here rather than recomputing them, so a credit note cancels the original rounding exactly. Instances via Taxed and Tax.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Taxed

Single-rate fast paths and accessors for Taxed.

Single-rate fast paths and accessors for Taxed.

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Taxed.type
object Terms

Construction and the terms computations for Terms.

Construction and the terms computations for Terms.

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Terms.type
final case class Terms

Payment terms as a customer record stores them: net days counted from the invoice date or from the end of its month, with an optional early-settlement discount. "2/10 net 30" is Terms.net(30).discount(Percent(2), 10).

Payment terms as a customer record stores them: net days counted from the invoice date or from the end of its month, with an optional early-settlement discount. "2/10 net 30" is Terms.net(30).discount(Percent(2), 10).

The calendar due date is computed here; rolling it onto a business day is a separate composition over the resulting Date. Instances via Terms.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Types

opaque type Bag

A holding of several currencies at once - a cart, a wallet, a multi-currency report - as an exact total per currency. Instances via Bag.

A holding of several currencies at once - a cart, a wallet, a multi-currency report - as an exact total per currency. Instances via Bag.

Attributes

opaque type Money[C <: Currency & Singleton]

An amount of one currency, represented as the exact decimal amount alone: the currency lives in C and is recovered from evidence rather than stored per value. Arithmetic is exact and closed over C, and every rounding step is a boundary the caller names. Instances via a currency value - Currency.KES(BigDecimal("120.50")) - or Money.

An amount of one currency, represented as the exact decimal amount alone: the currency lives in C and is recovered from evidence rather than stored per value. Arithmetic is exact and closed over C, and every rounding step is a boundary the caller names. Instances via a currency value - Currency.KES(BigDecimal("120.50")) - or Money.

Attributes

opaque type Percent

A proportion stored as its exact fraction, where Percent(16) is sixteen percent - so the sixteen-versus-nought-point-one-six confusion cannot be expressed. Instances via Percent.

A proportion stored as its exact fraction, where Percent(16) is sixteen percent - so the sixteen-versus-nought-point-one-six confusion cannot be expressed. Instances via Percent.

Attributes

opaque type Rate[F <: Currency & Singleton, T <: Currency & Singleton]

An exact positive decimal rate from currency F to currency T. The direction is in the type, so converting the wrong way does not compile. Instances via Rate.

An exact positive decimal rate from currency F to currency T. The direction is in the type, so converting the wrong way does not compile. Instances via Rate.

Attributes

Extensions

Extensions

extension (c: Currency)
def apply(amount: BigDecimal): Money[c.type]

An amount of this currency, typed by the currency's own singleton: the same expression serves compile-time constants (Currency.KES(100)) and runtime-bound currencies (val c = Currency.from(code)...; c(100)).

An amount of this currency, typed by the currency's own singleton: the same expression serves compile-time constants (Currency.KES(100)) and runtime-bound currencies (val c = Currency.from(code)...; c(100)).

Attributes

def minor(amount: Long): Money[c.type]

An amount given in minor units, so Currency.KES.minor(12345) is 123.45 shillings.

An amount given in minor units, so Currency.KES.minor(12345) is 123.45 shillings.

Attributes

extension (h: Historic)
def euro(amount: BigDecimal): Option[Money[EUR]]

Converts a legacy-currency amount through the EC 2866/98 fixed factor where one exists. The half-up cent rounding is EC 1103/97 art. 5's own rule, so it is not a parameter.

Converts a legacy-currency amount through the EC 2866/98 fixed factor where one exists. The half-up cent rounding is EC 1103/97 art. 5's own rule, so it is not a parameter.

Attributes

extension (t: Territory)
def currency: Option[Currency]

The principal legal tender of the territory, where one is current.

The principal legal tender of the territory, where one is current.

Attributes

def tender: Vector[Currency]

Every current legal tender of the territory, principal first.

Every current legal tender of the territory, principal first.

Attributes