Beispiel #1
0
        public string sendMail(int jobId, string email, string mailType)
        {
            JobMain      jobOrder = db.JobMains.Find(jobId);
            EMailHandler mail     = new EMailHandler();

            return(mail.SendMail(jobId, email, mailType, jobOrder.Description));
        }
        public string sendMail(int jobId, string email, string mailType)
        {
            string       siteRedirect = "https://realwheelsdavao.com/reservation/";
            JobMain      jobOrder     = db.JobMains.Find(jobId);
            EMailHandler mail         = new EMailHandler();

            return(mail.SendMail(jobId, email, mailType, jobOrder.Description, siteRedirect));
        }
Beispiel #3
0
        public string sendMail(int jobId, string renterEmail, string mailType, string recipientName)
        {
            EMailHandler mail = new EMailHandler();

            string siteRedirect = "http://palawantransportcoop.com/reservation/";

            return(mail.SendMail(jobId, renterEmail, mailType, recipientName, siteRedirect));
        }
Beispiel #4
0
        /// <summary>
        ///     Method to start the login with gmail email handler.
        ///     This method will only work if your steam account is registered with an gmail
        ///     account. If you have another Email provider, then use:
        ///     doLogin(string username, string password);
        /// </summary>
        /// <param name="username">Username of your steam account.</param>
        /// <param name="password">Password of your steam account.</param>
        /// <param name="emailAddress">Email address of your gmail account.</param>
        /// <param name="emailPassword">Password of your gmail account.</param>
        public void doLogin(string username, string password, string emailAddress, string emailPassword)
        {
            this.username = username;
            this.password = password;
            this.getOpenidLogin();
            GetRsaKey temp = this.getRSAKey();

            this.loginDoLogin(temp, "");
            temp = this.getRSAKey();
            string       steamGuardText = "";
            EMailHandler e = new EMailHandler(emailAddress, emailPassword);

            steamGuardText = e.getGuardText();
            System.Threading.Thread.Sleep(2500);
            this.setSteamCredentials(JsonConvert.DeserializeObject <DoLoginRootObject>(
                                         this.getResponseMessage(this.loginDoLogin(temp, steamGuardText))));
            this.postTransfer();
            this.getCookiesOnD2L(this.postOpenIDLogin2(this.postOpenIDLogin()));
        }
        public string sendMail(int jobId, string renterEmail, string mailType, string recipientName)
        {
            EMailHandler mail = new EMailHandler();

            return(mail.SendMail(jobId, renterEmail, mailType, recipientName, "https://realwheelsdavao.com/reservation/"));
        }
Beispiel #6
0
        public ActionResult Webhook()
        {
            // The APIContext object can contain an optional override for the trusted certificate.
            var apiContext = PayPalConfiguration.GetAPIContext();

            // Get the received request's headers
            var requestheaders = HttpContext.Request.Headers;

            // Get the received request's body
            var requestBody = string.Empty;

            using (var reader = new System.IO.StreamReader(HttpContext.Request.InputStream))
            {
                requestBody = reader.ReadToEnd();
            }

            //get event data from the request body
            dynamic  jsonBody        = JObject.Parse(requestBody);
            string   webhookId       = jsonBody.id;
            string   paypalID        = jsonBody.resource.id;
            decimal  Totalamount     = (decimal)jsonBody.resource.amount.total;
            DateTime paypalEventDate = (DateTime)jsonBody.create_time;
            DateTime paypalTransDate = (DateTime)jsonBody.resource.create_time;

            var ev = WebhookEvent.Get(apiContext, webhookId);

            // We have all the information the SDK needs, so perform the validation.
            // Note: at least on Sandbox environment this returns false.
            // var isValid = WebhookEvent.ValidateReceivedEvent(apiContext, ToNameValueCollection(requestheaders), requestBody, webhookId);

            //add record on the Notification table
            //Note: remove if events are successful. Notification table is used for sms notifications.
            DB.addTestNotification(1, "1");

            //get jobid from CUSTOM object field
            //int jobId =  (int)jsonBody.resource.custom ; // bookingid ,
            //PPtrans.AddPaypalNotif("1", 1, paypalEventDate, paypalTransDate, ev.event_type, Totalamount);

            //get job id from invoice number
            //PPtrans.AddPaypalNotif(paypalID, jobId, paypalEventDate, paypalTransDate, ev.event_type, Totalamount);
            //jobId = (int)jsonBody.resource.invoice_number;
            // DB.addTestNotification(jobId, paypalID);

            //get job description
            JobMain      jobOrder     = db.JobMains.Find(1);
            string       clientName   = jobOrder.Description;
            EMailHandler mail         = new EMailHandler();
            string       siteRedirect = "https://realwheelsdavao.com/reservation/";

            /* Handle transaction request from paypal webhook events
             * switch (ev.event_type)
             * {
             *  case "PAYMENT.CAPTURE.COMPLETED":
             *  case "PAYMENT.SALE.COMPLETED": // Handle payment completed
             *      //record payment
             *      AddPaymentRecord(jobId, Totalamount);
             *
             *      //send mail
             *      mail.SendMail(jobId, "*****@*****.**", "PAYMENT-SUCCESS", clientName, siteRedirect);
             *      //mail.SendMail(jobId, "*****@*****.**", "PAYMENT-SUCCESS", clientName, siteRedirect);
             *      //mail.SendMail(jobId, "*****@*****.**", "PAYMENT-SUCCESS", clientName, siteRedirect);
             *
             *      //add to log
             *      PPtrans.AddPaypalNotif(paypalID, jobId, paypalEventDate, paypalTransDate, ev.event_type, Totalamount);
             *      break;
             *  case "PAYMENT.SALE.DENIED":
             *  case "PAYMENT.CAPTURE.DENIED": // Handle payment denied
             *
             *      //send mail
             *      mail.SendMail(jobId, "*****@*****.**", "PAYMENT-DENIED", clientName, siteRedirect);
             *      //mail.SendMail(jobId, "*****@*****.**", "PAYMENT-DENIED", clientName, siteRedirect);
             *      //mail.SendMail(jobId, "*****@*****.**", "PAYMENT-DENIED", clientName, siteRedirect);
             *
             *      //add to log
             *      PPtrans.AddPaypalNotif(paypalID, jobId, paypalEventDate, paypalTransDate, ev.event_type, Totalamount);
             *
             *      break;
             *  // Handle other webhooks
             *  default: // Handle payment denied
             *      //send mail
             *      mail.SendMail(jobId, "*****@*****.**", "PAYMENT-PENDING", clientName, siteRedirect);
             *      //mail.SendMail2(jobId, "*****@*****.**", "PAYMENT-PENDING", clientName, siteRedirect, ev.event_type);
             *      //mail.SendMail(jobId, "*****@*****.**", "PAYMENT-PENDING", clientName, siteRedirect);
             *      //mail.SendMail(jobId, "*****@*****.**", "PAYMENT-PENDING", clientName, siteRedirect);
             *
             *      //add to log
             *      PPtrans.AddPaypalNotif(paypalID, jobId, paypalEventDate, paypalTransDate, ev.event_type, Totalamount);
             *
             *      break;
             * }
             */

            //AddPaymentRecord(jobId, Totalamount);
            //add to log
            //PPtrans.AddPaypalNotif(paypalID, jobId, paypalEventDate, paypalTransDate, ev.event_type, Totalamount);

            //send mail
            //mail.SendMail(1, "*****@*****.**", "PAYMENT-PENDING", clientName, siteRedirect);
            //mail.SendMail2(jobId, "*****@*****.**", "PAYMENT-PENDING", clientName, siteRedirect, ev.event_type);
            //mail.SendMail(jobId, "*****@*****.**", "PAYMENT-PENDING", clientName, siteRedirect);
            //mail.SendMail(jobId, "*****@*****.**", "PAYMENT-PENDING", clientName, siteRedirect);

            return(new HttpStatusCodeResult(200));
        }
