예제 #1
0
        private Stripe.Token CreateToken(string item, string email)
        {
            try
            {
                GeneralValues objGeneralValues = new GeneralValues();
                string        plan             = item.Split(new String[] { "|||" }, StringSplitOptions.None)[0].ToString();
                WifiManager   wifiManager      = (WifiManager)GetSystemService(Context.WifiService);
                WifiInfo      wInfo            = wifiManager.ConnectionInfo;
                String        MACAdress        = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId);
                string        amount           = item.Split(new String[] { "|||" }, StringSplitOptions.None)[1].ToString();
                string        id            = item.Split(new String[] { "|||" }, StringSplitOptions.None)[2].ToString();
                string        planid        = id;
                decimal       PaymentAmount = Convert.ToDecimal(amount);

                Dialog paymentdialog = new Dialog(this);
                paymentdialog.RequestWindowFeature((int)WindowFeatures.NoTitle);
                paymentdialog.SetContentView(Resource.Layout.Payment);
                paymentdialog.SetCanceledOnTouchOutside(false);
                Typeface tf = Typeface.CreateFromAsset(Assets, "Fonts/ROBOTO-LIGHT.TTF");
                string   encryptedplanname     = URLEncoder.Encode(Encrypt(plan), "UTF-8");
                string   encryptedamount       = URLEncoder.Encode(Encrypt(amount), "UTF-8");
                string   encryptedplanid       = URLEncoder.Encode(Encrypt(planid), "UTF-8");
                string   encrypteduserid       = URLEncoder.Encode(Encrypt(empid.ToString()), "UTF-8");
                string   encryptedmacadress    = URLEncoder.Encode(Encrypt(MACAdress), "UTF-8");
                string   encryptedemailaddress = URLEncoder.Encode(Encrypt(email), "UTF-8");
                string   url           = objGeneralValues.PaymentURL + "?planname=" + encryptedplanname + "&amount=" + encryptedamount + "&planid=" + encryptedplanid + "&user="******"&macaddress=" + encryptedmacadress + "&email=" + encryptedemailaddress;
                Intent   browserintent = new Intent(Intent.ActionView, Android.Net.Uri.Parse("http://59.162.181.91/dtswork/ImInventoryWebPayment/default.aspx?planname=" + encryptedplanname + "&amount=" + encryptedamount + "&planid=" + encryptedplanid + "&user="******"&macaddress=" + encryptedmacadress + "&email=" + encryptedemailaddress));
                selecteditempositin = 0;
                StartActivity(browserintent);
            }
            catch (Exception ex)
            {
            }
            return(new Stripe.Token());
        }
