public IActionResult UpdateStatus(TransactionDetails payment, [FromServices] IEmailSender emailSender, [FromServices] IConfiguration configuration)
        {
            var tr        = transactionService.GetTransaction(payment.TransactionID);
            var link      = transactionLinkService.GetTransactionLinks().Where(s => s.TransactionID == tr.Id).FirstOrDefault();
            var payements = paymentService.GetPayments().Where(s => s.LinkID == link.Id).FirstOrDefault();

            link.Status      = payment.statusID;
            tr.Status        = payment.statusID;
            payements.Status = payment.statusID;
            paymentService.UpdatePayment(payements);
            transactionService.UpdateTransaction(tr);
            transactionLinkService.UpdateTransactionLink(link);
            if (payment.statusID == 4)
            {
                var    linkas = Url.Action("TransactionView", "MyTransaction", new { code = link.LinkCode }, Request.Scheme, Request.Host.ToString());
                string coded  = link.LinkCode.ToString();
                var    title  = "Pay Guardex: You have a transaction.";
                var    title1 = "Pay Guardex: You have started a transaction.";

                var mailbody = "<html>" +
                               "<head>" +
                               "<link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css\" integrity=\"sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk\" crossorigin=\"anonymous\">" +
                               "</head>" +
                               "<body>" +
                               "<div class=\"container\">" +
                               "<div class=\"row\">" +
                               "<div class=\"col-md-12\" style=\"padding:30px;background-color:#d8e9ff\">" +
                               "<h3 style=\"color:forestgreen\">Pay Guardex</h3>" +
                               "<div>" +
                               "<p>You have recieved product from " + tr.SellerEmail + "  </p>" +
                               "</div>" +
                               "<div>" +
                               "<p>Your have successfully recieved product.</p>" +
                               "<p>You can still view the transaction.</p>" +
                               "<p>" + linkas + "</p>" +
                               "</div>" +
                               "<div style=\"text-align:center\">" +
                               "<a href=" + linkas + " class=\"btn btn-success\"> Manage Transaction : </a>" +
                               "</div>" +
                               "</div>" +
                               "</div>" +
                               "</div>" +
                               "</ body >" +
                               "</html>";
                var mailbody1 = "<html>" +
                                "<head>" +
                                "<link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css\" integrity=\"sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk\" crossorigin=\"anonymous\">" +
                                "</head>" +
                                "<body>" +
                                "<div class=\"container\">" +
                                "<div class=\"row\">" +
                                "<div class=\"col-md-12\" style=\"padding:30px;background-color:#d8e9ff\">" +
                                "<h3 style=\"color:forestgreen\">Pay Guardex</h3>" +
                                "<div>" +
                                "<p> " + tr.BuyerEmail + " recieved the product</p>" +
                                "</div>" +
                                "<div>" +
                                "<p>" + tr.BuyerEmail + " recieved the product successfully.</p>" +
                                "<p>When buyer recieve the product we will inform you.</p>" +
                                "<p>Thank you.</p>" +
                                "<p></p>" +
                                "</div>" +
                                "<div style=\"text-align:center\">" +
                                "</div>" +
                                "</div>" +
                                "</div>" +
                                "</div>" +
                                "</ body >" +
                                "</html>";

                emailSender.Post(
                    subject: title,
                    body: mailbody,
                    recipients: tr.BuyerEmail,
                    sender: configuration["AdminContact"]);
                emailSender.Post(
                    subject: title1,
                    body: mailbody1,
                    recipients: tr.SellerEmail,
                    sender: configuration["AdminContact"]);
            }
            return(Redirect("/Myescrow/Index"));
        }
