Compare commits

...

1 Commits

Author SHA1 Message Date
MentatBot
b23ed4fc01 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`.
2024-08-16 07:30:25 +00:00
3 changed files with 34 additions and 2 deletions

View File

@@ -59,4 +59,9 @@ public class PayAppDO extends BaseDO {
*/ */
private String transferNotifyUrl; private String transferNotifyUrl;
/**
* 应用密钥
*/
private String appKey;
} }

View File

@@ -146,4 +146,22 @@ public interface PayOrderService {
*/ */
int expireOrder(); 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);
} }

View File

@@ -85,6 +85,15 @@ public class PayOrderServiceImpl implements PayOrderService {
return orderMapper.selectByAppIdAndMerchantOrderId(appId, merchantOrderId); 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 @Override
public List<PayOrderDO> getOrderList(Collection<Long> ids) { public List<PayOrderDO> getOrderList(Collection<Long> ids) {
if (CollUtil.isEmpty(ids)) { if (CollUtil.isEmpty(ids)) {