public IEnumerator GetPromoCodesForUser(string userName, Action <List <PromoCode> > callback)
    {
        GetPromoCodeForUserRequest request = new GetPromoCodeForUserRequest();

        request.userName      = userName;
        request.securityToken = HashKey.apiKey;

        var jsonString = JsonUtility.ToJson(request);

        byte[] byteData = System.Text.Encoding.ASCII.GetBytes(jsonString.ToCharArray());

        UnityWebRequest unityWebRequest = UnityWebRequest.Post(apiURL + "/userPromoCodes", jsonString);

        unityWebRequest.uploadHandler             = new UploadHandlerRaw(byteData);
        unityWebRequest.uploadHandler.contentType = "application/json";
        unityWebRequest.SetRequestHeader("Content-Type", "application/json");

        DownloadHandlerBuffer downloadHandlerBuffer = new DownloadHandlerBuffer();

        unityWebRequest.downloadHandler = downloadHandlerBuffer;

        yield return(unityWebRequest.SendWebRequest());

        if (unityWebRequest.isNetworkError || unityWebRequest.isHttpError)
        {
            Debug.Log(unityWebRequest.error);
            callback(null);
        }
        else
        {
            string      response = unityWebRequest.downloadHandler.text;
            PromoCode[] codes    = JsonHelper.FromJsonWithFix <PromoCode>(response);
            callback(new List <PromoCode>(codes));
        }
    }
    public IEnumerator DoesUserExist(string userName, Action <bool> callback)
    {
        GetPromoCodeForUserRequest request = new GetPromoCodeForUserRequest();

        request.securityToken = HashKey.apiKey;
        request.userName      = userName;

        var jsonString = JsonUtility.ToJson(request);

        byte[] byteData = System.Text.Encoding.ASCII.GetBytes(jsonString.ToCharArray());

        UnityWebRequest unityWebRequest = UnityWebRequest.Post(apiURL + "/userExists", jsonString);

        unityWebRequest.uploadHandler             = new UploadHandlerRaw(byteData);
        unityWebRequest.uploadHandler.contentType = "application/json";
        unityWebRequest.SetRequestHeader("Content-Type", "application/json");

        DownloadHandlerBuffer downloadHandlerBuffer = new DownloadHandlerBuffer();

        unityWebRequest.downloadHandler = downloadHandlerBuffer;

        yield return(unityWebRequest.SendWebRequest());

        if (unityWebRequest.isNetworkError || unityWebRequest.isHttpError)
        {
            Debug.Log(unityWebRequest.error);
        }
        else
        {
            string response = System.Text.Encoding.ASCII.GetString(unityWebRequest.downloadHandler.data);
            bool   userExists;
            Boolean.TryParse(response, out userExists);
            callback(userExists);
        }
    }