Example #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));
        }
Example #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));
        }
        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/"));
        }
Example #5
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));
        }
Example #6
0
        public string sendMail(int jobId, string renterEmail, string mailType, string recipientName)
        {
            EMailHandler mail = new EMailHandler();

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