Esempio n. 1
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     v();
     if (v())
     {
         DataTable err = TransactionBOL.insertdetail(RdGender.SelectedItem.ToString(), txtFirstName.Text, txtLastName.Text, txtAddress.Text, txtCity.Text, DdlCountry.Text, txtEmailId.Text, txtpin.Text, txtMobileNo.Text, ddlday.SelectedItem + "-" + ddlmonth.SelectedValue + "-" + ddlyear.SelectedValue, RdMartialStatus.SelectedItem.ToString(), DateTime.Now, CardNo, BankName, CardType, DropDownList1.SelectedItem + "-" + DropDownList2.SelectedValue + "-" + DropDownList3.SelectedValue);
         if (err != null && err.Rows.Count > 0)
         {
             foreach (DataRow dr in err.Rows)
             {
                 msg = dr[0].ToString();
             }
             if (msg != "Sorry, You are already enrolled for Membership")
             {
                 DataTable dt = TransactionBOL.Select_RoyalCardMcDetail_REFIDWISE(txtEmailId.Text, txtMobileNo.Text);
                 ReceiptUtils.RoyalCardMcResponse(dt.Rows[0]);
                 ReceiptUtils.RoyalCardMcResponseloyality(dt.Rows[0], ConfigurationManager.AppSettings.Get("royal"));
             }
         }
         lblmsg.Text           = msg;
         grayBG.Visible        = true;
         showcontainer.Visible = true;
         Container.Visible     = true;
         clear();
         Session.Abandon();
     }
 }
Esempio n. 2
0
    protected void HandleFailure(TransactionRecord tr)
    {
        #region handlefailure

        String _refNo = tr.ReferenceNo.ToString();

        KoDTicketing.GTICKV.LogEntry(tr.ReferenceNo.ToString(), "IDBI Error Occured -- Payment Not Successful", "27", tr.ReferenceNo.ToString());
        long BookingID = long.Parse(tr.ReferenceNo.ToString());
        try
        {
            DataTable dt = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID);

            if (dt.Rows.Count == 0)
            {
                ReceiptUtils.FailurePaymentResponse();
            }
            else
            {
                ReceiptUtils.FailurePaymentResponse(dt.Rows[0]);
            }
        }
        catch (Exception ex)
        {
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Error occurred processing unsuccessful payment through IDBI..." + ex.Message);
        }
        #endregion handlefailure
    }
Esempio n. 3
0
    protected string UpdateResponseByTranId()
    {
        try
        {
            TransactionRecord tr = new TransactionRecord();
            tr.BookingID   = tr.VoucherBookingID;
            tr.ReceiptNo   = "''";
            tr.ReferenceNo = long.Parse(PayDetailsTemp[1].Split('_')[0]);
            tr.AgentCode   = PayDetailsTemp[1].Split('_')[1].Split('~')[1];
            //****** Promo code usecase start here ************
            KODHelper objKODHelper = new KODHelper();
            tr = objKODHelper.GetPromotionDetails(tr);
            //****** Promo code usecase END here ************
            DataTable dt = TransactionBOL.Get_Transaction_Detail(tr);
            if (dt.Rows.Count > 0)
            {
                DataRow dr               = dt.Rows[0];
                bool    seatsBooked      = (dt.Rows[0]["SeatBooked"].ToString() == "1");
                bool    alreadyProcessed = (dt.Rows[0]["AlreadyProcessed"].ToString() == "1");
                if (seatsBooked)
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Voucher Transaction : Seats Booked for " + tr.BookingID.ToString());
                }
                if (!alreadyProcessed)
                {
                    ReceiptUtils.SuccessPaymentResponse(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, "");
                }
            }
        }
        catch (Exception ex)
        {
            if (qstring == "")
            {
                qstring += "?err=seat";
            }
            else
            {
                qstring += "&err=seat";
            }
            GTICKV.LogEntry(merchantReferenceNo, "Error Occured --" + ex.Message.Replace("'", ""), "19", MainBookingID);
        }
        Session["bookid"] = qstring;


        return(qstring);
    }
Esempio n. 4
0
        /// <summary>
        /// Method dedicated to the upload receipt process. Runs methods from the library depending on what
        /// is being uploaded.
        /// </summary>
        /// <returns></returns>
        private bool UploadFullReceipt()
        {
            // Get first and only receipt
            ReceiptModel r = receipts[0];

            // Create receipt in the database first to ensure the other data is able to get access to the receipt ID.
            ReceiptUploader.UploadToReceiptTable(employeeKey, r.OrderBaseCost, r.OrderDeliveryCost, r.OrderReceiptCost);

            // Receipt ID
            int id = ReceiptUploader.GetReceiptID();

            // If ID is present, cycle through everything in the order and run the corresponding methods to upload
            // their data to the database.
            if (id > 0)
            {
                foreach (PizzaModel p in r.PizzaList)
                {
                    ReceiptUploader.UploadToPizzaTable(p.Size, ReceiptUtils.ToppingsToString(p.Toppings), p.Price, id);
                }

                foreach (SideModel s in r.SideList)
                {
                    ReceiptUploader.UploadToSideTable(s.Name, s.Quantity, s.Price, id);
                }

                foreach (DrinkModel d in r.DrinkList)
                {
                    ReceiptUploader.UploadToDrinkTable(d.Name, d.Quantity, d.Price, id);
                }

                // Upload customer information
                ReceiptUploader.UploadToCustomerTable(r.CustomerName, r.CustomerAddressLine1, r.CustomerPostCode, id);

                return(true);
            }
            else
            {
                MessageBox.Show("Receipt ID not found! Report to a developer immediately.");
            }

            return(false);
        }
Esempio n. 5
0
    //Function to send email to Gcab and KodRef
    private void SendNotificationMailForHotels(bool seatsBooked, DataRow dtRow, string referecneNo, string bookingId, string receiptNo, string Promotioncode)
    {
        // Fetch email Ids from config & Pass as params

        try
        {
            string GCabEmail1   = ConfigurationManager.AppSettings.Get("KODHotelPromoGCabsRefEmail1");
            string GCabEmail2   = ConfigurationManager.AppSettings.Get("KODHotelPromoGCabsRefEmail2");
            string KODrefEmail  = ConfigurationManager.AppSettings.Get("KODHotelPromoKODRefEmail1");
            string KODrefEmail2 = ConfigurationManager.AppSettings.Get("KODHotelPromoKODRefEmail2");
            if (Promotioncode.ToString() != "" || Promotioncode != null)
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Mail send to GCAB and REFKOD");
                ReceiptUtils.SuccessPaymentResponseForHotels(seatsBooked, dtRow, referecneNo, bookingId, referecneNo, GCabEmail1, GCabEmail2, KODrefEmail, KODrefEmail2);
            }
        }
        catch (Exception ex)
        {
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Error is " + ex.Message);
        }
    }
Esempio n. 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        System.Text.StringBuilder qstring = new System.Text.StringBuilder();
        int qsCount = Request.QueryString.Count;

        #region processreceipt
        if (qsCount > 0 && Request.QueryString["sta"] != null && Request.QueryString["tid"] != null)
        {
            TransactionRecord tr = new TransactionRecord();
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(string.Format("IDBI Web payment transaction response [{0}]", Request.QueryString["sta"]));
            tr.Status = Request.QueryString["sta"].ToString().Equals("50020");
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Web payment transaction complete. Status: " + (tr.Status ? "Success" : "Failure"));

            string IpAddress = System.Configuration.ConfigurationManager.AppSettings["KoDTicketingIPAddress"];
            #region parsereference

            String   refNo     = Request.QueryString["tid"].ToString();
            string[] refTokens = refNo.Split('_');
            KoDTicketing.GTICKV.LogEntry(refTokens[0], "Payment Getaway Response: " + (tr.Status ? "Success" : "Failure"), "14", "");
            if (refTokens.Length < 2)
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Payment Response: Tokenization of reference string did not result in enough tokens. --> " + refNo);
                return;
            }

            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Transaction reference: " + refTokens[0].ToString());
            tr.ReferenceNo = long.Parse(refTokens[0].ToString());

            string[] refSubTokens = refTokens[1].Split('~');

            if (refSubTokens.Length < 2)
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Payment Response: Tokenization of reference substring did not result in enough sub tokens. --> " + refTokens[1].ToString());
                return;
            }

            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Booking ID: " + refSubTokens[0]);
            tr.BookingID = long.Parse(refSubTokens[0]);

            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Agent Code: " + refSubTokens[1]);
            tr.AgentCode = refSubTokens[1];
            #endregion parsereference
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Amount: " + Request.QueryString["amt"].ToString());
            tr.TotalAmount = decimal.Parse(Request.QueryString["amt"].ToString());
            try
            {
                if (true == tr.Status)
                {
                    HandleSuccess(ref tr, ref qstring);
                }
                else //failure
                {
                    GTICKV.LogEntry(tr.ReferenceNo.ToString(), "Payment Not Successful", "25", tr.BookingID.ToString());
                    GTICKBOL.ON_Session_out(tr.ReferenceNo.ToString());
                    GTICKV.LogEntry(tr.ReferenceNo.ToString(), "Seats Unlocked", "26", tr.BookingID.ToString());
                    long BookingID = long.Parse(tr.ReferenceNo.ToString());
                    GTICKV.LogEntry(tr.ReferenceNo.ToString(), "User Press Cancel Button", "15", tr.BookingID.ToString());
                    DataTable dt = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID);
                    if (dt != null && dt.Rows.Count > 0 && (Convert.ToDateTime(dt.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.ToShortDateString()) || Convert.ToDateTime(dt.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.AddDays(-1).ToShortDateString())))
                    {
                        ReceiptUtils.PaymentNotCaptureResponse(tr.ReceiptNo.ToString(), dt.Rows[0], "");
                    }
                    qstring.Append("?err=pay");
                }
            }
            catch (Exception ex)
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(ex.Message);
                HandleFailure(tr);
                qstring.Append("?err=seat");
            }
        }

        #endregion processreceipt

        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Transaction Complete. " + Request.QueryString["rec"]);
        Response.Redirect("../Print-Receipt.aspx" + qstring.ToString(), false);
    }
