예제 #1
0
        public static TwocheckoutResponse Check(Dictionary <string, string> args, String secret)
        {
            TwocheckoutResponse Result = new TwocheckoutResponse();
            String Notice = JsonConvert.SerializeObject(Result, Formatting.Indented);

            if (!String.IsNullOrEmpty(secret) && args.ContainsKey("sid") &&
                args.ContainsKey("order_number") && args.ContainsKey("total") &&
                args.ContainsKey("key"))
            {
                String HashString = secret + args["sid"] + args["order_number"] + args["total"];
                String CheckHash  = TwocheckoutUtil.Md5Hash(HashString);
                if (CheckHash != args["key"])
                {
                    Result.response_code    = "Fail";
                    Result.response_message = "Hash Mismatch";
                }
                else
                {
                    Result.response_code    = "Success";
                    Result.response_message = "Hash Matched";
                }
            }
            else
            {
                Result.response_code    = "Notice";
                Result.response_message = "You must pass a sid, order_number, total, key and secret word.";
            }
            return(Result);
        }
        public static TwocheckoutResponse Check(Dictionary <string, string> args, String secret)
        {
            TwocheckoutResponse Result = new TwocheckoutResponse();
            String Notice = JsonConvert.SerializeObject(Result, Formatting.Indented);

            if (!String.IsNullOrEmpty(secret) && args.ContainsKey("sale_id") &&
                args.ContainsKey("vendor_id") && args.ContainsKey("invoice_id") &&
                args.ContainsKey("md5_hash"))
            {
                String HashString = args["sale_id"] + args["vendor_id"] + args["invoice_id"] + secret;
                String CheckHash  = TwocheckoutUtil.Md5Hash(HashString);
                if (CheckHash != args["md5_hash"])
                {
                    Result.response_code    = "Fail";
                    Result.response_message = "Hash Mismatch";
                }
                else
                {
                    Result.response_code    = "Success";
                    Result.response_message = "Hash Matched";
                }
            }
            else
            {
                Result.response_code    = "Notice";
                Result.response_message = "You must pass a sale_id, vendor_id, invoice_id, md5_hash and secret word.";
            }
            return(Result);
        }