Service class for managing withdrawals related operations.

Hierarchy

  • ApiService
    • WithdrawalService

Methods

  • Requests a withdrawal status update.

    Parameters

    Returns Promise<Withdrawal>

    A promise that resolves to the updated withdrawal.

    Throws

    If the HTTP request fails.

    Example

    // Example usage:
    withdrawalService.confirm(withdrawalId)
    .then((response) => {
    console.log(response);
    })
    .catch((error) => {
    console.error(`Error processing withdrawal.`);
    });
  • Requests a withdrawal creation.

    Parameters

    Returns Promise<Withdrawal>

    A promise that resolves to the updated withdrawal.

    Throws

    If the HTTP request fails.

    Example

    // Example usage:
    withdrawalService.create(withdrawalCreate)
    .then((response) => {
    console.log(response);
    })
    .catch((error) => {
    console.error(`Error creating withdrawal.`);
    });
  • Retrieves a withdrawal by id.

    Parameters

    • id: string

      The id of the withdrawal.

    Returns Promise<Withdrawal>

    A promise that resolves to a withdrawal.

    Throws

    If the HTTP request fails.

    Example

    // Example usage:
    withdrawalService.get(withdrawalId)
    .then((response) => {
    console.log(response);
    })
    .catch((error) => {
    console.error(`Error fetching withdrawal.`);
    });
  • Retrieves user withdrawals with pagination metadata.

    Parameters

    Returns Promise<WithdrawalList>

    A promise that resolves to a withdrawal list.

    Throws

    If the HTTP request fails.

    Example

    // Example usage:
    withdrawalService.getAll({ limit: 5 })
    .then((response) => {
    console.log(response);
    })
    .catch((error) => {
    console.error(`Error fetching withdrawals.`);
    });
  • Retrieves all withdrawal options.

    Returns Promise<WithdrawalOption[]>

    A promise that resolve to a list of withdrawal options.

    Throws

    If the HTTP request fails.

    Example

    // Example usage:
    withdrawalService.getOptions()
    .then((response) => {
    console.log(response);
    })
    .catch((error) => {
    console.error(`Error fetching withdrawal options.`);
    });
  • Creates a withdrawal preview.

    Parameters

    • withdrawalRequest: WithdrawalRequest

      The request payload for creating a withdrawal preview.

    Returns Promise<Withdrawal>

    A promise that resolve to the newly created withdrawal preview.

    Throws

    If the HTTP request fails.

    Example

    // Example usage:
    withdrawalService.preview(withdrawalRequest)
    .then((response) => {
    console.log(response);
    })
    .catch((error) => {
    console.error(`Error creating withdrawal.`);
    });
  • Retrieves the singleton instance of the WithdrawalService class.

    Returns WithdrawalService

    The singleton instance of the WithdrawalService class.

    Function

    Static

    Example

    // Usage:
    const withdrawalService = WithdrawalService.getInstance();