Esempio n. 7
0
    protected String UpdateResponse(String trackid, String reference, String result, String postdate, String auth)
    {
        System.Text.StringBuilder qstring = new System.Text.StringBuilder();
        try
        {
            TransactionRecord tr = new TransactionRecord();

            string IpAddress = System.Configuration.ConfigurationManager.AppSettings["KoDTicketingIPAddress"];

            #region parsereference

            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Transaction reference: " + trackid);
            string refNo = trackid;

            if (refNo.Length < 1)
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Payment Response: Tokenization of reference string did not result in enough sub tokens. --> " + refNo);
                return("?err=pay");
            }

            tr.EvtBookingID = refNo;

            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(string.Format("HDFC Payment Response: Reference[{0}], Booking ID [{1}], Agent Code [{2}] ", tr.ReferenceNo.ToString(), tr.EvtBookingID.ToString(), tr.AgentCode));
            #endregion parsereference

            if (Request["amt"] != null)
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Amount: " + Request["amt"].ToString());
                tr.EvtTotalAmount = decimal.Parse(Request["amt"].ToString());
            }

            if (Request["paymentid"] != null)
            {
                try
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Receipt: " + Request["paymentid"].ToString());
                    tr.EvtReceiptNo = Request["paymentid"].ToString();
                }
                catch (Exception ex)
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Response: Error parsing receipt.");
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(ex.Message);
                }
            }


            if (result == "CAPTURED")
            {
                # region CAPTURED
                //string retURL = UpdateResponseByTranId(status, amount, transactionId);
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC payment captured.");
                try
                {
                    string EvtBookingID = tr.EvtBookingID.ToString();
                    TransactionBOL.Get_Event_Details(tr.EvtBookingID, tr.EvtReceiptNo);
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Going to Fetch Details of Booking Id from DB.Booking ID where" + EvtBookingID);
                    DataTable dt = TransactionBOL.Select_EventTransaction(tr.EvtBookingID.ToString());
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Fetched Details of Booking Id from DB.Booking ID where" + EvtBookingID);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Fetched Details of Booking Id from DB.Booking ID where" + dt.Rows[0]);
                        try
                        {
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Seats booked against HDFC payment.");
                            qstring.Append("?b=");
                            qstring.Append(tr.EvtBookingID.ToString());
                            // ReceiptUtils.ValentinePaymentSuccess(dt.Rows[0], tr.VLReceiptNo.ToString(), tr.BookingID.ToString());
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Payment successful..." + tr.EvtBookingID.ToString() + tr.EvtReceiptNo.ToString());
                            GTICKV.LogEntry("HDFC Payment successful...", "10", tr.BookingID.ToString(), tr.ReceiptNo.ToString());
                        }

                        catch (Exception ex)
                        {
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Error processing receipt post booking. " + ex.Message);
                            // ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt.Rows[0], "");
                            //ReceiptUtils.SuccessPaymentResponse(tr.VLBookingID.ToString(), tr.VLReceiptNo);
                            qstring.Append((qstring.Length == 0) ? "?err=seat" : "&err=seat");
                        }
                        return(qstring.ToString());
                    }
                    else
                    {
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC successful booking but ask customer to call");;
                        long BookingID1 = long.Parse(tr.ReferenceNo.ToString());
                        //DataTable dt1 = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID1);
                        //ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt1.Rows[0], "");
                        //ReceiptUtils.SuccessPaymentResponse(tr.VLBookingID.ToString(), tr.VLReceiptNo);
                        qstring.Append((qstring.Length == 0) ? "?err=seat" : "&err=seat");
                    }
                }
                catch (Exception ex)
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Receipt: error getting transaction details - " + ex.Message); qstring.Append((qstring.Length == 0) ? "?err=seat" : "&err=seat");
                }
                //if you reach here problem occurred

                String _refNo = tr.EvtBookingID.ToString();
                KoDTicketing.GTICKV.LogEntry(_refNo, "HDFC Payment Not Successful", "17", tr.EvtBookingID.ToString());
                //GTICKBOL.ON_Session_out(_refNo);
                KoDTicketing.GTICKV.LogEntry(_refNo, "Seats Unlocked", "18", tr.EvtBookingID.ToString());
                qstring.Append("err=pay");

                KoDTicketing.GTICKV.LogEntry(tr.EvtReceiptNo.ToString(), "HDFC Error Occurred -- Payment Not Successful", "19", tr.EvtBookingID.ToString());
                string BookingID = tr.EvtBookingID.ToString();
                try
                {
                    DataTable dt = TransactionBOL.Select_EventTransaction(BookingID);

                    if (dt.Rows.Count == 0)
                    {
                        ReceiptUtils.FailurePaymentResponse();
                    }
                    else
                    {
                        ReceiptUtils.FailurePaymentResponse(dt.Rows[0]);
                    }
                    qstring.Append((qstring.Length == 1) ? "err=seat" : "&err=seat");
                    return(qstring.ToString());
                }

                catch (Exception ex)
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Error occurred processing unsuccessful payment..." + ex.Message);
                }
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Final Call");
                Response.Redirect(IpAddress + "EventTransaction/HDFC/FinalCall.aspx" + qstring.ToString(), false);
                #endregion
            }
            else
            {
                GTICKV.LogEntry(tr.EvtReceiptNo.ToString(), "HDFC Payment Not Successful", "17", tr.EvtBookingID.ToString());
                //GTICKBOL.ON_Session_out(tr.ReferenceNo.ToString());
                GTICKV.LogEntry(tr.EvtReceiptNo.ToString(), "Seats Unlocked", "18", tr.EvtBookingID.ToString());
                long      BookingID = long.Parse(tr.ReferenceNo.ToString());
                DataTable dt        = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID);
                ReceiptUtils.PaymentNotCaptureResponse(tr.ReceiptNo.ToString(), dt.Rows[0], "");
                qstring.Append("?err=pay");
            }
        }
