public IActionResult AddPayment(int id)
        {
            var       linkdetails = transactionLinkService.GetTransactionLink(id);
            var       transaction = transactionService.GetTransaction(linkdetails.TransactionID);
            PaymentVM payment     = new PaymentVM();

            payment.LinkID = linkdetails.Id;
            payment.Amount = transaction.Totalfee;
            return(View(payment));
        }
Exemple #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"));
        }