コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((Request.QueryString["Tx_Key"] != null) && (Request.QueryString["Tx_Key"] != ""))
            {
                Tx_Key = Convert.ToInt32(Request.QueryString["Tx_Key"].ToString());

                if (Tx_Key == 0)
                {
                    //they cancelled
                    pnlerror.Visible = true;
                    pnlworked.Visible = false;
                }
                else
                {
                    //it worked
                    lblid.Text = Tx_Key.ToString();
                    BlueIkons_DB.SPs.UpdateTransaction(Tx_Key, 0, 0, 0, 2, "", "").Execute();
                    Site sitetemp = new Site();

                    gift giftinfo = sitetemp.GetGiftInfo(Tx_Key);

                    string strapprurl = ConfigurationManager.AppSettings.Get("App_URL").ToString();
                    string strpicurl = ConfigurationManager.AppSettings.Get("BlueIkons_Pics").ToString() + giftinfo.blueikon.ToString() + ".png";
                    if (giftinfo.fbpost)
                    {
                        DataSet dstemp2 = BlueIkons_DB.SPs.ViewFBUser(giftinfo.sender_fbid).GetDataSet();
                        string accesstoken = dstemp2.Tables[0].Rows[0]["Access_Token"].ToString();
                        string receivername = giftinfo.receiver_name;
                        if (receivername.ToLower() == "none")
                        {
                            receivername = "";
                        }
                        string strmessage = "Just sent " + receivername +" a gift using BlueIkons";
                        string strdescription = receivername + ", you can claim your gift by clicking on the BlueIkons image";
                        sitetemp.Facebook_PostLink_OnWall(giftinfo.sender_fbid.ToString(), strapprurl, strmessage, strpicurl, "BlueIkons, Faster than a Gift Card and more Fun!", accesstoken, "", strdescription);
                    }

                    SendEmail se = new SendEmail();
                    se.Send_GiftEmail(Tx_Key, 0);
                    se.Send_GiftEmail(Tx_Key, 1);
                }
            }
        }
コード例 #2
0
ファイル: SendEmail.cs プロジェクト: BlueIkons/BlueIkons
        public void Send_GiftEmail(int giftkey,int type)
        {
            Site sitetemp = new Site();

            gift giftinfo = sitetemp.GetGiftInfo(giftkey);
            fbuser fbuser = sitetemp.Getfbuser(giftinfo.sender_fbid);

            string thebody="";
            string strsubject="";
            string stremailaddress = "";
            //type = 0 Sender email
            //type = 1 Receiver email
            if (type == 0){
                thebody = System.IO.File.ReadAllText(HttpContext.Current.Server.MapPath("/Emails/SenderEmail1.txt"));
                strsubject = "Your BlueIkons gift has been sent";
                stremailaddress = fbuser.Email;
            }
            else if (type == 1)
            {
                thebody = System.IO.File.ReadAllText(HttpContext.Current.Server.MapPath("/Emails/ReceiverEmail1.txt"));
                strsubject = fbuser.Firstname + " " + fbuser.Lastname + " has sent you a BlueIkons gift of " + decimal.Round(giftinfo.amount,2).ToString();
                stremailaddress = giftinfo.receiver_email;
            }
            string strpicurl = ConfigurationManager.AppSettings.Get("BlueIkons_Pics").ToString() + giftinfo.blueikon.ToString() + ".png";
            string strapprurl = ConfigurationManager.AppSettings.Get("App_URL").ToString() + "getgift.aspx?invite=" + giftkey.ToString();

            thebody = thebody.Replace("FIRSTNAME", fbuser.Firstname);
            thebody = thebody.Replace("LASTNAME", fbuser.Lastname);
            thebody = thebody.Replace("AMOUNT", decimal.Round(giftinfo.amount,2).ToString());
            thebody = thebody.Replace("WITTYMESSAGE", giftinfo.witty_message);
            thebody = thebody.Replace("IMAGE", strpicurl);
            thebody = thebody.Replace("CLAIMURL", strapprurl);
            thebody = thebody.Replace("RECEIVEREMAIL", giftinfo.receiver_email);

            Send_Email(fbuser.Email, stremailaddress, strsubject, thebody);
        }
コード例 #3
0
ファイル: GiveGift.aspx.cs プロジェクト: BlueIkons/BlueIkons
        protected void Setfbid()
        {
            string oauth = "";
            oauth = HttpContext.Current.Request.QueryString["code"].ToString();
            //oauth = oauth.Substring(0, oauth.IndexOf("|"));

            //oauth = oauth.Substring(0, oauth.IndexOf("|"));

            WebClient wc = new WebClient();
            wc.Encoding = System.Text.Encoding.UTF8; //This is if you have non english characters
            //string result = wc.DownloadString("https://graph.facebook.com/oauth/access_token?response_type=token&client_secret=" + ConfigurationManager.AppSettings.Get("Secret").ToString() + "&client_id=" + ConfigurationManager.AppSettings.Get("fbAppID").ToString() + "&code=" + oauth);
            string strsend = "https://graph.facebook.com/oauth/access_token?client_id=" + ConfigurationManager.AppSettings.Get("fbAppID").ToString() + "&redirect_uri=" + thereturnpage + "&client_secret=" + ConfigurationManager.AppSettings.Get("Secret").ToString() + "&code=" + oauth;
            string result = wc.DownloadString(strsend);
            string accesstoken = result.Replace("access_token=", "");
            int endofaccesstoken = accesstoken.IndexOf("&expire");
            accesstoken = accesstoken.Substring(0, endofaccesstoken);

            //Get user id
             wc.Encoding = System.Text.Encoding.UTF8; //This is if you have non english characters
            string result2 = wc.DownloadString("https://graph.facebook.com/me?access_token=" + accesstoken);

            try
            {
                JObject o = JObject.Parse(result2);
                string fbid = (string)o["id"];
                string email = "";
                string firstname = "";
                string lastname = "";
                if (o["email"] != null)
                {
                    email = (string)o["email"];
                }
                if (o["first_name"] != null)
                {
                    firstname = (string)o["first_name"];
                }
                if (o["last_name"] != null)
                {
                    lastname = (string)o["last_name"];
                }

                bool isnewuser = false;

                BlueIkons_DB.SPs.UpdateFBUser(Convert.ToInt64(fbid), firstname, lastname, email, accesstoken).Execute();
                fbuser.UID = Convert.ToInt64(fbid);
                fbuser.Email = email;
                fbuser.Firstname = firstname;
                fbuser.Lastname = lastname;
                fbuser.AccessToken = accesstoken;

                Site sitetemp = new Site();

            }
            catch
            {
            }
        }
