Currency Conversion Service

Platform provides a standard WebAction which you can reference in your UiMetaModel. This allows users to view all the available CurrencyConvertersFactors.

<WebAction name="CurrencyConversionReport">
<PanelOptions>
<PanelClass>One.Report</PanelClass>
<PanelConfig>{reportName: 'PLT.CurrencyConversionReport', autoExecute: true }</PanelConfig>
</PanelOptions>
</WebAction>

images/download/attachments/144835318/currency_conversion_factor-version-1-modificationdate-1645044721000-api-v2.png

Platform does not provide a default UI to create CurrencyConversionFactor. Instead, platform provides the "PLT.CurrencyConversionFactor_IB" inbound interface to upload data through CSV upload framework.

CurrencyConversionService is a Platform service for converting a monetary amount from one currency to another, at a given point in time, using a specific currency "API".

CurrencyConverter converter = new CurrencyConverter();
converter.setAPI("Data");
Services.get(CurrencyConversionService.class).convert(new BigDecimal("1"), CurrencyCode.USD, CurrencyCode.INR, new Date(), converter);

To create your own conversion API, your class should implement the com.onenetwork.platform.common.currency.CurrencyConversionAPI interface provided by platform. Register your API using registerAPI() method on CurrencyConversionService in your ModuleContextListener.

Once this is done, you can create a CurrencyConverter which references your API and call CurrencyConversionService.convert().

Platform provides a default implementation of API called "Data" which internally uses the CurrencyConversionFactor model records to convert the amount from one currency to another.