Exemplo n.º 1
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
    }
Exemplo n.º 2
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;

            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.ReferenceNo = long.Parse(refTokens[0]);
            tr.SummerBookingID = refNo;
            //tr.AgentCode = refTokens[2];

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

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

            if (Request["paymentid"] != null)
            {
                try
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Receipt: " + Request["paymentid"].ToString());
                    tr.SummerReceiptNo = 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 summerBookingID = tr.SummerBookingID.ToString();
                    TransactionBOL.Get_Summer_Detail(tr.SummerBookingID, tr.SummerReceiptNo);
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Going to Fetch Details of Booking Id from DB.Booking ID where" + summerBookingID);
                    DataTable dt = TransactionBOL.Select_SummerTransaction_REFIDWISE(tr.SummerBookingID.ToString());
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Fetched Details of Booking Id from DB.Booking ID where" + summerBookingID);
                    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.SummerBookingID.ToString());
                            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("HDFC Payment successful..." + tr.SummerBookingID.ToString() + tr.SummerReceiptNo.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.SummerBookingID.ToString(), tr.SummerReceiptNo);
                            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.SummerBookingID.ToString(), tr.SummerReceiptNo);
                        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.MMTBookingID.ToString();
                KoDTicketing.GTICKV.LogEntry(_refNo, "HDFC Payment Not Successful", "17", tr.SummerBookingID.ToString());
                //GTICKBOL.ON_Session_out(_refNo);
                KoDTicketing.GTICKV.LogEntry(_refNo, "Seats Unlocked", "18", tr.SummerBookingID.ToString());
                qstring.Append("err=pay");

                KoDTicketing.GTICKV.LogEntry(tr.SummerReceiptNo.ToString(), "HDFC Error Occurred -- Payment Not Successful", "19", tr.SummerBookingID.ToString());
                string BookingID = tr.SummerBookingID.ToString();
                try
                {
                    DataTable dt = TransactionBOL.Select_SummerTransaction_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 + "SumerCamp/HDFC/FinalCall.aspx" + qstring.ToString(), false);
                #endregion
            }
            else
            {
                GTICKV.LogEntry(tr.SummerReceiptNo.ToString(), "HDFC Payment Not Successful", "17", tr.SummerBookingID.ToString());
                //GTICKBOL.ON_Session_out(tr.ReferenceNo.ToString());
                GTICKV.LogEntry(tr.SummerReceiptNo.ToString(), "Seats Unlocked", "18", tr.SummerBookingID.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");
            }
        }