Esempio n. 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        System.Text.StringBuilder qstring = new System.Text.StringBuilder("?");
        try
        {
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Amex Return Receipt Page");
            int qsCount = Request.QueryString.Count;

            if (qsCount > 0 && Request.QueryString["sta"] != null && Request.QueryString["tid"] != null)
            {
                TransactionRecord tr = new TransactionRecord();

                #region parsereference
                //tr.Status = Request.QueryString["sta"].ToString().Equals("0");
                tr.Status = false;
                if (Request.QueryString["enroll"].ToString().Equals("Y"))
                {
                    if (Request.QueryString["sta"].ToString().Equals("0") && (Request.QueryString["Safecode"].ToString().Equals("Y") || Request.QueryString["Safecode"].ToString().Equals("A")))
                    {
                        tr.Status = true;
                    }
                }
                else
                {
                    if (Request.QueryString["sta"].ToString().Equals("0") && Request.QueryString["response"].ToString().Equals("M"))
                    {
                        tr.Status = true;
                    }
                }
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Web payment transaction complete. Status: " + (tr.Status ? "Success" : "Failure"));

                String   refNo     = Request.QueryString["tid"].ToString();
                string[] refTokens = refNo.Split('_');
                KoDTicketing.GTICKV.LogEntry(refTokens[0], "Payment Getaway Response: " + (tr.Status ? "Success" : "Failure"), "14", "");
                if (refTokens.Length < 2)
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Response from gateway received but query string does not have information about the transaction refernece: " + refNo);
                    return;
                }

                tr.ReferenceNo = long.Parse(refTokens[0].ToString());
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Transaction reference: " + tr.ReferenceNo.ToString());

                string[] refSubTokens = refTokens[1].Split('~');
                if (refTokens.Length < 2)
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Tokenization of query string did not result in enough sub tokens. --> " + refNo);
                    return;
                }

                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmExBooking ID: " + refSubTokens[0]);
                tr.BookingID = long.Parse(refSubTokens[0]);

                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Agent Code: " + refSubTokens[1]);
                tr.AgentCode = refSubTokens[1];
                #endregion parsereference

                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Amount: " + Request.QueryString["amt"].ToString());
                tr.TotalAmount = decimal.Parse(Request.QueryString["amt"].ToString());

                if (true == tr.Status) //successful
                {
                    #region handlesuccess

                    #region parsereceipt
                    if (Request.QueryString["rec"] != null)
                    {
                        try
                        {
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Receipt: " + Request.QueryString["rec"]);
                            tr.ReceiptNo = Request.QueryString["rec"];
                        }
                        catch (Exception ex)
                        {
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Amex Resposne: Error parsing receipt.");
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(ex.Message);
                        }
                    }
                    #endregion parsereceipt

                    try
                    {
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEX Payment Successful. Ensuring the seats are reserved...");
                        //****** Promo code usecase start here ************
                        KODHelper objKODHelper = new KODHelper();
                        tr = objKODHelper.GetPromotionDetails(tr);
                        tr.PaymentGateway = "AMEX";
                        //****** Promo code usecase END here ************
                        TransactionBOL.Update_PaymentStatus(tr);     //Update payment status in temp transection table
                        DataTable dt = TransactionBOL.Get_Transaction_Detail(tr);

                        if (dt.Rows.Count == 0)
                        {
                            long      BookingID1 = long.Parse(tr.ReferenceNo.ToString());
                            DataTable dt1        = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID1);
                            if (dt1 != null && dt1.Rows.Count > 0 && (Convert.ToDateTime(dt1.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.ToShortDateString()) || Convert.ToDateTime(dt1.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.AddDays(-1).ToShortDateString())))
                            {
                                ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt1.Rows[0], "");
                            }
                            //ReceiptUtils.SuccessPaymentResponse(tr.BookingID.ToString(), tr.ReceiptNo);
                            qstring.Append("?err=seat");
                        }
                        else
                        {
                            bool seatsBooked      = (int.Parse(dt.Rows[0]["SeatBooked"].ToString()) > 0);
                            bool alreadyProcessed = (dt.Rows[0]["AlreadyProcessed"].ToString() == "1");
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(string.Format("Amex [{0},{1},{2}] Seats Booked.", tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo));
                            if (!alreadyProcessed)
                            {
                                if (dt.Rows[0]["PromotionCode"].ToString() == "MMT")
                                {
                                    DataTable dt1 = TransactionBOL.Select_MMTTransaction_REFIDWISE(tr.BookingID.ToString());
                                    ReceiptUtils.MMTPaymentResponse(dt.Rows[0], dt1.Rows[0], tr.ReceiptNo.ToString(), tr.BookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId2"), ConfigurationManager.AppSettings.Get("ConcertRefMailId3"), dt.Rows[0]["ShowTime"].ToString(), dt.Rows[0]["ShowDate"].ToString());
                                }
                                else if (dt.Rows[0]["PromotionCode"].ToString() == "MANA")
                                {
                                    DataTable dt2 = TransactionBOL.Select_MANATransaction_REFIDWISE(tr.BookingID.ToString());
                                    ReceiptUtils.MANAPaymentResponse(dt.Rows[0], dt2.Rows[0], tr.ReceiptNo.ToString(), tr.BookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId2"), ConfigurationManager.AppSettings.Get("ConcertRefMailId3"), dt.Rows[0]["ShowTime"].ToString(), dt.Rows[0]["ShowDate"].ToString());
                                }
                                else if (dt.Rows[0]["PromotionCode"].ToString() == "MCOTHERS" || dt.Rows[0]["PromotionCode"].ToString() == "MCWORLD")
                                {
                                    DataTable dt3 = TransactionBOL.Select_MCTransaction_REFIDWISE(tr.ReferenceNo.ToString());
                                    ReceiptUtils.MCPaymentResponse(dt.Rows[0], dt3.Rows[0], tr.ReceiptNo.ToString(), tr.BookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId2"), ConfigurationManager.AppSettings.Get("ConcertRefMailId3"), dt.Rows[0]["ShowTime"].ToString(), dt.Rows[0]["ShowDate"].ToString());
                                }
                                else if (dt.Rows[0]["PromotionCode"].ToString() == "JHUMROOOFFER")
                                {
                                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Enter into jhumroo offer mail content");
                                    ReceiptUtils.JHUMROOOFFERPaymentResponse(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, "");
                                }
                                else
                                {
                                    ReceiptUtils.SuccessPaymentResponse(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, "");
                                }
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Mail send through normal flow");
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Values are " + dt.Rows[0] + " , " + tr.ReferenceNo.ToString() + "," + tr.BookingID.ToString() + "," + tr.PromotionCode.ToString());
                                SendNotificationMailForHotels(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, tr.PromotionCode.ToString());
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Mail send through Hotel flow");
                            }
                            qstring.Clear();
                            qstring.Append("?b=");
                            qstring.Append((seatsBooked) ? dt.Rows[0]["BookingID"].ToString() : dt.Rows[0]["ID"].ToString());
                            KoDTicketing.GTICKV.LogEntry(tr.ReferenceNo.ToString(), "AMEX Payment successful...", "16", tr.BookingID.ToString(), tr.ReceiptNo.ToString());
                        }
                    }
                    catch (Exception ex)
                    {
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Receipt: error getting transaction details - " + ex.Message);
                        String _refNo = tr.ReferenceNo.ToString();

                        KoDTicketing.GTICKV.LogEntry(tr.ReferenceNo.ToString(), "Amex Error Occured -- Payment Not Successful", "27", tr.ReferenceNo.ToString());
                        long BookingID = long.Parse(tr.ReferenceNo.ToString());
                        try
                        {
                            DataTable dt = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID);

                            if (dt.Rows.Count == 0)
                            {
                                ReceiptUtils.FailurePaymentResponse();
                            }
                            else
                            {
                                ReceiptUtils.FailurePaymentResponse(dt.Rows[0]);
                            }
                            qstring.Append("?err=seat");
                        }
                        catch (Exception ex1)
                        {
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Error occurred processing unsuccessful payment through Amex..." + ex1.Message);
                        }
                    }
                    #endregion handlesuccess
                }
                else //failure
                {
                    #region handlefailure
                    String _refNo = tr.ReferenceNo.ToString();
                    KoDTicketing.GTICKV.LogEntry(_refNo, "Payment Not Successful", "25", tr.BookingID.ToString());
                    GTICKBOL.ON_Session_out(_refNo);
                    KoDTicketing.GTICKV.LogEntry(_refNo, "Seats Unlocked", "26", tr.BookingID.ToString());
                    long      BookingID = long.Parse(tr.ReferenceNo.ToString());
                    DataTable dt        = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID);
                    if (dt != null && dt.Rows.Count > 0 && (Convert.ToDateTime(dt.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.ToShortDateString()) || Convert.ToDateTime(dt.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.AddDays(-1).ToShortDateString())))
                    {
                        ReceiptUtils.PaymentNotCaptureResponse(tr.ReceiptNo.ToString(), dt.Rows[0], "");
                    }
                    qstring.Append("err=pay");
                    #endregion handlefailure
                }
            }
            else
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Response from gateway received but query string does not have information about the transaction.");
                qstring.Append((qstring.Length == 1) ? "err=seat" : "&err=seat");
            }
        }
        catch (Exception ex)
        {
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Exception thrown processing receipt. " + ex.Message);
            qstring.Append((qstring.Length == 1) ? "err=seat" : "&err=seat");
        }

        Response.Redirect("~/Payment/Print-Receipt.aspx" + qstring.ToString(), false);
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (Decrypt(Request.QueryString["SessionId"]) == sessionvalue[12].ToString() && Session[Decrypt(Request.QueryString["SessionId"])] != "")
        {
            long transid         = 0;
            long refno           = 0;
            TransactionRecord tr = new TransactionRecord();
            try
            {
                #region Session based
                if (Session_value != "" && Request.QueryString["SessionId"] != null)
                {
                    try
                    {
                        string[] strarr;
                        strarr = Session_value.Split(',');
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(string.Format("Transaction [{0}]  ", strarr[12]));
                        tr.BookingID = long.Parse(strarr[12]);
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(string.Format("Seats  " + Session_value));
                        // tr.AgentCode = Session["AgentCode"].ToString();
                        tr.AgentCode   = "Agent-" + Session["Agent"].ToString();
                        tr.Source      = "Web-TicketingAgent";
                        tr.BookingType = "Web-TicketingAgent";
                        //tr.VoucherType = rblVoucher.SelectedValue;
                        //tr.VoucherNo = "";
                        //tr.VoucherBookingID = 0;

                        tr.CardType       = "";
                        tr.PaymentGateway = "Web-TicketingAgent";
                        tr.CardNo         = "1111222233334444";
                        tr.MobileNo       = txtContactNo.Text;
                        tr.Name           = txtName.Text;
                        tr.PaymentType    = "";
                        tr.DateOfBooking  = DateTime.Now.Date.ToShortDateString();
                        // tr.IsProcessed = ;
                        // tr.PaymentStatus = ;
                        tr.router                = "";
                        tr.WantComplimentary     = false;
                        tr.WantComplimentaryDrop = false;
                        tr.PlaceOfDrop           = "";
                        tr.PlaceOfPick           = "";
                        tr.TimeOfPick            = "";
                        tr.TimeOfDrop            = "";
                        tr.EmailID               = txtEmailAddress.Text;
                        tr.Status                = false;
                        tr.TimeOfBooking         = DateTime.Now.ToShortTimeString();
                        tr.TotalSeats            = int.Parse(strarr[5].ToString());
                        tr.Category              = strarr[8];
                        tr.Location              = strarr[6];
                        tr.Play = strarr[1];

                        string[] datarr = strarr[2].ToString().Split('/');//for live server
                        //string[] datarr = strarr[2].ToString().Split('-');// for dev/local

                        tr.ShowDate = datarr[1] + "/" + datarr[0] + "/" + datarr[2];//for live server
                        //tr.ShowDate = datarr[0] + "/" + datarr[1] + "/" + datarr[2]; // for dev/local


                        tr.ShowTime = strarr[7];
                        tr.Day      = Convert.ToDateTime(tr.ShowDate).DayOfWeek.ToString();
                        //tr.ShowDate = datarr[1] + "/" + datarr[0] + "/" + datarr[2];//for local
                        tr.Remark      = "";
                        tr.TotalAmount = GTICKBOL.Get_SeatPrice_SeatKeyNoWise(tr.BookingID);
                        tr.SeatInfo    = SeatVal;
                        tr.Address     = txtAddress.Text.Trim();
                        tr.IP          = GetIP();
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Date : " + tr.DateOfBooking);
                        transid        = TransactionBOL.Transaction_Temp_Insert(tr);
                        tr.ReferenceNo = tr.BookingID;
                        tr.BookingID   = transid;
                        refno          = GTICKBOL.InsertAgentBooking_Details(tr);
                        GTICKV.LogEntry(tr.ReferenceNo.ToString(), "Starting to write Information to temp Session Table", "7", "");
                    }
                    catch (Exception ex)
                    {
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Transaction Preparation Error: " + ex.Message);
                        ClientScript.RegisterStartupScript(GetType(), "myscript", "<script>alert('Session Timeout. Please start the transaction again');window.location.href='Default.aspx';</script>");
                    }
                    GTICKV.LogEntry(tr.ReferenceNo.ToString(), "Category : " + tr.Category + " ,Seat Info : " + tr.SeatInfo +
                                    ", Total Amt : " + tr.TotalAmount, "8", "");

                    if (transid > 0 && refno > 0)
                    {
                        Session["AgentCode"] = null;
                        GTICKV.LogEntry(tr.BookingID.ToString(), "Data Successfully Written to Temp Transaction Table", "9", transid.ToString());
                        string    URL = "";
                        DataTable dt  = TransactionBOL.Get_Transaction_Detail(tr);
                        if (dt != null && dt.Rows.Count > 0)
                        {
                            GTICKBOL.Update_AgentBooking(tr.BookingID);
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Payment Redirection: " + URL);
                            Response.Redirect("Print-Receipt.aspx?b=" + tr.BookingID.ToString(), false);
                            Session[Decrypt(Request.QueryString["SessionId"])] = "";
                            bool seatsBooked = (int.Parse(dt.Rows[0]["SeatBooked"].ToString()) > 0);
                            ReceiptUtils.SuccessPaymentResponse(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, "");
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Booking successfull" + tr.ReferenceNo);
                        }
                        else
                        {
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("booking failed" + tr.ReferenceNo);
                            DataTable dt1 = TransactionBOL.Select_Temptransaction_REFIDWISE(tr.ReferenceNo);
                            if (dt != null && dt.Rows.Count > 0)
                            {
                                ReceiptUtils.PaymentNotCaptureResponse(tr.ReceiptNo.ToString(), dt1.Rows[0], "");
                            }
                            if (sessionvalue[12] != null)
                            {
                                String KeyNo = Decrypt(sessionvalue[12]);
                                GTICKBOL.ON_Session_out(KeyNo);
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("seat releasefor:" + KeyNo);
                            }
                            Session.Clear();
                            ClientScript.RegisterStartupScript(GetType(), "myscript", "<script>alert('Session Timeout. Please start the transaction again');window.location.href='Default.aspx';</script>");
                        }
                    }
                    else
                    {
                        lblMess.Text = "Session Timeout. Please start the transaction again by clicking \"Back\" button";
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Session Timeout. Need to restart transaction");
                        ClientScript.RegisterStartupScript(GetType(), "myscript", "<script>alert('Session Timeout. Please start the transaction again');window.location.href='Default.aspx';</script>");
                    }
                }
                else //no Session[seat_val]
                {
                    ClientScript.RegisterStartupScript(GetType(), "myscript", "<script>alert('Session Timeout. Please start the transaction again');window.location.href='Default.aspx';</script>");
                }
                #endregion
            }
            catch (Exception ex)
            {
                GTICKV.LogEntry(tr.BookingID.ToString(), "Error Occurred - " + ex.Message.Replace("'", ""), "8", transid.ToString());
                ClientScript.RegisterStartupScript(GetType(), "myscript", "<script>alert('Session Timeout. Please start the transaction again');window.location.href='Default.aspx';</script>");
            }
        }
        else
        {
            Session.Clear();
            ClientScript.RegisterStartupScript(GetType(), "myscript", "<script>alert('Session Timeout. Please start the transaction again');window.location.href='Default.aspx';</script>");
        }
    }
Esempio n. 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            string transactionTypeCode, installments, transactionId, amount, exponent, currencyCode, merchantReferenceNo,
       status, eci, pgErrorCode, pgErrorDetail, pgErrorMsg, messageHash, messageHashBuf, messageHashClient;
            bool   hashMatch = false;
            string URL       = "";
            //fill response from idbi
            transactionTypeCode = Request.Form["transaction_type_code"];
            installments        = Request.Form["installments"];
            transactionId       = Request.Form["transaction_id"];
            amount              = Request.Form["amount"];
            exponent            = Request.Form["exponent"];
            currencyCode        = Request.Form["currency_code"];
            merchantReferenceNo = Request.Form["merchant_reference_no"];
            status              = Request.Form["status"];
            eci         = Request.Form["3ds_eci"];
            pgErrorCode = Request.Form["pg_error_code"];
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI: " + pgErrorCode);
            pgErrorDetail = Request.Form["pg_error_detail"];
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI:  " + pgErrorDetail);
            pgErrorMsg = Request.Form["pg_error_msg"];
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI: " + pgErrorMsg);
            messageHash = Request.Form["message_hash"];

            messageHashBuf = System.Configuration.ConfigurationManager.AppSettings["pgInstanceId"] + "|" +
                             System.Configuration.ConfigurationManager.AppSettings["merchantId"] + "|" + transactionTypeCode + "|" +
                             installments + "|" + transactionId + "|" + amount + "|" + exponent + "|" + currencyCode + "|" +
                             merchantReferenceNo + "|" + status + "|" + eci + "|" + pgErrorCode + "|" +
                             System.Configuration.ConfigurationManager.AppSettings["hashKey"] + "|";
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI: " + messageHashBuf);


            /*******************Payement Gateway Error Value Code**********************/
            #region PG_DB for ReturnReceipt
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("PG_DB");
            string bookingid = merchantReferenceNo.Split('_')[1].ToString().Split('~')[0].ToString();
            int    i         = GTICKBOL.Insert_Payment_DB(pgErrorDetail.ToString(), bookingid, "IDBI");
            #endregion PG_DB for ReturnReceipt
            /*********************End******************************/

            messageHashClient = "13:" + enUtility.DoHash(messageHashBuf);
            hashMatch         = (messageHash == messageHashClient);
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI hash " + (hashMatch ? "matched" : "mismatched"));

            //Url needed for the agent module to replace here
            if (merchantReferenceNo.Contains("RCM-topup") || merchantReferenceNo.Contains("RCM-signup"))
            {
                URL = "http://royalty.kingdomofdreams.in/Payment/Idbi/cr.aspx?tid=" + merchantReferenceNo + "&sta=" + status + "&amt=" + amount + "&rec=" + transactionId;
            }
            else
            {
                if (merchantReferenceNo.Split('_').Length > 2)
                {
                    URL = "http://www.kodagent.com/ReturnReceipt.aspx?tid=" + merchantReferenceNo + "&sta=" + status + "&amt=" + amount + "&rec=" + transactionId;
                }
                else
                {
                    KoDTicketing.GTICKV.LogEntry(merchantReferenceNo.Split('_')[0].ToString(), "Return From IDBI Payment Gateway, amt : " + amount + ",recieptNO : " + transactionId, "13", merchantReferenceNo.Split('_')[1].Split('~')[0]);
                    if (merchantReferenceNo.Contains("royal_card_payment_idbi"))
                    {
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Royal Card Payment reference no " + merchantReferenceNo);
                        URL = "../../RoyalCard/Account/Payment/Idbi/CR.aspx?tid=" + merchantReferenceNo + "&sta=" + status + "&amt=" + amount + "&rec=" + transactionId;
                    }
                    else
                    {
                        URL = "CR.aspx?tid=" + merchantReferenceNo + "&sta=" + status + "&amt=" + amount + "&rec=" + transactionId;
                    }
                }
            }
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Payment Redirecting..." + URL);
            Response.Redirect(URL, false);
        }
        catch (Exception ex)
        {
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Return Receipt Exception " + ex.Message);
            if (ex.Message != null)
            {
                ReceiptUtils.IDBIReturnReceipt(ex.Message, "");
            }
        }
    }
