Tax

world.money.Tax
See theTax companion class
object Tax

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

Attributes

Companion
class
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Tax.type

Members list

Type members

Classlikes

enum Category

The UNTC 5305 duty, tax, and fee category vocabulary as EN 16931 admits it - the ten codes a compliant invoice line or VAT breakdown carries - with each category's discipline as data. World models the semantics; documents and their profiles stay downstream.

The UNTC 5305 duty, tax, and fee category vocabulary as EN 16931 admits it - the ten codes a compliant invoice line or VAT breakdown carries - with each category's discipline as data. World models the semantics; documents and their profiles stay downstream.

Attributes

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

The per-category discipline for Category, from the EN 16931 validation artefacts: BR-CL-17 and BR-CL-18 fix the ten codes, each family's -09 rule the arithmetic, and each -10 rule the reason.

The per-category discipline for Category, from the EN 16931 validation artefacts: BR-CL-17 and BR-CL-18 fix the ten codes, each family's -09 rule the arithmetic, and each -10 rule the reason.

Attributes

Companion
enum
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Category.type
final case class Component

One named component of a declared structure. Instances via the Tax builders.

One named component of a declared structure. Instances via the Tax builders.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
sealed abstract class Invalid(message: String) extends WorldError

Why a structure was refused, each case carrying the offending label.

Why a structure was refused, each case carrying the offending label.

Attributes

Companion
object
Supertypes
class WorldError
class TypedError
trait NoStackTrace
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
Known subtypes
class Duplicate
class Unlisted
class Withheld
object Invalid

Attributes

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

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements.

The names of the product elements.

Attributes

Inherited from:
Mirror
type MirroredLabel <: String

The name of the type.

The name of the type.

Attributes

Inherited from:
Mirror

Value members

Concrete methods

def exclusive[C <: Currency & Singleton](t: Tax, amount: Money[C], mode: Rounding)(using ValueOf[C]): Taxed[C]

Prices tax-exclusively, where amount is the net.

Prices tax-exclusively, where amount is the net.

Attributes

def inclusive[C <: Currency & Singleton](t: Tax, amount: Money[C], mode: Rounding)(using ValueOf[C]): Either[Undefined, Taxed[C]]

Prices tax-inclusively, where amount is the gross.

Prices tax-inclusively, where amount is the gross.

Attributes

def inclusive[C <: Currency & Singleton](t: Tax, amount: Money[C], scale: Int, mode: Rounding): Either[Undefined, Taxed[C]]
def of(components: Component*): Either[Invalid, Tax]

Assembles a structure: labels distinct, every base declared before the component that reads it, and no base withheld - a withheld amount never enters the gross, so cascading over one would read an amount the document does not carry.

Assembles a structure: labels distinct, every base declared before the component that reads it, and no base withheld - a withheld amount never enters the gross, so cascading over one would read an amount the document does not carry.

Attributes

def on(label: String, rate: Percent): Component

A component levied on the net.

A component levied on the net.

Attributes

def over(label: String, rate: Percent, base: Component*): Component

A component levied on the net plus the named components' charged amounts.

A component levied on the net plus the named components' charged amounts.

Attributes

def withheld(label: String, rate: Percent): Component

A withholding component: computed on the net, subtracted from the payable, never part of the gross.

A withholding component: computed on the net, subtracted from the payable, never part of the gross.

Attributes

Givens

Givens

given derived$CanEqual: CanEqual[Tax, Tax]

Extensions

Extensions

extension (t: Tax)
def exclusive[C <: Currency & Singleton](amount: Money[C], mode: Rounding)(using ValueOf[C]): Taxed[C]

Prices tax-exclusively: amount is the net, and each component is computed forward from it and rounded at the currency's scale by mode. Named for the pricing direction, so that net and gross keep one reading each across the module.

Prices tax-exclusively: amount is the net, and each component is computed forward from it and rounded at the currency's scale by mode. Named for the pricing direction, so that net and gross keep one reading each across the module.

Attributes

def inclusive[C <: Currency & Singleton](amount: Money[C], mode: Rounding)(using c: ValueOf[C]): Either[Undefined, Taxed[C]]

Prices tax-inclusively: amount is the gross, the shelf price. The combined factor is inverted, the components computed forward, and the net reconciled as gross minus their sum - so net + tax == gross holds by construction and the rounding remainder lands in the net deterministically. Withholding computes on the reconciled net. Undefined where a degenerate structure would divide by zero.

Prices tax-inclusively: amount is the gross, the shelf price. The combined factor is inverted, the components computed forward, and the net reconciled as gross minus their sum - so net + tax == gross holds by construction and the rounding remainder lands in the net deterministically. Withholding computes on the reconciled net. Undefined where a degenerate structure would divide by zero.

Attributes

def inclusive[C <: Currency & Singleton](amount: Money[C], scale: Int, mode: Rounding): Either[Undefined, Taxed[C]]

The same extraction at an explicit scale - the controlled form for currencies that record no minor unit, completing the family's explicit-scale pair.

The same extraction at an explicit scale - the controlled form for currencies that record no minor unit, completing the family's explicit-scale pair.

Attributes