コード例 #1
0
        public void checkRequestStatus(object source, ElapsedEventArgs e, long paymentID, long userID, long amount)
        {
            Debug.WriteLine("GIRDI");
            PaymentInsert pInsert = new PaymentInsert(Configuration, _hostingEnvironment);

            string smsXML = @$ "<request point = " "3587" "><status id=" "{paymentID}" "/></request >";

            KeyManager.SetKeyPath($"{_hostingEnvironment.ContentRootPath}/wwwroot/private.pem");
            string certificate = KeyManager.GenerateSignature(smsXML, Encoding.UTF8);
            var    smsContent  = new StringContent(smsXML, Encoding.UTF8, "text/xml");
            //smsContent.Headers.ContentType = MediaTypeHeaderValue.Parse("text/xml");

            string     smsUrl    = $"https://smartpay.az/external/extended";
            HttpClient smsClient = new HttpClient();

            smsClient.DefaultRequestHeaders.Add("paylogic-signature", certificate);

            var smsRslt = smsClient.PostAsync(smsUrl, smsContent).Result;
            var smsResp = smsRslt.Content.ReadAsStringAsync().Result;

            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.LoadXml(smsResp);
            XmlNodeList parentNode = xmlDoc.GetElementsByTagName("result");

            foreach (XmlNode childrenNode in parentNode)
            {
                int state    = Convert.ToInt32(childrenNode.Attributes["state"].Value);
                int substate = Convert.ToInt32(childrenNode.Attributes["substate"].Value);
                int final    = Convert.ToInt32(childrenNode.Attributes["final"].Value);
                if (final == 1)
                {
                    aTimer.Stop();
                    aTimer.Enabled = false;

                    pInsert.UpdateTransaction(paymentID, state, substate, final);
                    switch (state)
                    {
                    case 60:
                        pInsert.WithdrawUserBalance(userID, amount);
                        break;

                    default:

                        break;
                    }

                    //status.response = 1;//ugurlu
                }
            }
        }
コード例 #2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        DataView dv3   = (DataView)SelectTag.Select(DataSourceSelectArguments.Empty);
        int      taggg = (int)dv3.Table.Rows[0][0];

        x = Convert.ToDouble(TextBox8.Text);
        y = Convert.ToDouble(TextBox3.Text);
        if (taggg == 4)
        {
            if (x == y)
            {
                TagUpdate.Update();
            }
        }
        else if (taggg == 6)
        {
            if (x == y)
            {
                TagUpdate0.Update();
            }
        }
        string sttt = "";

        sttt = DateTime.Now.ToLongTimeString();
        if (sttt.Length == 10)
        {
            sttt = "0" + sttt;
        }
        string post = sttt.Substring(9, 2);

        if (post == "PM")
        {
            int h = Convert.ToInt32(sttt.Substring(0, 2)) + 12;
            TTime.Text = h.ToString() + sttt.Substring(2, 6);
        }
        else
        {
            TTime.Text = sttt.Substring(0, 8);
        }
        y             = x - y;
        TextBox6.Text = y.ToString();
        PaymentInsert.Insert();
        TextBox5.Text = DateTime.Now.ToShortDateString();
        SqlDataSource1.Update();
        LinkButton1.Enabled     = true;
        Button3.Enabled         = true;
        RangeValidator1.Visible = false;
    }
コード例 #3
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string sttt = "";

        sttt = DateTime.Now.ToLongTimeString();
        if (sttt.Length == 10)
        {
            sttt = "0" + sttt;
        }
        string post = sttt.Substring(9, 2);

        if (post == "PM")
        {
            int h = Convert.ToInt32(sttt.Substring(0, 2)) + 12;
            TTime.Text = h.ToString() + sttt.Substring(2, 6);
        }
        else
        {
            TTime.Text = sttt.Substring(0, 8);
        }
        deduct.Update();
        UpdateTag.Update();
        UpdateDate.Insert();
        PaymentInsert.Insert();
        DataView dv = (DataView)AfftectedSelect.Select(DataSourceSelectArguments.Empty);
        int      x  = 0;

        foreach (DataRow dr in dv.Table.Rows)
        {
            Session["rr"] = (int)dv.Table.Rows[x][0];
            Session["gg"] = "Event Date Already Reserved";
            ccancel.Insert();
        }
        printhead.Visible = true;
        Button1.Enabled   = false;
        TextBox3.ReadOnly = true;
        Button2.Enabled   = false;
    }
コード例 #4
0
        public TransactionStatusStruct UpBalance([FromBody] TransactionStruct obj)
        {
            PaymentInsert insert = new PaymentInsert(Configuration, _hostingEnvironment);

            return(insert.UpBalance(obj));
        }