Esempio n. 11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        System.Text.StringBuilder qstring = new System.Text.StringBuilder("?");
        try
        {
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Amex Return Receipt Page MMT");
            int qsCount = Request.QueryString.Count;

            if (qsCount > 0 && Request.QueryString["sta"] != null && Request.QueryString["tid"] != null)
            {
                TransactionRecord tr = new TransactionRecord();

                #region parsereference
                //tr.Status = Request.QueryString["sta"].ToString().Equals("0");
                tr.Status = false;
                if (Request.QueryString["enroll"].ToString().Equals("Y"))
                {
                    if (Request.QueryString["sta"].ToString().Equals("0") && (Request.QueryString["Safecode"].ToString().Equals("Y") || Request.QueryString["Safecode"].ToString().Equals("A")))
                    {
                        tr.Status = true;
                    }
                }
                else
                {
                    if (Request.QueryString["sta"].ToString().Equals("0") && Request.QueryString["response"].ToString().Equals("M"))
                    {
                        tr.Status = true;
                    }
                }
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Web payment transaction complete. Status: " + (tr.Status ? "Success" : "Failure"));

                String refNo = Request.QueryString["tid"].ToString();
                // string[] refTokens = refNo.Split('_');
                if (refNo.Length < 1)
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Response from gateway received but query string does not have information about the transaction refernece: " + refNo);
                    return;
                }

                // tr.ReferenceNo = long.Parse(refTokens[0].ToString());
                //Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Transaction reference: " + tr.ReferenceNo.ToString());

                // string[] refSubTokens = refTokens[1].Split('~');
                //if (refTokens.Length < 2)
                //{
                //    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Tokenization of query string did not result in enough sub tokens. --> " + refNo);
                //    return;
                //}

                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmExBooking ID: " + refNo);
                tr.MMTBookingID = refNo.ToString();

                // Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Agent Code: " + refSubTokens[1]);
                //tr.AgentCode = refSubTokens[1];
                #endregion parsereference

                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Amount: " + Request.QueryString["amt"].ToString());
                tr.MMTPayableAmount = decimal.Parse(Request.QueryString["amt"].ToString());

                if (true == tr.Status) //successful
                {
                    #region handlesuccess

                    #region parsereceipt
                    if (Request.QueryString["rec"] != null)
                    {
                        try
                        {
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Receipt: " + Request.QueryString["rec"]);
                            tr.MMTReceiptNo = Request.QueryString["rec"];
                        }
                        catch (Exception ex)
                        {
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Amex Resposne: Error parsing receipt.");
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(ex.Message);
                        }
                    }
                    #endregion parsereceipt

                    try
                    {
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEX Payment Successful. Ensuring the seats are reserved...");
                        //****** Promo code usecase start here ************
                        //KODHelper objKODHelper = new KODHelper();
                        //tr = objKODHelper.GetPromotionDetails(tr);
                        //****** Promo code usecase END here ************
                        TransactionBOL.Get_MMT_Detail(tr.MMTBookingID, tr.MMTReceiptNo);
                        DataTable dt = TransactionBOL.Select_MMTTransaction_REFIDWISE(tr.MMTBookingID.ToString());
                        if (dt.Rows.Count == 0)
                        {
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AMEX successful booking but ask customer to call");
                            long      BookingID1 = long.Parse(tr.ReferenceNo.ToString());
                            DataTable dt1        = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID1);
                            ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt1.Rows[0], "");
                            //ReceiptUtils.SuccessPaymentResponse(tr.BookingID.ToString(), tr.ReceiptNo);
                            qstring.Append("?err=seat");
                        }
                        else
                        {
                            //bool seatsBooked = (int.Parse(dt.Rows[0]["SeatBooked"].ToString()) > 0);
                            //bool alreadyProcessed = (dt.Rows[0]["AlreadyProcessed"].ToString() == "1");
                            //Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(string.Format("Amex [{0},{1},{2}] Seats Booked.", tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo));

                            ReceiptUtils.MMTPaymentResponse(dt.Rows[0], dt.Rows[0], tr.MMTReceiptNo.ToString(), tr.BookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId2"), ConfigurationManager.AppSettings.Get("ConcertRefMailId3"), "", "");
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Mail send through normal flow");
                            //Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Values are " + dt.Rows[0] + " , " + tr.MMTReceiptNo.ToString() + "," + tr.BookingID.ToString());
                            //Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Mail send through Hotel flow");

                            qstring.Clear();
                            qstring.Append("?b=");
                            qstring.Append(dt.Rows[0]["BookingId"].ToString());
                        }
                    }
                    catch (Exception ex)
                    {
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Receipt: error getting transaction details - " + ex.Message);
                        //String _refNo = tr.ReferenceNo.ToString();

                        KoDTicketing.GTICKV.LogEntry(tr.ReferenceNo.ToString(), "Amex Error Occured -- Payment Not Successful", "19", tr.MMTBookingID.ToString());
                        //long BookingID = long.Parse(tr.ReferenceNo.ToString());
                        string BookingID = tr.MMTBookingID.ToString();
                        try
                        {
                            DataTable dt = TransactionBOL.Select_MMTTransaction_REFIDWISE(BookingID);

                            if (dt.Rows.Count == 0)
                            {
                                ReceiptUtils.FailurePaymentResponse();
                            }
                            else
                            {
                                ReceiptUtils.FailurePaymentResponse(dt.Rows[0]);
                            }
                            qstring.Append("?err=seat");
                        }
                        catch (Exception ex1)
                        {
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Error occurred processing unsuccessful payment through IDBI..." + ex1.Message);
                        }
                    }
                    #endregion handlesuccess
                }
                else //failure
                {
                    #region handlefailure
                    String _refNo = tr.MMTBookingID.ToString();
                    // KoDTicketing.GTICKV.LogEntry(_refNo, "Payment Not Successful", "17", tr.MMTBookingID.ToString());
                    //GTICKBOL.ON_Session_out(_refNo);
                    //KoDTicketing.GTICKV.LogEntry(_refNo, "Seats Unlocked", "18", tr.BookingID.ToString());
                    long      BookingID = long.Parse(tr.ReferenceNo.ToString());
                    DataTable dt        = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID);
                    ReceiptUtils.PaymentNotCaptureResponse(tr.ReceiptNo.ToString(), dt.Rows[0], "");
                    qstring.Append("err=pay");
                    #endregion handlefailure
                }
            }
            else
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Response from gateway received but query string does not have information about the transaction.");
                qstring.Append((qstring.Length == 1) ? "err=seat" : "&err=seat");
            }
        }
        catch (Exception ex)
        {
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Exception thrown processing receipt. " + ex.Message);
            qstring.Append((qstring.Length == 1) ? "err=seat" : "&err=seat");
        }

        Server.Transfer("~/MMT/Print-Receipt.aspx" + qstring.ToString(), false);
    }
Esempio n. 12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        System.Text.StringBuilder qstring = new System.Text.StringBuilder("?");
        try
        {
            int qsCount = Request.QueryString.Count;

            if (qsCount > 0 && Request.QueryString["sta"] != null && Request.QueryString["tid"] != null)
            {
                TransactionRecord tr = new TransactionRecord();

                #region parsereference
                //tr.Status = Request.QueryString["sta"].ToString().Equals("0");
                tr.Status = false;
                if (Request.QueryString["sta"].ToString().Equals("0") && (Request.QueryString["ResultCode"].ToString().Equals("Y") || Request.QueryString["ResultCode"].ToString().Equals("M")))
                {
                    tr.Status = true;
                }
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Web payment transaction complete. Status: " + (tr.Status ? "Success" : "Failure"));

                String   refNo     = Request.QueryString["tid"].ToString();
                string[] refTokens = refNo.Split('_');
                if (refTokens.Length < 2)
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Response from gateway received but query string does not have information about the transaction refernece: " + refNo);
                    return;
                }

                tr.ReferenceNo = long.Parse(refTokens[0].ToString());
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Transaction reference: " + tr.ReferenceNo.ToString());

                string[] refSubTokens = refTokens[1].Split('~');
                if (refTokens.Length < 2)
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Tokenization of query string did not result in enough sub tokens. --> " + refNo);
                    return;
                }

                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmExBooking ID: " + refSubTokens[0]);
                tr.BookingID = long.Parse(refSubTokens[0]);

                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Agent Code: " + refSubTokens[1]);
                tr.AgentCode = refSubTokens[1];
                #endregion parsereference

                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Amount: " + Request.QueryString["amt"].ToString());
                tr.TotalAmount = decimal.Parse(Request.QueryString["amt"].ToString());

                if (true == tr.Status) //successful
                {
                    #region handlesuccess

                    #region parsereceipt
                    if (Request.QueryString["rec"] != null)
                    {
                        try
                        {
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEx Receipt: " + Request.QueryString["rec"]);
                            tr.ReceiptNo = Request.QueryString["rec"];
                        }
                        catch (Exception ex)
                        {
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Amex Resposne: Error parsing receipt.");
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(ex.Message);
                        }
                    }
                    #endregion parsereceipt

                    try
                    {
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("AmEX Payment Successful. Ensuring the seats are reserved...");
                        //****** Promo code usecase start here ************
                        KODHelper objKODHelper = new KODHelper();
                        tr = objKODHelper.GetRoyalCardDetails(tr);
                        tr = objKODHelper.GetPromotionDetails(tr);
                        //****** Promo code/RoyalCard usecase END here ************


                        if (tr.TopUpAmount != 0)
                        {
                            TransactionBOL.Top_UP(tr.TopUpTransactionId);
                        }
                        tr.AvailedAmount += tr.TopUpAmount;
                        if (tr.AvailedAmount != 0 || tr.AvailedPoints != 0)
                        {
                            TransactionBOL.Redeem_Points(tr.RegId, tr.AvailedAmount, tr.AvailedPoints, tr.TotalAmount, tr.Play, tr.MobileNo, tr.ReferenceNo.ToString(), tr.TotalSeats);
                        }

                        //****** Promo code usecase END here ************
                        DataTable dt = TransactionBOL.Get_Transaction_Detail(tr);
                        if (dt.Rows.Count == 0)
                        {
                            long      BookingID1 = long.Parse(tr.ReferenceNo.ToString());
                            DataTable dt1        = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID1);
                            ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt1.Rows[0], "");
                            //ReceiptUtils.SuccessPaymentResponse(tr.BookingID.ToString(), tr.ReceiptNo);
                        }
                        else
                        {
                            bool seatsBooked      = (int.Parse(dt.Rows[0]["SeatBooked"].ToString()) > 0);
                            bool alreadyProcessed = (dt.Rows[0]["AlreadyProcessed"].ToString() == "1");
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(string.Format("Amex [{0},{1},{2}] Seats Booked.", tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo));
                            if (!alreadyProcessed)
                            {
                                ReceiptUtils.SuccessPaymentResponse(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, System.Configuration.ConfigurationManager.AppSettings["RoyalCardAdminID"]);
                            }
                            qstring.Clear();
                            qstring.Append("?b=");
                            qstring.Append((seatsBooked) ? dt.Rows[0]["BookingID"].ToString() : dt.Rows[0]["ID"].ToString());
                        }
                    }
                    catch (Exception ex)
                    {
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Receipt: error getting transaction details - " + ex.Message);
                    }
                    #endregion handlesuccess
                }
                else //failure
                {
                    #region handlefailure
                    String _refNo = tr.ReferenceNo.ToString();
                    KoDTicketing.GTICKV.LogEntry(_refNo, "Payment Not Successful", "17", tr.BookingID.ToString());
                    GTICKBOL.ON_Session_out(_refNo);
                    KoDTicketing.GTICKV.LogEntry(_refNo, "Seats Unlocked", "18", tr.BookingID.ToString());
                    long      BookingID = long.Parse(tr.ReferenceNo.ToString());
                    DataTable dt        = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID);
                    ReceiptUtils.PaymentNotCaptureResponse(tr.ReceiptNo.ToString(), dt.Rows[0], "");
                    qstring.Append("err=pay");

                    KoDTicketing.GTICKV.LogEntry(tr.ReferenceNo.ToString(), "Error Occured -- Payment Not Successful", "19", tr.BookingID.ToString());
                    //long BookingID = long.Parse(tr.ReferenceNo.ToString());
                    try
                    {
                        //DataTable dt = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID);

                        if (dt.Rows.Count == 0)
                        {
                            ReceiptUtils.FailurePaymentResponse();
                        }
                        else
                        {
                            ReceiptUtils.FailurePaymentResponse(dt.Rows[0]);
                        }

                        qstring.Append((qstring.Length == 1) ? "err=seat" : "&err=seat");
                    }
                    catch (Exception ex)
                    {
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Error occurred processing unsuccessful payment..." + ex.Message);
                    }
                    #endregion handlefailure
                }
            }
            else
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Response from gateway received but query string does not have information about the transaction.");
                qstring.Append((qstring.Length == 1) ? "err=seat" : "&err=seat");
            }
        }
        catch (Exception ex)
        {
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Exception thrown processing receipt. " + ex.Message);
            qstring.Append((qstring.Length == 1) ? "err=seat" : "&err=seat");
        }

        Response.Redirect("~/RoyalCard/Account/Payment/Print-Receipt.aspx" + qstring.ToString(), false);
    }
Esempio n. 13
0
    protected String UpdateResponse(String trackid, String reference, String result, String postdate, String auth)
    {
        System.Text.StringBuilder qstring = new System.Text.StringBuilder();
        try
        {
            TransactionRecord tr = new TransactionRecord();

            string IpAddress = System.Configuration.ConfigurationManager.AppSettings["KoDTicketingIPAddress"];

            #region parsereference
            //HDFC Track ID: 1000109173_1100065925-WEB

            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Transaction reference: " + trackid);
            string   refNo     = trackid;
            string[] refTokens = refNo.Split(new char[] { '_', '-' });
            if (refTokens.Length < 3)
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Payment Response: Tokenization of reference string did not result in enough sub tokens. --> " + refNo);
                return("?err=pay");
            }

            tr.ReferenceNo = long.Parse(refTokens[0]);
            tr.BookingID   = long.Parse(refTokens[1]);
            tr.AgentCode   = refTokens[2];

            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(string.Format("HDFC Payment Response: Reference[{0}], Booking ID [{1}], Agent Code [{2}] ", tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.AgentCode));

            #endregion parsereference

            if (Request["amt"] != null)
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Amount: " + Request["amt"].ToString());
                tr.TotalAmount = decimal.Parse(Request["amt"].ToString());
            }

            if (Request["paymentid"] != null)
            {
                try
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Receipt: " + Request["paymentid"].ToString());
                    tr.ReceiptNo = Request["paymentid"].ToString();
                }
                catch (Exception ex)
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Response: Error parsing receipt.");
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(ex.Message);
                }
            }

            if (result == "CAPTURED")
            {
                # region CAPTURED
                //string retURL = UpdateResponseByTranId(status, amount, transactionId);
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC payment captured.");
                try
                {
                    //****** Promo code usecase start here ************
                    KODHelper objKODHelper = new KODHelper();
                    tr = objKODHelper.GetPromotionDetails(tr);
                    tr.PaymentGateway = "HDFC";
                    //****** Promo code usecase END here ************
                    TransactionBOL.Update_PaymentStatus(tr);     //Update payment status in temp transection table
                    DataTable dt = TransactionBOL.Get_Transaction_Detail(tr);

                    if (dt != null && dt.Rows.Count > 0)
                    {
                        try
                        {
                            //String dbamount = dt.Rows[0]["TotalAmount"].ToString();
                            //String dbTrackID = dt.Rows[0]["BookingID"].ToString() + "_" + dt.Rows[0]["ReferenceNo"].ToString() + "-" + dt.Rows[0]["AgentCode"].ToString();
                            ////Validating the Booking Amount and Track ID
                            //if (Request.QueryString["amt"].ToString() == dbamount && Request.QueryString["trackid"].ToString() == dbTrackID)
                            //{
                            bool seatsBooked      = (int.Parse(dt.Rows[0]["SeatBooked"].ToString()) > 0);
                            bool alreadyProcessed = (dt.Rows[0]["AlreadyProcessed"].ToString() == "1");
                            if (seatsBooked)
                            {
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Seats booked against HDFC payment.");
                            }
                            if (!alreadyProcessed)
                            {
                                if (dt.Rows[0]["PromotionCode"].ToString() == "MMT")
                                {
                                    DataTable dt1 = TransactionBOL.Select_MMTTransaction_REFIDWISE(tr.BookingID.ToString());
                                    ReceiptUtils.MMTPaymentResponse(dt.Rows[0], dt1.Rows[0], tr.ReceiptNo.ToString(), tr.BookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId2"), ConfigurationManager.AppSettings.Get("ConcertRefMailId3"), dt.Rows[0]["ShowTime"].ToString(), dt.Rows[0]["ShowDate"].ToString());
                                }
                                else if (dt.Rows[0]["PromotionCode"].ToString() == "MANA")
                                {
                                    DataTable dt2 = TransactionBOL.Select_MANATransaction_REFIDWISE(tr.BookingID.ToString());
                                    ReceiptUtils.MANAPaymentResponse(dt.Rows[0], dt2.Rows[0], tr.ReceiptNo.ToString(), tr.BookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId2"), ConfigurationManager.AppSettings.Get("ConcertRefMailId3"), dt.Rows[0]["ShowTime"].ToString(), dt.Rows[0]["ShowDate"].ToString());
                                }
                                else if (dt.Rows[0]["PromotionCode"].ToString() == "MCOTHERS" || dt.Rows[0]["PromotionCode"].ToString() == "MCWORLD")
                                {
                                    DataTable dt3 = TransactionBOL.Select_MCTransaction_REFIDWISE(tr.ReferenceNo.ToString());
                                    ReceiptUtils.MCPaymentResponse(dt.Rows[0], dt3.Rows[0], tr.ReceiptNo.ToString(), tr.BookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId2"), ConfigurationManager.AppSettings.Get("ConcertRefMailId3"), dt.Rows[0]["ShowTime"].ToString(), dt.Rows[0]["ShowDate"].ToString());
                                }
                                else if (dt.Rows[0]["PromotionCode"].ToString() == "JHUMROOOFFER")
                                {
                                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Enter into jhumroo offer mail content");
                                    ReceiptUtils.JHUMROOOFFERPaymentResponse(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, "");
                                }
                                else
                                {
                                    ReceiptUtils.SuccessPaymentResponse(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, "");
                                }
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Mail send through normal flow");
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Values are " + dt.Rows[0] + " , " + tr.ReferenceNo.ToString() + "," + tr.BookingID.ToString() + "," + tr.PromotionCode.ToString());
                                SendNotificationMailForHotels(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, tr.PromotionCode.ToString());
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Mail send through Hotel flow");
                            }
                            qstring.Append("?b=");
                            qstring.Append((seatsBooked) ? dt.Rows[0]["BookingID"].ToString() : dt.Rows[0]["ID"].ToString());
                            GTICKV.LogEntry(tr.ReferenceNo.ToString(), "HDFC Payment successful...", "16", tr.BookingID.ToString(), tr.ReceiptNo.ToString());
                            //}
                            //else
                            //{
                            //    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Amounts mismatch customer asked to call to confirm transaction.");
                            //    ReceiptUtils.SuccessPaymentResponse(tr.BookingID.ToString(), tr.ReceiptNo);
                            //}
                        }
                        catch (Exception ex)
                        {
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Error processing receipt post booking. " + ex.Message);
                            if (dt != null && dt.Rows.Count > 0 && (Convert.ToDateTime(dt.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.ToShortDateString()) || Convert.ToDateTime(dt.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.AddDays(-1).ToShortDateString())))
                            {
                                ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt.Rows[0], "");
                            }
                            //ReceiptUtils.SuccessPaymentResponse(tr.BookingID.ToString(), tr.ReceiptNo);
                            qstring.Append((qstring.Length == 0) ? "?err=seat" : "&err=seat");
                        }
                    }
                    else
                    {
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC successful booking but ask customer to call");;
                        long      BookingID1 = long.Parse(tr.ReferenceNo.ToString());
                        DataTable dt2        = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID1);
                        if (dt2 != null && dt2.Rows.Count > 0 && (Convert.ToDateTime(dt2.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.ToShortDateString()) || Convert.ToDateTime(dt2.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.AddDays(-1).ToShortDateString())))
                        {
                            ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt2.Rows[0], "");
                        }
                        //ReceiptUtils.SuccessPaymentResponse(tr.BookingID.ToString(), tr.ReceiptNo);
                        qstring.Append((qstring.Length == 0) ? "?err=seat" : "&err=seat");
                    }

                    return(qstring.ToString());
                }
                catch (Exception ex)
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Receipt: error getting transaction details - " + ex.Message); qstring.Append((qstring.Length == 0) ? "?err=seat" : "&err=seat");
                }
                //if you reach here problem occurred

                String _refNo = tr.ReferenceNo.ToString();
                KoDTicketing.GTICKV.LogEntry(_refNo, "HDFC Payment Not Successful", "25", tr.BookingID.ToString());
                GTICKBOL.ON_Session_out(_refNo);
                KoDTicketing.GTICKV.LogEntry(_refNo, "Seats Unlocked", "26", tr.BookingID.ToString());
                qstring.Append("err=pay");

                KoDTicketing.GTICKV.LogEntry(tr.ReferenceNo.ToString(), "HDFC Error Occurred -- Payment Not Successful", "27", tr.BookingID.ToString());
                long BookingID = long.Parse(tr.ReferenceNo.ToString());
                try
                {
                    DataTable dt = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID);

                    if (dt.Rows.Count == 0)
                    {
                        ReceiptUtils.FailurePaymentResponse();
                    }
                    else
                    {
                        ReceiptUtils.FailurePaymentResponse(dt.Rows[0]);
                    }
                    qstring.Append((qstring.Length == 1) ? "err=seat" : "&err=seat");
                    return(qstring.ToString());
                }
                catch (Exception ex)
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Error occurred processing unsuccessful payment..." + ex.Message);
                }

                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Final Call");
                Response.Redirect(IpAddress + "Payment/FinalCall.aspx" + qstring.ToString(), false);
                #endregion
            }
            else
            {
                GTICKV.LogEntry(tr.ReferenceNo.ToString(), "User Press Cancel Button", "15", tr.BookingID.ToString());
                GTICKV.LogEntry(tr.ReferenceNo.ToString(), "HDFC Payment Not Successful", "25", tr.BookingID.ToString());
                GTICKBOL.ON_Session_out(tr.ReferenceNo.ToString());
                GTICKV.LogEntry(tr.ReferenceNo.ToString(), "Seats Unlocked", "26", tr.BookingID.ToString());
                long      BookingID = long.Parse(tr.ReferenceNo.ToString());
                DataTable dt        = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID);
                if (dt != null && dt.Rows.Count > 0 && (Convert.ToDateTime(dt.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.ToShortDateString()) || Convert.ToDateTime(dt.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.AddDays(-1).ToShortDateString())))
                {
                    ReceiptUtils.PaymentNotCaptureResponse(tr.ReceiptNo.ToString(), dt.Rows[0], "");
                }
                qstring.Append("?err=pay");
            }
        }
Esempio n. 14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (Request.UrlReferrer != null)
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(Request.UrlReferrer.ToString());
            }

            if (!IsPostBack)
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Printing Receipt Parameters: " + Request.QueryString.Count.ToString());
                if (Session["bookid"] != null) //Voucher
                {
                    string bookid = Session["bookid"].ToString();
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Printing Receipt for purchase by voucher. Booking Id: " + bookid);
                    Session["bookid"] = null;
                    Session.Abandon();
                    Server.Transfer("Print-Receipt.aspx" + bookid);
                }
                else
                {
                    if (Request.QueryString["b"] != null)
                    {
                        #region paramB
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("[B] Printing Receipt For  " + Request.QueryString["b"].ToString());

                        long      BookingID = long.Parse(Request.QueryString["b"].ToString());
                        DataTable dt        = TransactionBOL.Select_Temptransaction_transactionIDWise(BookingID);
                        if (dt.Rows.Count > 0)
                        {
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("[B] Printing Receipt with transaction details for  " + Request.QueryString["b"].ToString());
                            dvDetails.Visible     = true;
                            dvErrorDetail.Visible = false;

                            DataRow dr        = dt.Rows[0];
                            int     chkstatus = int.Parse(dr["SeatBooked"].ToString());
                            lblVenue.Text    = "Kingdom of Dreams, Gurgaon";
                            lblshowname.Text = dr["play"].ToString();
                            lblSeatInfo.Text = dr["Category"] + " - " + dr["SeatInfo"].ToString();
                            lblPayMode.Text  = dr["PaymentType"].ToString();
                            //lbltranamt.Text = dr["TotalAmount"].ToString() + " INR";


                            decimal DiscountPercentage = decimal.Parse(dr["DiscountPercentage"].ToString());
                            decimal tktAmount          = decimal.Parse(dr["TotalAmount"].ToString());
                            int     numberOfSeats      = int.Parse(dr["TotalSeats"].ToString());
                            if (DiscountPercentage > 0)
                            {
                                decimal amtAfterDeduction = 0;
                                decimal SingleTicketPrice = tktAmount / numberOfSeats;

                                decimal DiscountedPrice = SingleTicketPrice - (SingleTicketPrice * DiscountPercentage / 100);
                                DiscountedPrice = decimal.Truncate(DiscountedPrice);
                                if (DiscountedPrice == 1274)
                                {
                                    DiscountedPrice = DiscountedPrice + 1;
                                }
                                else if (DiscountedPrice == 2124)
                                {
                                    DiscountedPrice = DiscountedPrice + 1;
                                }
                                else if (DiscountedPrice == 2974)
                                {
                                    DiscountedPrice = DiscountedPrice + 1;
                                }
                                else if (DiscountedPrice == 4249)
                                {
                                    DiscountedPrice = DiscountedPrice + 1;
                                }

                                amtAfterDeduction = DiscountedPrice * numberOfSeats;

                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Total Amount Price For a Ticket" + amtAfterDeduction.ToString());

                                lbltranamt.Text = Convert.ToString(amtAfterDeduction) + " INR";
                            }
                            else
                            {
                                lbltranamt.Text = dr["TotalAmount"].ToString() + " INR";
                                //added two fields
                                lblCardType.Text = Session["PayableAmount"].ToString() + "INR";
                                String Points  = Session["RedeemPoints"].ToString();
                                String Bal     = Session["RedeemBalance"].ToString();
                                Double RBal    = Convert.ToDouble(Bal);
                                Double RPoints = Convert.ToDouble(Points);
                                //Double Total = RBal + RPoints;
                                lblroyalcard.Text   = RBal.ToString();
                                lblroyalPoints.Text = RPoints.ToString();
                            }



                            if (chkstatus > 0)
                            {
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("[B] Printing Receipt with seats booked for " + Request.QueryString["b"].ToString());
                                lblBookingID.Text     = dr["BookingID"].ToString();
                                lblIdbiReceiptno.Text = dr["ReceiptNo"].ToString();
                                lbltransid.Text       = dr["ReferenceNo"].ToString();
                            }
                            else
                            {
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("[B] Printing Receipt with NO seats booked for " + Request.QueryString["b"].ToString());
                                dvErrorDetail.Visible = true;
                                lblIdbiReceiptno.Text = dr["ReferenceNo"].ToString();
                                lbltransid.Text       = dr["BookingID"].ToString();
                                lblFinalMess.Text     = "Your Transaction was successful, but your seats were not booked for some technical reason, please contact 0124 - 4528000 for Seat Confirmation";
                            }
                            lbltrnsresponse.Text = "Transaction Successful";
                            lblBookTime.Text     = Convert.ToDateTime(dr["DateOfBooking"]).ToLongDateString() + " at " + Convert.ToDateTime(dr["TimeOfBooking"]).ToShortTimeString();
                            lblShowDaTE.Text     = Convert.ToDateTime(dr["ShowDate"]).ToLongDateString() + " at " + Convert.ToDateTime(dr["ShowTime"]).ToShortTimeString();


                            ////*********Reedem Value when Top up the Payable Amount*********//
                            //string[] strarr = Session["seat_Val"].ToString().Split(',');
                            //Session["TotalSeats"] = int.Parse(strarr[5].ToString());

                            //string RegID = Session["Regid"].ToString();
                            //Decimal RedeemAmount = decimal.Parse(dr["TopUpAmount"].ToString());
                            //Decimal RedeemPoints = decimal.Parse(dr["AvailedPoints"].ToString());
                            //Decimal TotalAmount = decimal.Parse(dr["TotalAmount"].ToString());
                            //string Play = dr["play"].ToString();
                            //string CustomerNo = Session["MobileNo"].ToString();
                            //string ReferenceNO = (long.Parse(dr["BookingID"].ToString())).ToString();
                            //int NoOfTickets = Convert.ToInt32(Session["TotalSeats"].ToString());
                            //Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Print Receipt 2 redeem");
                            //TransactionBOL.Redeem_Points(RegID, RedeemAmount, RedeemPoints, TotalAmount, Play, CustomerNo, ReferenceNO, NoOfTickets);
                            ////****************//

                            //printing bar code here
                            toBarCode(BookingID.ToString());
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("[B] Printing Receipt Done for " + Request.QueryString["b"].ToString());
                        }
                        #endregion
                    }
                    else if (Request.QueryString["err"] != null)
                    {
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Received Print Receipt with err value..." + Request.QueryString["err"].ToString());
                        string err = Request.QueryString["err"].ToString();
                        if (err == "pay")
                        {
                            lblFinalMess.Text = "Your transaction was not successful. Please try later.";
                            if (Request["ErrorText"] != null)
                            {
                                lblFinalMess.Text += Environment.NewLine + "Transaction failed because" + Request["ErrorText"].ToString();
                            }
                        }
                        else if (err == "seat")
                        {
                            lblFinalMess.Text = "Your payment transaction was successful, but your seats were not booked due to technical glitch, please contact (0124)4528000 for Seat Confirmation. Sorry for inconvenience.";
                            //*********Reedem Value when Top up the Payable Amount*********//
                            //long BookingID = long.Parse(Session["BookingID"].ToString());
                            //DataTable dt = TransactionBOL.Select_Temptransaction_transactionIDWise(BookingID);
                            //DataRow dr = dt.Rows[0];
                            //string RegID = Session["Regid"].ToString();
                            //Decimal RedeemAmount = decimal.Parse(dr["TopUpAmount"].ToString());
                            //Decimal RedeemPoints = decimal.Parse(dr["AvailedPoints"].ToString());
                            //Decimal TotalAmount = decimal.Parse(dr["TotalAmount"].ToString());
                            //string Play = dr["play"].ToString();
                            //string CustomerNo = Session["MobileNo"].ToString();
                            //string ReferenceNO = (long.Parse(dr["BookingID"].ToString())).ToString();
                            //int NoOfTickets = Convert.ToInt32(Session["TotalSeats"].ToString());
                            //Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Print Receipt 3 redeem");
                            //TransactionBOL.Redeem_Points(RegID, RedeemAmount, RedeemPoints, TotalAmount, Play, CustomerNo, ReferenceNO, NoOfTickets);
                            ////****************//
                        }
                        dvDetails.Visible     = false;
                        dvErrorDetail.Visible = true;
                        lblDate.Text          = System.DateTime.Now.ToString();
                    }
                    else
                    {
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Payable Amount Session = " + Session["PayableAmount"].ToString());
                        if (Session["PayableAmount"] != null || Session["PayableAmount"].ToString() == "0")
                        {
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("[B] Printing Receipt For  " + Session["ID"].ToString());

                            long BookingID = long.Parse(Session["ID"].ToString());


                            TransactionRecord tr = new TransactionRecord();
                            tr.BookingID   = BookingID;
                            tr.AgentCode   = "WEB";
                            tr.ReferenceNo = long.Parse(Session["BookingID"].ToString());

                            string[] strarr = Session["seat_Val"].ToString().Split(',');
                            Session["TotalSeats"] = int.Parse(strarr[5].ToString());

                            string  RegID        = Session["Regid"].ToString();
                            Decimal RedeemAmount = Convert.ToDecimal(Session["RedeemBalance"].ToString());
                            Decimal RedeemPoints = Convert.ToDecimal(Session["RedeemPoints"].ToString());
                            Decimal TotalAmount  = Convert.ToDecimal(Session["TotalAmount"].ToString());
                            string  Play         = Session["play_Val"].ToString();
                            string  CustomerNo   = Session["MobileNo"].ToString();
                            string  ReferenceNO  = (long.Parse(Session["BookingID"].ToString())).ToString();
                            int     NoOfTickets  = Convert.ToInt32(Session["TotalSeats"].ToString());
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Print Receipt 1 redeem");
                            TransactionBOL.Redeem_Points(RegID, RedeemAmount, RedeemPoints, TotalAmount, Play, CustomerNo, ReferenceNO, NoOfTickets);
                            DataTable dtTr = TransactionBOL.Get_Transaction_Detail(tr);

                            if (dtTr != null && dtTr.Rows.Count > 0)
                            {
                                try
                                {
                                    bool seatsBooked      = (int.Parse(dtTr.Rows[0]["SeatBooked"].ToString()) > 0);
                                    bool alreadyProcessed = (dtTr.Rows[0]["AlreadyProcessed"].ToString() == "1");
                                    if (!alreadyProcessed)
                                    {
                                        ReceiptUtils.SuccessPaymentResponse(seatsBooked, dtTr.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, System.Configuration.ConfigurationManager.AppSettings["RoyalCardAdminID"]);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("RoyalCard Payment Receipt - No Money Payed" + ex.Message);
                                    //DataTable dt = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID);
                                    ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dtTr.Rows[0], "");
                                    //ReceiptUtils.SuccessPaymentResponse(tr.BookingID.ToString(), tr.ReceiptNo);
                                }
                            }

                            DataTable dt = TransactionBOL.Select_Temptransaction_transactionIDWise(BookingID);
                            if (dt.Rows.Count > 0)
                            {
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("[B] Printing Receipt with transaction details for  " + Session["ID"].ToString());
                                dvDetails.Visible     = true;
                                dvErrorDetail.Visible = false;

                                DataRow dr        = dt.Rows[0];
                                int     chkstatus = int.Parse(dr["SeatBooked"].ToString());
                                lblBookingID.Text     = dr["BookingID"].ToString();
                                lbltransid.Text       = dr["ReferenceNo"].ToString();
                                lblVenue.Text         = "Kingdom of Dreams, Gurgaon";
                                lblshowname.Text      = dr["play"].ToString();
                                lblShowDaTE.Text      = Convert.ToDateTime(dr["ShowDate"]).ToLongDateString() + " at " + Convert.ToDateTime(dr["ShowTime"]).ToShortTimeString();
                                lblSeatInfo.Text      = dr["Category"] + " - " + dr["SeatInfo"].ToString();
                                lblIdbiReceiptno.Text = dr["ReceiptNo"].ToString();
                                lblPayMode.Text       = "RoyalCard";
                                lbltranamt.Text       = dr["TotalAmount"].ToString() + " INR";
                                lblCardType.Text      = Session["PayableAmount"].ToString() + " INR";
                                String Points  = Session["RedeemPoints"].ToString();
                                String Bal     = Session["RedeemBalance"].ToString();
                                Double RBal    = Convert.ToDouble(Bal);
                                Double RPoints = Convert.ToDouble(Points);
                                //Double Total = RBal + RPoints;
                                lblroyalcard.Text    = RBal.ToString();
                                lblroyalPoints.Text  = RPoints.ToString();
                                lblBookTime.Text     = Convert.ToDateTime(dr["DateOfBooking"]).ToLongDateString() + " at " + Convert.ToDateTime(dr["TimeOfBooking"]).ToShortTimeString();
                                lbltrnsresponse.Text = "Transaction Successful";

                                toBarCode(BookingID.ToString());
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("[B] Printing Receipt Done for " + Session["ID"].ToString());
                            }
                        }
                        else
                        {
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Received Print Receipt without parameter...");
                            dvErrorDetail.Visible = true;
                            dvDetails.Visible     = false;
                            lblFinalMess.Text     = "Sorry your payment transaction was not successful, please try again after some time.";
                        }
                    }
                }
                lblDate.Text = "Date : " + System.DateTime.Now.ToString();
            }
        }
        catch (Exception ex)
        {
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Error Printing Receipt For " + ex.Message);
        }
    }
