示例#1
0
        private NotifactionData GenerateNotification(PayFormData request)
        {
            var orderId  = DateTime.Now.ToString("yyyyMMddHHmmss");
            var response = new NotifactionData
            {
                Language          = request.Language,
                OrderIdOfGateway  = "GOID" + orderId,
                OrderIdOfMerchant = request.OrderId,
                OrderIdOfRouter   = "ROID" + orderId,
                PayMethod         = request.Method,
            };

            response.Signature = GetMD5HashInHexadecimalFormat(response.SignParams + OnlineDepositKey);
            return(response);
        }
示例#2
0
        private string ValidateInRequest(PayFormData request)
        {
            var msg = new StringBuilder();

            if (string.IsNullOrEmpty(request.Method))
            {
                msg.AppendFormat("{0} should not be null<BR>", "Method");
            }

            if (string.IsNullOrEmpty(request.MerchantId))
            {
                msg.AppendFormat("{0} should not be null<BR>", "MerchantId");
            }
            else
            {
                if (OnlineDepositMerchantId != request.MerchantId)
                {
                    msg.AppendFormat("{0}:{1} is wrong<BR>", "MerchantId", request.MerchantId);
                }
            }

            if (string.IsNullOrEmpty(request.Signature))
            {
                msg.AppendFormat("{0} should not be null<BR>", "Signature");
            }

            if (string.IsNullOrEmpty(request.OrderId))
            {
                msg.AppendFormat("{0} should not be null<BR>", "OrderId");
            }

            if (request.Amount.HasValue == false)
            {
                msg.AppendFormat("{0} should not be null<BR>", "Amount");
            }
            else
            {
                if (request.Amount.Value <= 0)
                {
                    msg.AppendFormat("{0} should be greater than 0<BR>", "Amount");
                }
            }

            if (request.Channel.HasValue == false)
            {
                msg.AppendFormat("{0} should not be null<BR>", "Channel");
            }

            if (string.IsNullOrEmpty(request.Currency))
            {
                msg.AppendFormat("{0} should not be null<BR>", "Currency");
            }

            if (string.IsNullOrEmpty(request.Language))
            {
                msg.AppendFormat("{0} should not be null<BR>", "Language");
            }

            if (string.IsNullOrEmpty(request.NotifyUrl))
            {
                msg.AppendFormat("{0} should not be null<BR>", "NotifyUrl");
            }

            if (string.IsNullOrEmpty(request.ReturnUrl))
            {
                msg.AppendFormat("{0} should not be null<BR>", "ReturnUrl");
            }

            if (msg.Length == 0)
            {
                var signString = request.SignParams;
                var expect     = GetMD5HashInHexadecimalFormat(signString + OnlineDepositKey);
                if (request.Signature != null && request.Signature != expect)
                {
                    msg.AppendFormat("{0} is not match,expect:{1},actual:{2}<BR>", "Signature", expect, request.Signature);
                }
            }

            return(msg.ToString());
        }