bug fix
This commit is contained in:
parent
9bb9918421
commit
e83c62824b
@ -0,0 +1,246 @@
|
|||||||
|
package com.foxinmy.weixin4j.pay;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.foxinmy.weixin4j.pay.payment.mch.MchPayPackage;
|
||||||
|
import com.foxinmy.weixin4j.pay.payment.mch.SceneInfo;
|
||||||
|
import com.foxinmy.weixin4j.pay.payment.mch.SceneInfoApp;
|
||||||
|
import com.foxinmy.weixin4j.pay.payment.mch.SceneInfoStore;
|
||||||
|
import com.foxinmy.weixin4j.pay.type.TradeType;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MchPayPackage生成器
|
||||||
|
*
|
||||||
|
* 微信支付中很多新增的支付产品或功能不定期的在原来各种支付API中添加参数项,导致MchPayPackage类会不断更新
|
||||||
|
* MchPayPackage构造方法参数会越来越多,不断增加的参数项也不好继续改构造方法。
|
||||||
|
* PayApi中一些特定的支付api(如JSAPI、MACROPAY)等都是直接传入参数,然后在API内构造MchPayPackage,而不是传入MchPayPackage,
|
||||||
|
* 一旦增加新参数就需要改API,影响正在使用SDK的工程,但如果改为直接使用MchPayPackag的createPayRequest方法,
|
||||||
|
* MchPayPackage的构造方式又太难看,开发者需要对着微信文档然后看着构造函数里边一大堆的参数一一匹配
|
||||||
|
* 所以最终有了PayPackageBuilder这个类,通过一些链式的API构造MchPayPackage,既提供最小参数的各种支付构造方法,又能让代码看上去直观一些
|
||||||
|
*
|
||||||
|
* @author kit (kit.li@qq.com)
|
||||||
|
* @date 2020年06月02日
|
||||||
|
*/
|
||||||
|
public class PayPackageBuilder {
|
||||||
|
private static final String Y = "Y";
|
||||||
|
private MchPayPackage mchPayPackage;
|
||||||
|
|
||||||
|
private PayPackageBuilder(){
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用MchPayPackage初始化
|
||||||
|
*
|
||||||
|
* @param payPackage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static PayPackageBuilder init(MchPayPackage payPackage){
|
||||||
|
PayPackageBuilder instance = new PayPackageBuilder();
|
||||||
|
instance.mchPayPackage = payPackage;
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 付款码支付/人脸支付
|
||||||
|
*
|
||||||
|
* @param body
|
||||||
|
* 商品描述
|
||||||
|
* @param outTradeNo
|
||||||
|
* 商户订单号
|
||||||
|
* @param totalFee
|
||||||
|
* 支付金额
|
||||||
|
* @param createIp
|
||||||
|
* 终端IP
|
||||||
|
* @param authCode
|
||||||
|
* 用户付款码
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static PayPackageBuilder microPay(String body, String outTradeNo, double totalFee, String createIp,
|
||||||
|
String authCode){
|
||||||
|
PayPackageBuilder instance = new PayPackageBuilder();
|
||||||
|
instance.mchPayPackage = new MchPayPackage(body, outTradeNo, totalFee, null, createIp, TradeType.MICROPAY,
|
||||||
|
null, authCode, null, null);
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JSAPI支付/小程序支付
|
||||||
|
*
|
||||||
|
* @param body
|
||||||
|
* 商品描述
|
||||||
|
* @param outTradeNo
|
||||||
|
* 商户订单号
|
||||||
|
* @param totalFee
|
||||||
|
* 支付金额
|
||||||
|
* @param createIp
|
||||||
|
* 终端IP
|
||||||
|
* @param notifyUrl
|
||||||
|
* 回调通知地址
|
||||||
|
* @param openid
|
||||||
|
* 用户标识
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static PayPackageBuilder jsapiPay(String body, String outTradeNo, double totalFee, String createIp,
|
||||||
|
String notifyUrl, String openid){
|
||||||
|
PayPackageBuilder instance = new PayPackageBuilder();
|
||||||
|
instance.mchPayPackage = new MchPayPackage(body, outTradeNo, totalFee, notifyUrl, createIp, TradeType.JSAPI,
|
||||||
|
openid, null, null, null);
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* native支付
|
||||||
|
*
|
||||||
|
* @param body
|
||||||
|
* 商品描述
|
||||||
|
* @param outTradeNo
|
||||||
|
* 商户订单号
|
||||||
|
* @param totalFee
|
||||||
|
* 支付金额
|
||||||
|
* @param createIp
|
||||||
|
* 终端IP
|
||||||
|
* @param notifyUrl
|
||||||
|
* 回调通知地址
|
||||||
|
* @param productId
|
||||||
|
* 产品ID
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static PayPackageBuilder nativePay(String body, String outTradeNo, double totalFee, String createIp,
|
||||||
|
String notifyUrl, String productId){
|
||||||
|
PayPackageBuilder instance = new PayPackageBuilder();
|
||||||
|
instance.mchPayPackage = new MchPayPackage(body, outTradeNo, totalFee, notifyUrl, createIp, TradeType.NATIVE,
|
||||||
|
null, null, productId, null);
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APP支付
|
||||||
|
*
|
||||||
|
* @param body
|
||||||
|
* 商品描述
|
||||||
|
* @param outTradeNo
|
||||||
|
* 商户订单号
|
||||||
|
* @param totalFee
|
||||||
|
* 支付金额
|
||||||
|
* @param createIp
|
||||||
|
* 终端IP
|
||||||
|
* @param notifyUrl
|
||||||
|
* 回调通知地址
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static PayPackageBuilder appPay(String body, String outTradeNo, double totalFee, String createIp, String notifyUrl){
|
||||||
|
PayPackageBuilder instance = new PayPackageBuilder();
|
||||||
|
instance.mchPayPackage = new MchPayPackage(body, outTradeNo, totalFee, notifyUrl, createIp, TradeType.APP,
|
||||||
|
null, null, null, null);
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* H5支付
|
||||||
|
*
|
||||||
|
* @param body
|
||||||
|
* 商品描述
|
||||||
|
* @param outTradeNo
|
||||||
|
* 商户订单号
|
||||||
|
* @param totalFee
|
||||||
|
* 支付金额
|
||||||
|
* @param createIp
|
||||||
|
* 终端IP
|
||||||
|
* @param notifyUrl
|
||||||
|
* 回调通知地址
|
||||||
|
* @param wapUrl
|
||||||
|
* wap网站URL地址
|
||||||
|
* @param wapName
|
||||||
|
* wap网站名
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static PayPackageBuilder h5Pay(String body, String outTradeNo, double totalFee, String createIp,
|
||||||
|
String notifyUrl, String wapUrl, String wapName){
|
||||||
|
PayPackageBuilder instance = new PayPackageBuilder();
|
||||||
|
instance.mchPayPackage = new MchPayPackage(body, outTradeNo, totalFee, notifyUrl, createIp, TradeType.APP,
|
||||||
|
null, null, null, null);
|
||||||
|
SceneInfoApp app = SceneInfoApp.createWapAPP(wapName, wapUrl);
|
||||||
|
instance.mchPayPackage.setSceneInfo(String.format("{\"h5_info\":\"%s\"}", app.getSceneInfo()));
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PayPackageBuilder detail(String detail){
|
||||||
|
this.mchPayPackage.setDetail(detail);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PayPackageBuilder attach(String attach){
|
||||||
|
this.mchPayPackage.setAttach(attach);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PayPackageBuilder goodsTag(String goodsTag){
|
||||||
|
this.mchPayPackage.setGoodsTag(goodsTag);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PayPackageBuilder limitPay(){
|
||||||
|
this.mchPayPackage.setLimitPay("no_credit");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PayPackageBuilder timeStart(Date date){
|
||||||
|
this.mchPayPackage.setTimeStart(date);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PayPackageBuilder timeStart(String date){
|
||||||
|
this.mchPayPackage.setTimeStart(date);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PayPackageBuilder timeExpire(Date date){
|
||||||
|
this.mchPayPackage.setTimeExpire(date);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PayPackageBuilder timeExpire(String date){
|
||||||
|
this.mchPayPackage.setTimeExpire(date);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PayPackageBuilder receipt(){
|
||||||
|
this.mchPayPackage.setReceipt(Y);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PayPackageBuilder sceneInfo(SceneInfo info){
|
||||||
|
this.mchPayPackage.setSceneInfo(info.toJson());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PayPackageBuilder deposit(){
|
||||||
|
this.mchPayPackage.setDeposit(Y);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PayPackageBuilder profitSharing(){
|
||||||
|
this.mchPayPackage.setProfitSharing(Y);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PayPackageBuilder subOpenId(String subOpenId){
|
||||||
|
this.mchPayPackage.setSubOpenId(subOpenId);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PayPackageBuilder totalFee(double totalFee){
|
||||||
|
this.mchPayPackage.setTotalFee(totalFee);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PayPackageBuilder totalFee(int totalFee){
|
||||||
|
this.mchPayPackage.setTotalFee(totalFee);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MchPayPackage build(){
|
||||||
|
return this.mchPayPackage;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -279,7 +279,7 @@ public class WeixinPayProxy {
|
|||||||
* @param attach
|
* @param attach
|
||||||
* 附加数据 非必填
|
* 附加数据 非必填
|
||||||
* @param store
|
* @param store
|
||||||
* 门店信息 非必填
|
* APP支付已无门店信息,不需要再传
|
||||||
* @return APP支付对象
|
* @return APP支付对象
|
||||||
* @see PayApi
|
* @see PayApi
|
||||||
* @see SceneInfoStore
|
* @see SceneInfoStore
|
||||||
@ -366,41 +366,9 @@ public class WeixinPayProxy {
|
|||||||
totalFee, createIp, attach, store);
|
totalFee, createIp, attach, store);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 旧版刷脸支付接口
|
|
||||||
*
|
|
||||||
* @param faceCode
|
|
||||||
* 人脸凭证
|
|
||||||
* @param body
|
|
||||||
* 商品或支付单简要描述,格式要求:门店品牌名-城市分店名-实际商品名称
|
|
||||||
* @param outTradeNo
|
|
||||||
* 商户系统内部的订单号,32个字符内、可包含字母;更换授权码必须要换新的商户订单号
|
|
||||||
* @param totalFee
|
|
||||||
* 订单总金额,单位元
|
|
||||||
* @param createIp
|
|
||||||
* 调用微信支付API的机器IP
|
|
||||||
* @param openId
|
|
||||||
* 用户在商户appid 下的唯一标识
|
|
||||||
* @param attach
|
|
||||||
* 附加数据,在查询API和支付通知中原样返回,该字段主要用于商户携带订单的自定义数据
|
|
||||||
* @return
|
|
||||||
* @throws WeixinException
|
|
||||||
* @see <a href=
|
|
||||||
* "https://pay.weixin.qq.com/wiki/doc/wxfacepay/develop/backend.html#刷脸支付后端接口">
|
|
||||||
* 刷脸支付后端接口</a>
|
|
||||||
* @see <a href=
|
|
||||||
* "https://pay.weixin.qq.com/wiki/doc/wxfacepay/develop/sdk-android.html#人脸支付凭证-getwxpayfacecode"
|
|
||||||
* 获取人脸支付凭证</a>
|
|
||||||
*/
|
|
||||||
public MchPayRequest createFacePayRequest(String faceCode, String body,
|
|
||||||
String outTradeNo, double totalFee, String createIp, String openId,
|
|
||||||
String attach) throws WeixinException {
|
|
||||||
return payApi.createFacePayRequest(faceCode, body, outTradeNo,
|
|
||||||
totalFee, createIp, openId, attach);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 押金支付请求
|
* 押金支付请求
|
||||||
|
* 注意:(此功能微信已下架,改为邀请开通,因此暂未使用)
|
||||||
*
|
*
|
||||||
* @param code
|
* @param code
|
||||||
* 授权码/人脸凭证
|
* 授权码/人脸凭证
|
||||||
|
|||||||
@ -35,7 +35,7 @@ public class MchApi extends BaseApi {
|
|||||||
private final static String PEM_CERT_PREFIX = "-----BEGIN CERTIFICATE-----";
|
private final static String PEM_CERT_PREFIX = "-----BEGIN CERTIFICATE-----";
|
||||||
|
|
||||||
static {
|
static {
|
||||||
WEIXIN_BUNDLE = ResourceBundle.getBundle("com/foxinmy/weixin4j/payment/weixin");
|
WEIXIN_BUNDLE = ResourceBundle.getBundle("com/foxinmy/weixin4j/pay/weixin");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final WeixinPayAccount weixinAccount;
|
protected final WeixinPayAccount weixinAccount;
|
||||||
|
|||||||
@ -33,6 +33,8 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public class PayApi extends MchApi {
|
public class PayApi extends MchApi {
|
||||||
|
|
||||||
|
private final static String Y = "Y";
|
||||||
|
|
||||||
public PayApi(WeixinPayAccount weixinAccount) {
|
public PayApi(WeixinPayAccount weixinAccount) {
|
||||||
super(weixinAccount);
|
super(weixinAccount);
|
||||||
}
|
}
|
||||||
@ -87,14 +89,14 @@ public class PayApi extends MchApi {
|
|||||||
null, payPackage.getCreateIp(), null, payPackage.getOpenId(),
|
null, payPackage.getCreateIp(), null, payPackage.getOpenId(),
|
||||||
payPackage.getAuthCode(), null, payPackage.getAttach(),
|
payPackage.getAuthCode(), null, payPackage.getAttach(),
|
||||||
null, null, payPackage.getGoodsTag(),
|
null, null, payPackage.getGoodsTag(),
|
||||||
payPackage.getLimitPay(), payPackage.getSubAppId(), payPackage.getFaceCode(),
|
payPackage.getLimitPay(), payPackage.getSubAppId(), payPackage.getReceipt(),
|
||||||
payPackage.getDeposit(), payPackage.getProfitSharing());
|
payPackage.getDeposit(), payPackage.getProfitSharing());
|
||||||
// 默认为MD5签名
|
// 默认为MD5签名
|
||||||
SignType signType= SignType.MD5;
|
SignType signType= SignType.MD5;
|
||||||
super.declareMerchant(_payPackage);
|
super.declareMerchant(_payPackage);
|
||||||
// 默认为刷卡支付(付款码支付)的API地址
|
// 默认为刷卡支付(付款码支付)的API地址
|
||||||
String url = getRequestUri("micropay_uri");
|
String url = getRequestUri("micropay_uri");
|
||||||
if(payPackage.getDeposit()==YesNoType.Y){
|
if(Y.equals(payPackage.getDeposit())){
|
||||||
// 押金支付只支持HMAC-SHA256签名
|
// 押金支付只支持HMAC-SHA256签名
|
||||||
signType = SignType.HMAC$SHA256;
|
signType = SignType.HMAC$SHA256;
|
||||||
_payPackage.setSignType("HMAC-SHA256");
|
_payPackage.setSignType("HMAC-SHA256");
|
||||||
@ -275,7 +277,7 @@ public class PayApi extends MchApi {
|
|||||||
* @param attach
|
* @param attach
|
||||||
* 附加数据 非必填
|
* 附加数据 非必填
|
||||||
* @param store
|
* @param store
|
||||||
* 门店信息 非必填
|
* APP支付已无门店信息,不需要再传
|
||||||
* @return APP支付对象
|
* @return APP支付对象
|
||||||
* @see SceneInfoStore
|
* @see SceneInfoStore
|
||||||
* @see APPPayRequest
|
* @see APPPayRequest
|
||||||
@ -290,11 +292,6 @@ public class PayApi extends MchApi {
|
|||||||
MchPayPackage payPackage = new MchPayPackage(body, outTradeNo,
|
MchPayPackage payPackage = new MchPayPackage(body, outTradeNo,
|
||||||
totalFee, notifyUrl, createIp, TradeType.APP, null, null, null,
|
totalFee, notifyUrl, createIp, TradeType.APP, null, null, null,
|
||||||
attach);
|
attach);
|
||||||
if (store != null) {
|
|
||||||
payPackage.setSceneInfo(String.format(
|
|
||||||
"{\"store_id\": \"%s\", \"store_name\":\"%s\"}",
|
|
||||||
store.getId(), store.getName()));
|
|
||||||
}
|
|
||||||
return createPayRequest(payPackage);
|
return createPayRequest(payPackage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -331,8 +328,7 @@ public class PayApi extends MchApi {
|
|||||||
totalFee, notifyUrl, createIp, TradeType.MWEB, null, null,
|
totalFee, notifyUrl, createIp, TradeType.MWEB, null, null,
|
||||||
null, attach);
|
null, attach);
|
||||||
if (app != null) {
|
if (app != null) {
|
||||||
payPackage.setSceneInfo(String.format("{\"h5_info\":\"%s\"}",
|
payPackage.setSceneInfo(app.toJson());
|
||||||
app.getSceneInfo()));
|
|
||||||
}
|
}
|
||||||
return createPayRequest(payPackage);
|
return createPayRequest(payPackage);
|
||||||
}
|
}
|
||||||
@ -370,8 +366,7 @@ public class PayApi extends MchApi {
|
|||||||
totalFee, null, createIp, TradeType.MICROPAY, null, authCode,
|
totalFee, null, createIp, TradeType.MICROPAY, null, authCode,
|
||||||
null, attach);
|
null, attach);
|
||||||
if (store != null) {
|
if (store != null) {
|
||||||
payPackage.setSceneInfo(String.format("{\"store_info\":\"%s\"}",
|
payPackage.setSceneInfo(store.toJson());
|
||||||
JSON.toJSONString(store)));
|
|
||||||
}
|
}
|
||||||
return createPayRequest(payPackage);
|
return createPayRequest(payPackage);
|
||||||
}
|
}
|
||||||
@ -767,29 +762,6 @@ public class PayApi extends MchApi {
|
|||||||
return response.getAsObject(new TypeReference<PayfaceAuthinfo>() {});
|
return response.getAsObject(new TypeReference<PayfaceAuthinfo>() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 微信旧版刷脸支付
|
|
||||||
*
|
|
||||||
* @param faceCode
|
|
||||||
* @param body
|
|
||||||
* @param outTradeNo
|
|
||||||
* @param totalFee
|
|
||||||
* @param createIp
|
|
||||||
* @param openId
|
|
||||||
* @param attach
|
|
||||||
* @return
|
|
||||||
* @throws WeixinException
|
|
||||||
*/
|
|
||||||
public MchPayRequest createFacePayRequest(String faceCode, String body,
|
|
||||||
String outTradeNo, double totalFee, String createIp, String openId,
|
|
||||||
String attach) throws WeixinException {
|
|
||||||
MchPayPackage payPackage = new MchPayPackage(body, outTradeNo,
|
|
||||||
totalFee, null, createIp, TradeType.FACEPAY, openId, null,
|
|
||||||
null, attach);
|
|
||||||
payPackage.setFaceCode(faceCode);
|
|
||||||
return createPayRequest(payPackage);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建押金支付
|
* 创建押金支付
|
||||||
*
|
*
|
||||||
@ -814,16 +786,15 @@ public class PayApi extends MchApi {
|
|||||||
if(isFacePay) {
|
if(isFacePay) {
|
||||||
payPackage = new MchPayPackage(body, outTradeNo, totalFee, null, createIp, TradeType.FACEPAY,
|
payPackage = new MchPayPackage(body, outTradeNo, totalFee, null, createIp, TradeType.FACEPAY,
|
||||||
openId, null, null, attach);
|
openId, null, null, attach);
|
||||||
payPackage.setFaceCode(code);
|
payPackage.setAuthCode(code);
|
||||||
payPackage.setDeposit(YesNoType.Y);
|
payPackage.setDeposit(Y);
|
||||||
return createPayRequest(payPackage);
|
return createPayRequest(payPackage);
|
||||||
}else{
|
}else{
|
||||||
payPackage = new MchPayPackage(body, outTradeNo, totalFee, null, createIp, TradeType.MICROPAY,
|
payPackage = new MchPayPackage(body, outTradeNo, totalFee, null, createIp, TradeType.MICROPAY,
|
||||||
openId, code, null, attach);
|
openId, code, null, attach);
|
||||||
payPackage.setDeposit(YesNoType.Y);
|
payPackage.setDeposit(Y);
|
||||||
if (store != null) {
|
if (store != null) {
|
||||||
payPackage.setSceneInfo(String.format("{\"store_info\":\"%s\"}",
|
payPackage.setSceneInfo(store.toJson());
|
||||||
JSON.toJSONString(store)));
|
|
||||||
}
|
}
|
||||||
return createPayRequest(payPackage);
|
return createPayRequest(payPackage);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import com.foxinmy.weixin4j.pay.profitsharing.*;
|
|||||||
import com.foxinmy.weixin4j.pay.type.ProfitIdType;
|
import com.foxinmy.weixin4j.pay.type.ProfitIdType;
|
||||||
import com.foxinmy.weixin4j.pay.type.SignType;
|
import com.foxinmy.weixin4j.pay.type.SignType;
|
||||||
import com.foxinmy.weixin4j.pay.type.profitsharing.ReturnAccountType;
|
import com.foxinmy.weixin4j.pay.type.profitsharing.ReturnAccountType;
|
||||||
|
import com.foxinmy.weixin4j.util.RandomUtil;
|
||||||
import com.foxinmy.weixin4j.xml.XmlStream;
|
import com.foxinmy.weixin4j.xml.XmlStream;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -109,7 +110,9 @@ public class ProfitSharingApi extends MchApi {
|
|||||||
*/
|
*/
|
||||||
public ProfitSharingResult profitSharingQuery(String transactionId, String outOrderNo) throws WeixinException {
|
public ProfitSharingResult profitSharingQuery(String transactionId, String outOrderNo) throws WeixinException {
|
||||||
ProfitSharingRequest request = new ProfitSharingRequest(transactionId, outOrderNo, null);
|
ProfitSharingRequest request = new ProfitSharingRequest(transactionId, outOrderNo, null);
|
||||||
super.declareMerchant(request);
|
request.setMchId(weixinAccount.getMchId());
|
||||||
|
request.setNonceStr(RandomUtil.generateString(16));
|
||||||
|
request.setSubMchId(weixinAccount.getSubMchId());
|
||||||
String url = getRequestUri("profit_sharing_query_uri");
|
String url = getRequestUri("profit_sharing_query_uri");
|
||||||
request.setSign(weixinSignature.sign(request, SignType.HMAC$SHA256));
|
request.setSign(weixinSignature.sign(request, SignType.HMAC$SHA256));
|
||||||
String para = XmlStream.toXML(request);
|
String para = XmlStream.toXML(request);
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import com.alibaba.fastjson.annotation.JSONField;
|
|||||||
import com.foxinmy.weixin4j.pay.payment.PayPackage;
|
import com.foxinmy.weixin4j.pay.payment.PayPackage;
|
||||||
import com.foxinmy.weixin4j.pay.type.CurrencyType;
|
import com.foxinmy.weixin4j.pay.type.CurrencyType;
|
||||||
import com.foxinmy.weixin4j.pay.type.TradeType;
|
import com.foxinmy.weixin4j.pay.type.TradeType;
|
||||||
import com.foxinmy.weixin4j.pay.type.YesNoType;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
@ -77,18 +76,15 @@ public class MchPayPackage extends PayPackage {
|
|||||||
@XmlElement(name = "scene_info")
|
@XmlElement(name = "scene_info")
|
||||||
@JSONField(name = "scene_info")
|
@JSONField(name = "scene_info")
|
||||||
private String sceneInfo;
|
private String sceneInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 人脸凭证,用于旧版人脸支付。
|
* 电子发票入口开放标识
|
||||||
*/
|
*/
|
||||||
@XmlElement(name = "face_code")
|
private String receipt;
|
||||||
@JSONField(name = "face_code")
|
|
||||||
private String faceCode;
|
|
||||||
/**
|
/**
|
||||||
* 是否押金人脸支付,Y-是,N-普通人脸支付
|
* 是否押金人脸支付,Y-是,N-普通人脸支付
|
||||||
*/
|
*/
|
||||||
@XmlElement(name = "deposit")
|
private String deposit;
|
||||||
@JSONField(name = "deposit")
|
|
||||||
private YesNoType deposit;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否需要分帐,非必传,默认为不分帐
|
* 是否需要分帐,非必传,默认为不分帐
|
||||||
@ -96,7 +92,7 @@ public class MchPayPackage extends PayPackage {
|
|||||||
*/
|
*/
|
||||||
@XmlElement(name = "profit_sharing")
|
@XmlElement(name = "profit_sharing")
|
||||||
@JSONField(name = "profit_sharing")
|
@JSONField(name = "profit_sharing")
|
||||||
private YesNoType profitSharing;
|
private String profitSharing;
|
||||||
|
|
||||||
protected MchPayPackage() {
|
protected MchPayPackage() {
|
||||||
// jaxb required
|
// jaxb required
|
||||||
@ -172,9 +168,9 @@ public class MchPayPackage extends PayPackage {
|
|||||||
* @param subOpenId
|
* @param subOpenId
|
||||||
* 用户在子商户appid下的唯一标识 非必填
|
* 用户在子商户appid下的唯一标识 非必填
|
||||||
* openid和sub_openid可以选传其中之一,如果选择传sub_openid ,则必须传sub_appid
|
* openid和sub_openid可以选传其中之一,如果选择传sub_openid ,则必须传sub_appid
|
||||||
* @param faceCode
|
* @param receipt
|
||||||
* 人脸凭证,用于旧版刷脸支付。
|
* 电子发票入口开放标识
|
||||||
* @param depositType
|
* @param deposit
|
||||||
* 是否押金支付
|
* 是否押金支付
|
||||||
* @param profitSharing
|
* @param profitSharing
|
||||||
* 是否需要分账
|
* 是否需要分账
|
||||||
@ -183,20 +179,20 @@ public class MchPayPackage extends PayPackage {
|
|||||||
double totalFee, CurrencyType feeType, String notifyUrl,
|
double totalFee, CurrencyType feeType, String notifyUrl,
|
||||||
String createIp, TradeType tradeType, String openId,
|
String createIp, TradeType tradeType, String openId,
|
||||||
String authCode, String productId, String attach, Date timeStart,
|
String authCode, String productId, String attach, Date timeStart,
|
||||||
Date timeExpire, String goodsTag, String limitPay, String subOpenId, String faceCode,
|
Date timeExpire, String goodsTag, String limitPay, String subOpenId, String receipt,
|
||||||
YesNoType depositType, YesNoType profitSharing) {
|
String deposit, String profitSharing) {
|
||||||
super(body, detial, outTradeNo, totalFee, notifyUrl, createIp, attach,
|
super(body, detial, outTradeNo, totalFee, notifyUrl, createIp, attach,
|
||||||
timeStart, timeExpire, goodsTag);
|
timeStart, timeExpire, goodsTag);
|
||||||
this.tradeType = tradeType != null ? tradeType.name() : null;
|
this.tradeType = tradeType != null ? tradeType.name() : null;
|
||||||
this.feeType = feeType == null ? CurrencyType.CNY.name() : feeType
|
this.feeType = feeType == null ? CurrencyType.CNY.name() : feeType.name();
|
||||||
.name();
|
|
||||||
this.openId = openId;
|
this.openId = openId;
|
||||||
this.authCode = authCode;
|
this.authCode = authCode;
|
||||||
this.productId = productId;
|
this.productId = productId;
|
||||||
this.limitPay = limitPay;
|
this.limitPay = limitPay;
|
||||||
this.subOpenId = subOpenId;
|
this.subOpenId = subOpenId;
|
||||||
this.faceCode = faceCode;
|
this.receipt = receipt;
|
||||||
this.deposit = depositType;
|
this.deposit = deposit;
|
||||||
|
this.profitSharing = profitSharing;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTradeType() {
|
public String getTradeType() {
|
||||||
@ -263,27 +259,27 @@ public class MchPayPackage extends PayPackage {
|
|||||||
this.sceneInfo = sceneInfo;
|
this.sceneInfo = sceneInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFaceCode() {
|
public String getReceipt() {
|
||||||
return faceCode;
|
return receipt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFaceCode(String faceCode) {
|
public void setReceipt(String receipt) {
|
||||||
this.faceCode = faceCode;
|
this.receipt = receipt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public YesNoType getDeposit() {
|
public String getDeposit() {
|
||||||
return deposit;
|
return deposit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeposit(YesNoType deposit) {
|
public void setDeposit(String deposit) {
|
||||||
this.deposit = deposit;
|
this.deposit = deposit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public YesNoType getProfitSharing() {
|
public String getProfitSharing() {
|
||||||
return profitSharing;
|
return profitSharing;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProfitSharing(YesNoType profitSharing) {
|
public void setProfitSharing(String profitSharing) {
|
||||||
this.profitSharing = profitSharing;
|
this.profitSharing = profitSharing;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,7 +294,7 @@ public class MchPayPackage extends PayPackage {
|
|||||||
", limitPay='" + limitPay + '\'' +
|
", limitPay='" + limitPay + '\'' +
|
||||||
", subOpenId='" + subOpenId + '\'' +
|
", subOpenId='" + subOpenId + '\'' +
|
||||||
", sceneInfo='" + sceneInfo + '\'' +
|
", sceneInfo='" + sceneInfo + '\'' +
|
||||||
", faceCode='" + faceCode + '\'' +
|
", receipt='" + receipt + '\'' +
|
||||||
", deposit=" + deposit +
|
", deposit=" + deposit +
|
||||||
", profitSharing=" + profitSharing +
|
", profitSharing=" + profitSharing +
|
||||||
'}';
|
'}';
|
||||||
|
|||||||
@ -0,0 +1,16 @@
|
|||||||
|
package com.foxinmy.weixin4j.pay.payment.mch;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付场景信息接口
|
||||||
|
*
|
||||||
|
* @author kit
|
||||||
|
* @date 2020年06月03日
|
||||||
|
*/
|
||||||
|
public interface SceneInfo {
|
||||||
|
/**
|
||||||
|
* 格式化为Json字符串
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String toJson();
|
||||||
|
}
|
||||||
@ -1,24 +1,34 @@
|
|||||||
package com.foxinmy.weixin4j.pay.payment.mch;
|
package com.foxinmy.weixin4j.pay.payment.mch;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
@XmlRootElement
|
@XmlRootElement
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class SceneInfoApp {
|
public class SceneInfoApp implements SceneInfo {
|
||||||
/**
|
/**
|
||||||
* 终端类型
|
* 终端类型
|
||||||
*/
|
*/
|
||||||
private String type;
|
private String type;
|
||||||
/**
|
/**
|
||||||
* 应用名称
|
* WAP 网站名
|
||||||
*/
|
*/
|
||||||
|
@XmlElement(name = "wap_name")
|
||||||
|
@JSONField(name = "wap_name")
|
||||||
private String name;
|
private String name;
|
||||||
/**
|
/**
|
||||||
* 应用路径
|
* WAP网站URL地址
|
||||||
*/
|
*/
|
||||||
|
@XmlElement(name = "wap_url")
|
||||||
|
@JSONField(name = "wap_url")
|
||||||
private String path;
|
private String path;
|
||||||
|
|
||||||
|
@JSONField(serialize = false)
|
||||||
private String sceneInfo;
|
private String sceneInfo;
|
||||||
|
|
||||||
protected SceneInfoApp(){
|
protected SceneInfoApp(){
|
||||||
@ -55,21 +65,25 @@ public class SceneInfoApp {
|
|||||||
this.path = path;
|
this.path = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public String getSceneInfo() {
|
public String getSceneInfo() {
|
||||||
return sceneInfo;
|
return sceneInfo;
|
||||||
}
|
}
|
||||||
|
@Deprecated
|
||||||
public void setSceneInfo(String sceneInfo) {
|
public void setSceneInfo(String sceneInfo) {
|
||||||
this.sceneInfo = sceneInfo;
|
this.sceneInfo = sceneInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IOS应用
|
* IOS应用
|
||||||
|
* APP环境直接使用APP支付,此方法将作废
|
||||||
*
|
*
|
||||||
* @param appName 应用名
|
* @param appName 应用名
|
||||||
* @param bundleId 模块ID
|
* @param bundleId 模块ID
|
||||||
* @return
|
* @return
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static SceneInfoApp createIOSAPP(String appName, String bundleId) {
|
public static SceneInfoApp createIOSAPP(String appName, String bundleId) {
|
||||||
SceneInfoApp app = new SceneInfoApp("IOS", appName, bundleId);
|
SceneInfoApp app = new SceneInfoApp("IOS", appName, bundleId);
|
||||||
String sceneInfo = String
|
String sceneInfo = String
|
||||||
@ -81,11 +95,14 @@ public class SceneInfoApp {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Android应用
|
* Android应用
|
||||||
|
* APP环境直接使用APP支付,此方法将作废
|
||||||
*
|
*
|
||||||
* @param appName 应用名
|
* @param appName 应用名
|
||||||
* @param packageName 包名
|
* @param packageName 包名
|
||||||
* @return
|
* @return
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static SceneInfoApp createAndroidAPP(String appName, String packageName) {
|
public static SceneInfoApp createAndroidAPP(String appName, String packageName) {
|
||||||
SceneInfoApp app = new SceneInfoApp("Android", appName, packageName);
|
SceneInfoApp app = new SceneInfoApp("Android", appName, packageName);
|
||||||
String sceneInfo = String
|
String sceneInfo = String
|
||||||
@ -112,4 +129,9 @@ public class SceneInfoApp {
|
|||||||
app.setSceneInfo(sceneInfo);
|
app.setSceneInfo(sceneInfo);
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toJson() {
|
||||||
|
return String.format("{\"h5_info\": %s}", JSON.toJSONString(this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.foxinmy.weixin4j.pay.payment.mch;
|
package com.foxinmy.weixin4j.pay.payment.mch;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.annotation.JSONField;
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
@ -9,7 +10,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||||||
|
|
||||||
@XmlRootElement
|
@XmlRootElement
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class SceneInfoStore {
|
public class SceneInfoStore implements SceneInfo {
|
||||||
/**
|
/**
|
||||||
* SZTX001 门店唯一标识
|
* SZTX001 门店唯一标识
|
||||||
*/
|
*/
|
||||||
@ -67,9 +68,22 @@ public class SceneInfoStore {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SceneInfoStore(String id, String name, String areaCode, String address) {
|
||||||
|
super();
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.areaCode = areaCode;
|
||||||
|
this.address = address;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "SceneInfoStore [id=" + id + ", name=" + name + ", areaCode="
|
return "SceneInfoStore [id=" + id + ", name=" + name + ", areaCode="
|
||||||
+ areaCode + ", address=" + address + "]";
|
+ areaCode + ", address=" + address + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toJson() {
|
||||||
|
return String.format("{\"store_info\": %s}", JSON.toJSONString(this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,5 +1,6 @@
|
|||||||
package com.foxinmy.weixin4j.pay.profitsharing;
|
package com.foxinmy.weixin4j.pay.profitsharing;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.annotation.JSONField;
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
import com.foxinmy.weixin4j.pay.payment.mch.MerchantResult;
|
import com.foxinmy.weixin4j.pay.payment.mch.MerchantResult;
|
||||||
|
|
||||||
@ -29,13 +30,13 @@ public class ProfitSharingRequest extends MerchantResult {
|
|||||||
/**
|
/**
|
||||||
* 商户订单号
|
* 商户订单号
|
||||||
*/
|
*/
|
||||||
@XmlElement(name = "out_trade_no")
|
@XmlElement(name = "out_order_no")
|
||||||
@JSONField(name = "out_trade_no")
|
@JSONField(name = "out_order_no")
|
||||||
private String outOrderNo;
|
private String outOrderNo;
|
||||||
/**
|
/**
|
||||||
* 分账接收方列表,不超过50个
|
* 分账接收方列表,不超过50个
|
||||||
*/
|
*/
|
||||||
private List<ReceiverProfit> receivers;
|
private String receivers;
|
||||||
/**
|
/**
|
||||||
* 分账完结描述
|
* 分账完结描述
|
||||||
*/
|
*/
|
||||||
@ -44,7 +45,7 @@ public class ProfitSharingRequest extends MerchantResult {
|
|||||||
public ProfitSharingRequest(String transactionId, String outOrderNo, List<ReceiverProfit> receivers){
|
public ProfitSharingRequest(String transactionId, String outOrderNo, List<ReceiverProfit> receivers){
|
||||||
this.transactionId = transactionId;
|
this.transactionId = transactionId;
|
||||||
this.outOrderNo = outOrderNo;
|
this.outOrderNo = outOrderNo;
|
||||||
this.receivers = receivers;
|
this.receivers = receivers!=null && receivers.size()>0 ? JSON.toJSONString(receivers) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTransactionId() {
|
public String getTransactionId() {
|
||||||
@ -63,11 +64,11 @@ public class ProfitSharingRequest extends MerchantResult {
|
|||||||
this.outOrderNo = outOrderNo;
|
this.outOrderNo = outOrderNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ReceiverProfit> getReceivers() {
|
public String getReceivers() {
|
||||||
return receivers;
|
return receivers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setReceivers(List<ReceiverProfit> receivers) {
|
public void setReceivers(String receivers) {
|
||||||
this.receivers = receivers;
|
this.receivers = receivers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.foxinmy.weixin4j.pay.profitsharing;
|
package com.foxinmy.weixin4j.pay.profitsharing;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.annotation.JSONField;
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
import com.foxinmy.weixin4j.pay.payment.mch.MerchantResult;
|
import com.foxinmy.weixin4j.pay.payment.mch.MerchantResult;
|
||||||
|
|
||||||
@ -49,7 +50,8 @@ public class ProfitSharingResult extends MerchantResult {
|
|||||||
/**
|
/**
|
||||||
* 分账接收方列表(分帐查询)
|
* 分账接收方列表(分帐查询)
|
||||||
*/
|
*/
|
||||||
private List<ReceiverProfitResult> receivers;
|
@JSONField(serialize = false)
|
||||||
|
private String receivers;
|
||||||
/**
|
/**
|
||||||
* 分账金额(分帐查询)
|
* 分账金额(分帐查询)
|
||||||
* 分账完结的分账金额,单位为分, 仅当查询分账完结的执行结果时,存在本字段
|
* 分账完结的分账金额,单位为分, 仅当查询分账完结的执行结果时,存在本字段
|
||||||
@ -101,11 +103,11 @@ public class ProfitSharingResult extends MerchantResult {
|
|||||||
this.closeReason = closeReason;
|
this.closeReason = closeReason;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ReceiverProfitResult> getReceivers() {
|
public String getReceivers() {
|
||||||
return receivers;
|
return receivers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setReceivers(List<ReceiverProfitResult> receivers) {
|
public void setReceivers(String receivers) {
|
||||||
this.receivers = receivers;
|
this.receivers = receivers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,4 +126,9 @@ public class ProfitSharingResult extends MerchantResult {
|
|||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JSONField(name = "receivers")
|
||||||
|
public List<ReceiverProfitResult> getProfitResult(){
|
||||||
|
return JSON.parseArray(this.receivers, ReceiverProfitResult.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,13 @@ public class ReceiverProfit extends Receiver {
|
|||||||
private int amount;
|
private int amount;
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* json deserialize need
|
||||||
|
*/
|
||||||
|
public ReceiverProfit(){
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
public ReceiverProfit(ReceiverType type, String account, int amount, String description){
|
public ReceiverProfit(ReceiverType type, String account, int amount, String description){
|
||||||
super(type, account, null);
|
super(type, account, null);
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.foxinmy.weixin4j.pay.profitsharing;
|
package com.foxinmy.weixin4j.pay.profitsharing;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
import com.foxinmy.weixin4j.pay.payment.mch.MerchantResult;
|
import com.foxinmy.weixin4j.pay.payment.mch.MerchantResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -15,6 +16,7 @@ public class ReceiverResult extends MerchantResult {
|
|||||||
/**
|
/**
|
||||||
* 分账接收方对象,json格式字符串
|
* 分账接收方对象,json格式字符串
|
||||||
*/
|
*/
|
||||||
|
@JSONField(serialize = false)
|
||||||
private String receiver;
|
private String receiver;
|
||||||
|
|
||||||
public String getReceiver() {
|
public String getReceiver() {
|
||||||
@ -28,6 +30,7 @@ public class ReceiverResult extends MerchantResult {
|
|||||||
/**
|
/**
|
||||||
* 返回接收方java对象
|
* 返回接收方java对象
|
||||||
*/
|
*/
|
||||||
|
@JSONField(name = "receiver")
|
||||||
public Receiver getReceiverObject(){
|
public Receiver getReceiverObject(){
|
||||||
try {
|
try {
|
||||||
return JSON.parseObject(receiver, Receiver.class);
|
return JSON.parseObject(receiver, Receiver.class);
|
||||||
|
|||||||
@ -1,19 +0,0 @@
|
|||||||
package com.foxinmy.weixin4j.pay.type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通用的是或否参数
|
|
||||||
*
|
|
||||||
* @author kit (kit.li@qq.com)
|
|
||||||
* @date 2020年05月22日
|
|
||||||
* @since weixin4j-pay 1.1.0
|
|
||||||
*/
|
|
||||||
public enum YesNoType {
|
|
||||||
/**
|
|
||||||
* 是
|
|
||||||
*/
|
|
||||||
Y,
|
|
||||||
/**
|
|
||||||
* 否
|
|
||||||
*/
|
|
||||||
N
|
|
||||||
}
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
package com.foxinmy.weixin4j.pay.test;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.foxinmy.weixin4j.exception.WeixinException;
|
|
||||||
import com.foxinmy.weixin4j.pay.WeixinPayProxy;
|
|
||||||
import com.foxinmy.weixin4j.pay.model.WeixinPayAccount;
|
|
||||||
import com.foxinmy.weixin4j.pay.payment.mch.MchPayRequest;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
public class TestFacePay {
|
|
||||||
@Test
|
|
||||||
public void test() throws WeixinException {
|
|
||||||
String appid = "";
|
|
||||||
String mchid = "";
|
|
||||||
String paySignKey = "";
|
|
||||||
WeixinPayAccount payAccount = new WeixinPayAccount(appid, paySignKey, mchid);
|
|
||||||
WeixinPayProxy proxy = new WeixinPayProxy(payAccount);
|
|
||||||
|
|
||||||
String orderNo = "TESTORDER2019092001";
|
|
||||||
String openId = "oguJRswolIOGg7Vd1VaqGJuDBFAE";
|
|
||||||
String faceCode = "0f879a6c-5fff-421c-a233-5fac0f4aad12";
|
|
||||||
|
|
||||||
MchPayRequest rsp = proxy.createFacePayRequest(faceCode, "测试的人脸支付",
|
|
||||||
orderNo, 1,
|
|
||||||
"127.0.0.1", openId, null);
|
|
||||||
|
|
||||||
JSONObject obj = (JSONObject) JSON.toJSON(rsp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user