1
0
Эх сурвалжийг харах

[示例] 修正失败返回结果

Roc 5 жил өмнө
parent
commit
aa6dca5a16

+ 17 - 12
samples/WebApplicationSample/Controllers/AlipayNotifyController.cs

@@ -82,11 +82,11 @@ namespace WebApplicationSample.Controllers
                         }
                 }
 
-                return NoContent();
+                return AlipayNotifyResult.Failure;
             }
             catch
             {
-                return NoContent();
+                return AlipayNotifyResult.Failure;
             }
         }
 
@@ -106,11 +106,12 @@ namespace WebApplicationSample.Controllers
 
                     return AlipayNotifyResult.Success;
                 }
-                return NoContent();
+
+                return AlipayNotifyResult.Failure;
             }
             catch
             {
-                return NoContent();
+                return AlipayNotifyResult.Failure;
             }
         }
 
@@ -130,11 +131,12 @@ namespace WebApplicationSample.Controllers
 
                     return AlipayNotifyResult.Success;
                 }
-                return NoContent();
+
+                return AlipayNotifyResult.Failure;
             }
             catch
             {
-                return NoContent();
+                return AlipayNotifyResult.Failure;
             }
         }
 
@@ -154,11 +156,12 @@ namespace WebApplicationSample.Controllers
 
                     return AlipayNotifyResult.Success;
                 }
-                return NoContent();
+
+                return AlipayNotifyResult.Failure;
             }
             catch
             {
-                return NoContent();
+                return AlipayNotifyResult.Failure;
             }
         }
 
@@ -178,11 +181,12 @@ namespace WebApplicationSample.Controllers
 
                     return AlipayNotifyResult.Success;
                 }
-                return NoContent();
+
+                return AlipayNotifyResult.Failure;
             }
             catch
             {
-                return NoContent();
+                return AlipayNotifyResult.Failure;
             }
         }
 
@@ -202,11 +206,12 @@ namespace WebApplicationSample.Controllers
 
                     return AlipayNotifyResult.Success;
                 }
-                return NoContent();
+
+                return AlipayNotifyResult.Failure;
             }
             catch
             {
-                return NoContent();
+                return AlipayNotifyResult.Failure;
             }
         }
     }

+ 9 - 6
samples/WebApplicationSample/Controllers/WeChatPayNotifyController.cs

@@ -1,6 +1,7 @@
 using System;
 using System.Threading.Tasks;
 using Essensoft.AspNetCore.Payment.WeChatPay;
+using Essensoft.AspNetCore.Payment.WeChatPay.V2;
 using Essensoft.AspNetCore.Payment.WeChatPay.V2.Notify;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.Extensions.Options;
@@ -35,14 +36,15 @@ namespace WebApplicationSample.Controllers
                     {
                         Console.WriteLine("OutTradeNo: " + notify.OutTradeNo);
 
-                        return Essensoft.AspNetCore.Payment.WeChatPay.V2.WeChatPayNotifyResult.Success;
+                        return WeChatPayNotifyResult.Success;
                     }
                 }
-                return NoContent();
+
+                return WeChatPayNotifyResult.Failure;
             }
             catch
             {
-                return NoContent();
+                return WeChatPayNotifyResult.Failure;
             }
         }
 
@@ -61,14 +63,15 @@ namespace WebApplicationSample.Controllers
                     if (notify.RefundStatus == WeChatPayCode.Success)
                     {
                         Console.WriteLine("OutTradeNo: " + notify.OutTradeNo);
-                        return Essensoft.AspNetCore.Payment.WeChatPay.V2.WeChatPayNotifyResult.Success;
+                        return WeChatPayNotifyResult.Success;
                     }
                 }
-                return NoContent();
+
+                return WeChatPayNotifyResult.Failure;
             }
             catch
             {
-                return NoContent();
+                return WeChatPayNotifyResult.Failure;
             }
         }
     }

+ 3 - 2
samples/WebApplicationSample/Controllers/WeChatPayV3NotifyController.cs

@@ -35,11 +35,12 @@ namespace WebApplicationSample.Controllers
                     Console.WriteLine("OutTradeNo: " + notify.OutTradeNo);
                     return WeChatPayNotifyResult.Success;
                 }
-                return NoContent();
+
+                return WeChatPayNotifyResult.Failure;
             }
             catch
             {
-                return NoContent();
+                return WeChatPayNotifyResult.Failure;
             }
         }
     }