EnumValue
MimeEncodedText
Money
Quantity
DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!
Let us know so we can improve!
Represents money in Commerce Cloud Digital.
| Constant | Description |
|---|---|
| NOT_AVAILABLE: Money | Represents that there is no money available. |
| Property | Description |
|---|---|
available: Boolean (read-only) | Identifies if the instance contains settings for value and currency. |
currencyCode: String (read-only) | Returns the ISO 4217 currency mnemonic (such as ‘USD’, ‘EUR’) of the currency the money value relates to. |
decimalValue: Decimal (read-only) | Returns the money as Decimal, null is returned when the money is not available. |
value: Number (read-only) | Returns the value of the money instance. |
valueOrNull: Number (read-only) | Return the value of the money instance or null if the Money instance is NOT_AVAILABLE. |
| Constructor | Description |
|---|---|
| Money(Number, String) | Constructs a new money instance with the specified amount for the specified currency. |
| Method | Description |
|---|---|
| add(Money) | Returns a Money instance by adding the specified Money object to the current object. |
| addPercent(Number) | Adds a certain percentage to the money object. |
| addRate(Number) | Adds a rate (e.g. |
| compareTo(Money) | Compares two Money values. |
| divide(Number) | Divide Money object by specified divisor. |
| equals(Object) | Compares two money values whether they are equivalent. |
| getCurrencyCode() | Returns the ISO 4217 currency mnemonic (such as ‘USD’, ‘EUR’) of the currency the money value relates to. |
| getDecimalValue() | Returns the money as Decimal, null is returned when the money is not available. |
| getValue() | Returns the value of the money instance. |
| getValueOrNull() | Return the value of the money instance or null if the Money instance is NOT_AVAILABLE. |
| hashCode() | Calculates the hash code for a money; |
| isAvailable() | Identifies if the instance contains settings for value and currency. |
| isOfSameCurrency(Money) | Identifies if two Money value have the same currency. |
| multiply(Number) | Multiply Money object by specified factor. |
| multiply(Quantity) | Multiplies the Money object with the given quantity. |
| newMoney(Decimal) | Method returns a new instance of Money with the same currency but different value. |
| percentLessThan(Money) | Convenience method. |
| percentOf(Money) | Convenience method. |
| static prorate(Money, Money[]) | Prorates the specified values using the specified discount. |
| subtract(Money) | Returns a new Money instance by substracting the specified Money object from the current object. |
| subtractPercent(Number) | Subtracts a certain percentage from the money object. |
| subtractRate(Number) | Subtracts a rate (e.g. |
| toFormattedString() | Returns a string representation of Money according to the regional settings configured for current request locale, for example ‘$59.00’ or ‘USD 59.00’. |
| toNumberString() | Returns a string representation for the numeric value of this money. |
| toString() | Returns a string representation of this Money object. |
| valueOf() | According to the ECMA spec returns the “natural” primitve value. |
assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values
Represents that there is no money available.
(read-only)Identifies if the instance contains settings for value and currency.
(read-only)Returns the ISO 4217 currency mnemonic (such as 'USD', 'EUR') of the currency the money value relates to.
Note a money instance may also describe a price that is 'not available'.
In this case the value of this attribute is N/A.
(read-only)Returns the money as Decimal, null is returned when the money is not available.
(read-only)Returns the value of the money instance.
See Also:
(read-only)Return the value of the money instance or null if the Money instance is NOT_AVAILABLE.
Constructs a new money instance with the specified amount for the specified
currency. Note that each currency has a precision (number of digits after the
decimal point) and that values beyond the precision are "rounded up" to their
"nearest neighbor" following the rules of java.math.RoundingMode.HALF_UP.
Parameters:
null.null.Returns a Money instance by adding the specified Money object to the current object. Only objects representing the same currency can be added. If one of the Money values is N/A, the result is N/A.
Parameters:
Returns:
Adds a certain percentage to the money object. The percent value is given as true percent value, so for example 10 represent 10%. If this Money is N/A the result is also N/A.
Parameters:
Returns:
Adds a rate (e.g. 0.05) to the money object. This is typically for example to add a tax rate.
Parameters:
Returns:
Compares two Money values. An exception is thrown if the two Money values are of different currency. If one of the Money values represents the N/A value it is treated as 0.0.
Parameters:
Returns:
Divide Money object by specified divisor. If this Money is N/A the result is also N/A.
Parameters:
Returns:
Compares two money values whether they are equivalent.
Parameters:
Returns:
Returns the ISO 4217 currency mnemonic (such as 'USD', 'EUR') of the currency the money value relates to.
Note a money instance may also describe a price that is 'not available'.
In this case the value of this attribute is N/A.
Returns:
Returns the money as Decimal, null is returned when the money is not available.
Returns:
Returns the value of the money instance.
Returns:
See Also:
Return the value of the money instance or null if the Money instance is NOT_AVAILABLE.
Returns:
Calculates the hash code for a money;
Identifies if the instance contains settings for value and currency.
Returns:
Identifies if two Money value have the same currency.
Parameters:
Returns:
Multiply Money object by specified factor. If this Money is N/A the result is also N/A.
Parameters:
Returns:
Multiplies the Money object with the given quantity. If this Money is N/A the result is also N/A.
Parameters:
Returns:
Method returns a new instance of Money with the same currency but different value. An N/A instance is returned if value is null.
Parameters:
Returns:
Convenience method.
Calculates and returns the percentage off this price represents in
relation to the passed base price. The result is generally equal to
100.0 - this.percentOf(value). For example, if this value
is $30 and the passed value is $50, then the return
value will be 40.0, representing a 40% discount.
This method will return null if the compare value is null, this value or the compare value is unavailable, or the compare value equals 0.0.
Parameters:
Returns:
Throws:
See Also:
Convenience method. Calculates and returns the percentage of the passed value this price represents. For example, if this value is $30 and the passed value is $50, then the return value will be 60.0 (i.e. 60%).
This method will return null if the compare value is null, this value or the compare value is unavailable, or the compare value equals 0.0.
Parameters:
Returns:
Throws:
Prorates the specified values using the specified discount.
Parameters:
Returns:
Returns a new Money instance by substracting the specified Money object from the current object. Only objects representing the same currency can be subtracted. If one of the Money values is N/A, the result is N/A.
Parameters:
Returns:
Subtracts a certain percentage from the money object. The percent value is given as true percent value, so for example 10 represent 10%. If this Money is N/A the result is also N/A.
Parameters:
Returns:
Subtracts a rate (e.g. 0.05) from the money object. This is typically for example to subtract a tax rates.
Parameters:
Returns:
Returns a string representation of Money according to the regional settings configured for current request locale, for example '$59.00' or 'USD 59.00'.
Returns:
Returns a string representation for the numeric value of this money. The number is formatted with the decimal symbols of the platforms default locale.
Returns:
Returns a string representation of this Money object.
Returns:
According to the ECMA spec returns the "natural" primitve value. Here the value portion of the Money is returned.