public final class CurrencyConverter extends Object
Constructor and Description |
---|
CurrencyConverter() |
Modifier and Type | Method and Description |
---|---|
BulkFixedRateConversionResult |
convertCurrenciesWithFixedRate(List<ConversionParametersForFixedRate> conversionParameters)
Provides conversion capabilities for multiple conversions in one call and depends on the
ExchangeRateValue provided specifically in the request. |
BulkNonFixedRateConversionResult |
convertCurrenciesWithNonFixedRate(List<ConversionParametersForNonFixedRate> conversionParameters,
DataAdapter dataAdapter)
Provides conversion capabilities for multiple conversions in one call by picking the best possible exchange rate
that is applicable.
|
BulkNonFixedRateConversionResult |
convertCurrenciesWithNonFixedRate(List<ConversionParametersForNonFixedRate> conversionParameters,
DataAdapter dataAdapter,
OverrideTenantSetting overrideSetting)
Provides conversion capabilities for multiple conversions in one call by overriding the default tenant settings
that are provided by the
DataAdapter and uses the Data Adapter provided in the input to get the required
ExchangeRate s. |
SingleFixedRateConversionResult |
convertCurrencyWithFixedRate(ConversionParametersForFixedRate param)
Provides conversion capabilities for one conversion in one call and depends on the
ExchangeRateValue
provided specifically in the request. |
SingleNonFixedRateConversionResult |
convertCurrencyWithNonFixedRate(ConversionParametersForNonFixedRate param,
DataAdapter dataAdapter)
Provides conversion capabilities for one conversion in one call by picking the best possible exchange rate that
is applicable.
|
SingleNonFixedRateConversionResult |
convertCurrencyWithNonFixedRate(ConversionParametersForNonFixedRate param,
DataAdapter dataAdapter,
OverrideTenantSetting overrideSetting)
Provides conversion capabilities for one conversion in one call by picking the best possible exchange rate that
is applicable.
|
@Nonnull public SingleNonFixedRateConversionResult convertCurrencyWithNonFixedRate(@Nonnull ConversionParametersForNonFixedRate param, @Nonnull DataAdapter dataAdapter) throws ConversionException
ExchangeRate
and other tenant-based settings like the data provider code for conversion that the
'DataAdapter' provides. If you want to perform more than one conversion, you must use the API for bulk conversion
instead.
If the 'fromCurrency' and 'toCurrency' are the same in the ConversionParametersForNonFixedRate
, the
response amount will be the same as the input currency amount and an ExchangeRate
entry is provided with
default values, with the exchange rate value as 1.
param
- ConversionParametersForNonFixedRate
: A conversion parameter for a non-fixed rate. This acts as
the input for the conversion and the same object is provided in the resultant
SingleNonFixedRateConversionResult
for correlation.dataAdapter
- Your implementation of the DataAdapter
that provides a list of ExchangeRate
s and
TenantSettings
for the conversion being performed.SingleNonFixedRateConversionResult
: Returns the single conversion result for a non-fixed rate.ConversionException
- An exception that occurs when the requested conversions could not be processed. This exception can
occur when, for example, your data adapter implementation returned an empty list of
ExchangeRate
s or because we could not read your default TenantSettings
. There could
be more error scenarios. Please check the conversion exception for detailed information.@Nonnull public BulkNonFixedRateConversionResult convertCurrenciesWithNonFixedRate(@Nonnull List<ConversionParametersForNonFixedRate> conversionParameters, @Nonnull DataAdapter dataAdapter) throws ConversionException
ExchangeRate
and other tenant-based settings like the data provider code for
conversion that the 'DataAdapter' provides. Check the inline messages of any individual conversion failures for
detailed information.
If the 'fromCurrency' and 'toCurrency' are the same in the ConversionParametersForNonFixedRate
, the
response amount will be the same as the input currency amount and an ExchangeRate
entry is provided with
default values, with the exchange rate value as 1.
conversionParameters
- ConversionParametersForNonFixedRate
: A list of conversion parameters for a non-fixed rate.
This acts as the input for the conversion and the same object is provided in the resultant
SingleNonFixedRateConversionResult
for correlation. The maximum number of conversion
parameters supported in a single call is 1000.dataAdapter
- Your implementation of the DataAdapter
that provides a list of ExchangeRate
s and
TenantSettings
for the conversion being performed.BulkNonFixedRateConversionResult
: Returns the conversion result for a non-fixed rate.ConversionException
- An exception that occurs when none of the requested conversions could be processed. This could have
happened either because your data adapter implementation returned an empty list of
ExchangeRate
s or because we could not read your default TenantSettings
. Check your
DataAdapter
implementation details.@Nonnull public SingleNonFixedRateConversionResult convertCurrencyWithNonFixedRate(@Nonnull ConversionParametersForNonFixedRate param, @Nonnull DataAdapter dataAdapter, @Nonnull OverrideTenantSetting overrideSetting) throws ConversionException
ExchangeRate
and other tenant-based settings like the data provider code for conversion provided by the
'DataAdapter'. You must use the API for bulk conversion if you want to perform multiple conversions.
If the 'fromCurrency' and 'toCurrency' are the same in the ConversionParametersForNonFixedRate
, the
response amount will be the same as the input currency amount and an ExchangeRate
entry is provided with
default values, with the exchange rate value as 1.
param
- ConversionParametersForNonFixedRate
: A conversion parameter for a non-fixed rate. This acts as
the input for the conversion and the same object is provided in the resultant
SingleNonFixedRateConversionResult
for correlation.dataAdapter
- Your implementation of DataAdapter
that provides a list of ExchangeRate
s and
TenantSettings
for the conversion being performed.overrideSetting
- These settings are used for this conversion request. Default TenantSettings
provided by the
DataAdapter
are not used during the conversion process because the override setting takes
precedence. This value cannot be null, and it should be a valid object for consuming this API.SingleNonFixedRateConversionResult
: The single conversion result for a non-fixed rate.ConversionException
- An exception that occurs when the requested conversions could not be processed. Check the conversion
exception for detailed information. For example , This could have happened either because your data
adapter implementation returned an empty list of ExchangeRate
s or because we could not read
your default TenantSettings
etc.@Nonnull public BulkNonFixedRateConversionResult convertCurrenciesWithNonFixedRate(@Nonnull List<ConversionParametersForNonFixedRate> conversionParameters, @Nonnull DataAdapter dataAdapter, @Nonnull OverrideTenantSetting overrideSetting) throws ConversionException
DataAdapter
and uses the Data Adapter provided in the input to get the required
ExchangeRate
s. The default data source setting is not applicable for this request. Check the inline
messages of any individual conversion failures for detailed information.
If the 'fromCurrency' and 'toCurrency' are the same in the ConversionParametersForNonFixedRate
, the
response amount will be the same as the input currency amount and a ExchangeRate
entry is provided with
default values, with the exchange rate value as 1.
conversionParameters
- ConversionParametersForNonFixedRate
: A list of conversion parameters for a non-fixed rate.
This acts as the input for the conversion and the same object is provided in the result
SingleNonFixedRateConversionResult
for correlation. The maximum number of conversion
parameters supported in a single call is 1000.dataAdapter
- Your implementation of the DataAdapter
that provides a list of ExchangeRate
s and
TenantSettings
for the conversion being performed.overrideSetting
- These settings are used for this conversion request. Default TenantSettings
provided by the
DataAdapter
are not used during the conversion process because the override setting takes
precedence. This value cannot be null, and it should be a valid object for consuming this API.BulkNonFixedRateConversionResult
: The conversion result for a non-fixed rate.ConversionException
- An exception that occurs when none of the requested conversions could be processed. This could have
happened either because your data adapter implementation returned an empty list of
ExchangeRate
s or because we could not read your default TenantSettings
. Check your
DataAdapter
implementation details.@Nonnull public SingleFixedRateConversionResult convertCurrencyWithFixedRate(@Nonnull ConversionParametersForFixedRate param) throws ConversionException
ExchangeRateValue
provided specifically in the request. Please use the API for bulk conversion if you want to perform ,multiple
conversions.
If the 'fromCurrency' and 'toCurrency' are the same in the ConversionParametersForFixedRate
, the response
amount will be the same as the input currency amount and the given exchange rate value is not used in the
conversion.
SingleFixedRateConversionResult
: Returns a single conversion result for a fixed rate.ConversionException
- An exception that occurs when none of the requested conversions could be processed. Check the
conversion exception for detailed information.@Nonnull public BulkFixedRateConversionResult convertCurrenciesWithFixedRate(@Nonnull List<ConversionParametersForFixedRate> conversionParameters) throws ConversionException
ExchangeRateValue
provided specifically in the request. Check the inline messages of any individual
conversion failures for detailed information.
If the 'fromCurrency' and 'toCurrency' are the same in the ConversionParametersForFixedRate
, the response
amount will be the same as the input currency amount and the given exchange rate value is not used in the
conversion.
conversionParameters
- ConversionParametersForFixedRate
: A list of conversion parameters for a fixed rate. This acts
as the input for the conversion and the same object is provided in the resultant
SingleFixedRateConversionResult
for correlation. The maximum number of conversion parameters
supported in a single call is 1000.BulkFixedRateConversionResult
: The conversion result for a fixed rate.ConversionException
- An exception that occurs when the requested conversions could not be processed.Copyright © 2020 SAP SE. All rights reserved.