コード例 #4
0
ファイル: PayPal.cs プロジェクト: BlueIkons/BlueIkons
        public Boolean ParallelPayment(bool Live_Trial, gift giftinfo, string receiveremail)
        {
            Boolean txcompleted = false;
            BaseAPIProfile profile2 = new BaseAPIProfile();
            int Tx_Key = giftinfo.txkey;
            Site sitetemp = new Site();
            Transactions txinfo = sitetemp.Gettx(giftinfo.txkey);

            ////Three token

            profile2.APIProfileType = ProfileType.ThreeToken;
            string blueikonemail = "";

            if (Live_Trial)//true = Live , false = trial
            {
                profile2.Environment = ConfigurationManager.AppSettings.Get("Live_Environment").ToString();
                profile2.ApplicationID = ConfigurationManager.AppSettings.Get("AppID_Live").ToString();
                profile2.APIUsername = ConfigurationManager.AppSettings.Get("APIUsername_Live").ToString();
                profile2.APIPassword = ConfigurationManager.AppSettings.Get("APIPassword_Live").ToString();
                profile2.APISignature = ConfigurationManager.AppSettings.Get("APISignature_Live").ToString();
                blueikonemail = ConfigurationManager.AppSettings.Get("My_Email_Live").ToString();
            }
            else
            {
                profile2.Environment = ConfigurationManager.AppSettings.Get("Trial_Environment").ToString();
                profile2.ApplicationID = ConfigurationManager.AppSettings.Get("AppID").ToString();
                profile2.APIUsername = ConfigurationManager.AppSettings.Get("APIUsername").ToString();
                profile2.APIPassword = ConfigurationManager.AppSettings.Get("APIPassword").ToString();
                profile2.APISignature = ConfigurationManager.AppSettings.Get("APISignature").ToString();
                blueikonemail = ConfigurationManager.AppSettings.Get("My_Email_Trial").ToString();
            }
            /*profile2.RequestDataformat = "SOAP11";
            profile2.ResponseDataformat = "SOAP11";
            */

            profile2.IsTrustAllCertificates = Convert.ToBoolean(ConfigurationManager.AppSettings["TrustAll"]);

            string url = ConfigurationManager.AppSettings.Get("Callback").ToString() + "/";
            string returnURL = url + "Order_Confirmation.aspx?Tx_key=" + Tx_Key.ToString();
            string cancelURL = url + "Order_Confirmation.aspx?Tx_key=0";

            PayRequest payRequest = null;
            payRequest = new PayRequest();
            payRequest.cancelUrl = cancelURL;
            payRequest.returnUrl = returnURL;
            payRequest.reverseAllParallelPaymentsOnError = true;

            //payRequest.senderEmail = email.Value;
            //payRequest.clientDetails = new ClientDetailsType();
            //payRequest.clientDetails = ClientInfoUtil.getMyAppDetails();

            payRequest.feesPayer = "SENDER";//feesPayer.Value;
            payRequest.memo = "BlueIkons";// memo.Value;
            payRequest.actionType = "PAY";
            payRequest.currencyCode = "USD"; //currencyCode.Items[currencyCode.SelectedIndex].Value;
            payRequest.requestEnvelope = new RequestEnvelope();
            payRequest.requestEnvelope.errorLanguage = "en_US";//ClientInfoUtil.getMyAppRequestEnvelope();
            payRequest.preapprovalKey = txinfo.pakey;

            payRequest.receiverList = new Receiver[2];
            payRequest.receiverList[0] = new Receiver();
            payRequest.receiverList[0].amount = decimal.Round(giftinfo.amount,2);//amount_0.Value);
            payRequest.receiverList[0].email = receiveremail;//receiveremail_0.Value;

            decimal blueikonamount = (giftinfo.amount * Convert.ToDecimal(.1));
            if (receiveremail != blueikonemail)
            {
                payRequest.receiverList[1] = new Receiver();
                payRequest.receiverList[1].amount = decimal.Round(blueikonamount, 2);
                payRequest.receiverList[1].email = blueikonemail;
            }
            else
            {
                payRequest.receiverList[0].amount += decimal.Round(blueikonamount, 2);
            }
            //Eventomatic_DB.SPs.UpdateTransactionTicketAmountEmail(Tx_Key, strEmail1).Execute();

            profile2.ResponseDataformat = "SOAP11";
            profile2.RequestDataformat = "SOAP11";

            AdapativePayments ap = new AdapativePayments();

            ap.APIProfile = profile2;

            PayResponse PResponse = ap.pay(payRequest);

            if (ap.isSuccess.ToUpper() == "FAILURE")
            {
                //HttpContext.Current.Session[Constants.SessionConstants.FAULT] = ap.LastError;
                for (int i = 0; i <= ap.LastError.ErrorDetails.Length - 1; i++)
                {
                    FaultDetailFaultMessageError ETtemp = (FaultDetailFaultMessageError)ap.LastError.ErrorDetails.GetValue(i);
                    //decimal OverallTotal = decimal.Round(dcAmount1, 2) + decimal.Round(dcAmount2, 2);
                    //Eventomatic_DB.SPs.UpdateCCErrors(ETtemp.message.ToString(), Tx_Key, 2, OverallTotal.ToString()).Execute();
                }
                //HttpContext.Current.Response.Redirect("APIError.aspx", false);
            }
            else
            {
                //Payment went through
                BlueIkons_DB.SPs.UpdateTransaction(Tx_Key, 0, 0, 0, 3, PResponse.responseEnvelope.correlationId, receiveremail).Execute();
                txcompleted = true;
            }
            return txcompleted;
        }