Beispiel #2
0
        public IActionResult UpdateStatus(Payment payment, [FromServices] IEmailSender emailSender, [FromServices] IConfiguration configuration)
        {
            var payements = paymentService.GetPayment(payment.Id);
            var link      = transactionLinkService.GetTransactionLink(payements.LinkID);
            var tr        = transactionService.GetTransaction(link.TransactionID);

            link.Status      = payment.Status;
            tr.Status        = payment.Status;
            payements.Status = payment.Status;
            paymentService.UpdatePayment(payements);
            transactionService.UpdateTransaction(tr);
            transactionLinkService.UpdateTransactionLink(link);
            if (payment.Status == 2)
            {
                var    linkas = Url.Action("TransactionView", "MyTransaction", new { code = link.LinkCode }, Request.Scheme, Request.Host.ToString());
                string coded  = link.LinkCode.ToString();


                var title  = "Pay Guardex: You have a transaction.";
                var title1 = "Pay Guardex: You have started a transaction.";

                var mailbody = "<html>" +
                               "<head>" +
                               "<link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css\" integrity=\"sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk\" crossorigin=\"anonymous\">" +
                               "</head>" +
                               "<body>" +
                               "<div class=\"container\">" +
                               "<div class=\"row\">" +
                               "<div class=\"col-md-12\" style=\"padding:30px;background-color:#d8e9ff\">" +
                               "<h3 style=\"color:forestgreen\">Recieved your payment</h3>" +
                               "<div>" +
                               "<p>We have recieved you payment successfully. </p>" +
                               "</div>" +
                               "<div>" +
                               "<p> We have notify " + tr.SellerEmail + " for shipping the product.</p>" +
                               "<p>Please visit the link or click the button to view the transaction.</p>" +
                               "<p>" + linkas + "</p>" +
                               "</div>" +
                               "<div style=\"text-align:center\">" +
                               "<a href=" + linkas + " class=\"btn btn-success\"> Manage Transaction </a>" +
                               "</div>" +
                               "</div>" +
                               "</div>" +
                               "</div>" +
                               "</ body >" +
                               "</html>";
                var mailbody1 = "<html>" +
                                "<head>" +
                                "<link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css\" integrity=\"sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk\" crossorigin=\"anonymous\">" +
                                "</head>" +
                                "<body>" +
                                "<div class=\"container\">" +
                                "<div class=\"row\">" +
                                "<div class=\"col-md-12\" style=\"padding:30px;background-color:#d8e9ff\">" +
                                "<h3 style=\"color:forestgreen\">Payment has been recieved.</h3>" +
                                "<div>" +
                                "<p>Please ship the product for " + tr.BuyerEmail + " </p>" +
                                "</div>" +
                                "<div>" +
                                "<p>Your transaction code is : " + coded + "</p>" +
                                "<p>We have recieved payment please ship the product and then marked the status as shipped.</p>" +
                                "<p></p>" +
                                "</div>" +
                                "<div style=\"text-align:center\">" +
                                "</div>" +
                                "</div>" +
                                "</div>" +
                                "</div>" +
                                "</ body >" +
                                "</html>";
                emailSender.Post(
                    subject: title,
                    body: mailbody,
                    recipients: tr.BuyerEmail,
                    sender: configuration["AdminContact"]);
                emailSender.Post(
                    subject: title1,
                    body: mailbody1,
                    recipients: tr.SellerEmail,
                    sender: configuration["AdminContact"]);
            }
            return(Redirect("/ManagePayment/Index"));
        }
Beispiel #3
0
        public IActionResult UpdateStatus(IFormCollection form, [FromServices] IEmailSender emailSender, [FromServices] IConfiguration configuration)
        {
            StatusUpdateModel details = JsonConvert.DeserializeObject <StatusUpdateModel>(form["aboutInfo"]);

            try
            {
                var transaction = transactionService.GetTransaction(details.ID);
                var link        = transactionLinkService.GetTransactionLinks().Where(s => s.TransactionID == transaction.Id).FirstOrDefault();
                transaction.Status = details.Status.Value;
                link.Status        = details.Status.Value;
                transactionService.UpdateTransaction(transaction);
                transactionLinkService.UpdateTransactionLink(link);
                if (transaction.Status == 3)
                {
                    var    linkas = Url.Action("TransactionView", "MyTransaction", new { code = link.LinkCode }, Request.Scheme, Request.Host.ToString());
                    string coded  = link.LinkCode.ToString();


                    var title = "Pay Guardex: Product has been shipped.";

                    var mailbody = "<html>" +
                                   "<head>" +
                                   "<link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css\" integrity=\"sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk\" crossorigin=\"anonymous\">" +
                                   "</head>" +
                                   "<body>" +
                                   "<div class=\"container\">" +
                                   "<div class=\"row\">" +
                                   "<div class=\"col-md-12\" style=\"padding:30px;background-color:#d8e9ff\">" +
                                   "<h3 style=\"color:forestgreen\">Product has been Shipped</h3>" +
                                   "<div>" +
                                   "<p>Seller shipped the product. When buyer recieved the product will update the status using the link </p>" +
                                   "</div>" +
                                   "<div>" +
                                   "<p>Please visit the link or click the button to view the transaction.</p>" +
                                   "<p>" + linkas + "</p>" +
                                   "</div>" +
                                   "<div style=\"text-align:center\">" +
                                   "<a href=" + linkas + " class=\"btn btn-success\"> Manage Transaction </a>" +
                                   "</div>" +
                                   "</div>" +
                                   "</div>" +
                                   "</div>" +
                                   "</ body >" +
                                   "</html>";

                    emailSender.Post(
                        subject: title,
                        body: mailbody,
                        recipients: transaction.BuyerEmail,
                        sender: configuration["AdminContact"]);
                    emailSender.Post(
                        subject: title,
                        body: mailbody,
                        recipients: transaction.SellerEmail,
                        sender: configuration["AdminContact"]);
                }
                return(Json(new { success = true }));
            }
            catch (Exception ex)
            {
                return(Json(new { success = false }));
            }
        }