Exemple #1
0
        public static string SendSMS(string phone, string sender_name, string message)
        {
            try
            {
                Encoding enc = Encoding.GetEncoding("UTF-8");

                string timestamp = HTTPRequests.HTTPRequest(Variables.get, "http://enter.mirsms.ru/external/get/timestamp.php", String.Empty);
                //string timestamp = (string)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds.ToString("#");
                string strASCII  = string.Empty;
                string signature = StringToMD5(Variables.mirSMSLogin + phone + sender_name + message + timestamp + Variables.mirSMSAPIKey);

                byte[] bytes = enc.GetBytes(message);
                foreach (var byt in bytes)
                {
                    strASCII = strASCII + String.Format("%{0:X2}", byt);
                }

                string response = HTTPRequests.HTTPRequest(Variables.get, "http://enter.mirsms.ru/external/get/send.php?login="******"&signature=" + signature + "&phone=" + phone + "&text=" + strASCII + "&sender="
                                                           + sender_name + "&timestamp=" + timestamp + "", String.Empty);

                return(response);
            }
            catch (Exception ex)
            {
                Trace("SMS send error: \n" + ex.ToString() + "\n\n\n");
                return(String.Empty);
            }
        }
Exemple #2
0
        public static Resources GetResourseInfo(Applications Applications)
        {
            string           sucReqElectCard  = String.Empty;
            string           pingResponse     = String.Empty;
            ProcessingResult ProcessingResult = new ProcessingResult();
            Stopwatch        ResponsePing     = new Stopwatch();

            ResponsePing.Start();
            string[] version = HTTPRequests.GetVersion(Applications.Address);
            ResponsePing.Stop();

            if (!String.Equals(version[0], Variables.offline))
            {
                pingResponse = Math.Round(Convert.ToDecimal(ResponsePing.ElapsedMilliseconds) / 1000, 3).ToString();
            }

            switch (Applications.AppType)
            {
            case Variables.processingType:
                ProcessingResult = Processing.ProcessingTest(Applications.DataSource, Applications.Address, Applications.TerminalId, Applications.TerminalPassword, Applications.requestId, Applications.cardNum);
                pingResponse     = ProcessingResult.Ping;

                if (String.Equals(ProcessingResult.Error, Variables.requestStateError))
                {
                    pingResponse = Variables.error;
                    version[0]   = Variables.offline;
                }

                sucReqElectCard = AdditionalFunc.DataBaseSQL(Applications.DataSource, "select count(*) as data from requests "
                                                             + "where trunc(ins_date) = trunc(sysdate) "
                                                             + "and(request_type = 'PAYMENT_AND_CONFIRM' or request_type = 'DEPOST' or "
                                                             + "request_type = 'PAYMENT' or request_type = 'CANCEL' or "
                                                             + "request_type = 'PAYMENT_CONFIRM') "
                                                             + "and (request_state = 'PROCESSED' or request_state = 'READY' or request_state = 'SUCCESS')", true);
                break;

            case Variables.mobileType:
                sucReqElectCard = AdditionalFunc.DataBaseSQL(Applications.DataSource, "select count(*) as data from card_emission_units where state = 'IN_STOCK'", true);
                break;

            default:
                break;
            }

            return(new Resources
            {
                address = "Адрес ресурса: " + Applications.Address,
                name = Applications.Name,
                status = version[0],
                version = version[1],
                sucReqElectCard = sucReqElectCard,
                responsePing = pingResponse,
                requestId = ProcessingResult.requestId,
                cardNum = ProcessingResult.cardNum
            });
        }
