public RedirectToRouteResult Create(paymentModel model) { // Cast to ClaimsIdentity. var identity = HttpContext.User.Identity as ClaimsIdentity; // Gets list of claims. IEnumerable <Claim> claim = identity.Claims; //get policyid var acr = claim.SingleOrDefault(c => c.Type == "http://schemas.microsoft.com/claims/authnclassreference").Value; //{http://schemas.microsoft.com/claims/authnclassreference: b2c_1a_psd2_susi} var payee = model.Payee; var accountNumber = model.AccountNumber; var amount = model.Amount; Dictionary <string, string> claims = new Dictionary <string, string>(); claims["amount"] = amount; claims["payee"] = payee; claims["accountnumber"] = accountNumber; string id_token_hint = BuildIdToken(claims, Globals.ClientId); return(RedirectToAction("StepUp", "Account", new { value1 = "", id_token_hint = id_token_hint })); }
public async Task <ActionResult> Confirm() { var identity = HttpContext.User.Identity as ClaimsIdentity; // Gets list of claims. IEnumerable <Claim> claim = identity.Claims; string acr = claim.SingleOrDefault(c => c.Type == "http://schemas.microsoft.com/claims/authnclassreference").Value; paymentModel paymentConfirmedDetails = new paymentModel(); if (acr == "b2c_1a_psd2_stepup") { paymentConfirmedDetails.Payee = claim.SingleOrDefault(c => c.Type == "payee").Value; paymentConfirmedDetails.AccountNumber = claim.SingleOrDefault(c => c.Type == "accountnumber").Value; paymentConfirmedDetails.Amount = claim.SingleOrDefault(c => c.Type == "amount").Value; } if (acr != "b2c_1a_psd2_stepup") { paymentConfirmedDetails.Payee = "NA"; paymentConfirmedDetails.AccountNumber = "NA"; paymentConfirmedDetails.Amount = "NA"; } return(View("Confirm", paymentConfirmedDetails)); }
public async Task <Dto> Handle(Command request, CancellationToken cancellationToken) { var paymentdata = new paymentModel { transaction_id = request.data.Attributes.transaction_id, payment_type = request.data.Attributes.payment_type, gross_amount = request.data.Attributes.gross_amount, bank = request.data.Attributes.bank, order_id = request.data.Attributes.order_id }; konteks.payments.Add(paymentdata); await konteks.SaveChangesAsync(cancellationToken); var payment = konteks.payments.First(x => x.order_id == request.data.Attributes.order_id); var target = new TargetCommand() { Id = payment.id, Email_destination = "*****@*****.**" }; var client = new HttpClient(); var command = new PostCommand() { Title = "hjfrhftcutcuc6ello rtyxdrtxdye4ty", Message = "you think this is hello world, but it was me dio", Type = "email", From = 56, Target = new List <TargetCommand>() { target } }; var attributes = new Data <PostCommand>() { Attributes = command }; var httpContent = new RequestData <PostCommand>() { data = attributes }; var jsonObj = JsonConvert.SerializeObject(httpContent); //send to rabbit var factory = new ConnectionFactory() { HostName = "localhost" }; using (var connection = factory.CreateConnection()) using (var channel = connection.CreateModel()) { var Body = Encoding.UTF8.GetBytes(jsonObj); var properties = channel.CreateBasicProperties(); properties.Persistent = true; channel.BasicPublish(exchange: "", routingKey: "userData", basicProperties: null, body: Body); Console.WriteLine("user data has been forwarded"); Console.ReadLine(); } Console.ReadLine(); //send to mail var _client = new SmtpClient("smtp.mailtrap.io", 2525) { Credentials = new NetworkCredential("ccdced0fc36ee1", "215162738c26d0"), EnableSsl = true }; _client.Send("*****@*****.**", "*****@*****.**", "title: payment data", "msg: data has been sent to rabbitmq"); Console.WriteLine("Sent"); return(new Dto { message = "payment posted", success = true }); }