Ejemplo n.º 1
0
        protected void btnFirstProduct_Click(object sender, EventArgs e)
        {
            /// TIME NEEDS TO BE IN INDIA STANDARD TIME
            DateTime databaseUtcTime = DateTime.UtcNow;
            var      indiaTimeZone   = TimeZoneInfo.FindSystemTimeZoneById("India Standard Time");
            var      indiaTime       = TimeZoneInfo.ConvertTimeFromUtc(databaseUtcTime, indiaTimeZone);


            BridgePGUtil objBridgePGUtil        = new BridgePGUtil();
            string       merchant_id            = ConfigurationManager.AppSettings["merchant_id"];
            string       csc_id                 = Session["username"].ToString();
            string       merchant_txn           = merchant_id + indiaTime.Year.ToString().PadLeft(4, '0') + indiaTime.Month.ToString().PadLeft(2, '0') + indiaTime.Day.ToString().PadLeft(2, '0') + indiaTime.Hour.ToString().PadLeft(2, '0') + indiaTime.Minute.ToString().PadLeft(2, '0') + indiaTime.Second.ToString().PadLeft(2, '0') + indiaTime.Millisecond.ToString().PadLeft(2, '0');
            string       merchant_txn_date_time = indiaTime.Year.ToString().PadLeft(4, '0') + "-" + indiaTime.Month.ToString().PadLeft(2, '0') + "-" + indiaTime.Day.ToString().PadLeft(2, '0') + " " + indiaTime.Hour.ToString().PadLeft(2, '0') + ":" + indiaTime.Minute.ToString().PadLeft(2, '0') + ":" + indiaTime.Second.ToString().PadLeft(2, '0');
            string       product_id             = ConfigurationManager.AppSettings["product_id1"];
            string       product_name           = ConfigurationManager.AppSettings["product_name1"];
            string       txn_amount             = "200";
            string       amount_parameter       = "NA";
            string       txn_mode               = "D";
            string       txn_type               = "D";
            string       merchant_receipt_no    = merchant_id + indiaTime.Year.ToString().PadLeft(4, '0') + indiaTime.Month.ToString().PadLeft(2, '0') + indiaTime.Day.ToString().PadLeft(2, '0') + indiaTime.Hour.ToString().PadLeft(2, '0') + indiaTime.Minute.ToString().PadLeft(2, '0') + indiaTime.Second.ToString().PadLeft(2, '0') + indiaTime.Millisecond.ToString().PadLeft(4, '0');
            string       csc_share_amount       = "0";
            string       pay_to_email           = "*****@*****.**";
            string       return_url             = ConfigurationManager.AppSettings["SUCCESS_URL"];
            string       cancel_url             = ConfigurationManager.AppSettings["FAILURE_URL"];
            string       Currency               = "INR";
            string       Discount               = "0";
            string       param_1                = "NA";
            string       param_2                = "NA";
            string       param_3                = "NA";
            string       param_4                = "NA";



            string message = objBridgePGUtil.CreateMessage(merchant_id, csc_id, merchant_txn, merchant_txn_date_time, product_id,
                                                           product_name, txn_amount, amount_parameter, txn_mode, txn_type, merchant_receipt_no,
                                                           csc_share_amount, pay_to_email, return_url, cancel_url, Currency, Discount, param_1,
                                                           param_2, param_3, param_4);

            message = ConfigurationManager.AppSettings["merchant_id"] + "|" + message;

            Response.Clear();

            StringBuilder sb = new StringBuilder();

            sb.Append("<html>");
            sb.AppendFormat(@"<body onload='document.forms[""form""].submit()'>");
            sb.AppendFormat("<form name='form' action='{0}' method='post'>", objBridgePGUtil.CreateURLappendString());
            sb.AppendFormat("<input type='hidden' name='message' value='{0}'>", message);
            sb.Append("</form>");
            sb.Append("</body>");
            sb.Append("</html>");
            string strpost = sb.ToString();

            Response.Write(strpost);

            Response.End();
        }
        protected void btnRecon_Click(object sender, EventArgs e)
        {
            BridgePGUtil obj          = new BridgePGUtil();
            string       merchant_txn = txtMerchantTxn.Text.Trim();

            string merchant_date = txtMerchantDate.Text.Trim();
            string merchant_ID   = ConfigurationManager.AppSettings["MERCHANT_ID"];

            string str = obj.transaction_reversal(merchant_ID, merchant_txn, merchant_date);

            Literal1.Text = str;
        }
