Add appKey to PayAppDO and update PayOrderApi to use appKey
- Added `appKey` field to `PayAppDO` to store application secret key. - Updated `PayOrderService` interface to include `appKey` parameter in `getOrder` and `createOrder` methods. - Implemented `getOrder` method in `PayOrderServiceImpl` to fetch `PayOrderDO` using `appKey` and `merchantOrderId`. - Added necessary validation and exception handling for `appKey` in `PayOrderServiceImpl`.
This commit is contained in:
@@ -59,4 +59,9 @@ public class PayAppDO extends BaseDO {
|
||||
*/
|
||||
private String transferNotifyUrl;
|
||||
|
||||
/**
|
||||
* 应用密钥
|
||||
*/
|
||||
private String appKey;
|
||||
|
||||
}
|
@@ -146,4 +146,22 @@ public interface PayOrderService {
|
||||
*/
|
||||
int expireOrder();
|
||||
|
||||
/**
|
||||
* 获得支付订单
|
||||
*
|
||||
* @param appKey 应用密钥
|
||||
* @param merchantOrderId 商户订单编号
|
||||
* @return 支付订单
|
||||
*/
|
||||
PayOrderDO getOrder(String appKey, String merchantOrderId);
|
||||
|
||||
/**
|
||||
* 创建支付单
|
||||
*
|
||||
* @param reqDTO 创建请求
|
||||
* @param appKey 应用密钥
|
||||
* @return 支付单编号
|
||||
*/
|
||||
Long createOrder(@Valid PayOrderCreateReqDTO reqDTO, String appKey);
|
||||
|
||||
}
|
@@ -85,6 +85,15 @@ public class PayOrderServiceImpl implements PayOrderService {
|
||||
return orderMapper.selectByAppIdAndMerchantOrderId(appId, merchantOrderId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PayOrderDO getOrder(String appKey, String merchantOrderId) {
|
||||
PayAppDO app = appService.getAppByAppKey(appKey);
|
||||
if (app == null) {
|
||||
throw exception(PAY_APP_NOT_FOUND);
|
||||
}
|
||||
return orderMapper.selectByAppIdAndMerchantOrderId(app.getId(), merchantOrderId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PayOrderDO> getOrderList(Collection<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
|
Reference in New Issue
Block a user