コード例 #1
0
ファイル: AdditionalFunc.cs プロジェクト: stru4OK/RST
        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);
            }
        }
コード例 #2
0
ファイル: BposRequests.cs プロジェクト: stru4OK/RST
        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);
                }
            }
        }
コード例 #3
0
ファイル: BposRequests.cs プロジェクト: stru4OK/RST
        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);
                }
            }
        }
コード例 #4
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));
            }
        }