mirror of
https://gitee.com/egzosn/pay-java-parent.git
synced 2026-05-11 16:11:47 +08:00
jspai独立接口,优化案例
This commit is contained in:
@@ -282,9 +282,10 @@ public class AliPayService extends BasePayService<AliPayConfigStorage> implement
|
||||
bizContent.put(PRODUCT_CODE, "QUICK_MSECURITY_PAY");
|
||||
break;
|
||||
case MINAPP:
|
||||
bizContent.put("extend_params", order.getAddition());
|
||||
bizContent.put(PASSBACK_PARAMS, order.getAddition());
|
||||
bizContent.put("op_app_id", order.getAttrForString("op_app_id"));
|
||||
bizContent.put("buyer_id", order.getOpenid());
|
||||
bizContent.put(PRODUCT_CODE, "FACE_TO_FACE_PAYMENT");
|
||||
bizContent.put(PRODUCT_CODE, "JSAPI_PAY");
|
||||
break;
|
||||
case BAR_CODE:
|
||||
case WAVE_CODE:
|
||||
@@ -299,14 +300,27 @@ public class AliPayService extends BasePayService<AliPayConfigStorage> implement
|
||||
|
||||
setExpirationTime(bizContent, order);
|
||||
|
||||
bizContent.putAll(order.getAttrs());
|
||||
loadAddition(bizContent, order);
|
||||
orderInfo.put(BIZ_CONTENT, JSON.toJSONString(bizContent));
|
||||
return preOrderHandler(orderInfo, order);
|
||||
}
|
||||
|
||||
private Map<String, Object> setExpirationTime(Map<String, Object> bizContent, PayOrder order) {
|
||||
private void loadAddition(Map<String, Object> bizContent, PayOrder order) {
|
||||
OrderParaStructure.loadParameters(bizContent, AliPayConst.EXTEND_PARAMS, order);
|
||||
OrderParaStructure.loadParameters(bizContent, AliPayConst.BUSINESS_PARAMS, order);
|
||||
OrderParaStructure.loadParameters(bizContent, AliPayConst.DISCOUNTABLE_AMOUNT, order);
|
||||
OrderParaStructure.loadParameters(bizContent, AliPayConst.UNDISCOUNTABLE_AMOUNT, order);
|
||||
OrderParaStructure.loadParameters(bizContent, AliPayConst.STORE_ID, order);
|
||||
OrderParaStructure.loadParameters(bizContent, AliPayConst.ALIPAY_STORE_ID, order);
|
||||
OrderParaStructure.loadParameters(bizContent, AliPayConst.ENABLE_PAY_CHANNELS, order);
|
||||
OrderParaStructure.loadParameters(bizContent, AliPayConst.DISABLE_PAY_CHANNELS, order);
|
||||
OrderParaStructure.loadParameters(bizContent, AliPayConst.QUERY_OPTIONS, order);
|
||||
OrderParaStructure.loadParameters(bizContent, AliPayConst.AGREEMENT_SIGN_PARAMS, order);
|
||||
}
|
||||
|
||||
private void setExpirationTime(Map<String, Object> bizContent, PayOrder order) {
|
||||
if (null == order.getExpirationTime()) {
|
||||
return bizContent;
|
||||
return;
|
||||
}
|
||||
bizContent.put("timeout_express", DateUtils.minutesRemaining(order.getExpirationTime()) + "m");
|
||||
switch ((AliTransactionType) order.getTransactionType()) {
|
||||
@@ -316,11 +330,11 @@ public class AliPayService extends BasePayService<AliPayConfigStorage> implement
|
||||
case PAGE:
|
||||
case WAP:
|
||||
case APP:
|
||||
case MINAPP:
|
||||
bizContent.put("time_expire", DateUtils.formatDate(order.getExpirationTime(), DateUtils.YYYY_MM_DD_HH_MM_SS));
|
||||
break;
|
||||
default:
|
||||
}
|
||||
return bizContent;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -441,6 +455,31 @@ public class AliPayService extends BasePayService<AliPayConfigStorage> implement
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序支付,返回小程序所需的订单构建信息
|
||||
*
|
||||
* @param order 发起支付的订单信息
|
||||
* @return 返回支付结果
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> jsApi(PayOrder order) {
|
||||
if (null == order.getTransactionType()) {
|
||||
order.setTransactionType(AliTransactionType.MINAPP);
|
||||
}
|
||||
Map<String, Object> orderInfo = orderInfo(order);
|
||||
Map<String, Object> body = new LinkedHashMap<>();
|
||||
body.put(BIZ_CONTENT, orderInfo.remove(BIZ_CONTENT));
|
||||
OrderParaStructure.loadParameters(body, APP_AUTH_TOKEN, (String) orderInfo.remove(APP_AUTH_TOKEN));
|
||||
//预订单
|
||||
JSONObject result = getHttpRequestTemplate().postForObject(getReqUrl() + "?" + UriVariables.getMapToParameters(orderInfo), body, JSONObject.class);
|
||||
JSONObject response = result.getJSONObject("alipay_trade_create_response");
|
||||
if (!SUCCESS_CODE.equals(response.getString(CODE))) {
|
||||
LOG.warn("下单失败:{}", response);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* pos主动扫码付款(条码付)
|
||||
*
|
||||
@@ -461,7 +500,7 @@ public class AliPayService extends BasePayService<AliPayConfigStorage> implement
|
||||
JSONObject result = getHttpRequestTemplate().postForObject(getReqUrl() + "?" + UriVariables.getMapToParameters(orderInfo), null, JSONObject.class);
|
||||
JSONObject response = result.getJSONObject("alipay_trade_pay_response");
|
||||
if (!SUCCESS_CODE.equals(response.getString(CODE))) {
|
||||
LOG.info("收款失败");
|
||||
LOG.info("收款失败{}", response);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -64,9 +64,17 @@ public final class AliPayConst {
|
||||
* 业务扩展参数
|
||||
*/
|
||||
public static final String EXTEND_PARAMS = "extend_params";
|
||||
public static final String BUSINESS_PARAMS = "business_params";
|
||||
public static final String DISCOUNTABLE_AMOUNT = "discountable_amount";
|
||||
public static final String UNDISCOUNTABLE_AMOUNT = "undiscountable_amount";
|
||||
public static final String STORE_ID = "store_id";
|
||||
public static final String ENABLE_PAY_CHANNELS = "enable_pay_channels";
|
||||
public static final String DISABLE_PAY_CHANNELS = "disable_pay_channels";
|
||||
public static final String QUERY_OPTIONS = "query_options";
|
||||
public static final String AGREEMENT_SIGN_PARAMS = "agreement_sign_params";
|
||||
public static final String ALIPAY_STORE_ID = "alipay_store_id";
|
||||
public static final String BIZ_TYPE = "biz_type";
|
||||
public static final String REFUND_REASON = "refund_reason";
|
||||
public static final String QUERY_OPTIONS = "query_options";
|
||||
public static final String OUT_REQUEST_NO = "out_request_no";
|
||||
/**
|
||||
* 用户付款中途退出返回商户网站的地址
|
||||
|
||||
@@ -197,6 +197,17 @@ public abstract class BasePayService<PC extends PayConfigStorage> implements Pay
|
||||
return MatrixToImageWriter.writeInfoToJpgBuff(getQrPay(order));
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序支付,返回小程序所需的订单构建信息
|
||||
*
|
||||
* @param order 发起支付的订单信息
|
||||
* @return 返回支付结果
|
||||
*/
|
||||
@Override
|
||||
public <O extends PayOrder> Map<String, Object> jsApi(O order) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* 将请求参数或者请求流转化为 Map
|
||||
*
|
||||
|
||||
@@ -185,6 +185,14 @@ public interface PayService<PC extends PayConfigStorage> {
|
||||
*/
|
||||
<O extends PayOrder> String getQrPay(O order);
|
||||
|
||||
/**
|
||||
* 小程序支付,返回小程序所需的订单构建信息
|
||||
*
|
||||
* @param order 发起支付的订单信息
|
||||
* @param <O> 预订单类型
|
||||
* @return 返回支付结果
|
||||
*/
|
||||
<O extends PayOrder> Map<String, Object> jsApi(O order);
|
||||
/**
|
||||
* 刷卡付,pos主动扫码付款(条码付)
|
||||
* 刷脸付
|
||||
|
||||
@@ -72,6 +72,13 @@
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.annotation</groupId>
|
||||
<artifactId>jakarta.annotation-api</artifactId>
|
||||
<version>1.3.5</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- /spring -->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.egzosn.pay.ali.api.AliPayConfigStorage;
|
||||
import com.egzosn.pay.ali.api.AliPayService;
|
||||
import com.egzosn.pay.ali.bean.AliRefundResult;
|
||||
@@ -32,6 +33,7 @@ import com.egzosn.pay.common.bean.PayOrder;
|
||||
import com.egzosn.pay.common.bean.RefundOrder;
|
||||
import com.egzosn.pay.common.http.HttpConfigStorage;
|
||||
import com.egzosn.pay.common.http.UriVariables;
|
||||
import com.egzosn.pay.common.util.MapGen;
|
||||
import com.egzosn.pay.common.util.sign.SignUtils;
|
||||
import com.egzosn.pay.demo.request.QueryOrder;
|
||||
import com.egzosn.pay.demo.service.handler.AliPayMessageHandler;
|
||||
@@ -181,6 +183,29 @@ public class AliPayController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 刷卡付,pos主动扫码付款(条码付)
|
||||
*
|
||||
* @param openid 授权码,条码等
|
||||
* @param price 金额
|
||||
* @return 支付结果
|
||||
*/
|
||||
@RequestMapping(value = "minapp")
|
||||
public Map<String, Object> minapp(BigDecimal price, String openid) {
|
||||
//获取对应的支付账户操作工具(可根据账户id)
|
||||
//条码付
|
||||
PayOrder order = new PayOrder("egan order", "egan order", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), AliTransactionType.BAR_CODE);
|
||||
//声波付
|
||||
// PayOrder order = new PayOrder("egan order", "egan order", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), AliTransactionType.WAVE_CODE);
|
||||
//设置授权码,条码等
|
||||
order.setOpenid(openid);
|
||||
order.addAttr("op_app_id", "小程序支付中,商户实际经营主体的小程序应用的appid,也即最终唤起收银台支付所在的小程序的应用id");
|
||||
//预订单结果
|
||||
Map<String, Object> params = service.jsApi(order);
|
||||
//这里开发者自行处理
|
||||
return params;
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷卡付,pos主动扫码付款(条码付)
|
||||
*
|
||||
@@ -210,6 +235,27 @@ public class AliPayController {
|
||||
//这里开发者自行处理
|
||||
return params;
|
||||
}
|
||||
/**
|
||||
* 刷卡付,pos主动扫码付款(条码付)
|
||||
*
|
||||
* @param openid 授权码,条码等
|
||||
* @param price 金额
|
||||
* @return 支付结果
|
||||
*/
|
||||
@RequestMapping(value = "jsapi")
|
||||
public Map<String, Object> jsapi(BigDecimal price, String openid) {
|
||||
//获取对应的支付账户操作工具(可根据账户id)
|
||||
//条码付
|
||||
PayOrder order = new PayOrder("egan order", "egan order", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), AliTransactionType.BAR_CODE);
|
||||
|
||||
order.setOpenid(openid);
|
||||
//支付结果
|
||||
Map<String, Object> orderInfo = service.orderInfo(order);
|
||||
Map<String, Object> bizContent = new MapGen<>("biz_content", orderInfo.get("biz_content")).getAttr();
|
||||
JSONObject result = service.getHttpRequestTemplate().postForObject(service.getReqUrl() + "?" + UriVariables.getMapToParameters(orderInfo), bizContent, JSONObject.class);
|
||||
//这里开发者自行处理
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付回调地址 方式一
|
||||
|
||||
@@ -165,7 +165,7 @@ public class PayController {
|
||||
PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), PayType.valueOf(payResponse.getStorage().getPayType()).getTransactionType("JSAPI"));
|
||||
order.setOpenid(openid);
|
||||
|
||||
Map orderInfo = payResponse.getService().orderInfo(order);
|
||||
Map<String, Object> orderInfo = payResponse.getService().jsApi(order);
|
||||
orderInfo.put("code", 0);
|
||||
|
||||
return orderInfo;
|
||||
@@ -211,9 +211,9 @@ public class PayController {
|
||||
Map<String, Object> params = payResponse.getService().microPay(order);
|
||||
PayConfigStorage storage = payResponse.getService().getPayConfigStorage();
|
||||
//校验
|
||||
if (payResponse.getService().verify(params)) {
|
||||
if (payResponse.getService().verify(new NoticeParams(params))) {
|
||||
PayMessage message = new PayMessage(params, storage.getPayType());
|
||||
//支付校验通过后的处理
|
||||
//支付校验通过后的处理,,路由的方式已经不建议使用了
|
||||
payResponse.getRouter().route(message);
|
||||
}
|
||||
//这里开发者自行处理
|
||||
|
||||
@@ -124,7 +124,7 @@ public class WxPayController {
|
||||
PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), WxTransactionType.JSAPI);
|
||||
order.setOpenid(openid);
|
||||
|
||||
Map orderInfo = service.orderInfo(order);
|
||||
Map<String, Object> orderInfo = service.jsApi(order);
|
||||
orderInfo.put("code", 0);
|
||||
|
||||
return orderInfo;
|
||||
|
||||
@@ -126,7 +126,7 @@ public class WxV3CombinePayController {
|
||||
subOrder.setSubMchid("服务商必填----二级商户商户号,由微信支付生成并下发。服务商子商户的商户号,被合单方。直连商户不用传二级商户号。 ");
|
||||
subOrders.add(subOrder);
|
||||
order.setSubOrders(subOrders);
|
||||
Map orderInfo = service.orderInfo(order);
|
||||
Map orderInfo = service.jsApi(order);
|
||||
orderInfo.put("code", 0);
|
||||
return orderInfo;
|
||||
}
|
||||
|
||||
@@ -98,17 +98,18 @@ public class WxV3PayController {
|
||||
/**
|
||||
* 公众号支付
|
||||
*
|
||||
*
|
||||
* @param openid openid
|
||||
* @param price 金额
|
||||
* @param price 金额
|
||||
* @return 返回jsapi所需参数
|
||||
*/
|
||||
@RequestMapping(value = "jsapi")
|
||||
@RequestMapping(value = "jsapi" )
|
||||
public Map toPay(String openid, BigDecimal price) {
|
||||
|
||||
PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), WxTransactionType.JSAPI);
|
||||
PayOrder order = new PayOrder("订单title", "摘要", null == price ? BigDecimal.valueOf(0.01) : price, UUID.randomUUID().toString().replace("-", ""), com.egzosn.pay.wx.bean.WxTransactionType.JSAPI);
|
||||
order.setOpenid(openid);
|
||||
|
||||
Map orderInfo = service.orderInfo(order);
|
||||
Map<String, Object> orderInfo = service.jsApi(order);
|
||||
orderInfo.put("code", 0);
|
||||
|
||||
return orderInfo;
|
||||
|
||||
@@ -8,7 +8,12 @@ import com.egzosn.pay.common.bean.BasePayType;
|
||||
import com.egzosn.pay.common.bean.CertStoreType;
|
||||
import com.egzosn.pay.common.bean.TransactionType;
|
||||
import com.egzosn.pay.common.util.sign.SignUtils;
|
||||
import com.egzosn.pay.demo.service.handler.FuiouPayMessageHandler;
|
||||
import com.egzosn.pay.demo.service.handler.PayPalPayMessageHandler;
|
||||
import com.egzosn.pay.demo.service.handler.PayoneerMessageHandler;
|
||||
import com.egzosn.pay.demo.service.handler.UnionPayMessageHandler;
|
||||
import com.egzosn.pay.demo.service.handler.WxPayMessageHandler;
|
||||
import com.egzosn.pay.demo.service.handler.YouDianPayMessageHandler;
|
||||
import com.egzosn.pay.fuiou.api.FuiouPayConfigStorage;
|
||||
import com.egzosn.pay.fuiou.api.FuiouPayService;
|
||||
import com.egzosn.pay.fuiou.bean.FuiouTransactionType;
|
||||
@@ -64,7 +69,9 @@ public enum PayType implements BasePayType {
|
||||
aliPayConfigStorage.setInputCharset("utf-8");
|
||||
//是否为测试账号,沙箱环境
|
||||
aliPayConfigStorage.setTest(true);
|
||||
return new AliPayService(aliPayConfigStorage);
|
||||
AliPayService aliPayService = new AliPayService(aliPayConfigStorage);
|
||||
aliPayService.setPayMessageHandler(new WxPayMessageHandler(apyAccount.getPayId()));
|
||||
return aliPayService;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -102,7 +109,7 @@ public enum PayType implements BasePayType {
|
||||
httpConfigStorage.setCertStoreType(CertStoreType.PATH);
|
||||
return new WxPayService(wxPayConfigStorage, httpConfigStorage);*/
|
||||
WxPayService wxPayService = new WxPayService(wxPayConfigStorage);
|
||||
wxPayService.setPayMessageHandler(new WxPayMessageHandler(1));
|
||||
wxPayService.setPayMessageHandler(new WxPayMessageHandler(apyAccount.getPayId()));
|
||||
return wxPayService;
|
||||
}
|
||||
|
||||
@@ -131,7 +138,9 @@ public enum PayType implements BasePayType {
|
||||
wxPayConfigStorage.setSeller(apyAccount.getSeller());
|
||||
wxPayConfigStorage.setInputCharset(apyAccount.getInputCharset());
|
||||
wxPayConfigStorage.setTest(apyAccount.isTest());
|
||||
return new WxYouDianPayService(wxPayConfigStorage);
|
||||
final WxYouDianPayService wxYouDianPayService = new WxYouDianPayService(wxPayConfigStorage);
|
||||
wxYouDianPayService.setPayMessageHandler(new YouDianPayMessageHandler(apyAccount.getPayId()));
|
||||
return wxYouDianPayService;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -157,7 +166,9 @@ public enum PayType implements BasePayType {
|
||||
fuiouPayConfigStorage.setPayType(apyAccount.getPayType().toString());
|
||||
fuiouPayConfigStorage.setInputCharset(apyAccount.getInputCharset());
|
||||
fuiouPayConfigStorage.setTest(apyAccount.isTest());
|
||||
return new FuiouPayService(fuiouPayConfigStorage);
|
||||
final FuiouPayService fuiouPayService = new FuiouPayService(fuiouPayConfigStorage);
|
||||
fuiouPayService.setPayMessageHandler(new FuiouPayMessageHandler(apyAccount.getPayId()));
|
||||
return fuiouPayService;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -192,7 +203,9 @@ public enum PayType implements BasePayType {
|
||||
unionPayConfigStorage.setPayType(apyAccount.getPayType().toString());
|
||||
unionPayConfigStorage.setInputCharset(apyAccount.getInputCharset());
|
||||
unionPayConfigStorage.setTest(apyAccount.isTest());
|
||||
return new UnionPayService(unionPayConfigStorage);
|
||||
final UnionPayService unionPayService = new UnionPayService(unionPayConfigStorage);
|
||||
unionPayService.setPayMessageHandler(new UnionPayMessageHandler(apyAccount.getPayId()));
|
||||
return unionPayService;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -214,7 +227,9 @@ public enum PayType implements BasePayType {
|
||||
configStorage.setApiPassword(apyAccount.getPrivateKey());
|
||||
//是否为沙箱
|
||||
configStorage.setTest(true);
|
||||
return new PayoneerPayService(configStorage);
|
||||
final PayoneerPayService payoneerPayService = new PayoneerPayService(configStorage);
|
||||
payoneerPayService.setPayMessageHandler(new PayoneerMessageHandler(apyAccount.getPayId()));
|
||||
return payoneerPayService;
|
||||
|
||||
//以下不建议进行使用,会引起两次请求的问题
|
||||
//Basic Auth
|
||||
@@ -243,7 +258,9 @@ public enum PayType implements BasePayType {
|
||||
storage.setReturnUrl(apyAccount.getReturnUrl());
|
||||
//取消按钮转跳地址,这里兼容的做法
|
||||
storage.setNotifyUrl(apyAccount.getNotifyUrl());
|
||||
return new PayPalPayService(storage);
|
||||
final PayPalPayService payPalPayService = new PayPalPayService(storage);
|
||||
payPalPayService.setPayMessageHandler(new PayPalPayMessageHandler(apyAccount.getPayId()));
|
||||
return payPalPayService;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -52,9 +52,13 @@ public class PayResponse {
|
||||
//根据不同的账户类型 初始化支付配置
|
||||
this.service = apyAccount.getPayType().getPayService(apyAccount);
|
||||
this.storage = service.getPayConfigStorage();
|
||||
|
||||
|
||||
//这里设置http请求配置
|
||||
// service.setRequestTemplateConfigStorage(getHttpConfigStorage());
|
||||
buildRouter(apyAccount.getPayId());
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,7 +91,9 @@ public class PayResponse {
|
||||
* 配置路由
|
||||
*
|
||||
* @param payId 指定账户id,用户多微信支付多支付宝支付
|
||||
* @deprecated 不再推荐使用路由方式,回调或拦截器,直接在payService中设置并获取使用
|
||||
*/
|
||||
@Deprecated
|
||||
private void buildRouter(Integer payId) {
|
||||
router = new PayMessageRouter(this.service);
|
||||
router
|
||||
|
||||
@@ -1,27 +1,23 @@
|
||||
package com.egzosn.pay.demo.service.handler;
|
||||
|
||||
import com.egzosn.pay.common.api.PayMessageHandler;
|
||||
import com.egzosn.pay.common.api.PayService;
|
||||
import java.util.Map;
|
||||
|
||||
import com.egzosn.pay.common.bean.PayMessage;
|
||||
import com.egzosn.pay.common.bean.PayOutMessage;
|
||||
import com.egzosn.pay.common.exception.PayErrorException;
|
||||
import com.egzosn.pay.paypal.api.PayPalPayService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* PayPal支付回调处理器
|
||||
* Created by ZaoSheng on 2016/6/1.
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class PayPalPayMessageHandler implements PayMessageHandler<PayMessage, PayPalPayService> {
|
||||
|
||||
|
||||
|
||||
public class PayPalPayMessageHandler extends BasePayMessageHandler<PayMessage, PayPalPayService> {
|
||||
|
||||
|
||||
public PayPalPayMessageHandler(Integer payId) {
|
||||
super(payId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PayOutMessage handle(PayMessage payMessage, Map<String, Object> context, PayPalPayService payService) throws PayErrorException {
|
||||
|
||||
@@ -502,6 +502,20 @@ public class WxPayService extends BasePayService<WxPayConfigStorage> implements
|
||||
return (String) orderInfo.get("code_url");
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序支付,返回小程序所需的订单构建信息
|
||||
*
|
||||
* @param order 发起支付的订单信息
|
||||
* @return 返回支付结果
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> jsApi(PayOrder order) {
|
||||
if (null == order.getTransactionType()) {
|
||||
order.setTransactionType(WxTransactionType.JSAPI);
|
||||
}
|
||||
return orderInfo(order);
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷卡付,pos主动扫码付款
|
||||
*
|
||||
|
||||
@@ -105,6 +105,19 @@ public class WxCombinePayService extends WxPayService {
|
||||
return getAssistService().doExecute(parameters, order);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序支付,返回小程序所需的订单构建信息
|
||||
*
|
||||
* @param order 发起支付的订单信息
|
||||
* @return 返回支付结果
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> jsApi(PayOrder order) {
|
||||
if (null == order.getTransactionType()) {
|
||||
order.setTransactionType(WxTransactionType.COMBINE_JSAPI);
|
||||
}
|
||||
return super.jsApi(order);
|
||||
}
|
||||
|
||||
/**
|
||||
* 交易查询接口
|
||||
@@ -117,6 +130,7 @@ public class WxCombinePayService extends WxPayService {
|
||||
public Map<String, Object> query(String transactionId, String outTradeNo) {
|
||||
return query(new AssistOrder(outTradeNo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 交易查询接口
|
||||
*
|
||||
|
||||
@@ -450,6 +450,20 @@ public class WxPayService extends BasePayService<WxPayConfigStorage> implements
|
||||
return (String) orderInfo.get("code_url");
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序支付,返回小程序所需的订单构建信息
|
||||
*
|
||||
* @param order 发起支付的订单信息
|
||||
* @return 返回支付结果
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> jsApi(PayOrder order) {
|
||||
if (null == order.getTransactionType()) {
|
||||
order.setTransactionType(WxTransactionType.JSAPI);
|
||||
}
|
||||
return orderInfo(order);
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷卡付,pos主动扫码付款
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user