コード例 #1
0
ファイル: EmbeeIPN.aspx.cs プロジェクト: Lornestar/pfx
        protected void Page_Load(object sender, EventArgs e)
        {
            External_APIs.SendGrid sg = new External_APIs.SendGrid();

            if ((Request.QueryString["transid"] != null) && (Request.QueryString["transid"] != ""))
            {
                transid = Request.QueryString["transid"].ToString();
            }
            if ((Request.Form["transid"] != null) && (Request.Form["transid"] != ""))
            {
                transid = Request.Form["transid"].ToString();
            }
            if ((Request.QueryString["status"] != null) && (Request.QueryString["status"] != ""))
            {
                status = Request.QueryString["status"].ToString();
            }
            if ((Request.Form["status"] != null) && (Request.Form["status"] != ""))
            {
                status = Request.Form["status"].ToString();
            }
            if ((Request.QueryString["message"] != null) && (Request.QueryString["message"] != ""))
            {
                message = Request.QueryString["message"].ToString();
            }
            if ((Request.Form["message"] != null) && (Request.Form["message"] != ""))
            {
                message = Request.Form["message"].ToString();
            }

            sg.SimpleEmail("Lorne", "Passport PostBack", "*****@*****.**", "", "Request Postback was pinged forms count =" + Request.Form.Count.ToString() + ", querystring count = " + Request.QueryString.Count.ToString() + ". transid = " + transid + "; message = " + message + "; status = " + status, "Request Postback");

              /*  if (transid != "")
            {
                int paymentkey = sitetemp.getPaymentKey_fromEmbeetransid(Convert.ToInt32(transid));
                EmbeeObject embeeobject = sitetemp.getEmbeeObject(paymentkey);

                //Process transaction
                if (status.Trim().ToUpper() == "COMPLETED")
                {
                    //complete transaction
                    Peerfx_DB.SPs.UpdateEmbeeObjectsIpn(Convert.ToInt32(transid), message, 2).Execute();
                    Peerfx_DB.SPs.UpdatePaymentStatus(paymentkey, 5).Execute();

                    //email to say top up was sent
                    sg.Send_Email_Payment_Completed_Embee(embeeobject);
                }
                else if (status.Trim().ToUpper() == "CANCELED")
                {
                    //cancel transaction
                    Peerfx_DB.SPs.UpdateEmbeeObjectsIpn(Convert.ToInt32(transid), message, 3).Execute();
                    Peerfx_DB.SPs.UpdatePaymentStatus(paymentkey, 7).Execute();

                    //email to say top up was cancelled
                }
            }*/
        }
コード例 #2
0
ファイル: fblogin.aspx.cs プロジェクト: Lornestar/pfx
        protected void Setfb()
        {
            string oauth = Request.QueryString["code"].ToString();
            Peerfx.External_APIs.Facebook fb = new External_APIs.Facebook();
            string accesstoken = fb.getaccesstoken(oauth, HttpContext.Current.Request.Url.AbsoluteUri,currentuser.User_key);

            //Get user id
            fb.updateuserinfo(currentuser.User_key);

            sitetemp.VerificationReward(5, currentuser.User_key);

            External_APIs.Mixpanel mx = new External_APIs.Mixpanel();
            mx.TrackEvent("Verification - Facebook Connected",currentuser.User_key,null);

            string msg = "";
            if (currentuser.Referral != null)
            {
                //Embee Referral
                string url = "https://www.embeepay.com/fb/wallet/bin/embee_reward.php?id=" + currentuser.Referral;
                HttpWebRequest webRequest = WebRequest.Create(url) as HttpWebRequest;
                webRequest.ContentType = "application/x-www-form-urlencoded";
                webRequest.MediaType = "application/x-www-form-urlencoded";
                webRequest.Method = "GET";
                string responseString;
                try
                {
                    HttpWebResponse webResponse;
                    // Get the response from the request object and verify the status
                    webResponse = webRequest.GetResponse() as HttpWebResponse;
                    if (!webRequest.HaveResponse)
                    {
                        throw new Exception();
                    }
                    if (webResponse.StatusCode != HttpStatusCode.OK && webResponse.StatusCode != HttpStatusCode.Accepted)
                    {
                        throw new Exception();
                    }

                    // Read the response string
                    StreamReader reader = new StreamReader(webResponse.GetResponseStream());
                    responseString = reader.ReadToEnd();
                    reader.Close();
                    mx.TrackEvent("Referral Complete", currentuser.User_key,null);
                    msg = "?msg=You have completed your Embee task. Thanks! Feel free to continue to play around with our site.";
                }
                catch (Exception e)
                {
                    Peerfx_DB.SPs.UpdateApiErrors(3, "", e.Message, url).Execute();
                    string Toemail = System.Configuration.ConfigurationSettings.AppSettings.Get("ErrorToEmail").ToString();
                    External_APIs.SendGrid sg = new External_APIs.SendGrid();
                    sg.SimpleEmail("Lorne", "Passportfx API Error", Toemail, "*****@*****.**", e.Message, "Embee Error");
                }
            }

            //redirect back to verification page
            Response.Redirect("/User/Verification.aspx" + msg);
        }