示例#1
0
        internal static Boolean validate_signature(string[] FORTRequestParameters)
        {
            string returned_signature = Command.GetParameterValue(FORTRequestParameters, "signature");

            FORTRequestParameters = PayFortConfig.AddConfigToParameters(FORTRequestParameters);
            string signature = "";

            for (int i = 0; i < FORTRequestParameters.Length; i++)
            {
                if (FORTRequestParameters[i].IndexOf("signature") != -1)
                {
                    FORTRequestParameters[i] = "";
                }
            }


            FORTRequestParameters = FORTRequestParameters.Where(x => !string.IsNullOrEmpty(x)).ToArray();
            Array.Sort(FORTRequestParameters, StringComparer.InvariantCulture);
            string _pars      = PayFortConfig.SHA_ResponsePhase + string.Join("", FORTRequestParameters) + PayFortConfig.SHA_ResponsePhase;
            string Hashed_SHA = GetHashSHA(_pars, PayFortConfig.sha_type);

            signature = Hashed_SHA;
            if (signature == returned_signature)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
        public static string[]  SendRequestToPayFORT(string[] _record)
        {
            _record = PayFortConfig.AddConfigToParameters(_record);
            string json   = ConvertToJSON(_record);
            string result = send_request(json);

            return(ConvertFromJSON(result));
        }
示例#3
0
        public static ArrayList SendRequestToPayFORT(ArrayList _record)
        {
            _record = PayFortConfig.AddConfigToParameters(_record);
            string    json        = ConvertToJSON(_record.ToArray(typeof(string)) as string[]);
            string    result      = send_request(json);
            ArrayList myArrayList = new ArrayList();

            myArrayList.AddRange(ConvertFromJSON(result));
            return(myArrayList);
        }
示例#4
0
        internal static string generate_signature(string[] FORTRequestParameters)
        {
            FORTRequestParameters = PayFortConfig.AddConfigToParameters(FORTRequestParameters);

            string signature = "";

            for (int i = 0; i < FORTRequestParameters.Length; i++)
            {
                string par = FORTRequestParameters[i];
                if (par.IndexOf("signature") != -1 || par.IndexOf("card_security_code") != -1 || par.IndexOf("card_number") != -1 || par.IndexOf("expiry_date") != -1 || par.IndexOf("card_holder_name") != -1 || par.IndexOf("remember_me") != -1)
                {
                    FORTRequestParameters[i] = "";
                }
            }
            FORTRequestParameters = FORTRequestParameters.Where(x => !string.IsNullOrEmpty(x)).ToArray();
            Array.Sort(FORTRequestParameters, StringComparer.InvariantCulture);
            string _pars      = PayFortConfig.SHA_RequestPhase + string.Join("", FORTRequestParameters) + PayFortConfig.SHA_RequestPhase;
            string Hashed_SHA = GetHashSHA(_pars, PayFortConfig.sha_type);

            signature = Hashed_SHA;
            return(signature);
        }
示例#5
0
        public static Dictionary <string, string> SendRequestToPayFORT(Dictionary <string, string> dictionary)
        {
            ArrayList tmp = new ArrayList();

            foreach (var item in dictionary)
            {
                tmp.Add(item.Key.ToString() + "=" + item.Value.ToString());
            }
            string[] FORTRequestParameters = tmp.ToArray(typeof(string)) as string[];
            FORTRequestParameters = PayFortConfig.AddConfigToParameters(FORTRequestParameters);



            string json   = ConvertToJSON(FORTRequestParameters);
            string result = send_request(json);


            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic = ConvertFromJSON_dic(result);

            return(dic);
        }