コード例 #5
0
        public Status WithdrawFunds(long mobile, string pass, long account, long serviceID, long amount)
        {
            Status status = new Status();

            try
            {
                //(amount / 100) % 1 == 0
                if (amount > 100)
                {
                    PaymentSelect pSelect           = new PaymentSelect(Configuration, _hostingEnvironment);
                    long          smartpayServiceID = pSelect.GetSmartpayServiceID(serviceID);
                    if (smartpayServiceID > 0)
                    {
                        DbSelect select = new DbSelect(Configuration, _hostingEnvironment);
                        long     userID = select.getUserIdByMobile(mobile, pass);


                        if (userID > 0)
                        {
                            decimal earningValue = pSelect.GetUserEarningValue(userID);
                            if (earningValue > amount / 100)
                            {
                                if (account.ToString().Length == 9)
                                {
                                    PaymentInsert pInsert   = new PaymentInsert(Configuration, _hostingEnvironment);
                                    long          paymentID = pInsert.InsertTransaction(userID, serviceID, amount, account);
                                    if (paymentID > 0)
                                    {
                                        DateTime now = DateTime.Now;



                                        string smsXML = @$ "<request point=" "3587" ">
<payment account = " "{account}" " check = " "24776" " date = " "{DateTime.Now.ToString(" yyyy - MM - ddTHH : mm : sszz00 ")}" "
id = " "{paymentID}" " service = " "{smartpayServiceID}" " source = " "CASH" " sum = " "{amount}" "> <attribute name = " "id2" " value = " "pack" "/>
            
                </payment>
            </request>";
                                        KeyManager.SetKeyPath($"{_hostingEnvironment.ContentRootPath}/wwwroot/private.pem");
                                        string certificate = KeyManager.GenerateSignature(smsXML, Encoding.UTF8);
                                        var    smsContent  = new StringContent(smsXML, Encoding.UTF8, "text/xml");
                                        //smsContent.Headers.ContentType = MediaTypeHeaderValue.Parse("text/xml");

                                        string     smsUrl    = $"https://smartpay.az/external/extended";
                                        HttpClient smsClient = new HttpClient();
                                        smsClient.DefaultRequestHeaders.Add("paylogic-signature", certificate);

                                        var smsRslt = smsClient.PostAsync(smsUrl, smsContent).Result;
                                        var smsResp = smsRslt.Content.ReadAsStringAsync().Result;

                                        XmlDocument xmlDoc = new XmlDocument();
                                        xmlDoc.LoadXml(smsResp);
                                        XmlNodeList parentNode = xmlDoc.GetElementsByTagName("result");
                                        if (parentNode.Count > 0)
                                        {
                                            foreach (XmlNode childrenNode in parentNode)
                                            {
                                                int state    = Convert.ToInt32(childrenNode.Attributes["state"].Value);
                                                int substate = Convert.ToInt32(childrenNode.Attributes["substate"].Value);
                                                int final    = Convert.ToInt32(childrenNode.Attributes["final"].Value);
                                                if (state == 60 && substate == 0 && final == 1)
                                                {
                                                    pInsert.UpdateTransaction(paymentID, state, substate, final);
                                                    pInsert.WithdrawUserBalance(userID, amount);
                                                    status.response = 1; //ugurlu
                                                                         //Debug.WriteLine("");
                                                }
                                                else if (state == 0 || state == 30 || state == 40 || state == 70)
                                                {
                                                    pInsert.UpdateTransaction(paymentID, state, substate, final);
                                                    StartCheckRequestTimer(paymentID, userID, amount);
                                                    status.response = 2;//gozlemededi
                                                }
                                                else
                                                {
                                                    pInsert.UpdateTransaction(paymentID, state, substate, final);
                                                    status.response = 3;//odenish xetasi
                                                }
                                            }
                                        }
                                        else
                                        {
                                            status.response       = 4; // signature and etc
                                            status.responseString = "Error";
                                        }
                                    }
                                    else
                                    {
                                        status.response       = 4; // error
                                        status.responseString = "Error";
                                    }
                                }
                                else
                                {
                                    status.response       = 5;//wrong payNumber
                                    status.responseString = "check account";
                                }
                            }

                            else
                            {
                                status.response       = 6;//access danied
                                status.responseString = "not enough earning balance";
                            }
                        }
                        else
                        {
                            status.response       = 7;//access danied
                            status.responseString = "access danied";
                        }
                    }
                    else
                    {
                        status.response       = 8; // service not found
                        status.responseString = "Service not found";
                    }
                }
                else
                {
                    status.response       = 9; // service not found
                    status.responseString = "wrong amount";
                }
            }
            catch (Exception ex)
            {
                status.response       = 4; // error
                status.responseString = $"Internal error: {ex.Message}";
            }
            return(status);
        }