Handling Currencies

A Select Pro server can receive regular exchange rate updates, sent out daily from Web-Merchant/WM. By default you will be sent these updates but you can choose not to be sent them (contact support at Web-Merchant/WM). Select Pro also provides a set of Java classes that enable you to use this exchange rate information in a Java application. If you use these classes and have updates enabled then you can be confident that you are using the most up-to-date information available. If for some reason your server has not received an update then you may see a difference between the price displayed on your server and that displayed once the transaction has been sent to Web-Merchant/WM. The price on the Web-Merchant/WM server is definitive. Note that even if your site does not allow the shopper to display prices in a choice of currencies, he will still be able to choose once the transaction has been sent to Web-Merchant/WM.

Exchange Rate Files

The exchange rates received by your Select Pro server are put into dated files. You can make use of these files directly if you prefer not to use the Java utilities. The format of these files is the same as that returned by the Web-Merchant/WM "info" servlet, as described in Information Services at Web-Merchant/WM. The files are named with the following format:

MerchantCurrencyConverter.<instId>.properties.YYYY-MM-DD
For example, for installation id 4598 and 10th June 1999:
MerchantCurrencyConverter.4598.properties.1999-06-10
The rates in a given file are valid for the day specified by the date suffix in GMT (i.e. from midnight GMT). The files are placed in the directory specified for "currencyconfig" in select.properties.

Currency Java Classes

These classes enable you to manipulate currency and price information. To create a purchase token you need to use Currency and CurrencyAmount. You only need the MerchantCurrencyConverter if you wish to provide a choice of currencies for displaying prices on your own site.

Currency

This abstract class encapsulates information about the currencies supported by the system. Information stored includes the currency ISO code (for example "GBP") and currency symbol (for example, "£"). This objects of this class occur as parameters to methods in all the other classes mentioned here. A list of ISO currency codes can be found as an appendix to the Select Integration Guide.

CurrencyList

An extension of the standard List object allowing lists of currencies to be created and manipulated. CurrencyLists are returned by methods in the MerchantCurrencyConverter class, chiefly: getAcquisitionCurrencies() and getSettlementCurrencies() but can, of course, be created directly as required.

SelectCurrency

This class represents the currencies available to the whole Select system, above individual merchant/installation level. The class has methods to return lists of available currencies, such as all the currencies supported by the system or settlement currencies only.

CurrencyAmount

This class encapsulates an amount with a currency defining it as a currency amount. It has methods to create the object using a numeric amount and a Currency object. It also has methods to perform basic addition and subtraction of one CurrencyAmount object from another. The currency types must be identical in all cases. The subtraction method subtracts the given currency amount from the object. The addition method can either add to the current object or return the sum of two CurrencyAmount parameters. The class also includes methods to display the currency amount in a variety of useful formats including numeric and string values. CurrencyAmount objects are required as parameters to methods used in the MerchantCurrencyConverter class.

MerchantCurrencyConverter

An implementation of the CurrencyConverter class described above that is specific for the merchant side of Select. Constructors require the Select installation ID number and the class includes methods to return lists of currencies related to the setup of the given installation. see: getAcquisitionCurrencies() and getSettlementCurrencies().

An Example of a Currency selection/conversion Servlet

The CurrTest servlet provided in the examples directory demonstrates how to use the currency classes to build a simple application. This servlet allows the user to purchase a single item of fixed price, but also allows that price to be converted into any of the acquisition currencies available. The displayed price will change to match the currency selected and will be used when submitting the purchase form. The submission is actually to the example servlet 'BuyThis' which is also in the examples directory and which demonstrates a typical purchase submission to WM.

$Revision: 1.7 $