Esempio n. 15
0
    protected void HandleSuccess(ref TransactionRecord tr, ref System.Text.StringBuilder qstring)
    {
        qstring.Clear();

        #region handlesuccess
        GTICKV.LogEntry(tr.ReferenceNo.ToString(), "IDBI Payment successful...", "10", tr.BookingID.ToString(), tr.ReceiptNo.ToString());

        #region parsereceipt
        if (Request.QueryString["rec"] != null)
        {
            try
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Receipt: " + Request.QueryString["rec"]);
                tr.SummerReceiptNo = Request.QueryString["rec"].ToString();
            }
            catch (Exception ex)
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Response: Error parsing receipt.");
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(ex.Message);
            }
        }
        #endregion parsereceipt

        try
        {
            ////****** Promo code usecase start here ************
            //KODHelper objKODHelper = new KODHelper();
            //tr = objKODHelper.GetPromotionDetails(tr);
            ////****** Promo code usecase END here ************
            TransactionBOL.Get_Summer_Detail(tr.SummerBookingID, tr.SummerReceiptNo);
            DataTable dt = TransactionBOL.Select_SummerTransaction_REFIDWISE(tr.SummerBookingID.ToString());
            if (dt != null && dt.Rows.Count > 0)
            {
                bool seatsBooked = (dt.Rows[0]["IsPaymentSuccess"].ToString() == "1");
                ReceiptUtils.SummerPaymentResponse(dt.Rows[0], tr.SummerReceiptNo.ToString(), tr.SummerBookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId"), ConfigurationManager.AppSettings.Get("ConcertRefMailId1"));
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Mail send through normal flow");
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Values are " + dt.Rows[0] + " , " + tr.SummerReceiptNo.ToString() + "," + tr.SummerBookingID.ToString());
                //SendNotificationMailForHotels(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, tr.PromotionCode.ToString());
                //Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Mail send through Hotel flow");
                qstring.Clear();
                qstring.Append("?b=");
                qstring.Append((seatsBooked) ? dt.Rows[0]["BookingID"].ToString() : dt.Rows[0]["ID"].ToString());
            }
            else
            {
                long      BookingID1 = long.Parse(tr.ReferenceNo.ToString());
                DataTable dt1        = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID1);
                ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt1.Rows[0], "");
                //ReceiptUtils.SuccessPaymentResponse(tr.SummerBookingID.ToString(), tr.SummerReceiptNo);
                qstring.Append("?err=seat");
            }
        }
        catch (Exception ex)
        {
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Receipt: error getting transaction details - " + ex.Message);
            HandleFailure(tr);
            long      BookingID1 = long.Parse(tr.ReferenceNo.ToString());
            DataTable dt1        = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID1);
            ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt1.Rows[0], "");
            qstring.Append("?err=seat");
        }
        #endregion handlesuccess
    }
Esempio n. 16
0
    protected void HandleSuccess(ref TransactionRecord tr, ref System.Text.StringBuilder qstring)
    {
        qstring.Clear();

        #region handlesuccess
        GTICKV.LogEntry(tr.ReferenceNo.ToString(), "IDBI Payment successful...", "16", tr.BookingID.ToString(), tr.ReceiptNo.ToString());

        #region parsereceipt
        if (Request.QueryString["rec"] != null)
        {
            try
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Receipt: " + Request.QueryString["rec"]);
                tr.ReceiptNo = Request.QueryString["rec"].ToString();
            }
            catch (Exception ex)
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Response: Error parsing receipt.");
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(ex.Message);
            }
        }
        #endregion parsereceipt

        try
        {
            //****** Promo code usecase start here ************
            KODHelper objKODHelper = new KODHelper();
            tr = objKODHelper.GetPromotionDetails(tr);
            tr.PaymentGateway = "IDBI";
            //****** Promo code usecase END here ************
            TransactionBOL.Update_PaymentStatus(tr);     //Update payment status in temp transection table
            DataTable dt = TransactionBOL.Get_Transaction_Detail(tr);


            if (dt != null && dt.Rows.Count > 0)
            {
                bool seatsBooked      = (dt.Rows[0]["SeatBooked"].ToString() == "1");
                bool alreadyProcessed = (dt.Rows[0]["AlreadyProcessed"].ToString() == "1");
                if (seatsBooked)
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Transaction : Seats Booked for " + tr.BookingID.ToString());
                }
                if (!alreadyProcessed)
                {
                    if (dt.Rows[0]["PromotionCode"].ToString() == "MMT")
                    {
                        DataTable dt1 = TransactionBOL.Select_MMTTransaction_REFIDWISE(tr.BookingID.ToString());
                        ReceiptUtils.MMTPaymentResponse(dt.Rows[0], dt1.Rows[0], tr.ReceiptNo.ToString(), tr.BookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId2"), ConfigurationManager.AppSettings.Get("ConcertRefMailId3"), dt.Rows[0]["ShowTime"].ToString(), dt.Rows[0]["ShowDate"].ToString());
                    }
                    else if (dt.Rows[0]["PromotionCode"].ToString() == "MANA")
                    {
                        DataTable dt2 = TransactionBOL.Select_MANATransaction_REFIDWISE(tr.BookingID.ToString());
                        ReceiptUtils.MANAPaymentResponse(dt.Rows[0], dt2.Rows[0], tr.ReceiptNo.ToString(), tr.BookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId2"), ConfigurationManager.AppSettings.Get("ConcertRefMailId3"), dt.Rows[0]["ShowTime"].ToString(), dt.Rows[0]["ShowDate"].ToString());
                    }
                    else if (dt.Rows[0]["PromotionCode"].ToString() == "MCOTHERS" || dt.Rows[0]["PromotionCode"].ToString() == "MCWORLD")
                    {
                        DataTable dt3 = TransactionBOL.Select_MCTransaction_REFIDWISE(tr.ReferenceNo.ToString());
                        ReceiptUtils.MCPaymentResponse(dt.Rows[0], dt3.Rows[0], tr.ReceiptNo.ToString(), tr.BookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId2"), ConfigurationManager.AppSettings.Get("ConcertRefMailId3"), dt.Rows[0]["ShowTime"].ToString(), dt.Rows[0]["ShowDate"].ToString());
                    }
                    else if (dt.Rows[0]["PromotionCode"].ToString() == "JHUMROOOFFER")
                    {
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Enter into jhumroo offer mail content");
                        ReceiptUtils.JHUMROOOFFERPaymentResponse(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, "");
                    }
                    else
                    {
                        ReceiptUtils.SuccessPaymentResponse(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, "");
                    }
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Mail send through normal flow");
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Values are " + dt.Rows[0] + " , " + tr.ReferenceNo.ToString() + "," + tr.BookingID.ToString() + "," + tr.PromotionCode.ToString());
                    SendNotificationMailForHotels(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, tr.PromotionCode.ToString());
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Mail send through Hotel flow");
                }
                qstring.Clear();
                qstring.Append("?b=");
                qstring.Append((seatsBooked) ? dt.Rows[0]["BookingID"].ToString() : dt.Rows[0]["ID"].ToString());
            }
            else
            {
                long      BookingID1 = long.Parse(tr.ReferenceNo.ToString());
                DataTable dt2        = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID1);
                if (dt2 != null && dt2.Rows.Count > 0 && (Convert.ToDateTime(dt2.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.ToShortDateString()) || Convert.ToDateTime(dt2.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.AddDays(-1).ToShortDateString())))
                {
                    ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt2.Rows[0], "");
                }
                //ReceiptUtils.SuccessPaymentResponse(tr.BookingID.ToString(), tr.ReceiptNo);
                qstring.Append("?err=seat");
            }
        }
        catch (Exception ex)
        {
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Receipt: error getting transaction details - " + ex.Message);
            HandleFailure(tr);
            long      BookingID1 = long.Parse(tr.ReferenceNo.ToString());
            DataTable dt1        = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID1);
            if (dt1 != null && dt1.Rows.Count > 0 && (Convert.ToDateTime(dt1.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.ToShortDateString()) || Convert.ToDateTime(dt1.Rows[0]["DateOfBooking"].ToString()) == Convert.ToDateTime(DateTime.Now.Date.AddDays(-1).ToShortDateString())))
            {
                ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt1.Rows[0], "");
            }
            qstring.Append("?err=seat");
        }
        #endregion handlesuccess
    }
