walletsTransferWithHttpInfo method

Future<Response> walletsTransferWithHttpInfo(
  1. String idempotencyKey, {
  2. WalletTransferRequest? walletTransferRequest,
  3. Future<void>? abortTrigger,
})

Transfer between wallets

Moves funds from one of the partner's wallets to another, converting between their currencies. amount is in the source wallet's currency and is rounded to two decimals. The destination receives the amount converted at the current rate, rounded to two decimals. Returns the transferId, the sent and received amounts and currencies, the conversionRate and the transferDate. Both wallets record an exchange transaction. The two wallets must differ, and the amount must be above zero; otherwise, or when the source balance is too low, the call returns 400 with code 10001. An unknown wallet returns 404 with code 10004. Requires an Idempotency-Key header (a UUID). Repeating a completed transfer with the same key returns 409 with code 12000 (IDEMPOTENCY_KEY_ALREADY_USED) and moves no money; one still running returns 409 with code 12002, and a different body with the same key 409 with code 12001. A request that ended in an error can be sent again with the same key and body.

Note: This method returns the HTTP Response.

Parameters:

  • String idempotencyKey (required): UUID idempotency key for safe retries of this operation.

  • WalletTransferRequest walletTransferRequest: The source wallet, destination wallet and amount.

Implementation

Future<Response> walletsTransferWithHttpInfo(String idempotencyKey, { WalletTransferRequest? walletTransferRequest, Future<void>? abortTrigger, }) async {
  // ignore: prefer_const_declarations
  final path = r'/api/v1/b2b/wallets/transfer';

  // ignore: prefer_final_locals
  Object? postBody = walletTransferRequest;

  final queryParams = <QueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

  headerParams[r'Idempotency-Key'] = parameterToString(idempotencyKey);

  const contentTypes = <String>['application/json', 'text/json', 'application/*+json'];


  return apiClient.invokeAPI(
    path,
    'POST',
    queryParams,
    postBody,
    headerParams,
    formParams,
    contentTypes.isEmpty ? null : contentTypes.first,
    abortTrigger: abortTrigger,
  );
}