Exemple #3
0
        public static string BalanceRequest(string cardNum, string processingServiceName, string terminalId, string requestId)
        {
            string clientType    = "ProcessingTest";
            string clientVersion = "1.0.0.0";
            string employeeId    = "Pinger";
            string hardwareID    = AdditionalFunc.GetMACAddress();
            int    isOffline     = 0;
            string shiftId       = string.Empty;
            string type          = "BALANCE";
            string ver           = "0.1";

            /*string authRes = AuthRequest(processingServiceName, terminalId, "80626056");
             * if (String.Equals(authRes, Variables.errorResponce))
             *  return Variables.errorResponce;*/

            /*string requestId = NextRRN(RRN(cardNum, processingServiceName, terminalId));
             *
             * if (String.Equals(requestId, Variables.errorResponce))
             *  return Variables.errorResponce;*/

            string sign = AdditionalFunc.StringToMD5("cardNum=" + cardNum + ";clientType=" + clientType + ";clientVersion=" + clientVersion + ";employeeId=" + employeeId
                                                     + ";isOffline=" + isOffline + ";requestId=" + requestId + ";shiftId=" + shiftId + ";terminalId=" + terminalId + ";type=" + type + ";ver=" + ver + ";" + hardwareID);

            string data = "{\"getBalanceRequest\":{\"request\":{\"ver\":\"" + ver + "\",\"clientType\":\"" + clientType + "\",\"clientVersion\":\"" + clientVersion + "\",\"type\":\"" + type + "\"," +
                          "\"requestId\":\"" + requestId + "\",\"terminalId\":\"" + terminalId + "\",\"requestDate\":\"" + String.Format("{0:yyyy-MM-ddTHH:mm:ss}", DateTime.Now) + "Z\"," +
                          "\"employeeId\":\"" + employeeId + "\",\"cardNum\":\"" + cardNum + "\",\"isOffline\":" + isOffline + ",\"shiftId\":\"" + shiftId + "\",\"sign\":\"" + sign + "\"}}}";

            string req_result = HTTPRequests.HTTPRequest(Variables.post, processingServiceName + "bpsApi/bpos/balance", data);

            if (String.Equals(req_result, Variables.requestStateError))
            {
                return(Variables.requestStateError);
            }
            else
            {
                JavaScriptSerializer js = new JavaScriptSerializer();
                BPSResp resp            = js.Deserialize <BPSResp>(req_result);

                if (String.Equals(resp.getBalanceResponse.response.requestState, Variables.requestStateError) & !String.Equals(resp.getBalanceResponse.response.requestStateCode, Variables.incorrectRequestId))
                {
                    return(Variables.requestStateError);
                }
                else
                {
                    return(resp.getBalanceResponse.response.requestStateCode);
                }
            }
        }
Exemple #4
0
        public static string AuthRequest(string processingServiceName, string terminalId, string terminalPassword)
        {
            string cardNum       = string.Empty;
            string clientType    = "ProcessingTest";
            string clientVersion = "1.0.0.0";
            string employeeId    = "Pinger";
            string hardwareID    = AdditionalFunc.GetMACAddress();
            int    isOffline     = 0;
            string requestId     = "0000000000000000";
            string shiftId       = string.Empty;
            string type          = "AUTH";
            string ver           = "0.1";
            string sign          = AdditionalFunc.StringToMD5("cardNum=" + cardNum + ";clientType=" + clientType + ";clientVersion=" + clientVersion + ";employeeId=" + employeeId + ";hardwareID=" + hardwareID
                                                              + ";isOffline=" + isOffline + ";requestId=" + requestId + ";shiftId=" + shiftId + ";terminalId=" + terminalId + ";terminalPassword="******";type=" + type + ";ver=" + ver + ";" + hardwareID);

            string data = "{\"authRequest\":{\"request\":{\"ver\":\"" + ver + "\",\"clientType\":\"" + clientType + "\",\"clientVersion\":\"" + clientVersion + "\",\"type\":\"" + type + "\"," +
                          "\"requestId\":\"" + requestId + "\",\"terminalId\":\"" + terminalId + "\",\"requestDate\":\"" + String.Format("{0:yyyy-MM-ddTHH:mm:ss}", DateTime.Now) + "Z\",\"employeeId\":\"" + employeeId + "\","
                          + "\"cardNum\":\"\",\"isOffline\":" + isOffline + ",\"shiftId\":\"" + shiftId + "\",\"sign\":\"" + sign + "\"},\"auth\":{\"terminalPassword\":\"" + terminalPassword + "\",\"hardwareID\":\""
                          + hardwareID + "\"}}}";

            string req_result = HTTPRequests.HTTPRequest(Variables.post, processingServiceName + "bpsApi/bpos/auth", data);

            if (String.Equals(req_result, Variables.requestStateError))
            {
                return(Variables.requestStateError);
            }
            else
            {
                JavaScriptSerializer js = new JavaScriptSerializer();
                BPSResp resp            = js.Deserialize <BPSResp>(req_result);

                if (String.Equals(resp.authResponse.response.requestState, Variables.requestStateError))
                {
                    return(Variables.requestStateError);
                }
                else
                {
                    return(resp.authResponse.response.requestState);
                }
            }
        }
Exemple #5
0
        public static string SendTelegram(TelegramParams TelegramParams, string text)
        {
            Encoding enc      = Encoding.GetEncoding("UTF-8");
            string   strASCII = string.Empty;

            byte[] bytes = enc.GetBytes(text);
            foreach (var byt in bytes)
            {
                strASCII = strASCII + String.Format("%{0:X2}", byt);
            }

            text = strASCII;

            if (TelegramParams.Socks5Proxy != null)
            {
                return(Socks5.SendViaSocket5(TelegramParams, text));
            }
            else
            {
                return(HTTPRequests.HTTPRequest(TelegramParams, "GET", "https://api.telegram.org/bot426158475:AAHwCjhlnvNOXlaanVy5Tja3W5h6QySxK_g/sendMessage?chat_id="
                                                + TelegramParams.ChatId + "&text=" + text, String.Empty));
            }
        }