Ejemplo n.º 3
0
        protected void btnRecon_Click(object sender, EventArgs e)
        {
            BridgePGUtil obj                 = new BridgePGUtil();
            string       merchant_txn        = txtMerchantTxn.Text.Trim();
            string       csc_txn             = txtCSCTxn.Text.Trim();
            string       cscuser_id          = txtCscUserid.Text.Trim();
            string       product_id          = txtProductId.Text.Trim();
            string       txn_amount          = txtTxnAmount.Text.Trim();
            string       merchant_date       = txtMerchantDate.Text.Trim();
            string       merchant_txn_status = txtMerchantTxnStatus.Text.Trim();
            string       merchant_reciept    = txtMerchantReciept.Text.Trim();
            string       merchant_ID         = ConfigurationManager.AppSettings["MERCHANT_ID"];
            string       str                 = obj.recon_logNew(merchant_ID, merchant_txn, csc_txn, cscuser_id, product_id, txn_amount, merchant_date, merchant_txn_status, merchant_reciept, "NA", "NA");

            Literal1.Text = str;
        }
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            BridgePGUtil obj                 = new BridgePGUtil();
            string       merchant_txn        = txtMerchantTxn.Text.Trim();
            string       csc_txn             = txtCSCTxn.Text.Trim();
            string       merchant_txn_status = "Success";
            string       merchant_reference  = DateTime.Now.ToFileTime().ToString();
            string       refund_deduction    = "F";
            string       refund_mode         = "F";
            string       refund_type         = "R";
            string       refund_trigger      = "M";
            string       refund_reason       = "Ok";
            string       merchant_txn_param  = "N";
            string       merchant_ID         = ConfigurationManager.AppSettings["MERCHANT_ID"];

            string str = obj.refund_log(merchant_ID, merchant_txn, csc_txn, merchant_txn_status, merchant_reference, refund_deduction, refund_mode, refund_type, refund_trigger, refund_reason, merchant_txn_param);

            Literal1.Text = str;
        }
