convertAmount method

dynamic convertAmount({
  1. required String source,
  2. required String target,
  3. required int amount,
  4. required void onSuccess(
    1. ConvertedAmount
    ),
  5. required void onApiError(
    1. ApiErrorResponse apiError
    ),
  6. required void onFailure(
    1. NativeException e
    ),
})

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();
}