Example #1
0
 public XObjs.InterSwitchPostFields getISWtransactionByTransactionID(string txnref)
 {
     XObjs.InterSwitchPostFields x = new XObjs.InterSwitchPostFields();
     SqlConnection connection = new SqlConnection(this.ConnectXpay());
     SqlCommand command = new SqlCommand("SELECT * FROM InterSwitchPostFields WHERE txn_ref='" + txnref + "' ", connection);
     connection.Open();
     SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
     while (reader.Read())
     {
         x.xid = reader["xid"].ToString();
         x.product_id = reader["product_id"].ToString();
         x.amount = reader["amount"].ToString();
         x.isw_conv_fee = reader["isw_conv_fee"].ToString();
         x.currency = reader["currency"].ToString();
         x.site_redirect_url = reader["site_redirect_url"].ToString();
         x.txn_ref = reader["txn_ref"].ToString();
         x.hash = reader["hash"].ToString();
         x.mackey = reader["mackey"].ToString();
         x.pay_item_id = reader["pay_item_id"].ToString();
         x.site_name = reader["site_name"].ToString();
         x.cust_id = reader["cust_id"].ToString();
         x.cust_id_desc = reader["cust_id_desc"].ToString();
         x.cust_name = reader["cust_name"].ToString();
         x.resp_desc = reader["resp_desc"].ToString();
         x.pay_item_name = reader["pay_item_name"].ToString();
         x.local_date_time = reader["local_date_time"].ToString();
         x.TransactionDate = reader["TransactionDate"].ToString();
         x.MerchantReference = reader["MerchantReference"].ToString();
         x.trans_status = reader["trans_status"].ToString();
         x.pay_ref = reader["pay_ref"].ToString();
         x.ret_ref = reader["ret_ref"].ToString();
         x.xreg_date = reader["xreg_date"].ToString();
         x.xvisible = reader["xvisible"].ToString();
         x.xsync = reader["xsync"].ToString();
     }
     reader.Close();
     return x;
 }
 protected void btnSearch_Click(object sender, EventArgs e)
 {
     this.xsearch = this.txt_status.Text.Trim();
     string txnref;
     if (this.xsearch.Contains("-"))
     {
         txnref = this.xsearch.Trim().Split(new char[]
         {
             '-'
         })[0];
     }
     else
     {
         txnref = this.xsearch;
     }
     this.c_twall = this.ret.getTwalletByTransIDAdminID(txnref, this.adminID, this.agentType);
     this.c_app = this.ret.getApplicantByID(this.c_twall.applicantID);
     if (this.c_twall.xid != null)
     {
         if (this.c_twall.xgt == "xpay_bk")
         {
             this.xgt_type = "Bank";
         }
         else
         {
             if (this.c_twall.xgt == "xpay_isw")
             {
                 this.xgt_type = "Inter switch";
             }
             else
             {
                 this.xgt_type = "None";
             }
         }
         if (this.c_twall.xpay_status == "1")
         {
             this.payment_status = "Paid";
         }
         else
         {
             if (this.c_twall.xpay_status == "2")
             {
                 this.payment_status = "Pending";
             }
             else
             {
                 this.payment_status = "Failed";
             }
         }
         this.Session["c_twall"] = this.c_twall;
         this.lt_fdets = this.ret.getFee_detailsByTwalletID(this.c_twall.xid);
         if (this.lt_fdets.Count > 0)
         {
             this.Session["lt_fdets"] = this.lt_fdets;
         }
         this.lt_hwall = this.ret.getHwalletByTransID(txnref);
         this.isw_fields = this.ret.getISWtransactionByTransactionID(txnref);
         this.isw_fields.TransactionDate = this.isw_fields.TransactionDate.Substring(0, 11).Trim();
         int num = 1;
         int num2 = 0;
         foreach (XObjs.Hwallet current in this.lt_hwall)
         {
             XObjs.PaymentReciept paymentReciept = new XObjs.PaymentReciept();
             XObjs.Fee_list fee_list = new XObjs.Fee_list();
             fee_list = this.ret.getFee_listByID(this.ret.getFee_detailsByID(current.fee_detailsID).fee_listID);
             paymentReciept.sn = num.ToString();
             paymentReciept.item_code = fee_list.item_code;
             paymentReciept.item_desc = fee_list.xdesc;
             int num3 = Convert.ToInt32(fee_list.init_amt) + Convert.ToInt32(fee_list.tech_amt);
             paymentReciept.amount = string.Format("{0:n}", num3);
             paymentReciept.transID = string.Concat(new string[]
             {
                 current.transID,
                 "-",
                 current.fee_detailsID,
                 "-",
                 current.xid
             });
             num2 += Convert.ToInt32(num3);
             this.lt_pr.Add(paymentReciept);
             num++;
         }
         this.total_amt = string.Format("{0:n}", (double)num2 + Math.Round(Convert.ToDouble(this.isw_fields.isw_conv_fee), 2));
         this.show_receipt = 1;
         this.show_search = 0;
         return;
     }
     this.show_receipt = 0;
     this.show_search = 1;
 }
        protected void gvTm_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if ((Session["tm_cnt"] != null) && (Session["tm_cnt"].ToString() != ""))
            {
                tm_cnt = Convert.ToInt32(Session["tm_cnt"]);
            }
            if ((Session["lt_ri"] != null) && (Session["lt_ri"].ToString() != ""))
            {
                lt_ri = (List<XObjs.ReportItem>)Session["lt_ri"];
            }
            gvTm.DataSource = lt_ri;
            gvTm.DataBind();
            if (e.CommandName == "TmPayClick")
            {
                GridViewRow namingContainer = (GridViewRow)((ImageButton)e.CommandSource).NamingContainer;
                int rowIndex = namingContainer.RowIndex;
                string txnref = e.CommandArgument.ToString();
                xispf = ret.getISWtransactionByTransactionID(txnref);
                if ((xispf.xid != null) && (xispf.xid != null))
                {
                    Session["xispf"] = xispf;
                    base.Response.Redirect("../xis/pd/tx/re_payment_details.aspx");
                }
            }
            if (e.CommandName == "TmReqClick")
            {
                string str2 = DateTime.Now.ToString("dd-MMM-yy HH:MM:ss");
                GridViewRow row2 = (GridViewRow)((ImageButton)e.CommandSource).NamingContainer;
                int num2 = row2.RowIndex;
                string str3 = e.CommandArgument.ToString();
                int num = 0;
                isw_fields = ret.getISWtransactionByTransactionID(str3);
                string inputString = isw_fields.product_id + isw_fields.txn_ref + isw_fields.mackey;
                string headerValue = hash_value.GetGetSHA512String(inputString);
                isr = tx.myRedirect(check_trans_page + "?productid=" + isw_fields.product_id + "&transactionreference=" + isw_fields.txn_ref + "&amount=" + isw_fields.amount, "Hash", headerValue);
                if ((((isr.ResponseCode != "") && (isr.ResponseCode != null)) && ((isr.PaymentReference != "") && (isr.PaymentReference != null))) && ((isr.ResponseDescription != "") && (isr.ResponseDescription != null)))
                {
                    if (isw_fields.txn_ref == null)
                    {
                        isw_fields.txn_ref = "";
                    }
                    if (isw_fields.pay_ref == null)
                    {
                        isw_fields.pay_ref = "";
                    }
                    if (isw_fields.ret_ref == null)
                    {
                        isw_fields.ret_ref = "";
                    }
                    if (isr.ResponseCode == null)
                    {
                        isr.ResponseCode = "";
                    }
                    if (isr.TransactionDate == null)
                    {
                        isr.TransactionDate = "";
                    }
                    if (isr.MerchantReference == null)
                    {
                        isr.MerchantReference = "";
                    }
                    if (isr.ResponseDescription == null)
                    {
                        isr.ResponseDescription = "";
                    }
                    xstring.AppendLine("Sent Amount: " + isw_fields.amount + "\r\n Product ID: " + isw_fields.product_id + "\r\n Hash: " + headerValue + "\r\n Amount: " + isr.Amount + "\r\n CardNumber: " + isr.CardNumber + "\r\n MerchantReference: " + isr.MerchantReference + "\r\n PaymentReference: " + isr.PaymentReference + "\r\n RetrievalReferenceNumber: " + isr.RetrievalReferenceNumber + "\r\n LeadBankCbnCode: " + isr.LeadBankCbnCode + "\r\n TransactionDate: " + isr.TransactionDate + "\r\n ResponseCode: " + isr.ResponseCode + "\r\n ResponseDescription: " + isr.ResponseDescription + "\r\n Json Page: " + check_trans_page);
                    if (isw_fields.txn_ref != "")
                    {
                        docpath = base.Server.MapPath("~/") + "LiveInterLogs/Ag/" + isw_fields.txn_ref + ".txt";
                        num = x.WriteToFile(xstring.ToString(), docpath);
                    }
                    else
                    {
                        docpath = base.Server.MapPath("~/") + "LiveInterLogs/Ag/xxx.txt";
                        num = x.WriteToFile(xstring.ToString(), docpath);
                    }
                    if ((isr.ResponseCode == "") || (isr.ResponseCode == null))
                    {
                        xpay_status = "2";
                    }
                    else if (isr.ResponseCode == "00")
                    {
                        xpay_status = "1";
                    }
                    else
                    {
                        xpay_status = "3";
                    }
                    num = reg.updateInterSwitchRecords(isw_fields.txn_ref, isw_fields.pay_ref, isw_fields.ret_ref, isr.ResponseCode, isr.TransactionDate, isr.MerchantReference, isr.ResponseDescription);
                    reg.updateTwalletPaymentStatus(isw_fields.txn_ref, xpay_status);
                    reg.updateInterSwitchPostFieldsDate(isw_fields.txn_ref, str2);
                    base.Response.Redirect("./xreport_payments.aspx");
                    if (num == 0)
                    {
                    }
                }
                else
                {
                    base.Response.Redirect("./xreport_payments.aspx");
                }
            }
            if (e.CommandName == "TmDeleteClick")
            {
                GridViewRow row3 = (GridViewRow)((ImageButton)e.CommandSource).NamingContainer;
                int num3 = row3.RowIndex;
                string transID = e.CommandArgument.ToString();
                reg.updateInterSwitchVisibleStatus(transID, "0");
                base.Response.Redirect("./xreport_payments.aspx");
            }
            if (e.CommandName == "TmDetailsClick")
            {
                GridViewRow row4 = (GridViewRow)((ImageButton)e.CommandSource).NamingContainer;
                int num4 = row4.RowIndex;
                string str7 = e.CommandArgument.ToString();
                lt_twall = ret.getTwalletByMemberID(adminID, str7, Session["agentType"].ToString());
                //if (lt_twall.Count > 0) {  }

                if (lt_twall.Count > 0)
                {
                    isw_fields = ret.getISWtransactionByTransactionID(lt_twall[0].transID);
                    isw_fields.TransactionDate = isw_fields.TransactionDate.Substring(0, 11).Trim();

                    c_app = ret.getApplicantByID(lt_twall[0].applicantID);
                    string str8 = lt_twall[0].xpay_status;
                    lt_fdets = ret.getFee_detailsByTwalletID(lt_twall[0].xid);
                    Session["transID"] = str7;
                    Session["memberID"] = adminID;
                    show_inv = 1;
                    switch (str8)
                    {
                        case "0":
                            str8 = "PAYMENT UNCOMPLETED!!!";
                            return;

                        case "1":
                            str8 = "PAYMENT SUCCESSFUL!!!";
                            return;

                        case "2":
                            str8 = "PAYMENT PENDING!!!";
                            return;

                        case "3":
                            str8 = "PAYMENT UNSUCCESSFUL!!!";
                            break;
                    }
                }
            }
        }