Ejemplo n.º 5
0
        public string CreatePGData(
            string merchant_id,
            string csc_id,
            string txn_amount,
            string merchant_txn,
            string merchant_receipt_no,
            string return_url,
            string cancel_url,
            string product_id,
            string product_name,
            string strRegNo,
            string param2,
            string param3,
            string param4,
            string csc_share_amount)
        {
            string              postMessage         = string.Empty;
            BridgePGUtil        objBridgePGUtil     = new BridgePGUtil();
            List <BridgePGUtil> objListBridgePGUtil = new List <BridgePGUtil>();

            objBridgePGUtil.merchant_id         = merchant_id;
            objBridgePGUtil.csc_id              = csc_id;
            objBridgePGUtil.txn_amount          = txn_amount;
            objBridgePGUtil.merchant_receipt_no = merchant_receipt_no;
            objBridgePGUtil.return_url          = return_url;
            objBridgePGUtil.cancel_url          = cancel_url;
            DateTime databaseUtcTime = DateTime.UtcNow;
            var      indiaTimeZone   = TimeZoneInfo.FindSystemTimeZoneById("India Standard Time");
            var      indiaTime       = TimeZoneInfo.ConvertTimeFromUtc(databaseUtcTime, indiaTimeZone);

            objBridgePGUtil.merchant_txn_date_time = indiaTime.Year.ToString().PadLeft(4, '0') + "-" + indiaTime.Month.ToString().PadLeft(2, '0') + "-" + indiaTime.Day.ToString().PadLeft(2, '0') + " " + indiaTime.ToString("HH:mm:ss").PadLeft(2, '0');


            // objBridgePGUtil.merchant_txn_date_time = DateTime.Now.Year.ToString().PadLeft(4, '0') + "-" + DateTime.Now.Month.ToString().PadLeft(2, '0') + "-" + DateTime.Now.Day.ToString().PadLeft(2, '0') + " " + DateTime.Now.Hour.ToString().PadLeft(2, '0') + ":" + DateTime.Now.Minute.ToString().PadLeft(2, '0') + ":" + DateTime.Now.Second.ToString().PadLeft(2, '0');
            objBridgePGUtil.merchant_txn     = merchant_txn;
            objBridgePGUtil.product_id       = product_id;
            objBridgePGUtil.product_name     = product_name;
            objBridgePGUtil.amount_parameter = "NA";
            objBridgePGUtil.txn_mode         = "D";
            objBridgePGUtil.txn_type         = "D";
            objBridgePGUtil.csc_share_amount = csc_share_amount;
            objBridgePGUtil.pay_to_email     = "NA";
            objBridgePGUtil.Currency         = "INR";
            objBridgePGUtil.Discount         = "0";
            objBridgePGUtil.param_1          = strRegNo;
            objBridgePGUtil.param_2          = param2;
            objBridgePGUtil.param_3          = param3;
            objBridgePGUtil.param_4          = param4;
            objListBridgePGUtil.Add(objBridgePGUtil);

            for (int i = 0; i < objListBridgePGUtil.Count; i++)
            {
                postMessage = "merchant_id=" + objListBridgePGUtil[i].merchant_id + "|"
                              + "csc_id=" + objListBridgePGUtil[i].csc_id + "|"
                              + "merchant_txn=" + objListBridgePGUtil[i].merchant_txn + "|"
                              + "merchant_txn_date_time=" + objListBridgePGUtil[i].merchant_txn_date_time + "|"
                              + "product_id=" + objListBridgePGUtil[i].product_id + "|"
                              + "product_name=" + objListBridgePGUtil[i].product_name + "|"
                              + "txn_amount=" + objListBridgePGUtil[i].txn_amount + "|"
                              + "amount_parameter=" + objListBridgePGUtil[i].amount_parameter + "|"
                              + "txn_mode=" + objListBridgePGUtil[i].txn_mode + "|"
                              + "txn_type=" + objListBridgePGUtil[i].txn_type + "|"
                              + "merchant_receipt_no=" + objListBridgePGUtil[i].merchant_receipt_no + "|"
                              + "csc_share_amount=" + objListBridgePGUtil[i].csc_share_amount + "|"
                              + "pay_to_email=" + objListBridgePGUtil[i].pay_to_email + "|"
                              + "return_url=" + objListBridgePGUtil[i].return_url + "|"
                              + "cancel_url=" + objListBridgePGUtil[i].cancel_url + "|"
                              + "Currency=" + objListBridgePGUtil[i].Currency + "|"
                              + "Discount=" + objListBridgePGUtil[i].Discount + "|"
                              + "param_1=" + objListBridgePGUtil[i].param_1 + "|"
                              + "param_2=" + objListBridgePGUtil[i].param_2 + "|"
                              + "param_3=" + objListBridgePGUtil[i].param_3 + "|"
                              + "param_4=" + objListBridgePGUtil[i].param_4 + "|";
            }

            string strPRIVATE_KEY = ConfigurationManager.AppSettings["PRIVATE_KEY"];
            string strPUBLIC_KEY  = ConfigurationManager.AppSettings["PUBLIC_KEY"];

            strPRIVATE_KEY    = Base64Decode(strPRIVATE_KEY);
            strPUBLIC_KEY     = Base64Decode(strPUBLIC_KEY);
            Crypto.privateKey = strPRIVATE_KEY;
            Crypto.publicKey  = strPUBLIC_KEY;


            return(Crypto.encrypt(postMessage, Crypto.publicKey, Crypto.privateKey));
        }