-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c84b46a
commit 6472484
Showing
3 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
...java-pay/src/main/java/com/github/binarywang/wxpay/bean/notify/WxPayNotifyV3Response.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.github.binarywang.wxpay.bean.notify; | ||
|
||
import com.google.gson.Gson; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
/** | ||
* 微信支付订单和退款的异步通知,V3版本共用的响应类. | ||
* https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_11.shtml | ||
* | ||
* @author <a href="https://github.com/0katekate0">Wang_Wong</a> | ||
* @date 2022-08-15 | ||
*/ | ||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class WxPayNotifyV3Response { | ||
|
||
private static final transient String SUCCESS = "SUCCESS"; | ||
private static final transient String FAIL = "FAIL"; | ||
|
||
private String code; | ||
private String message; | ||
|
||
/** | ||
* 返回成功 | ||
* | ||
* @param msg | ||
* @return | ||
*/ | ||
public static String success(String msg) { | ||
WxPayNotifyV3Response response = new WxPayNotifyV3Response(SUCCESS, msg); | ||
return new Gson().toJson(response); | ||
} | ||
|
||
/** | ||
* 返回失败 | ||
* | ||
* @param msg 返回信息,如非空,为错误原因 | ||
* @return | ||
*/ | ||
public static String fail(String msg) { | ||
WxPayNotifyV3Response response = new WxPayNotifyV3Response(FAIL, msg); | ||
return new Gson().toJson(response); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters