Terms

world.money.Terms
See theTerms companion class
object Terms

Construction and the terms computations for Terms.

Attributes

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

Members list

Type members

Classlikes

final case class Discount(rate: Percent, within: Int)

An early-settlement offer: the rate, and the days from invoicing within which paying earns it.

An early-settlement offer: the rate, and the days from invoicing within which paying earns it.

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 terms were refused, each case carrying the rejected number.

Why terms were refused, each case carrying the rejected number.

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 Days
class Rate
class Window
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 discount(t: Terms, rate: Percent, within: Int): Either[Invalid, Terms]

The early-settlement discount.

The early-settlement discount.

Attributes

def discounted(t: Terms, invoiced: Date, paid: Date): Boolean

Whether a payment date falls inside the early-settlement window.

Whether a payment date falls inside the early-settlement window.

Attributes

def due(t: Terms, invoiced: Date): Either[Invalid, Date]

The calendar due date.

The calendar due date.

Attributes

def eom(days: Int): Either[Invalid, Terms]

Net days from the end of the invoice month.

Net days from the end of the invoice month.

Attributes

def net(days: Int): Either[Invalid, Terms]

Net days from the invoice date; zero is due on invoice, and negative days are refused.

Net days from the invoice date; zero is due on invoice, and negative days are refused.

Attributes

Givens

Givens

given derived$CanEqual: CanEqual[Terms, Terms]

Extensions

Extensions

extension (t: Terms)
def discount(rate: Percent, within: Int): Either[Invalid, Terms]

Adds an early-settlement discount; the window is at least one day and the rate below one hundred percent.

Adds an early-settlement discount; the window is at least one day and the rate below one hundred percent.

The window counts from the invoice date under both counting bases - no published source states an end-of-month window base, so the invoice-date reading is this library's documented choice, and an agreement counting otherwise composes its own predicate over Date.

Attributes

def discounted(invoiced: Date, paid: Date): Boolean
def due(invoiced: Date): Either[Invalid, Date]

The calendar due date, failing only at the edges of the representable range.

The calendar due date, failing only at the edges of the representable range.

Attributes