Пример #1
0
        private XsollaPaystationController GetPaystationController()
        {
            GameObject paystationobject = Instantiate(Resources.Load("Prefabs/XsollaPaystation")) as GameObject;
            XsollaPaystationController formController = paystationobject.GetComponent <XsollaPaystationController> ();

            return(formController);
        }
Пример #2
0
 private void SetToken(XsollaPaystationController controller, string token)
 {
     if (token != null)
     {
         controller.OpenPaystation(token, false);
     }
 }
Пример #3
0
        public static void CreatePaymentForm(XsollaJsonGenerator generator, Action <XsollaResult> actionOk, Action <XsollaError> actionError, bool isSandbox)
        {
            XsollaPaystationController formController = GetPaystationController();

            formController.OkHandler    += actionOk;
            formController.ErrorHandler += actionError;
            formController.OpenPaystation(generator.GetPrepared(), isSandbox);
        }
Пример #4
0
        public void CreatePaymentForm(string data)
        {
            XsollaPaystationController formController = GetPaystationController();

            formController.OkHandler    += (status) => { Debug.Log("OkHandler 1 " + status); };
            formController.ErrorHandler += (error) => { Debug.Log("ErrorHandler 2 " + error); };
            formController.OpenPaystation(data, isSandbox);
        }
Пример #5
0
        public void CreatePaymentForm(string data, Action <XsollaResult> actionOk, Action <XsollaError> actionError)
        {
            XsollaPaystationController formController = GetPaystationController();

            formController.OkHandler    += actionOk;
            formController.ErrorHandler += actionError;
            formController.OpenPaystation(data, isSandbox);
        }
Пример #6
0
        public void CreatePaymentForm(string data)
        {
            GameObject newItem = Instantiate(Resources.Load("Prefabs/XsollaPaystation")) as GameObject;
            XsollaPaystationController formController = newItem.GetComponent <XsollaPaystationController> ();

            formController.OkHandler    += (status) => { Debug.Log("OkHandler 1 " + status); };
            formController.ErrorHandler += (error) => { Debug.Log("ErrorHandler 2 " + error); };
            formController.OpenPaystation(data, isSandbox);
        }
Пример #7
0
        public void CreatePaymentForm(string data, Action <XsollaResult> actionOk, Action <XsollaError> actionError)
        {
            GameObject newItem = Instantiate(Resources.Load("Prefabs/XsollaPaystation")) as GameObject;
            XsollaPaystationController formController = newItem.GetComponent <XsollaPaystationController> ();

            formController.OkHandler    += actionOk;
            formController.ErrorHandler += actionError;
            formController.OpenPaystation(data, isSandbox);
        }
Пример #8
0
        public void CreatePaymentForm(InputField inputField)
        {
            XsollaPaystationController formController = GetPaystationController();
            string accessToken = inputField.text;

            formController.OkHandler    += (status) => { Debug.Log("OkHandler 1 " + status); };
            formController.ErrorHandler += (error) => { Debug.Log("ErrorHandler 2 " + error); };
            formController.OpenPaystation(accessToken, isSandbox);
        }
Пример #9
0
        public void CreatePaymentForm()
        {
            GameObject newItem = Instantiate(Resources.Load("Prefabs/XsollaPaystation")) as GameObject;
            XsollaPaystationController formController = newItem.GetComponent <XsollaPaystationController> ();

            formController.OkHandler    += (status) => { Debug.Log("OkHandler 1 " + status); };
            formController.ErrorHandler += (error) => { Debug.Log("ErrorHandler 2 " + error); };
            StartCoroutine(XsollaJsonGenerator.FreshToken((token) => SetToken(formController, token)));
        }
Пример #10
0
        private void onClickConfirmDeletePaymentMethod(XsollaSavedPaymentMethod pMethod)
        {
            Logger.Log("Delete payment method");
            Dictionary <string, object> reqParams = new Dictionary <string, object>();

            reqParams.Add("id", pMethod.GetKey());
            reqParams.Add("type", pMethod.GetMethodType());

            XsollaPaystationController controller = gameObject.GetComponentInParent <XsollaPaystationController>();

            controller.DeleteSavedPaymentMethod(reqParams);
        }
