Reference > IBM Sales Center extension points
Currency format extension point
This extension point is to allow the globalization plug-in to implement locale-specific currency formatting.
Identifier:
com.ibm.commerce.telesales.g11n.currencyFormat
Description:
This extension point is to allow the globalization plug-in to implement locale-specific currency formatting.
Configuration Markup:
<!ELEMENT extension ( currencyFormatter , currencyFormat+)>
<!ATTLIST extension
point CDATA #REQUIRED
id CDATA #IMPLIED
name CDATA #IMPLIED>
- point - The fully qualified identifier of the target extension point.
- id - An optional identifier for the target extension point
- name - An optional name for the extension instance
<!ELEMENT currencyFormatter EMPTY>
<!ATTLIST currencyFormatter
id CDATA #IMPLIED
class CDATA #REQUIRED>
Currency formatter class definition.
- id - Optional identifier for the currency formatter.
- class - This Class which will use data provided in currency line to format the currency. The target class must have a default (no-argument) constructor, and must implement interface com.ibm.commerce.telesales.g11n.ICurrencyFormatter.
<!ELEMENT currencyFormat ( currency)>
<!ATTLIST currencyFormat
id CDATA #REQUIRED>
A currency code specific currency format definition.
- id - A unique identifier for the currency format. This value of this attribute must be extension point id (which is com.ibm.commerce.telesales.g11n.currencyFormat) followed by the currency code, for example com.ibm.commerce.telesales.g11n.currencyFormat.USD/ com.ibm.commerce.telesales.g11n.currencyFormat.CAD.
<!ELEMENT currency ( currencyLine)>
<!ATTLIST currencyLine
currencySymbol CDATA #REQUIRED
currencyCode CDATA #IMPLIED
description CDATA #IMPLIED
currencyPrefixPositive CDATA #IMPLIED
currencyPrefixNegative CDATA #IMPLIED
currencySuffixPositive CDATA #IMPLIED
currencySuffixNegative CDATA #IMPLIED
decimalPlaces CDATA #IMPLIED
displayLocale CDATA #IMPLIED
radixPoint CDATA #IMPLIED
groupingChar CDATA #IMPLIED
numberPattern CDATA #IMPLIED
roundingMultiple CDATA #IMPLIED
numberUsgId CDATA #IMPLIED
roundingMethod CDATA #IMPLIED
minApproveAmount CDATA #IMPLIED
customizedCurrencyString CDATA #IMPLIED>
A Currency line definition.
- currencySymbol - Currency symbol to be displayed along with amount.
- currencyCode - This is a currency code as per ISO 4217 standards.
- description - A description of the currency, suitable for display to customers in a currency selection list.
- currencyPrefixPositive - The prefix to use when the amount is positive.
- currencyPrefixNegative - The prefix to use when the amount is negative.
- currencySuffixPositive - The suffix to use when the amount is positive.
- currencySuffixNegative - The suffix to use when the amount is negative.
- decimalPlaces - The number of decimal places in a rounded or truncated monetary amount.
- displayLocale - The Java locale used to create a currency NumberFormat object that is used to do the formatting. If this is NULL then the locale associated with the LANGUAGE_ID (see the LANGUAGE table) is used.
- radixPoint - The radix point for the NumberFormat object. For example, when formatting dollars for the U.S. English Language, this would be the decimal point character. If this is null, then the decimal separator of the currency NumberFormat, associated with the DisplayLocale, will be used
- groupingChar - The grouping character used by the NumberFormat object. For example, when formatting dollars for the U.S. English Language this would be the thousands separator. If this is null, then the grouping separator of the currency NumberFormat, associated with the DisplayLocale, will be used.
- numberPattern - The number pattern to be applied to the NumberFormat object. The number pattern is described in the documentation for the class java.text.DecimalFormat. If this is NULL then the default number pattern of the NumberFormat object is used.
- roundingMultiple - Rounding multiple according to national law or practice. For example, specify 5 to round dollars to the nearest five cent piece. The default value is 1.
- numberUsgId - This currency formatting rule should be used when formatting monetary amounts for this usage.
- roundingMethod - How to round to a multiple of ROUNDINGMULTIPLE: R = round normally - up or down - to the nearest multiple T = truncate - round down for positive amounts, round up for negative amounts.
- minApproveAmount - A small amount to be authorized when a backorder is initially submitted, to check that a successful authorization can be obtained. The full amount of the Order will not be authorized until sufficient inventory is allocated to release the backorder.
- customizedCurrencyString - An alternate currency format expression. Eg. "${0,number,#,##0.##} (CAD)". If this value is provided, the other values are neglected and a MessageFormat object is constructed with this, and that object is used for parsing.
Examples:
<extension point="com.ibm.commerce.telesales.g11n.currencyFormat"> <currencyFormatter class="com.ibm.commerce.telesales.g11n.CurrencyFormatter"/> <!-- currency formatter for INR --> <currencyFormat id="com.ibm.commerce.telesales.g11n.currencyFormat.INR"> <currency> <currencyLine currencyCode="INR" currencyPrefixPositive="RS" currencyPrefixNegative="-RS" currencySymbol="RS" description="Indian Rupees" numberPattern = "#,##0.00" roundingMultiple ="1" roundingMethod = "R" decimalPlaces = "2"/> </currency> </currencyFormat> <!-- currency formatter for CNY --> <currencyFormat id="com.ibm.commerce.telesales.g11n.currencyFormat.CNY"> <currency> <currencyLine currencyCode="CNY" currencyPreffixPositive="CNY" currencyPrefixNegative="-CNY" currencySymbol="CNY" description="Chinese Yuan" numberPattern = "#,##0.00" roundingMultiple ="1" roundingMethod = "R" decimalPlaces = "2"/> </currency> </currencyFormat> </extension>
API Information:
This extension point allows customization of the way the currency format is displayed. One can specify a currencyFormatter class name using the attribute class of the element currencyFormatter. If defined, this class" formatCurrency method will be invoked by the globalization class. The globalization class also will set the currency format corresponding to the customer"s selected currency if it is defined in the extension point. For more details, see the example in the Examples section.
Supplied Implementation:
The IBM Sales Center globalization plugin includes a "DefaultCurrencyFomatter" class which formats the currency using "java.text.NumberFormat.getCurrencyInstance(Locale.getDefault)"