Beispiel #7
0
        public ActionResult Webhook()
        {
            // The APIContext object can contain an optional override for the trusted certificate.
            var apiContext = PayPalConfiguration.GetAPIContext();

            // Get the received request's headers
            var requestheaders = HttpContext.Request.Headers;

            // Get the received request's body
            var requestBody = string.Empty;

            using (var reader = new System.IO.StreamReader(HttpContext.Request.InputStream))
            {
                requestBody = reader.ReadToEnd();
            }

            dynamic jsonBody    = JObject.Parse(requestBody);
            string  webhookId   = jsonBody.id;
            string  paypalID    = jsonBody.resource.id;
            decimal Totalamount = (decimal)jsonBody.resource.amount.total;
            int     jobId       = (int)jsonBody.resource.invoice_number; // bookingid
            var     ev          = WebhookEvent.Get(apiContext, webhookId);

            // We have all the information the SDK needs, so perform the validation.
            // Note: at least on Sandbox environment this returns false.
            // var isValid = WebhookEvent.ValidateReceivedEvent(apiContext, ToNameValueCollection(requestheaders), requestBody, webhookId);

            // DB.addTestNotification(jobId, paypalID);
            //get job description
            JobMain      jobOrder   = db.JobMains.Find(jobId);
            string       clientName = jobOrder.Description;
            EMailHandler mail       = new EMailHandler();

            switch (ev.event_type)
            {
            case "PAYMENT.CAPTURE.COMPLETED":
            case "PAYMENT.SALE.COMPLETED":     // Handle payment completed
                //record payment
                AddPaymentRecord(jobId, Totalamount);

                //send mail
                mail.SendMail(jobId, "*****@*****.**", "PAYMENT-SUCCESS", clientName);
                mail.SendMail(jobId, "*****@*****.**", "PAYMENT-SUCCESS", clientName);
                mail.SendMail(jobId, "*****@*****.**", "PAYMENT-SUCCESS", clientName);

                //add to log
                DB.addTestNotification(jobId, paypalID);
                break;

            case "PAYMENT.SALE.DENIED":
            case "PAYMENT.CAPTURE.DENIED":     // Handle payment denied

                //send mail
                mail.SendMail(jobId, "*****@*****.**", "PAYMENT-DENIED", clientName);
                mail.SendMail(jobId, "*****@*****.**", "PAYMENT-DENIED", clientName);
                mail.SendMail(jobId, "*****@*****.**", "PAYMENT-DENIED", clientName);

                //add to log
                DB.addTestNotification(jobId, paypalID);
                break;

            // Handle other webhooks
            default:     // Handle payment denied
                //send mail
                mail.SendMail(jobId, "*****@*****.**", "PAYMENT-PENDING", clientName);
                mail.SendMail(jobId, "*****@*****.**", "PAYMENT-PENDING", clientName);
                mail.SendMail(jobId, "*****@*****.**", "PAYMENT-PENDING", clientName);

                //add to log
                DB.addTestNotification(jobId, paypalID);

                break;
            }

            return(new HttpStatusCodeResult(200));
        }
Beispiel #8
0
        public string sendMail(int jobId, string renterEmail, string mailType, string recipientName)
        {
            EMailHandler mail = new EMailHandler();

            return(mail.SendMail(jobId, renterEmail, mailType, recipientName));
        }