The responsibility of the Rates Provider layer is to provide rate conversion service to the Foreign Exchange Layer. Given an arbitrary pair of currencies and their monetary item type, the Rates Provider Layer returns the sell rate or the buy rate to the caller according to the request. The RatesProviderImpl is a default implementation of this function. When querying an exchange rate between two currencies, the RatesProviderImpl firstly checks whether the direct conversion rate is available between the two. If a direct rate does not exist, it uses the conversion currency to perform the calculation.
For example, a financial institution has to convert Mexican pesos (in Traveler's check) to Canadian dollars (in cash). If a direct conversion rate exists between the two, that rate is returned. If not, the RatesProviderImpl tries to convert the pesos Traveler's check into the conversion currency in Traveler's check. If no conversion rate exists between the two, the provider converts the pesos Traveler's check into the conversion currency in cash (the basic monetary item), then converts the conversion currency to the Canadian dollars.
The rate conversion process is an example of the functionality of the Rates Provider layer. You must implement your own process according to your business requirements. The raw conversion rates (rates in the storage with no conversion) needed by the Rates Provider layer are provided by the Rates Repository layer.