Exemple #1
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.NYBookingID = 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.NYBookingID.ToString(), tr.AgentCode));
            #endregion parsereference

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

            if (Request["paymentid"] != null)
            {
                try
                {
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Receipt: " + Request["paymentid"].ToString());
                    tr.NYReceiptNo = 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 NYBookingID = tr.NYBookingID.ToString();
                    TransactionBOL.Get_BollyLand_Detail(tr.NYBookingID, tr.NYReceiptNo);
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Going to Fetch Details of Booking Id from DB.Booking ID where" + NYBookingID);
                    DataTable dt = TransactionBOL.Select_BollyLandTransaction_REFIDWISE(tr.NYBookingID.ToString());
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Fetched Details of Booking Id from DB.Booking ID where" + NYBookingID);
                    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.NYBookingID.ToString());
                            ReceiptUtils.BollyLandPaymentResponse(dt.Rows[0], tr.NYReceiptNo.ToString(), tr.BookingID.ToString(), ConfigurationManager.AppSettings.Get("ConcertRefMailId1"));
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("HDFC Payment successful..." + tr.NYBookingID.ToString() + tr.NYReceiptNo.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.NYBookingID.ToString(), tr.NYReceiptNo);
                            ReceiptUtils.SuccessPaymentResponse(tr.ReceiptNo.ToString(), dt.Rows[0], "");
                            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.NYBookingID.ToString(), tr.NYReceiptNo);
                        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.NYBookingID.ToString();
                KoDTicketing.GTICKV.LogEntry(_refNo, "HDFC Payment Not Successful", "17", tr.NYBookingID.ToString());
                //GTICKBOL.ON_Session_out(_refNo);
                KoDTicketing.GTICKV.LogEntry(_refNo, "Seats Unlocked", "18", tr.NYBookingID.ToString());
                qstring.Append("err=pay");

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