Exemple #1
0
    public void SendVerifyRequestToServer(System.Action <APIResponse> callback, string receiptData, string receiptSignature, string userId, string productId, string secretKey)
    {
        this.callback = callback;

        APIRequest request = new APIRequest();

        request.apiName  = "verify_android";
        request.callback = RequestCallback;

        request.AddData("receiptData", AES.Encrypt(receiptData, NetworkConfig.IsUsingEncryption));
        request.AddData("receiptSignature", AES.Encrypt(receiptSignature, NetworkConfig.IsUsingEncryption));
        request.AddData("userId", AES.Encrypt(userId, NetworkConfig.IsUsingEncryption));
        request.AddData("productId", AES.Encrypt(productId, NetworkConfig.IsUsingEncryption));
        request.AddData("secretKey", AES.Encrypt(secretKey, NetworkConfig.IsUsingEncryption));
        StartCoroutine(CoreAPI.Instance.SendVerifyRequestToServer(request));
    }
Exemple #2
0
    public void SendRequestToServer(System.Action <APIResponse> callback, string apiName, string[] fieldName, string[] input, int totalField)
    {
        this.callback = callback;
        JSONObject j = new JSONObject(JSONObject.Type.OBJECT);
        //Call API To server
        APIRequest request = new APIRequest();

        request.apiName  = apiName;
        request.callback = RequestCallback;
        for (int i = 0; i < totalField; i++)
        {
            j.AddField(fieldName [i], input [i]);
        }
        string data = j.Print();

        if (NetworkConfig.IsUsingEncryption)
        {
            data = AES.Encrypt(data);
        }
        request.AddData(APITag.data, data);
        StartCoroutine(CoreAPI.Instance.SendRequestToServer(request));
    }