mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-23 07:41:53 +08:00
增加模拟支付的订单号、退款号返回
This commit is contained in:
parent
bf3e848c17
commit
ae98315616
@ -70,6 +70,7 @@ public class PayClientFactoryImpl implements PayClientFactory {
|
|||||||
case ALIPAY_APP: return (AbstractPayClient<Config>) new AlipayAppPayClient(channelId, (AlipayPayClientConfig) config);
|
case ALIPAY_APP: return (AbstractPayClient<Config>) new AlipayAppPayClient(channelId, (AlipayPayClientConfig) config);
|
||||||
case ALIPAY_PC: return (AbstractPayClient<Config>) new AlipayPcPayClient(channelId, (AlipayPayClientConfig) config);
|
case ALIPAY_PC: return (AbstractPayClient<Config>) new AlipayPcPayClient(channelId, (AlipayPayClientConfig) config);
|
||||||
case ALIPAY_BAR: return (AbstractPayClient<Config>) new AlipayBarPayClient(channelId, (AlipayPayClientConfig) config);
|
case ALIPAY_BAR: return (AbstractPayClient<Config>) new AlipayBarPayClient(channelId, (AlipayPayClientConfig) config);
|
||||||
|
// 其它支付
|
||||||
case MOCK: return (AbstractPayClient<Config>) new MockPayClient(channelId, (MockPayClientConfig) config);
|
case MOCK: return (AbstractPayClient<Config>) new MockPayClient(channelId, (MockPayClientConfig) config);
|
||||||
}
|
}
|
||||||
// 创建失败,错误日志 + 抛出异常
|
// 创建失败,错误日志 + 抛出异常
|
||||||
|
@ -11,7 +11,9 @@ import java.time.LocalDateTime;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模拟支付的 PayClient 实现类, 模拟支付返回结果都是成功
|
* 模拟支付的 PayClient 实现类
|
||||||
|
*
|
||||||
|
* 模拟支付返回结果都是成功,方便大家日常流畅
|
||||||
*
|
*
|
||||||
* @author jason
|
* @author jason
|
||||||
*/
|
*/
|
||||||
@ -25,31 +27,30 @@ public class MockPayClient extends AbstractPayClient<MockPayClientConfig> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doInit() {
|
protected void doInit() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected PayOrderRespDTO doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) {
|
protected PayOrderRespDTO doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) {
|
||||||
// 模拟支付渠道订单号为空
|
return PayOrderRespDTO.successOf("MOCK-P-" + reqDTO.getOutTradeNo(), "", LocalDateTime.now(),
|
||||||
return PayOrderRespDTO.successOf("", "", LocalDateTime.now(), reqDTO.getOutTradeNo(), MOCK_RESP_SUCCESS_DATA);
|
reqDTO.getOutTradeNo(), MOCK_RESP_SUCCESS_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected PayOrderRespDTO doGetOrder(String outTradeNo) {
|
protected PayOrderRespDTO doGetOrder(String outTradeNo) {
|
||||||
// 模拟支付渠道订单号为空
|
return PayOrderRespDTO.successOf("MOCK-P-" + outTradeNo, "", LocalDateTime.now(),
|
||||||
return PayOrderRespDTO.successOf("", "", LocalDateTime.now(), outTradeNo, MOCK_RESP_SUCCESS_DATA);
|
outTradeNo, MOCK_RESP_SUCCESS_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected PayRefundRespDTO doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) {
|
protected PayRefundRespDTO doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) {
|
||||||
// 模拟支付渠道退款单号为空
|
return PayRefundRespDTO.successOf("MOCK-R-" + reqDTO.getOutRefundNo(), LocalDateTime.now(),
|
||||||
return PayRefundRespDTO.successOf("", LocalDateTime.now(), reqDTO.getOutRefundNo(), MOCK_RESP_SUCCESS_DATA);
|
reqDTO.getOutRefundNo(), MOCK_RESP_SUCCESS_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected PayRefundRespDTO doGetRefund(String outTradeNo, String outRefundNo) {
|
protected PayRefundRespDTO doGetRefund(String outTradeNo, String outRefundNo) {
|
||||||
// 模拟支付渠道退款单号为空
|
return PayRefundRespDTO.successOf("MOCK-R-" + outRefundNo, LocalDateTime.now(),
|
||||||
return PayRefundRespDTO.successOf("", LocalDateTime.now(), outRefundNo, MOCK_RESP_SUCCESS_DATA);
|
outRefundNo, MOCK_RESP_SUCCESS_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -61,4 +62,5 @@ public class MockPayClient extends AbstractPayClient<MockPayClientConfig> {
|
|||||||
protected PayOrderRespDTO doParseOrderNotify(Map<String, String> params, String body) {
|
protected PayOrderRespDTO doParseOrderNotify(Map<String, String> params, String body) {
|
||||||
throw new UnsupportedOperationException("模拟支付无支付回调");
|
throw new UnsupportedOperationException("模拟支付无支付回调");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -14,7 +14,9 @@ import javax.validation.Validator;
|
|||||||
public class MockPayClientConfig implements PayClientConfig {
|
public class MockPayClientConfig implements PayClientConfig {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 配置名称,如果不加任何属性, JsonUtils.parseObject2 解析会报错. 暂时加个名称
|
* 配置名称
|
||||||
|
*
|
||||||
|
* 如果不加任何属性,JsonUtils.parseObject2 解析会报错,所以暂时加个名称
|
||||||
*/
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ -22,4 +24,5 @@ public class MockPayClientConfig implements PayClientConfig {
|
|||||||
public void validate(Validator validator) {
|
public void validate(Validator validator) {
|
||||||
// 模拟支付配置无需校验
|
// 模拟支付配置无需校验
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -10,7 +10,6 @@
|
|||||||
</el-radio>
|
</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label-width="180px" label="备注" prop="remark">
|
<el-form-item label-width="180px" label="备注" prop="remark">
|
||||||
<el-input v-model="formData.remark" :style="{width: '100%'}"></el-input>
|
<el-input v-model="formData.remark" :style="{width: '100%'}"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
Loading…
Reference in New Issue
Block a user