Esempio n. 17
0
    protected void HandleSuccess(ref TransactionRecord tr, ref System.Text.StringBuilder qstring)
    {
        qstring.Clear();

        #region handlesuccess
        GTICKV.LogEntry(tr.ReferenceNo.ToString(), "IDBI Payment successful...", "10", tr.BookingID.ToString(), tr.ReceiptNo.ToString());

        #region parsereceipt
        if (Request.QueryString["rec"] != null)
        {
            try
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Receipt: " + Request.QueryString["rec"]);
                tr.ReceiptNo = Request.QueryString["rec"].ToString();
            }
            catch (Exception ex)
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Response: Error parsing receipt.");
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(ex.Message);
            }
        }
        #endregion parsereceipt

        try
        {
            //****** Promo code/RoyalCard usecase start here ************
            KODHelper objKODHelper = new KODHelper();
            tr = objKODHelper.GetRoyalCardDetails(tr);
            tr = objKODHelper.GetPromotionDetails(tr);
            //****** Promo code/RoyalCard usecase END here ************


            if (tr.TopUpAmount != 0)
            {
                TransactionBOL.Top_UP(tr.TopUpTransactionId);
            }
            tr.AvailedAmount += tr.TopUpAmount;
            if (tr.AvailedAmount != 0 || tr.AvailedPoints != 0)
            {
                TransactionBOL.Redeem_Points(tr.RegId, tr.AvailedAmount, tr.AvailedPoints, tr.TotalAmount, tr.Play, tr.MobileNo, tr.ReferenceNo.ToString(), tr.TotalSeats);
            }

            DataTable dt = TransactionBOL.Get_Transaction_Detail(tr);
            if (dt != null && dt.Rows.Count > 0)
            {
                bool seatsBooked      = (dt.Rows[0]["SeatBooked"].ToString() == "1");
                bool alreadyProcessed = (dt.Rows[0]["AlreadyProcessed"].ToString() == "1");
                if (seatsBooked)
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Transaction : Seats Booked for " + tr.BookingID.ToString());
                }
                if (!alreadyProcessed)
                {
                    ReceiptUtils.SuccessPaymentResponse(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, System.Configuration.ConfigurationManager.AppSettings["RoyalCardAdminID"]);
                }
                qstring.Clear();
                qstring.Append("?b=");
                qstring.Append((seatsBooked) ? dt.Rows[0]["BookingID"].ToString() : dt.Rows[0]["ID"].ToString());
            }
            else
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI successful booking but ask customer to call");
                long      BookingID1 = long.Parse(tr.ReferenceNo.ToString());
                DataTable dt1        = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID1);
                ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt1.Rows[0], "");
                //ReceiptUtils.SuccessPaymentResponse(tr.BookingID.ToString(), tr.ReceiptNo);
                qstring.Append("?err=seat");
            }
        }
        catch (Exception ex)
        {
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("IDBI Receipt: error getting transaction details - " + ex.Message);
            HandleFailure(tr);
            long      BookingID1 = long.Parse(tr.ReferenceNo.ToString());
            DataTable dt1        = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID1);
            ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt1.Rows[0], "");
            qstring.Append("?err=seat");
        }
        #endregion handlesuccess
    }
Esempio n. 18
0
    protected String UpdateResponse(String trackid, String reference, String result, String postdate, String auth)
    {
        System.Text.StringBuilder qstring = new System.Text.StringBuilder();
        try
        {
            TransactionRecord tr = new TransactionRecord();

            string IpAddress = System.Configuration.ConfigurationManager.AppSettings["KoDTicketingIPAddress"];

            #region parsereference
            //HDFC Track ID: 1000109173_1100065925-WEB

            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Transaction reference: " + trackid);
            string   refNo     = trackid;
            string[] refTokens = refNo.Split(new char[] { '_', '-' });
            if (refTokens.Length < 3)
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Payment Response: Tokenization of reference string did not result in enough sub tokens. --> " + refNo);
                return("?err=pay");
            }

            tr.ReferenceNo = long.Parse(refTokens[0]);
            tr.BookingID   = long.Parse(refTokens[1]);
            tr.AgentCode   = refTokens[2];

            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(string.Format("HDFC Payment Response: Reference[{0}], Booking ID [{1}], Agent Code [{2}] ", tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.AgentCode));

            #endregion parsereference

            if (Request["amt"] != null)
            {
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Amount: " + Request["amt"].ToString());
                tr.TotalAmount = decimal.Parse(Request["amt"].ToString());
            }

            if (Request["paymentid"] != null)
            {
                try
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Receipt: " + Request["paymentid"].ToString());
                    tr.ReceiptNo = Request["paymentid"].ToString();
                }
                catch (Exception ex)
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Response: Error parsing receipt.");
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(ex.Message);
                }
            }

            if (result == "CAPTURED")
            {
                # region CAPTURED
                //string retURL = UpdateResponseByTranId(status, amount, transactionId);
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC payment captured.");
                try
                {
                    //****** Promo code/RoyalCard usecase start here ************
                    KODHelper objKODHelper = new KODHelper();
                    tr = objKODHelper.GetRoyalCardDetails(tr);
                    tr = objKODHelper.GetPromotionDetails(tr);
                    //****** Promo code/RoyalCard usecase END here ************


                    if (tr.TopUpAmount != 0)
                    {
                        TransactionBOL.Top_UP(tr.TopUpTransactionId);
                    }
                    tr.AvailedAmount += tr.TopUpAmount;
                    if (tr.AvailedAmount != 0 || tr.AvailedPoints != 0)
                    {
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Return Receipt HDFC 1 redeem");
                        TransactionBOL.Redeem_Points(tr.RegId, tr.AvailedAmount, tr.AvailedPoints, tr.TotalAmount, tr.Play, tr.MobileNo, tr.ReferenceNo.ToString(), tr.TotalSeats);
                    }

                    DataTable dt = TransactionBOL.Get_Transaction_Detail(tr);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        try
                        {
                            //String dbamount = dt.Rows[0]["TotalAmount"].ToString();
                            //String dbTrackID = dt.Rows[0]["BookingID"].ToString() + "_" + dt.Rows[0]["ReferenceNo"].ToString() + "-" + dt.Rows[0]["AgentCode"].ToString();
                            ////Validating the Booking Amount and Track ID
                            //if (Request.QueryString["amt"].ToString() == dbamount && Request.QueryString["trackid"].ToString() == dbTrackID)
                            //{
                            bool seatsBooked      = (int.Parse(dt.Rows[0]["SeatBooked"].ToString()) > 0);
                            bool alreadyProcessed = (dt.Rows[0]["AlreadyProcessed"].ToString() == "1");
                            if (seatsBooked)
                            {
                                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Seats booked against HDFC payment.");
                            }
                            if (!alreadyProcessed)
                            {
                                ReceiptUtils.SuccessPaymentResponse(seatsBooked, dt.Rows[0], tr.ReferenceNo.ToString(), tr.BookingID.ToString(), tr.ReceiptNo, System.Configuration.ConfigurationManager.AppSettings["RoyalCardAdminID"]);
                            }
                            qstring.Append("?b=");
                            qstring.Append((seatsBooked) ? dt.Rows[0]["BookingID"].ToString() : dt.Rows[0]["ID"].ToString());
                            GTICKV.LogEntry(tr.ReferenceNo.ToString(), "HDFC Payment successful...", "10", tr.BookingID.ToString(), tr.ReceiptNo.ToString());
                            //}
                            //else
                            //{
                            //    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Amounts mismatch customer asked to call to confirm transaction.");
                            //    ReceiptUtils.SuccessPaymentResponse(tr.BookingID.ToString(), tr.ReceiptNo);
                            //}
                        }
                        catch (Exception ex)
                        {
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Error processing receipt post booking. " + ex.Message);
                            ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt.Rows[0], "");
                            //ReceiptUtils.SuccessPaymentResponse(tr.BookingID.ToString(), tr.ReceiptNo);
                            qstring.Append((qstring.Length == 0) ? "?err=seat" : "&err=seat");
                        }
                    }
                    else
                    {
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC successful booking but ask customer to call");;
                        long      BookingID1 = long.Parse(tr.ReferenceNo.ToString());
                        DataTable dt1        = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID1);
                        ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt1.Rows[0], "");
                        //ReceiptUtils.SuccessPaymentResponse(tr.BookingID.ToString(), tr.ReceiptNo);
                        qstring.Append((qstring.Length == 0) ? "?err=seat" : "&err=seat");
                    }

                    return(qstring.ToString());
                }
                catch (Exception ex)
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Receipt: error getting transaction details - " + ex.Message); qstring.Append((qstring.Length == 0) ? "?err=seat" : "&err=seat");
                }
                //if you reach here problem occurred

                String _refNo = tr.ReferenceNo.ToString();
                KoDTicketing.GTICKV.LogEntry(_refNo, "HDFC Payment Not Successful", "17", tr.BookingID.ToString());
                GTICKBOL.ON_Session_out(_refNo);
                KoDTicketing.GTICKV.LogEntry(_refNo, "Seats Unlocked", "18", tr.BookingID.ToString());
                qstring.Append("err=pay");

                KoDTicketing.GTICKV.LogEntry(tr.ReferenceNo.ToString(), "HDFC Error Occurred -- Payment Not Successful", "19", tr.BookingID.ToString());
                long BookingID = long.Parse(tr.ReferenceNo.ToString());
                try
                {
                    DataTable dt = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID);

                    if (dt.Rows.Count == 0)
                    {
                        ReceiptUtils.FailurePaymentResponse();
                    }
                    else
                    {
                        ReceiptUtils.FailurePaymentResponse(dt.Rows[0]);
                    }
                    qstring.Append((qstring.Length == 1) ? "err=seat" : "&err=seat");
                    return(qstring.ToString());
                }
                catch (Exception ex)
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Error occurred processing unsuccessful payment..." + ex.Message);
                }

                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Final Call");
                Response.Redirect(IpAddress + "RoyalCard/Account/Payment/FinalCall.aspx" + qstring.ToString(), false);
                #endregion
            }
            else
            {
                GTICKV.LogEntry(tr.ReferenceNo.ToString(), "HDFC Payment Not Successful", "17", tr.BookingID.ToString());
                GTICKBOL.ON_Session_out(tr.ReferenceNo.ToString());
                GTICKV.LogEntry(tr.ReferenceNo.ToString(), "Seats Unlocked", "18", tr.BookingID.ToString());
                long      BookingID = long.Parse(tr.ReferenceNo.ToString());
                DataTable dt        = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID);
                ReceiptUtils.PaymentNotCaptureResponse(tr.ReceiptNo.ToString(), dt.Rows[0], "");
                qstring.Append("?err=pay");
            }
        }