Пример #11
0
        private void onClickConfirmReplacedAnotherMethod(XsollaSavedPaymentMethod pMethod)
        {
            Logger.Log("Raplaced existing method");
            Dictionary <string, object> reqParams = new Dictionary <string, object>();

            reqParams.Add("id_payment_account", pMethod.GetKey());
            reqParams.Add("replace_payment_account", 1);
            reqParams.Add("type_payment_account", pMethod.GetMethodType());

            XsollaPaystationController payController = GetComponentInParent <XsollaPaystationController> ();

            payController.ChooseItem(reqParams);
        }
        private void OnLinkPaymentMethodAction(XsollaManagerSubDetails pSubDetail)
        {
            Logger.Log("Link payment method");
            Dictionary <string, object> reqParams = new Dictionary <string, object>();

            reqParams.Add("change_account", "1");
            reqParams.Add("id_recurrent_subscription", pSubDetail.mId);
            reqParams.Add("id_payment_account", "");
            reqParams.Add("subscription_payment_type", "charge");

            XsollaPaystationController payController = GetComponentInParent <XsollaPaystationController> ();

            payController.ChooseItem(reqParams);
        }
        private void OnRenewBtnAction()
        {
            Logger.Log("Link payment method");
            Dictionary <string, object> reqParams = new Dictionary <string, object>();

            reqParams.Add("change_account", "0");
            reqParams.Add("id_recurrent_subscription", mLocalSubDetail.mId);
            reqParams.Add("id_payment_account", "");
            reqParams.Add("type_payment_account", "");

            XsollaPaystationController payController = GetComponentInParent <XsollaPaystationController> ();

            payController.ChooseItem(reqParams);
        }
Пример #14
0
        public void CreatePaymentForm()
        {
            XsollaPaystationController formController = GetPaystationController();

            formController.OkHandler    += (status) => { Debug.Log("OkHandler 1 " + status); };
            formController.ErrorHandler += (error) => { Debug.Log("ErrorHandler 2 " + error); };


            XsollaJsonGenerator generator = new XsollaJsonGenerator("user_1", 14004);             //test 15764

            generator.user.name         = "John Smith";
            generator.user.email        = "*****@*****.**";
            generator.user.country      = "US";
            generator.settings.currency = "USD";
            generator.settings.languge  = "en";
            string request = generator.GetPrepared();

            // Prepare args
            Dictionary <string, object> dataArgs = new Dictionary <string, object>();

            dataArgs.Add("data", request);
            XsollaPaystation.AddHttpRequestObj();
            // Get object to request
            HttpTlsRequest httpreq = GameObject.Find(HttpTlsRequest.loaderGameObjName).GetComponent <HttpTlsRequest>();

            StartCoroutine(httpreq.Request("https://livedemo.xsolla.com/sdk/token/", dataArgs, (value) => {
                if (!value.HasError)
                {
                    JSONNode rootNode = JSON.Parse(value.TextRequest);
                    Logger.Log("Token - " + rootNode["token"].Value);
                    SetToken(formController, rootNode["token"].Value);
                }
                else
                {
                    Logger.Log(value.ErrorText);
                }
            }));
            // Show payment form
            //SetToken(formController, token);
            //StartCoroutine(XsollaJsonGenerator.FreshToken ((token) => SetToken(formController, token)));
        }
Пример #15
0
        private void onClickConfirmReplaced(XsollaSavedPaymentMethod pMethod)
        {
            Logger.Log("Raplaced existing method");
            Dictionary <string, object> reqParams = new Dictionary <string, object>();

            reqParams.Add("id_payment_account", pMethod.GetKey());

            reqParams.Add("saved_method_id", mSelectedMethod.GetKey());
            reqParams.Add("pid", mSelectedMethod.GetPid());
            reqParams.Add("paymentWithSavedMethod", 1);
            reqParams.Add("paymentSid", pMethod.GetFormSid());
            reqParams.Add("type_payment_account", pMethod.GetMethodType());

            Dictionary <string, object> replacedParam = new Dictionary <string, object>();

            replacedParam.Add("replace_payment_account", 1);

            XsollaPaystationController payController = GetComponentInParent <XsollaPaystationController> ();

            payController.FillPurchase(ActivePurchase.Part.PAYMENT_MANAGER_REPLACED, replacedParam);
            payController.ChoosePaymentMethod(reqParams);
        }
Пример #16
0
        public void CreatePaymentForm()
        {
            XsollaPaystationController formController = GetPaystationController();

            formController.OkHandler    += (status) => { Debug.Log("OkHandler 1 " + status); };
            formController.ErrorHandler += (error) => { Debug.Log("ErrorHandler 2 " + error); };

            XsollaJsonGenerator generator = new XsollaJsonGenerator("user_1", 14004);             //test 15764

            generator.user.name         = "John Smith";
            generator.user.email        = "*****@*****.**";
            generator.user.country      = "US";
            generator.settings.currency = "USD";
            generator.settings.languge  = "en";
            string request = generator.GetPrepared();

            // Prepare args
            Dictionary <string, object> dataArgs = new Dictionary <string, object>();

            dataArgs.Add("data", request);
            StartCoroutine(XsollaJsonGenerator.FreshToken((token) => SetToken(formController, token)));
        }
Пример #17
0
 private void SetToken(XsollaPaystationController controller, string token)
 {
     if(token != null) {
         controller.OpenPaystation (token, false);
     }
 }