Example #4
0
        protected void gvTm_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "TmPayClick")
            {
                GridViewRow namingContainer = (GridViewRow)((ImageButton)e.CommandSource).NamingContainer;
                int rowIndex = namingContainer.RowIndex;
                string txnref = e.CommandArgument.ToString();
                int num = 0;
                this.isw_fields = this.ret.getISWtransactionByTransactionID(txnref);
                this.isr = this.tx.myRedirect(this.check_trans_page + "?productid=" + this.isw_fields.product_id + "&transactionreference=" + this.isw_fields.txn_ref + "&amount=" + this.isw_fields.amount, "Hash", this.isw_fields.hash);
                num = this.reg.updateInterSwitchRecords(this.isw_fields.txn_ref, this.isw_fields.pay_ref, this.isw_fields.ret_ref, this.isr.ResponseCode, this.isr.TransactionDate, this.isr.MerchantReference, this.isr.ResponseDescription);
                if (!(this.isr.ResponseCode == "") && (this.isr.ResponseCode != null))
                {
                    bool flag1 = this.isr.ResponseCode == "00";
                }
                string str2 = DateTime.Now.ToString("dd-MMM-yy HH:MM:ss");
                this.reg.updateInterSwitchPostFieldsDate(this.isw_fields.txn_ref, str2);
                base.Response.Redirect("./v_bask_tmp.aspx");
            }
            if (e.CommandName == "TmDeleteClick")
            {
                GridViewRow row2 = (GridViewRow)((ImageButton)e.CommandSource).NamingContainer;
                int num2 = row2.RowIndex;
                string transID = e.CommandArgument.ToString();
                this.reg.updateInterSwitchVisibleStatus(transID, "0");
                base.Response.Redirect("./v_bask_tmp.aspx");
            }
            if (e.CommandName == "TmDetailsClick")
            {
                GridViewRow row3 = (GridViewRow)((ImageButton)e.CommandSource).NamingContainer;
                int num3 = row3.RowIndex;
                string str4 = e.CommandArgument.ToString();
                this.lt_twall = this.ret.getTwalletByMemberID(this.adminID, str4, this.Session["agentType"].ToString());
                if (this.lt_twall.Count > 0)
                {
                    string str5 = this.lt_twall[0].xpay_status;
                    this.lt_fdets = this.ret.getFee_detailsByTwalletID(this.lt_twall[0].xid);
                    this.Session["transID"] = str4;
                    this.Session["memberID"] = this.adminID;
                    this.show_inv = 1;
                    switch (str5)
                    {
                        case "0":
                            str5 = "PAYMENT UNCOMPLETED!!!";
                            return;

                        case "1":
                            str5 = "PAYMENT SUCCESSFUL!!!";
                            return;

                        case "2":
                            str5 = "PAYMENT PENDING!!!";
                            return;

                        case "3":
                            str5 = "PAYMENT UNSUCCESSFUL!!!";
                            break;
                    }
                }
            }
        }