Browse Source

重新将通知应答(XXXNotifyResult)纳入Payment中

Roc 6 years ago
parent
commit
b9ee6043f1

+ 1 - 1
samples/WebApplicationSample/Controllers/NotifyController.cs

@@ -383,7 +383,7 @@ namespace WebApplicationSample.Controllers
             {
                 var notify = await _client.ExecuteAsync<UnionPayGatewayPayFrontConsumeNotifyResponse>(Request);
                 Console.WriteLine("OrderId: " + notify.OrderId + " respCode :" + notify.RespCode);
-                return UnionPayNotifyResult.Ok;
+                return UnionPayNotifyResult.Success;
             }
             catch
             {

+ 0 - 11
samples/WebApplicationSample/Helpers/AlipayNotifyResult.cs

@@ -1,11 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-
-namespace WebApplicationSample.Helpers
-{
-    public class AlipayNotifyResult
-    {
-        private static readonly ContentResult _success = new ContentResult { Content = "success", ContentType = "text/plain" };
-
-        public static IActionResult Success => _success;
-    }
-}

+ 0 - 14
samples/WebApplicationSample/Helpers/JDPayNotifyResult.cs

@@ -1,14 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-
-namespace WebApplicationSample.Helpers
-{
-    public class JDPayNotifyResult
-    {
-        private static readonly ContentResult _success = new ContentResult { Content = "success", ContentType = "text/plain" };
-        private static readonly ContentResult _ok = new ContentResult { Content = "ok", ContentType = "text/plain" };
-
-        public static IActionResult Success => _success;
-
-        public static IActionResult Ok => _ok;
-    }
-}

+ 0 - 11
samples/WebApplicationSample/Helpers/LianLianPayNotifyResult.cs

@@ -1,11 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-
-namespace WebApplicationSample.Helpers
-{
-    public class LianLianPayNotifyResult
-    {
-        private static readonly ContentResult _success = new ContentResult { Content = "{\"ret_code\":\"0000\",\"ret_msg\":\"交易成功\"}", ContentType = "application/json" };
-
-        public static IActionResult Success => _success;
-    }
-}

+ 0 - 11
samples/WebApplicationSample/Helpers/QPayNotifyResult.cs

@@ -1,11 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-
-namespace WebApplicationSample.Helpers
-{
-    public class QPayNotifyResult
-    {
-        private static readonly ContentResult _success = new ContentResult { Content = "<xml><return_code>SUCCESS</return_code></xml>", ContentType = "text/xml" };
-
-        public static IActionResult Success => _success;
-    }
-}

+ 0 - 11
samples/WebApplicationSample/Helpers/UnionPayNotifyResult.cs

@@ -1,11 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-
-namespace WebApplicationSample.Helpers
-{
-    public class UnionPayNotifyResult
-    {
-        private static readonly ContentResult _ok = new ContentResult { Content = "ok", ContentType = "text/plain" };
-
-        public static IActionResult Ok => _ok;
-    }
-}

+ 0 - 11
samples/WebApplicationSample/Helpers/WeChatPayNotifyResult.cs

@@ -1,11 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-
-namespace WebApplicationSample.Helpers
-{
-    public class WeChatPayNotifyResult
-    {
-        private static readonly ContentResult _success = new ContentResult { Content = "<xml><return_code><![CDATA[SUCCESS]]></return_code></xml>", ContentType = "text/xml" };
-
-        public static IActionResult Success => _success;
-    }
-}

+ 23 - 0
src/Essensoft.AspNetCore.Payment.Alipay/AlipayNotifyResult.cs

@@ -0,0 +1,23 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace Essensoft.AspNetCore.Payment.Alipay
+{
+    /// <summary>
+    /// 支付宝 - 通知应答
+    /// </summary>
+    public class AlipayNotifyResult
+    {
+        private static readonly ContentResult _success = new ContentResult { Content = "success", ContentType = "text/plain", StatusCode = 200 };
+        private static readonly ContentResult _failure = new ContentResult { Content = "failure", ContentType = "text/plain", StatusCode = 200 };
+
+        /// <summary>
+        /// 成功
+        /// </summary>
+        public static IActionResult Success => _success;
+
+        /// <summary>
+        /// 失败
+        /// </summary>
+        public static IActionResult Failure => _failure;
+    }
+}

+ 29 - 0
src/Essensoft.AspNetCore.Payment.JDPay/JDPayNotifyResult.cs

@@ -0,0 +1,29 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace Essensoft.AspNetCore.Payment.JDPay
+{
+    /// <summary>
+    /// 京东支付 - 通知应答
+    /// </summary>
+    public class JDPayNotifyResult
+    {
+        private static readonly ContentResult _success = new ContentResult { Content = "success", ContentType = "text/plain", StatusCode = 200 };
+        private static readonly ContentResult _ok = new ContentResult { Content = "ok", ContentType = "text/plain", StatusCode = 200 };
+        private static readonly ContentResult _failure = new ContentResult { Content = "failure", ContentType = "text/plain", StatusCode = 200 };
+
+        /// <summary>
+        /// 成功
+        /// </summary>
+        public static IActionResult Success => _success;
+
+        /// <summary>
+        /// 成功
+        /// </summary>
+        public static IActionResult Ok => _ok;
+
+        /// <summary>
+        /// 失败
+        /// </summary>
+        public static IActionResult Failure => _failure;
+    }
+}

+ 23 - 0
src/Essensoft.AspNetCore.Payment.LianLianPay/LianLianPayNotifyResult.cs

@@ -0,0 +1,23 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace Essensoft.AspNetCore.Payment.LianLianPay
+{
+    /// <summary>
+    /// 连连支付 - 通知应答
+    /// </summary>
+    public class LianLianPayNotifyResult
+    {
+        private static readonly ContentResult _success = new ContentResult { Content = "{\"ret_code\":\"0000\",\"ret_msg\":\"交易成功\"}", ContentType = "application/json", StatusCode = 200 };
+        private static readonly ContentResult _failure = new ContentResult { Content = "{\"ret_code\":\"9999\",\"ret_msg\":\"交易失败\"}", ContentType = "application/json", StatusCode = 200 };
+
+        /// <summary>
+        /// 成功
+        /// </summary>
+        public static IActionResult Success => _success;
+
+        /// <summary>
+        /// 失败
+        /// </summary>
+        public static IActionResult Failure => _failure;
+    }
+}

+ 23 - 0
src/Essensoft.AspNetCore.Payment.QPay/QPayNotifyResult.cs

@@ -0,0 +1,23 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace Essensoft.AspNetCore.Payment.QPay
+{
+    /// <summary>
+    /// QQ钱包 - 通知应答
+    /// </summary>
+    public class QPayNotifyResult
+    {
+        private static readonly ContentResult _success = new ContentResult { Content = "<xml><return_code>SUCCESS</return_code></xml>", ContentType = "text/xml", StatusCode = 200 };
+        private static readonly ContentResult _failure = new ContentResult { Content = "<xml><return_code>FAIL</return_code></xml>", ContentType = "text/xml", StatusCode = 200 };
+
+        /// <summary>
+        /// 成功
+        /// </summary>
+        public static IActionResult Success => _success;
+
+        /// <summary>
+        /// 失败
+        /// </summary>
+        public static IActionResult Failure => _failure;
+    }
+}

+ 23 - 0
src/Essensoft.AspNetCore.Payment.UnionPay/UnionPayNotifyResult.cs

@@ -0,0 +1,23 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace Essensoft.AspNetCore.Payment.UnionPay
+{
+    /// <summary>
+    /// 银联支付 - 通知应答
+    /// </summary>
+    public class UnionPayNotifyResult
+    {
+        private static readonly ContentResult _success = new ContentResult { StatusCode = 200 };
+        private static readonly ContentResult _failure = new ContentResult { StatusCode = 202 };
+
+        /// <summary>
+        /// 成功
+        /// </summary>
+        public static IActionResult Success => _success;
+
+        /// <summary>
+        /// 失败
+        /// </summary>
+        public static IActionResult Failure => _failure;
+    }
+}

+ 23 - 0
src/Essensoft.AspNetCore.Payment.WeChatPay/WeChatPayNotifyResult.cs

@@ -0,0 +1,23 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace Essensoft.AspNetCore.Payment.WeChatPay
+{
+    /// <summary>
+    /// 微信支付 - 通知应答
+    /// </summary>
+    public class WeChatPayNotifyResult
+    {
+        private static readonly ContentResult _success = new ContentResult { Content = "<xml><return_code><![CDATA[SUCCESS]]></return_code></xml>", ContentType = "text/xml", StatusCode = 200 };
+        private static readonly ContentResult _failure = new ContentResult { Content = "<xml><return_code><![CDATA[FAIL]]></return_code></xml>", ContentType = "text/xml", StatusCode = 200 };
+
+        /// <summary>
+        /// 成功
+        /// </summary>
+        public static IActionResult Success => _success;
+
+        /// <summary>
+        /// 失败
+        /// </summary>
+        public static IActionResult Failure => _failure;
+    }
+}