示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((Session["pwalletID"] != null) && (Session["pwalletID"].ToString() != ""))
            { this.adminID = Session["pwalletID"].ToString(); }
            else
            { base.Response.Redirect("../../../a_login.aspx"); }

            if (IsPostBack)
            {
                if (rblOptions.SelectedValue == "isw")
                {
                    if (Session["xispf"] != null)
                    {
                        xispf = (Ipong.Classes.XObjs.InterSwitchPostFields)Session["xispf"];
                        if ((Session["agentType"] != null) && (Session["agentType"].ToString() != ""))
                        {
                            agentType = Session["agentType"].ToString();
                            if (agentType == "Agent")
                            {
                                c_reg = (Classes.XObjs.Registration)Session["c_reg"];
                                xispf.cust_id = c_reg.Sys_ID;
                                xispf.cust_id_desc = "Portal Agent";
                            }
                            else
                            {
                                c_sub = (Classes.XObjs.Subagent)Session["c_sub"];
                                xispf.cust_id = c_sub.Sys_ID;
                                xispf.cust_id_desc = "Portal Sub-Agent";
                            }
                        }
                        addIsw_succ = reg.addInterSwitchRecords(xispf);
                        if (addIsw_succ > 0)
                        {
                            update_twallxgt_succ = reg.updateTwalletXgt(xispf.txn_ref, "xpay_isw", adminID);
                            if (update_twallxgt_succ > 0)
                            {
                                Response.Redirect("./payment_details.aspx");
                            }
                        }
                    }
                    else
                    {
                        Response.Redirect("../../../A/m_pay.aspx");
                    }
                }
                else if (rblOptions.SelectedValue == "bank")
                {
                    if (Session["xispf"] != null)
                    {
                        xispf = (Ipong.Classes.XObjs.InterSwitchPostFields)Session["xispf"];
                        update_twallxgt_succ = reg.updateTwalletXgtBanker(xispf.txn_ref, "xpay_bk", adminID);
                        if (update_twallxgt_succ > 0)
                        {
                            Response.Redirect("../../../A/m_invoice_bank.aspx?tx=" + xispf.txn_ref);
                        }
                    }
                }
            }
        }
