mirror of
https://gitee.com/egzosn/pay-java-parent.git
synced 2026-05-07 11:44:49 +08:00
微信转账,保留转账到零钱
This commit is contained in:
@@ -15,6 +15,7 @@ import java.util.UUID;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.egzosn.pay.wx.v3.api.WxPayConfigStorage;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@@ -52,17 +53,17 @@ public class WxV3PayController {
|
||||
|
||||
// @PostConstruct //没有证书的情况下注释掉,避免启动报错
|
||||
public void init() throws IOException {
|
||||
com.egzosn.pay.wx.v3.api.WxPayConfigStorage wxPayConfigStorage = new com.egzosn.pay.wx.v3.api.WxPayConfigStorage();
|
||||
wxPayConfigStorage.setAppId("wx5ce9f1a2****");
|
||||
wxPayConfigStorage.setMchId("170330*****");
|
||||
WxPayConfigStorage wxPayConfigStorage = new WxPayConfigStorage();
|
||||
wxPayConfigStorage.setAppId("wxc8f2d26c249a6801");
|
||||
wxPayConfigStorage.setMchId("1738563613");
|
||||
//V3密钥 https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay3_2.shtml
|
||||
wxPayConfigStorage.setV3ApiKey("KDBX2tbrKi9eWFEZ*****");
|
||||
wxPayConfigStorage.setV3ApiKey("f90e38d83cf941b3bc78fced177742fc");
|
||||
// //验签、转账等接口使用,9月份开始不允许获取证书方式了,直接通过公钥字符来做或公钥证书
|
||||
// wxPayConfigStorage.setPlatformCertificate(Files.readString(Paths.get("wechatpay//wechatpay_72C2EF0EE5095C6D************.pem")));
|
||||
// wxPayConfigStorage.setPlatformSerialNumber("72C2EF0EE5095C6D************");
|
||||
//验签、转账等接口使用,9月份开始不允许获取证书方式了,直接通过公钥字符来做或公钥证书
|
||||
wxPayConfigStorage.setKeyPublic("支付平台公钥(原为自动获取的证书)");
|
||||
wxPayConfigStorage.setKeyPublicId("支付平台公钥ID");
|
||||
wxPayConfigStorage.setKeyPublic("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2K3ohpaJ9edg+qhLPukZzLM+ZJcVpXg2f64C6ysa24Y4GuZtA4CXQvo+n/F/XQu2vH8hWfI2oE709/trMaGh3xVJCjX0bDXUOdKmjE10f3cn9+DUbq5AtIL/XZcEXXuGdVokG8gHIwHAVJySwoBEkKffRi99pOIUuVjFXfaW68VOyjN3vE7lVn9WTO1b5nHeR5F82HbuodvNpzkyofaGW8b1C4cmEhrr9G5fDt1nMP7JJNU3SKqFU8XEM15y3ADshDp9nLVJf27TtdN752aG/n5LIrwUNwZpcwMsRxT+GUV/JhEDU4trv0UAR3Tx4GP0SRxkzggGUrt0ASH/dcHvaQIDAQAB");
|
||||
wxPayConfigStorage.setKeyPublicId("PUB_KEY_ID_0117385636132026012800111566000802");
|
||||
|
||||
wxPayConfigStorage.setNotifyUrl("https://pay.egzosn.com/wxV3/payBack.json");
|
||||
wxPayConfigStorage.setReturnUrl("https://pay.egzosn.com/wxV3/payBack.json");
|
||||
|
||||
@@ -650,6 +650,30 @@ public class WxPayService extends BasePayService<WxPayConfigStorage> implements
|
||||
return getAssistService().doExecute(attr, transferOrder.getTransferType());
|
||||
}
|
||||
|
||||
Map<String, Object> parameters = new HashMap<>(12);
|
||||
parameters.put(WxConst.APPID, payConfigStorage.getAppId());
|
||||
parameters.put(WxConst.OUT_BILL_NO, transferOrder.getOutNo());
|
||||
parameters.put(WxConst.OPENID, transferOrder.getPayeeAccount());
|
||||
if (StringUtils.isNotEmpty(transferOrder.getPayeeName())){
|
||||
parameters.put(WxConst.USER_NAME, transferOrder.getPayeeName());
|
||||
}
|
||||
parameters.put(WxConst.TRANSFER_AMOUNT, Util.conversionCentAmount(transferOrder.getAmount()));
|
||||
parameters.put(WxConst.TRANSFER_REMARK, transferOrder.getRemark());
|
||||
parameters.put(WxConst.TOTAL_NUM, transferOrder.getAttr(WxConst.TOTAL_NUM));
|
||||
OrderParaStructure.loadParameters(parameters, WxConst.TRANSFER_SCENE_ID, transferOrder);
|
||||
OrderParaStructure.loadParameters(parameters, WxConst.NOTIFY_URL, transferOrder);
|
||||
OrderParaStructure.loadParameters(parameters, WxConst.USER_RECV_PERCEPTION, transferOrder);
|
||||
OrderParaStructure.loadParameters(parameters, WxConst.TRANSFER_SCENE_REPORT_INFOS, transferOrder);
|
||||
return getAssistService().doExecute(parameters, transferOrder.getTransferType());
|
||||
}
|
||||
|
||||
public Map<String, Object> transferLooseChange(TransferOrder transferOrder) {
|
||||
//转账账单电子回单申请受理接口
|
||||
if (transferOrder.getTransferType() == WxTransferType.TRANSFER_BILL_RECEIPT) {
|
||||
Map<String, Object> attr = new MapGen<String, Object>(WxConst.OUT_BATCH_NO, transferOrder.getBatchNo()).getAttr();
|
||||
return getAssistService().doExecute(attr, transferOrder.getTransferType());
|
||||
}
|
||||
|
||||
Map<String, Object> parameters = new HashMap<>(12);
|
||||
parameters.put(WxConst.APPID, payConfigStorage.getAppId());
|
||||
parameters.put(WxConst.OUT_BATCH_NO, transferOrder.getBatchNo());
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.egzosn.pay.wx.v3.bean.transfer;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
public class TransferSceneReport {
|
||||
@JSONField(name = "info_type")
|
||||
private String infoType;
|
||||
@JSONField(name = "info_content")
|
||||
private String infoContent;
|
||||
|
||||
public TransferSceneReport() {
|
||||
}
|
||||
|
||||
public TransferSceneReport(String infoType, String infoContent) {
|
||||
this.infoType = infoType;
|
||||
this.infoContent = infoContent;
|
||||
}
|
||||
|
||||
public String getInfoType() {
|
||||
return infoType;
|
||||
}
|
||||
|
||||
public void setInfoType(String infoType) {
|
||||
this.infoType = infoType;
|
||||
}
|
||||
|
||||
public String getInfoContent() {
|
||||
return infoContent;
|
||||
}
|
||||
|
||||
public void setInfoContent(String infoContent) {
|
||||
this.infoContent = infoContent;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.egzosn.pay.wx.v3.bean.transfer;
|
||||
|
||||
public enum TransferSceneType {
|
||||
CASH_MARKETING(1000, "现金营销"),
|
||||
CORPORATE_COMPENSATION(1011, "企业赔付"),
|
||||
COMMISSION_PAYMENT(1005, "佣金报酬"),
|
||||
PURCHASE_PAYMENT(1009, "采购货款"),
|
||||
SECOND_HAND_RECYCLING(1010, "二手回收"),
|
||||
PUBLIC_WELFARE_SUBSIDY(1013, "公益补助"),
|
||||
ADMINISTRATIVE_SUBSIDY(1002, "行政补贴"),
|
||||
INSURANCE_CLAIM(1004, "保险理赔")
|
||||
;
|
||||
private int code;
|
||||
private String desc;
|
||||
TransferSceneType(int code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -71,6 +71,7 @@ public final class WxConst {
|
||||
public static final String RESP_BODY = WxPayService.class.getName() + "$RESP_BODY";
|
||||
public static final String OUT_BATCH_NO = "out_batch_no";
|
||||
public static final String OUT_DETAIL_NO = "out_detail_no";
|
||||
public static final String OUT_BILL_NO = "out_bill_no";
|
||||
public static final String DETAIL_ID = "detail_id";
|
||||
public static final String BATCH_NAME = "batch_name";
|
||||
public static final String BATCH_REMARK = "batch_remark";
|
||||
@@ -82,7 +83,13 @@ public final class WxConst {
|
||||
public static final String NEED_QUERY_DETAIL = "need_query_detail";
|
||||
public static final String OFFSET = "offset";
|
||||
public static final String LIMIT = "limit";
|
||||
public static final String OPENID = "openid";
|
||||
public static final String USER_NAME = "user_name";
|
||||
public static final String DETAIL_STATUS = "detail_status";
|
||||
public static final String TRANSFER_AMOUNT = "transfer_amount";
|
||||
public static final String TRANSFER_REMARK = "transfer_remark";
|
||||
public static final String USER_RECV_PERCEPTION = "user_recv_perception";
|
||||
public static final String TRANSFER_SCENE_REPORT_INFOS = "transfer_scene_report_infos";
|
||||
public static final String WECHATPAY_SERIAL = "Wechatpay-Serial";
|
||||
public static final String AUTHORIZATION_CODE = "authorization_code";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user