convertAmount method
dynamic
convertAmount({
- required String source,
- required String target,
- required int amount,
- required void onSuccess(),
- required void onApiError(
- ApiErrorResponse apiError
- required void onFailure(),
Retrieves the ConvertedAmount for the provided input from the Connect Gateway.
The Connect Gateway will convert the provided amount
from its original currency source
to the new currency target
.
source
and target
should both be formatted as the 3 letter ISO Currency Code
amount
is an int
that represents the amount to be converted in cents and always having 2 decimals.
Implementation
convertAmount({
required String source,
required String target,
required int amount,
required void Function(ConvertedAmount) onSuccess,
required void Function(ApiErrorResponse apiError) onApiError,
required void Function(NativeException e) onFailure,
}) {
final request = ConvertAmountRequest(source, target, amount);
return _communicator
.convertAmount(
request,
_NativeFutureListener(
success: onSuccess, apiError: onApiError, failure: onFailure))
.awaitJob();
}