Class SimSwapClient

java.lang.Object
com.vonage.client.camara.NetworkApiClient
com.vonage.client.camara.simswap.SimSwapClient

public class SimSwapClient extends NetworkApiClient
A client for communicating with the Vonage SIM Swap API. The standard way to obtain an instance of this class is to use VonageClient.getSimSwapClient().
  • Constructor Details

    • SimSwapClient

      public SimSwapClient(HttpWrapper wrapper)
      Create a new SimSwapClient.
      Parameters:
      wrapper - Http Wrapper used to create requests.
  • Method Details

    • checkSimSwap

      public boolean checkSimSwap(String phoneNumber)
      Check if SIM swap has been performed within the last 240 hours for the given phone number. Use checkSimSwap(String, int) to specify the time period.
      Parameters:
      phoneNumber - Subscriber number in E.164 format (starting with country code). Optionally prefixed with '+'.
      Returns:
      true if the SIM card has been swapped during the period within the provided age.
      Throws:
      CamaraResponseException - If the request was unsuccessful. This could be for the following reasons:
      • 400: Invalid request arguments.
      • 401: Request not authenticated due to missing, invalid, or expired credentials.
      • 403: Client does not have sufficient permissions to perform this action.
      • 404: SIM Swap can't be checked because the phone number is unknown.
      • 409: Another request is created for the same MSISDN.
      • 502: Bad gateway.
    • checkSimSwap

      public boolean checkSimSwap(String phoneNumber, int maxAgeHours)
      Check if SIM swap has been performed during the specified past period for the given phone number.
      Parameters:
      phoneNumber - Subscriber number in E.164 format (starting with country code). Optionally prefixed with '+'.
      maxAgeHours - Period in hours to be checked for SIM swap. Must be between 1 and 2400.
      Returns:
      true if the SIM card has been swapped during the period within the provided age.
      Throws:
      CamaraResponseException - If the request was unsuccessful. This could be for the following reasons:
      • 400: Invalid request arguments.
      • 401: Request not authenticated due to missing, invalid, or expired credentials.
      • 403: Client does not have sufficient permissions to perform this action.
      • 404: SIM Swap can't be checked because the phone number is unknown.
      • 409: Another request is created for the same MSISDN.
      • 502: Bad gateway.
    • retrieveSimSwapDate

      public Instant retrieveSimSwapDate(String phoneNumber)
      Get timestamp of last MSISDN to IMSI pairing change for a mobile user account.
      Parameters:
      phoneNumber - Subscriber number in E.164 format (starting with country code). Optionally prefixed with '+'.
      Returns:
      Time of the latest SIM swap performed, or null if unknown / not applicable.
      Throws:
      CamaraResponseException - If the request was unsuccessful. This could be for the following reasons:
      • 400: Invalid request arguments.
      • 401: Request not authenticated due to missing, invalid, or expired credentials.
      • 403: Client does not have sufficient permissions to perform this action.
      • 404: SIM Swap can't be checked because the phone number is unknown.
      • 409: Another request is created for the same MSISDN.
      • 502: Bad gateway.