예제 #2
0
 private Stripe.Token CreateToken(string item)
 {
     try
     {
         GeneralValues objGeneralValues = new GeneralValues();
         WebService    objWebService    = new WebService();
         EditText      txtemail         = FindViewById <EditText>(Resource.Id.txtSignUpEmail);
         string        email            = txtemail.Text;
         plan = item.Split(new String[] { "|||" }, StringSplitOptions.None)[0].ToString();
         WifiManager wifiManager = (WifiManager)GetSystemService(Context.WifiService);
         WifiInfo    wInfo       = wifiManager.ConnectionInfo;
         String      MACAdress   = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId);
         string      amount      = item.Split(new String[] { "|||" }, StringSplitOptions.None)[1].ToString();
         string      id          = item.Split(new String[] { "|||" }, StringSplitOptions.None)[2].ToString();
         planid        = id;
         PaymentAmount = Convert.ToDecimal(amount);
         RadioButton rdbBusinessUse = FindViewById <RadioButton>(Resource.Id.rdbBusinessUse);
         Dialog      paymentdialog  = new Dialog(this);
         paymentdialog.RequestWindowFeature((int)WindowFeatures.NoTitle);
         paymentdialog.SetContentView(Resource.Layout.Payment);
         paymentdialog.SetCanceledOnTouchOutside(false);
         Typeface tf = Typeface.CreateFromAsset(Assets, "Fonts/ROBOTO-LIGHT.TTF");
         string   encryptedplanname     = URLEncoder.Encode(Encrypt(plan), "UTF-8");
         string   encryptedamount       = URLEncoder.Encode(Encrypt(amount), "UTF-8");
         string   encryptedplanid       = URLEncoder.Encode(Encrypt(planid), "UTF-8");
         string   encrypteduserid       = URLEncoder.Encode(Encrypt(userid), "UTF-8");
         string   encryptedmacadress    = URLEncoder.Encode(Encrypt(MACAdress), "UTF-8");
         string   encryptedemailaddress = URLEncoder.Encode(Encrypt(email), "UTF-8");
         string   url           = objGeneralValues.PaymentURL + "?planname=" + encryptedplanname + "&amount=" + encryptedamount + "&planid=" + encryptedplanid + "&user="******"&macaddress=" + encryptedmacadress + "&email=" + encryptedemailaddress;
         Intent   browserintent = new Intent(Intent.ActionView, Android.Net.Uri.Parse(objGeneralValues.PaymentURL + "?planname=" + encryptedplanname + "&amount=" + encryptedamount + "&planid=" + encryptedplanid + "&user="******"&macaddress=" + encryptedmacadress + "&email=" + encryptedemailaddress));
         selecteditempositin = 0;
         if (plan.Trim().ToLower().Contains("platinum"))
         {
             objWebService.ExternalSignUpUserSubscriptionAsync(EmployeeID.ToString(), MACAdress, "1", "1", "1");
         }
         else
         {
             objWebService.ExternalSignUpUserSubscriptionAsync(EmployeeID.ToString(), MACAdress, "0", "0", "0");
         }
         StartActivity(browserintent);
     }
     catch (Exception ex)
     {
     }
     return(token);
 }
예제 #3
0
        private void OpenPlanPopUp(string email)
        {
            string[] arrplans = null;
            try
            {
                GeneralValues objGeneralValues = new GeneralValues();
                planfetchdialog = ProgressDialog.Show(this, "Fectching Plan", "Please wait.....");
                StreamReader reader     = null;
                var          webrequest = (HttpWebRequest)WebRequest.Create("https://api.stripe.com/v1/plans?limit=3");
                webrequest.Method = "GET";
                webrequest.Headers.Add("Authorization", "Bearer " + objGeneralValues.SecretKey);
                HttpWebResponse webresponse = (HttpWebResponse)webrequest.GetResponse();
                reader = new StreamReader(webresponse.GetResponseStream());
                string   obj        = reader.ReadToEnd();
                var      parsedjson = JObject.Parse(obj)["data"].Value <JArray>();
                string[] arrlist    = new string[parsedjson.Count];
                arrplans = new string[parsedjson.Count];
                int i = 0;
                foreach (var item in parsedjson)
                {
                    var    parseditemjson = JObject.Parse(item.ToString().Replace("{{", "{").Replace("}}", "}"));
                    string planname       = parseditemjson["name"].ToString();
                    string amount         = parseditemjson["amount"].ToString();
                    string currency       = parseditemjson["currency"].ToString();
                    string id             = parseditemjson["id"].ToString();
                    arrlist[i]  = planname;
                    arrplans[i] = planname + "|||" + amount + "|||" + id;
                    i           = i + 1;
                }
                planfetchdialog.Dismiss();
                AlertDialog.Builder builder = new AlertDialog.Builder(this);
                builder.SetTitle("Choose plan");
                builder.SetSingleChoiceItems(arrlist, 0, ListClicked);
                builder.SetNeutralButton("Ok", (object sender, DialogClickEventArgs e) =>
                {
                    string item = arrplans[selecteditempositin].ToString();
                    var token   = CreateToken(item, email);
                });

                builder.SetCancelable(false);
                builder.Show();
            }
            catch (Exception ex)
            {
            }
        }