protected void Page_Load(object sender, EventArgs e) { AmexQuickPay.QuickPayClientAPI quickPayClientAPI = new QuickPayClientAPI(); if (PaymentGen.payment != null) { var x = PaymentGen.payment; var amount = Convert.ToDouble(PaymentGen.payment[1]); // lblAmount.Text = PaymentGen.payment[1]; lblAmount.Text = PaymentGen.payment[1]; lblCustomerName.Text = PaymentGen.payment[2]; lblEmail.Text = PaymentGen.payment[3]; lblStreetAddress.Text = PaymentGen.payment[8]; lblStateName.Text = PaymentGen.payment[7]; lblCountryName.Text = PaymentGen.payment[5]; lblZipCode.Text = PaymentGen.payment[9]; string orderId = PaymentGen.payment[0]; // generate payment request message string encId = ConfigurationManager.AppSettings["Enc_Id"].ToString(); MID.Value = ConfigurationManager.AppSettings["MID"].ToString(); string url = ConfigurationManager.AppSettings["RedirectUrl"].ToString(); string mgsrequest = quickPayClientAPI.generateDigitalOrder(MID.Value, orderId, (Convert.ToDecimal(lblAmount.Text) * 100).ToString(), url, encId); // string mgsrequest = quickPayClientAPI.getTransactionStatus(MID.Value, orderId, lblAmount.Text, url, encId); merchantRequest.Value = mgsrequest; } }
protected void Page_Load(object sender, EventArgs e) { string merchantDetailsResp = ""; string enc_Key = ConfigurationManager.AppSettings["Enc_Id"].ToString(); AmexQuickPay.QuickPayClientAPI ezeClickClientApi = new QuickPayClientAPI(); AmexQuickPay.ResponseDTO responseDTO = new ResponseDTO(); try { //Response.Write("I am on the page"); if (Request.Form["merchantResponse"] != null) { // merchantDetailResponse = Request.Form["merchantResponse"].ToString(); responseDTO = ezeClickClientApi.getDigitalReceipt(merchantDetailsResp, enc_Key); //retrieve the transaction status if (responseDTO.Qp_PaymentStatus.ToUpper() == "S") { //Transaction is Success //SMTP Client Mail //SmtpClient smtpClient = new SmtpClient("www.gmail.com"); //MailMessage msg = new MailMessage(); //msg.To.Add("*****@*****.**"); //MailAddress mailAddress = new MailAddress("*****@*****.**"); //msg.From = mailAddress; //msg.Body = "Payer Pappu"; //msg.IsBodyHtml = true; //smtpClient.Send(msg); } else { Response.Write("Fail"); //if Transaction is Failed...................... // SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587); // NetworkCredential ncr = new NetworkCredential("*****@*****.**", " hbfewui2838y"); // smtpClient.Credentials = ncr; // smtpClient.EnableSsl = true; // MailMessage msg = new MailMessage(); // msg.To.Add("*****@*****.**"); ////msg.CC.Add("*****@*****.**"); // MailAddress mailAddress = new MailAddress("*****@*****.**"); // msg.From = mailAddress; // msg.Body = "Hello Ok Mail Tested"; // msg.IsBodyHtml = true; // smtpClient.Send(msg); } } else { // no response retreive from ezeclick. merchant needs to handle the error message } } catch (Exception ex) { Response.Write(ex); } }