Merge branches 'baidu-pay' and 'master' of https://gitee.com/hocgin/pay-java-parent into baidu-pay

This commit is contained in:
hocgin
2019-11-24 17:08:30 +08:00
15 changed files with 37 additions and 28 deletions

View File

@@ -67,5 +67,4 @@ E-Mailegzosn@gmail.com
QQ群542193977
微信群: ![微信群](https://images.gitee.com/uploads/images/2019/1107/121546_6dbab7f7_1221178.jpeg "wx.jpg")
微信群: ![微信群](https://images.gitee.com/uploads/images/2019/1117/151422_5085eaae_1221178.jpeg "wx.jpg")

View File

@@ -12,11 +12,9 @@ import com.egzosn.pay.common.exception.PayErrorException;
import com.egzosn.pay.common.http.HttpConfigStorage;
import com.egzosn.pay.common.http.UriVariables;
import com.egzosn.pay.common.util.DateUtils;
import com.egzosn.pay.common.util.MatrixToImageWriter;
import com.egzosn.pay.common.util.Util;
import com.egzosn.pay.common.util.sign.SignUtils;
import com.egzosn.pay.common.util.str.StringUtils;
import java.awt.image.BufferedImage;
import java.math.BigDecimal;
import java.util.*;
@@ -28,7 +26,7 @@ import java.util.*;
* email egzosn@gmail.com
* date 2017-2-22 20:09
*/
public class AliPayService extends BasePayService<AliPayConfigStorage> {
public class AliPayService extends BasePayService<AliPayConfigStorage, PayOrder> {
/**
* 正式测试环境

View File

@@ -4,11 +4,11 @@ import com.egzosn.pay.common.util.Util;
import com.egzosn.pay.common.util.str.StringUtils;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
/**
* 交易结算信息
* @author egan
* email egzosn@gmail.com
* date 2019/4/28.20:29

View File

@@ -35,7 +35,7 @@ import static com.egzosn.pay.ali.api.AliPayService.SIGN;
* @see com.egzosn.pay.ali.api.AliPayService
*/
@Deprecated
public class AliPayService extends BasePayService<AliPayConfigStorage> {
public class AliPayService extends BasePayService<AliPayConfigStorage, PayOrder> {

View File

@@ -26,7 +26,7 @@ import java.util.*;
* date 2017/3/5 20:36
* </pre>
*/
public abstract class BasePayService<PC extends PayConfigStorage> implements PayService<PC> {
public abstract class BasePayService<PC extends PayConfigStorage, O extends PayOrder> implements PayService<PC, O> {
protected final Log LOG = LogFactory.getLog(getClass());
protected PC payConfigStorage;
@@ -138,7 +138,7 @@ public abstract class BasePayService<PC extends PayConfigStorage> implements Pay
* @return 对应页面重定向信息
*/
@Override
public String toPay(PayOrder order) {
public String toPay(O order) {
Map orderInfo = orderInfo(order);
return buildRequest(orderInfo, MethodType.POST);
}
@@ -150,7 +150,7 @@ public abstract class BasePayService<PC extends PayConfigStorage> implements Pay
* @return 返回图片信息,支付时需要的
*/
@Override
public BufferedImage genQrPay(PayOrder order) {
public BufferedImage genQrPay(O order) {
return MatrixToImageWriter.writeInfoToJpgBuff(getQrPay(order));
}
@@ -463,7 +463,7 @@ public abstract class BasePayService<PC extends PayConfigStorage> implements Pay
* @param orderInfo 订单信息
* @return 处理后订单信息
*/
public Map<String, Object> preOrderHandler(Map<String, Object> orderInfo, PayOrder payOrder){
public Map<String, Object> preOrderHandler(Map<String, Object> orderInfo, O payOrder){
return orderInfo;
}

View File

@@ -20,7 +20,7 @@ import java.util.Map;
* date 2016-5-18 14:09:01
* </pre>
*/
public interface PayService<PC extends PayConfigStorage> {
public interface PayService<PC extends PayConfigStorage, O extends PayOrder> {
/**
@@ -88,7 +88,7 @@ public interface PayService<PC extends PayConfigStorage> {
* @return 订单信息
* @see PayOrder 支付订单信息
*/
Map<String, Object> orderInfo(PayOrder order);
Map<String, Object> orderInfo(O order);
/**
* 页面转跳支付, 返回对应页面重定向信息
@@ -96,7 +96,7 @@ public interface PayService<PC extends PayConfigStorage> {
* @param order 订单信息
* @return 对应页面重定向信息
*/
String toPay(PayOrder order);
String toPay(O order);
/**
* 创建签名
@@ -160,14 +160,14 @@ public interface PayService<PC extends PayConfigStorage> {
* @param order 发起支付的订单信息
* @return 返回图片信息,支付时需要的
*/
BufferedImage genQrPay(PayOrder order);
BufferedImage genQrPay(O order);
/**
* 获取输出二维码信息,
*
* @param order 发起支付的订单信息
* @return 返回二维码信息,,支付时需要的
*/
String getQrPay(PayOrder order);
String getQrPay(O order);
/**
* 刷卡付,pos主动扫码付款(条码付)
@@ -175,7 +175,7 @@ public interface PayService<PC extends PayConfigStorage> {
* @param order 发起支付的订单信息
* @return 返回支付结果
*/
Map<String, Object> microPay(PayOrder order);
Map<String, Object> microPay(O order);
/**
* 交易查询接口
@@ -453,4 +453,15 @@ public interface PayService<PC extends PayConfigStorage> {
* @return 支付消息对象
*/
PayMessage createMessage(Map<String, Object> message);
/**
* 预订单回调处理器,用于订单信息的扩展
* 签名之前使用
* 如果需要进行扩展请重写该方法即可
* @param orderInfo 商户平台预订单信息
* @param payOrder 订单信息
* @return 处理后订单信息
*/
Map<String, Object> preOrderHandler(Map<String, Object> orderInfo, O payOrder);
}

View File

@@ -21,7 +21,7 @@ import java.util.*;
* create 2017 2017/1/16 0016
* </pre>
*/
public class FuiouPayService extends BasePayService<FuiouPayConfigStorage> {
public class FuiouPayService extends BasePayService<FuiouPayConfigStorage, PayOrder> {
/**
* 正式域名
@@ -129,14 +129,14 @@ public class FuiouPayService extends BasePayService<FuiouPayConfigStorage> {
/**
* 校验回调数据来源是否合法
*
* @param order_id 业务id, 数据的真实性.
* @param orderId 业务id, 数据的真实性.
* @return 返回校验结果
*/
@Override
public boolean verifySource(String order_id) {
public boolean verifySource(String orderId) {
LinkedHashMap<String, Object> params = new LinkedHashMap<>();
params.put("mchnt_cd", payConfigStorage.getPid());
params.put("order_id", order_id);
params.put("order_id", orderId);
params.put("md5", createSign(SignUtils.parameters2MD5Str(params, "|"), payConfigStorage.getInputCharset()));
JSONObject resultJson = getHttpRequestTemplate().postForObject(getReqUrl() + URL_FuiouSmpAQueryGate + "?" + UriVariables.getMapToParameters(params), null, JSONObject.class);
if (null == resultJson){

View File

@@ -1,6 +1,7 @@
package com.egzosn.pay.payoneer.api;
import com.egzosn.pay.common.api.PayService;
import com.egzosn.pay.common.bean.PayOrder;
import java.util.Map;
@@ -15,7 +16,7 @@ import java.util.Map;
*
*/
public interface AdvancedPayService extends PayService<PayoneerConfigStorage> {
public interface AdvancedPayService extends PayService<PayoneerConfigStorage, PayOrder> {
/**
* 获取授权页面
* @param payeeId 用户id

View File

@@ -33,7 +33,7 @@ import java.util.*;
* create 2018-01-19
* </pre>
*/
public class PayoneerPayService extends BasePayService<PayoneerConfigStorage> implements AdvancedPayService {
public class PayoneerPayService extends BasePayService<PayoneerConfigStorage, PayOrder> implements AdvancedPayService {
/**
* 测试地址
*/

View File

@@ -29,7 +29,7 @@ import java.util.concurrent.locks.Lock;
* email egzosn@gmail.com
* date 2018-4-8 22:15:09
*/
public class PayPalPayService extends BasePayService<PayPalConfigStorage>{
public class PayPalPayService extends BasePayService<PayPalConfigStorage, PayOrder>{
/**
* 沙箱环境

View File

@@ -38,7 +38,7 @@ import java.util.*;
* create 2017 2017/11/5
* </pre>
*/
public class UnionPayService extends BasePayService<UnionPayConfigStorage> {
public class UnionPayService extends BasePayService<UnionPayConfigStorage, PayOrder> {
/**
* 测试域名
*/

View File

@@ -27,7 +27,7 @@ import java.util.concurrent.locks.Lock;
* email egzosn@gmail.com
* date 2017/01/12 22:58
*/
public class WxYouDianPayService extends BasePayService<WxYouDianPayConfigStorage> {
public class WxYouDianPayService extends BasePayService<WxYouDianPayConfigStorage, PayOrder> {
private final static String URL = "http://life.51youdian.com/Api/CheckoutCounter/";

View File

@@ -36,7 +36,7 @@ import static com.egzosn.pay.wx.bean.WxTransferType.*;
* date 2016-5-18 14:09:01
* </pre>
*/
public class WxPayService extends BasePayService<WxPayConfigStorage> {
public class WxPayService extends BasePayService<WxPayConfigStorage, PayOrder> {
/**

View File

@@ -27,7 +27,7 @@ import java.util.TreeMap;
* email egzosn@gmail.com
* * date 2019/04/15 22:51
*/
public class YiJiPayService extends BasePayService<YiJiPayConfigStorage> {
public class YiJiPayService extends BasePayService<YiJiPayConfigStorage, PayOrder> {
/**
* 正式测试环境

BIN
wx.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB