Terms

world.money.Terms
See theTerms companion object
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).

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
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def discount(rate: Percent, within: Int): Either[Invalid, Terms]
Extension method from 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
Extension method from Terms
def due(invoiced: Date): Either[Invalid, Date]
Extension method from Terms

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

Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product