示例#2
0
        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<Classes.XObjs.ReportItem>)Session["lt_ri"]; }
            gvTm.DataSource = lt_ri;
            gvTm.DataBind();

            if (e.CommandName == "TmPayClick")
            {
                GridViewRow rowSelect = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer);
                int rowindex = rowSelect.RowIndex;
                string tnxref = e.CommandArgument.ToString();

                xispf = ret.getISWtransactionByTransactionID(tnxref);

                if ((xispf.xid != null) && (xispf.xid != null))
                {
                    Session["xispf"] = xispf;
                    Response.Redirect("../xis/pd/tx/re_payment_details.aspx");
                }
            }

            if (e.CommandName == "TmReqClick")
            {
                string new_local_date = DateTime.Now.ToString("dd-MMM-yy HH:MM:ss");
                GridViewRow rowSelect = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer);
                int rowindex = rowSelect.RowIndex;
                string og_transID = e.CommandArgument.ToString(); int succ = 0;

                isw_fields = ret.getISWtransactionByTransactionID(og_transID);
                //Get the hash value
                string inputString = isw_fields.product_id + isw_fields.txn_ref + isw_fields.mackey;

                string get_trans_hash = 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", get_trans_hash);
                //////////////////////////////////////////////////////////////////////////////////////////
                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: " + get_trans_hash + "\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);
                    //Log the info in a file
                    if (isw_fields.txn_ref != "")
                    {
                        docpath = base.Server.MapPath("~/") + "LiveInterLogs/Ag/" + isw_fields.txn_ref + ".txt";
                        succ = x.WriteToFile(xstring.ToString(), docpath);
                    }
                    else
                    {
                        docpath = base.Server.MapPath("~/") + "LiveInterLogs/Ag/xxx.txt";
                        succ = x.WriteToFile(xstring.ToString(), docpath);
                    }

                    if ((isr.ResponseCode == "") || (isr.ResponseCode == null))
                    {
                        xpay_status = "2";//Pending
                    }
                    else if (isr.ResponseCode == "00")
                    {
                        xpay_status = "1";//Successfull
                    }
                    else
                    {
                        xpay_status = "3";//Error
                    }
                    succ = 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, new_local_date);
                    Response.Redirect("./xreport_payments.aspx");
                    if (succ != 0)
                    {
                        //sendAlert();
                    }
                }
                else
                {
                    Response.Redirect("./xreport_payments.aspx");
                }
            }

            if (e.CommandName == "TmDeleteClick")
            {
                GridViewRow rowSelect = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer);
                int rowindex = rowSelect.RowIndex;
                string og_transID = e.CommandArgument.ToString(); int succ = 0;
                succ = reg.updateInterSwitchVisibleStatus(og_transID, "0");
                Response.Redirect("./xreport_payments.aspx");
                //if (succ != 0){    sendAlert();    }
            }

            if (e.CommandName == "TmDetailsClick")
            {
                GridViewRow rowSelect = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer);
                int rowindex = rowSelect.RowIndex;
                string tnxref = e.CommandArgument.ToString();
                lt_twall = ret.getTwalletByMemberID(adminID, tnxref, Session["agentType"].ToString());
                if (lt_twall.Count > 0)
                {
                    string pay_status = lt_twall[0].xpay_status;
                    lt_fdets = ret.getFee_detailsByTwalletID(lt_twall[0].xid);
                    Session["transID"] = tnxref; Session["memberID"] = adminID;
                    show_inv = 1;
                    if (pay_status == "0")
                    { pay_status = "PAYMENT UNCOMPLETED!!!"; }
                    else if (pay_status == "1") { pay_status = "PAYMENT SUCCESSFUL!!!"; }
                    else if (pay_status == "2") { pay_status = "PAYMENT PENDING!!!"; }
                    else if (pay_status == "3") { pay_status = "PAYMENT UNSUCCESSFUL!!!"; }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((Session["pwalletID"] != null) && (Session["pwalletID"].ToString() != ""))
            { this.adminID = Session["pwalletID"].ToString(); }
            else
            { base.Response.Redirect("../../../a_login.aspx"); }
             if (Session["xispf"] != null) { xispf = (Ipong.Classes.XObjs.InterSwitchPostFields)Session["xispf"]; }

             if ((Session["agentType"] != null) && (Session["agentType"].ToString() != ""))
             {
                 agentType = Session["agentType"].ToString();
                 if (agentType == "Agent")
                 {
                     if (Session["c_reg"] != null)
                     {
                         c_reg = (Classes.XObjs.Registration)Session["c_reg"];
                         Session["name"] = c_reg.Firstname + " " + c_reg.Surname;
                         Session["coy_name"] = c_reg.CompanyName;
                         Session["Address"] = c_reg.CompanyAddress;
                     }

                 }
                 else
                 {
                     Classes.XObjs.Registration c_sub_reg = new Classes.XObjs.Registration();

                     if (Session["c_sub"] != null)
                     {
                         c_sub = (Classes.XObjs.Subagent)Session["c_sub"];
                         Session["name"] = c_sub.Firstname + " " + c_sub.Surname;
                     }
                     if (Session["c_sub_reg"] != null)
                     {
                         c_sub_reg = (Classes.XObjs.Registration)Session["c_sub_reg"];
                         Session["coy_name"] = c_sub_reg.CompanyName;
                         Session["Address"] = c_sub_reg.CompanyAddress;
                     }

                 }
             }

             twall = ret.getTwalletByMemberID(adminID, xispf.txn_ref, agentType);
            lt_fdets = ret.getFee_detailsByTwalletID(twall[0].xid);

            int cld_amt = 0; int einao_amt = 0;
            if (lt_fdets.Count > 0)
            {
                foreach (Classes.XObjs.Fee_details f in lt_fdets)
                {
                    cld_amt += Convert.ToInt32(f.init_amt) * Convert.ToInt32(f.xqty) * 100;
                    einao_amt += Convert.ToInt32(f.tech_amt) * Convert.ToInt32(f.xqty) * 100;
                }
            }
            refno = xispf.txn_ref;
            isw_conv_fee = Math.Round(Convert.ToDecimal(xispf.isw_conv_fee), 2).ToString();
            total_amt =Convert.ToString( xispf.amount);
            amt = Convert.ToString((Convert.ToDecimal(total_amt)/100) - Convert.ToDecimal(isw_conv_fee));

            name = Session["name"].ToString();
            coy_name =Session["coy_name"].ToString();
            addy = Session["Address"].ToString();

            amt = string.Format("{0:n}", amt);
            isw_conv_fee = string.Format("{0:n}", isw_conv_fee);

            Session["amt"] = amt;
            Session["isw_conv_fee"] = isw_conv_fee;
            Session["total_amt"] = total_amt;
            Session["Refno"] = refno;
            Session["einao_split_amt"] = einao_amt.ToString(); ;
            Session["cld_split_amt"] = cld_amt.ToString();
            Session["hashString"] = xispf.hash;
            if (addy.Contains(',')) { addy = addy.Replace(",", ", "); }
        }