Exemple #1
0
        private RefundNotificationRequest RefundParameterCheck(string input, string mchId, string appId, string nonce)
        {
            using (MD5 md5 = MD5.Create())
            {
                var           base64 = Convert.FromBase64String(input);
                StringBuilder output = new StringBuilder();
                var           data   = md5.ComputeHash(Encoding.UTF8.GetBytes(_securityKey));
                foreach (var b in data)
                {
                    output.Append(b.ToString("x2"));
                }

                string          key           = output.ToString();
                byte[]          keyBuffer     = Encoding.UTF8.GetBytes(key);
                byte[]          encryptBuffer = base64;
                RijndaelManaged rDel          = new RijndaelManaged
                {
                    Key = keyBuffer, Mode = CipherMode.ECB, Padding = PaddingMode.PKCS7
                };
                ICryptoTransform cTransform   = rDel.CreateDecryptor();
                byte[]           resultBuffer =
                    cTransform.TransformFinalBlock(encryptBuffer, 0, encryptBuffer.Length);
                string xml = Encoding.UTF8.GetString(resultBuffer);
                RefundNotificationRequest notification =
                    XmlSerializeHelper.StringToObject <RefundNotificationRequest>(xml);
                notification.MchId = mchId;
                notification.AppId = appId;
                notification.Nonce = nonce;
                return(notification);
            }
        }
Exemple #2
0
 public Task <PayResponse> SuccessExecuted(RefundNotificationRequest notification)
 {
     return(Task.FromResult(new PayResponse()));
 }