public void OnReceivedFacebookCurrencyPurchase(string data)
        {
            Debug.Log("data: " + data);
            JsonData receiptData = JsonMapper.ToObject(data);

            if (data.Contains("error"))
            {
                PurchasePremiumCurrencyBundleResponse response = new PurchasePremiumCurrencyBundleResponse()
                {
                    Balance = 0,
                    Message = receiptData["error_message"].ToString(),
                    StatusCode = int.Parse(receiptData["error_code"].ToString())
                };

                OnPurchaseErrorEvent(response);
                return;
            }

            if (receiptData["status"].ToString() == "completed")
            {
                PurchasePremiumCurrencyBundleResponse response = new PurchasePremiumCurrencyBundleResponse()
                {
                    Balance = 0,
                    Message = receiptData["status"].ToString(),
                    StatusCode = 0
                };

                OnReceivedPurchaseResponse(response);
            }
            else
            {
                OnPurchaseErrorEvent(null);
            }
        }
        void OnItemPurchaseError(string errorMessage)
        {
            PurchasePremiumCurrencyBundleResponse response = new PurchasePremiumCurrencyBundleResponse();
            response.StatusCode = 0;
            response.Message = "Error: " + errorMessage;

            OnPurchaseErrorEvent(response);
        }
        void OnItemPurchaseCancelled(string cancelledString)
        {
            PurchasePremiumCurrencyBundleResponse response = new PurchasePremiumCurrencyBundleResponse();
            response.StatusCode = 0;
            response.Message = "User Cancelled";

            OnPurchaseErrorEvent(response);
        }
        public void OnReceivedPurchaseResponse(PurchasePremiumCurrencyBundleResponse data)
        {
            Debug.Log("Received purchase response:" + data.Message);

            if (data.StatusCode == 1)
            {
                if (RecievedPurchaseResponse != null)
                {
                    RecievedPurchaseResponse(data);
                    initStore();
                }
            }
            else
            {
                Debug.Log("Purchase was not authentic, consuming Item");

                if (OnPurchaseErrorEvent != null)
                {
                    OnPurchaseErrorEvent(data);
                    initStore();
                }

            }
        }
        void OnAndroidPurchaseSuccessful(string message)
        {
            Debug.Log("Received from java message: " + message);

            if (message != "Fail")
            {
                BundlePurchaseRequest bundlePurchaseRequest = new BundlePurchaseRequest();
                bundlePurchaseRequest.BundleID = currentBundleID;
                bundlePurchaseRequest.PaymentPlatform = 3;

                GooglePlayReceiptToken receiptToken = JsonMapper.ToObject<GooglePlayReceiptToken>(message);
                receiptToken.OrderInfo = receiptToken.OrderInfo.Replace("\\\"", "\"");
                string jsonData  = JsonMapper.ToJson(receiptToken);

                bundlePurchaseRequest.ReceiptToken = jsonData;

                CallHandler.Instance.PurchasePremiumCurrencyBundle(bundlePurchaseRequest, OnReceivedPurchaseResponse);
            }
            else
            {
                PurchasePremiumCurrencyBundleResponse response = new PurchasePremiumCurrencyBundleResponse();
                response.StatusCode = 0;
                response.Message = message;

                OnPurchaseErrorEvent(response);
            }
        }
 public void OnReceivedPurchaseResponse(PurchasePremiumCurrencyBundleResponse data)
 {
     if (RecievedPurchaseResponse != null)
         RecievedPurchaseResponse(data);
 }
 void PremiumCurrencyBundleStore_OnPremiumCurrencyPurchased(PurchasePremiumCurrencyBundleResponse obj)
 {
     Invoke("UpdateLabels", 1.5f);
 }
        void platformPurchasor_OnPurchaseErrorEvent(PurchasePremiumCurrencyBundleResponse obj)
        {
            Debug.LogError("Purchase Platform Error: " + obj);

            isPurchaseRequest = false;
        }
        void OnRecievedPurchaseResponse(PurchasePremiumCurrencyBundleResponse data)
        {
            Debug.Log("Received purchase response:  " + data);
            isPurchaseRequest = false;

            if (OnPremiumCurrencyPurchased != null)
            {
                OnPremiumCurrencyPurchased(data);
            }
        }
 public void OnReceivedPurchaseResponse(PurchasePremiumCurrencyBundleResponse data)
 {
     Debug.Log("received credit response: " + data);
     RecievedPurchaseResponse(data);
     CallHandler.Instance.GetPremiumCurrencyBalance(null);
 }
 void PremiumCurrencyBundleStore_OnPremiumCurrencyPurchased(PurchasePremiumCurrencyBundleResponse obj)
 {
     purchasePopup.SetActive(true);
     purchasePopup.GetComponentInChildren<Text>().text = "Purchase Successful";
 }
 void OnTransactionSuccess(PurchasePremiumCurrencyBundleResponse response)
 {
     transactionWindowObj.SetActive(true);
     transactionText.text = response.Message;
 }