支付接口增加分账参数
This commit is contained in:
parent
4cb7e800ec
commit
eaa59ba9a1
|
|
@ -31,10 +31,10 @@ public class WxPayController extends BaseController {
|
|||
* &redirect_uri=http%3A%2F%2Fwww.opsoul.com%2Fpay%2Fwx%2Fpub
|
||||
* &response_type=code
|
||||
* &scope=snsapi_userinfo&state=STATE&connect_redirect=1#wechat_redirect
|
||||
* */
|
||||
*/
|
||||
@GetMapping("/pub")
|
||||
@ResponseBody
|
||||
public AjaxResult pubPay(HttpServletRequest request){
|
||||
public AjaxResult pubPay(HttpServletRequest request) {
|
||||
String code = request.getParameter("code");
|
||||
logger.info("code is " + code);
|
||||
//测试时前端不带订单号.
|
||||
|
|
@ -47,14 +47,14 @@ public class WxPayController extends BaseController {
|
|||
//调用adapay微信公众号支付.
|
||||
WxLiteExpend expend = new WxLiteExpend();
|
||||
expend.setOpen_id(openId);
|
||||
Map<String, Object> map = adapayService.wxPubPay(new WxPubPayCallBack(), expend, "wxPay123456" + Math.ceil(Math.random()*100), "1.00",
|
||||
"测试商品", "测试商品detail", "description");
|
||||
Map<String, Object> map = adapayService.wxPubPay(new WxPubPayCallBack(), expend, "wxPay123456" + Math.ceil(Math.random() * 100), "1.00",
|
||||
"测试商品", "测试商品detail", null, "description");
|
||||
//拼接消息给前端.前端通过JSAPI调用微信支付
|
||||
map.forEach((key,value)->{
|
||||
map.forEach((key, value) -> {
|
||||
logger.info("key is " + key + ", value is " + value);
|
||||
});
|
||||
return AjaxResult.success(map);
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error(ExceptionUtil.getExceptionMessage(e));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,24 +68,24 @@ public class AdapayService {
|
|||
* 支付宝正扫支付
|
||||
*/
|
||||
public Map<String, Object> alipayQrPay(PayCallback callback, WxLiteExpend expend, String orderNo, String payAmt,
|
||||
String goodsTittle, String goodsDesc, String description) throws BaseAdaPayException {
|
||||
return pay(callback, PayChannelEnum.ALIPAY_QR.getCode(), expend, orderNo, payAmt, goodsTittle, goodsDesc, description);
|
||||
String goodsTittle, String goodsDesc, String divMembers, String description) throws BaseAdaPayException {
|
||||
return pay(callback, PayChannelEnum.ALIPAY_QR.getCode(), expend, orderNo, payAmt, goodsTittle, goodsDesc, divMembers, description);
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信小程序支付
|
||||
*/
|
||||
public Map<String, Object> wxPubPay(PayCallback callback, WxLiteExpend expend, String orderNo, String payAmt,
|
||||
String goodsTittle, String goodsDesc, String description) throws BaseAdaPayException {
|
||||
return pay(callback, PayChannelEnum.WX_PUB.getCode(), expend, orderNo, payAmt, goodsTittle, goodsDesc, description);
|
||||
String goodsTittle, String goodsDesc, String divMembers, String description) throws BaseAdaPayException {
|
||||
return pay(callback, PayChannelEnum.WX_PUB.getCode(), expend, orderNo, payAmt, goodsTittle, goodsDesc, divMembers, description);
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信小程序支付
|
||||
*/
|
||||
public Map<String, Object> wxLitePay(PayCallback callback, WxLiteExpend expend, String orderNo, String payAmt,
|
||||
String goodsTittle, String goodsDesc, String description) throws BaseAdaPayException {
|
||||
return pay(callback, PayChannelEnum.WX_LITE.getCode(), expend, orderNo, payAmt, goodsTittle, goodsDesc, description);
|
||||
String goodsTittle, String goodsDesc, String divMembers, String description) throws BaseAdaPayException {
|
||||
return pay(callback, PayChannelEnum.WX_LITE.getCode(), expend, orderNo, payAmt, goodsTittle, goodsDesc, divMembers, description);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -96,11 +96,12 @@ public class AdapayService {
|
|||
* @param goodsDesc [必填项]商品描述信息,微信小程序和微信公众号该字段最大长度42个字符
|
||||
* @param payChannel [必填项]支付渠道,详见 https://docs.adapay.tech/api/appendix.html#id2
|
||||
* @param expend 支付渠道额外参数,条件可输入,详见 https://docs.adapay.tech/api/appendix.html#expend
|
||||
* @param divMembers 分账对象信息列表,最多仅支持7个分账方,json 数组形式,详见 https://docs.adapay.tech/api/appendix.html#divmembers
|
||||
* @param description 订单附加说明
|
||||
* @return 同步返回一个 支付对象,详见 https://docs.adapay.tech/api/trade.html#id2
|
||||
*/
|
||||
public Map<String, Object> pay(PayCallback callback, String payChannel, Expend expend, String orderNo, String payAmt,
|
||||
String goodsTittle, String goodsDesc, String description) throws BaseAdaPayException {
|
||||
String goodsTittle, String goodsDesc, String divMembers, String description) throws BaseAdaPayException {
|
||||
Map<String, Object> paymentParams = new HashMap<>(16);
|
||||
paymentParams.put("app_id", adapayProperties.getAppId());
|
||||
paymentParams.put("notify_url", adapayProperties.getNotifyUrl());
|
||||
|
|
@ -109,11 +110,12 @@ public class AdapayService {
|
|||
paymentParams.put("pay_amt", payAmt);
|
||||
paymentParams.put("goods_title", goodsTittle);
|
||||
paymentParams.put("goods_desc", goodsDesc);
|
||||
paymentParams.put("div_members", divMembers);
|
||||
paymentParams.put("description", description);
|
||||
paymentParams.put("expend", expend);
|
||||
PayReplyMapping.putCallback(orderNo, callback);
|
||||
|
||||
paymentParams.forEach((key,value)->{
|
||||
paymentParams.forEach((key, value) -> {
|
||||
logger.info("key is " + key + ", value is " + value);
|
||||
});
|
||||
return Payment.create(paymentParams);
|
||||
|
|
|
|||
Loading…
Reference in New Issue