Foundations Apex API Developer Reference

fferpcore.ExchangeRateService

global inherited sharing class ExchangeRateService

Returns or updates exchange rates stored in Foundations.

Methods

getRates

global static Map<String, Decimal> getRates(String groupName, String rateType, Date effectiveDate, String relativeCurrency, Set<String> targetCurrencies)

Get exchange rates for a set of currencies that are effective on a specific date.

Input Parameters

Name Type Description
groupName String The name of the group that contains the exchange rates, stored in ExchangeRateGroup__c.Name.
rateType String The type of exchange rate, such as Spot or Historical.
effectiveDate Date The date you want to return exchange rates for.
relativeCurrency String The ISO code of the relative currency. All exchange rates returned are returned relative to this currency.
targetCurrencies Set<String> The ISO codes of the currencies that you want to return exchange rates for.

Return Value

A map of exchange rates that uses the currency ISO codes as keys.

getRateTables

global static fferpcore.ExchangeRateService.RateTablesResult getRateTables(fferpcore.ExchangeRateService.RateTablesRequest rateTableRequest)

Get exchange rates for a set of currencies covering multiple dates and groups.

Input Parameters

Name Type Description
rateTableRequest fferpcore.ExchangeRateService.RateTablesRequest An instance of the RateTablesRequest class that specifies the range of data that you want to return.

Return Value

An implementation of RateTablesResult that provides access to the table data.

setRates

global static void setRates(List<fferpcore.ExchangeRateService.SetRateRequest> requests)

Update exchange rates stored in Foundations.

Input Parameters

Name Type Description
requests List<fferpcore.ExchangeRateService.SetRateRequest> A list of request objects, each for a single date range for a single group and rate type.

fferpcore.ExchangeRateService.RateTablesResult

global interface RateTablesResult

A wrapper for accessing exchange rate tables that are returned from the database.

Methods

getRateTable

ExchangeRateService.RateTable getRateTable(String groupName, String rateType)

Get an exchange rate table for a specific exchange rate group and type.

Input Parameters

Name Type Description
groupName String The name of the exchange rate group that contains the exchange rates.
rateType String The type of exchange rate, such as Spot or Historical.

Return Value

A rate table containing exchange rates for multiple currencies and dates.

fferpcore.ExchangeRateService.RateTable

global interface RateTable

A set of exchange rates for multiple currencies and dates.

Methods

getRateType

String getRateType()

Get the type of exchange rate for the data in this RateTable, such as Spot or Historical.

Return Value

The type of exchange rate.

getStartDate

Date getStartDate()

Get the earliest effective date for the data in this rate table.

Return Value

The start date for the data in this rate table.

getEndDate

Date getEndDate()

Get the latest effective date for the range of data in this RateTable.

Return Value

The last date for the data in this rate table.

getRate

Decimal getRate(Date effectiveDate, String relativeCurrency, String targetCurrency)

Get the exchange rate for a currency that is effective on a specific date.

Input Parameters

Name Type Description
effectiveDate Date The date you want to return a rate for.
relativeCurrency String The ISO code of the relative currency. The returned exchange rate is relative to this currency.
targetCurrency String The ISO codes of the currency that you want to return an exchange rate for.

Return Value

The exchange rate.

getRates

Map<String, Decimal> getRates(Date effectiveDate, String relativeCurrency, Set<String> targetCurrencies)

Get exchange rates for a set of currencies that are effective on a specific date.

Input Parameters

Name Type Description
effectiveDate Date The date you want to return exchange rates for.
relativeCurrency String The ISO code of the relative currency. All exchange rates returned are returned relative to this currency.
targetCurrencies Set<String> The ISO codes of the currencies that you want to return exchange rates for.

Return Value

A map of exchange rates that uses the currency ISO codes as keys.

getAvailableCurrencies

Set<String> getAvailableCurrencies(Date effectiveDate)

Get the currencies that contain exchange rates on the specified date.

Input Parameters

Name Type Description
effectiveDate Date The date you want to return exchange rates for.

Return Value

A set of ISO codes for the available currencies.

getStartDate

Date getStartDate(Date effectiveDate, String targetCurrency)

Get the date that an exchange rate is first effective.

Input Parameters

Name Type Description
effectiveDate Date The effective date for the target exchange rate.
targetCurrency String The currency ISO code for the target exchange rate.

Return Value

The first date that the exchange rate is effective.

getEndDate

Date getEndDate(Date effectiveDate, String targetCurrency)

Get the last date that an exchange rate is effective.

Input Parameters

Name Type Description
effectiveDate Date The effective date for the target exchange rate.
targetCurrency String The currency ISO code for the target exchange rate.

Return Value

The last date that the exchange rate is effective.

fferpcore.ExchangeRateService.RateTablesRequest

global inherited sharing class RateTablesRequest

A request object that stores the parameters required to query the exchange rate data. Used exclusively with getRateTables.

Properties

Name Type Description
GroupNames Set<String> The names of the exchange rate groups that contain the exchange rates, stored in ExchangeRateGroup__c.Name.
FromDate Date The start of the date range you want to return rates for (inclusive).
ToDate Date The end of the date range you want to return rates for (inclusive).
RateTypes Set<String> The type of exchange rates to return.

Methods

RateTablesRequest

global RateTablesRequest(Set<String> groupNames, Date fromDate, Date toDate, Set<String> rateTypes)

fferpcore.ExchangeRateService.SetRateRequest

global inherited sharing class SetRateRequest

Data required to update the exchange rates for one date range for a specific exchange rate group and type.

Properties

Name Type Description
RateGroup String The name or ID of the exchange rate group to update.
RateType String The exchange rate type to associate with the exchange rates.
StartDate Date The first date on which to apply the exchange rates.
EndDate Date The last date on which to apply the exchange rates.
RelativeCurrency String The ISO code of the relative currency. All exchange rates provided are relative to this currency.
RatesByCurrency Map<String, Decimal> The map of exchange rates that uses the currency ISO codes as keys.

Methods

SetRateRequest

global SetRateRequest(String rateGroup, String rateType, Date startDate, Date endDate, String relativeCurrency, Map<String, Decimal> ratesByCurrency)

Constructs a request with multiple exchange rates.

Input Parameters

Name Type Description
rateGroup String The name or ID of the exchange rate group to update.
rateType String The exchange rate type to associate with the exchange rates.
startDate Date The first date on which to apply the exchange rates.
endDate Date The last date on which to apply the exchange rates.
relativeCurrency String The ISO code of the relative currency. All exchange rates provided are relative to this currency.
ratesByCurrency Map<String, Decimal> The map of exchange rates that uses the currency ISO codes as keys.

SetRateRequest

global SetRateRequest(String rateGroup, String rateType, Date startDate, Date endDate, String relativeCurrency, String targetCurrency, Decimal rate)

Constructs a request with a single exchange rate.

Input Parameters

Name Type Description
rateGroup String The name or ID of the exchange rate group to update.
rateType String The exchange rate type to associate with the exchange rate.
startDate Date The first date on which to apply the exchange rate.
endDate Date The last date on which to apply the exchange rate.
relativeCurrency String The ISO code of the relative currency. All exchange rates provided are relative to this currency.
targetCurrency String The ISO code of the exchange rate.
rate Decimal The value of the exchange rate.
© Copyright 2009–2024 Certinia Inc. All rights reserved. Various trademarks held by their respective owners.