code review 支付相关的代码实现

pull/2/head
YunaiV 2021-11-21 12:24:08 +08:00
parent 7d6f205dc0
commit b18cd457c8
7 changed files with 11 additions and 8 deletions

View File

@ -15,6 +15,7 @@ import java.util.Map;
@Builder
public class PayNotifyDataDTO {
// TODO @jason使用 /** */ 的形式注释哈
//返回的所有参数
private String body;

View File

@ -105,12 +105,11 @@ public abstract class AbstractPayClient<Config extends PayClientConfig> implemen
@Override
public PayRefundUnifiedRespDTO unifiedRefund(PayRefundUnifiedReqDTO reqDTO) {
PayRefundUnifiedRespDTO resp;
try {
resp = doUnifiedRefund(reqDTO);
}catch (SocketTimeoutException ex){
//网络 read time out 异常
} catch (SocketTimeoutException ex){
// 网络 read time out 异常
log.error("[unifiedRefund][request({}) 发起退款失败,网络读超时,退款状态未知]", toJsonString(reqDTO), ex);
return PayRefundUnifiedRespDTO.builder()
.exceptionMsg(ex.getMessage())

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.framework.pay.core.enums;
// TODO @芋艿:感觉情况有点多,得讨论下
/**
*
* @author jason

View File

@ -25,6 +25,7 @@ public class AlipayQrPayClientTest extends BaseMockitoUnitTest {
.setAppId("2021000118634035")
.setServerUrl(AlipayPayClientConfig.SERVER_URL_SANDBOX)
.setSignType(AlipayPayClientConfig.SIGN_TYPE_DEFAULT)
// TODO @tinakey 可以随机就好,简洁一点哈。
.setPrivateKey("MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCHsEV1cDupwJ" +
"v890x84qbppUtRIfhaKSwSVN0thCcsDCaAsGR5MZslDkO8NCT9V4r2SVXjyY7eJUZlZd1M0C8T" +
"01Tg4UOx5LUbic0O3A1uJMy6V1n9IyYwbAW3AEZhBd5bSbPgrqvmv3NeWSTQT6Anxnllf+2iDH" +
@ -50,8 +51,8 @@ public class AlipayQrPayClientTest extends BaseMockitoUnitTest {
"gnZFv2gK51HExF8v/BaP7P979PhFMgWTqmOOI+Dtno5s+yD09XTY1WkshbLk6i4g2Xlr8fyW9ODnkU88RI2w9UdPhQU4cPPwBN" +
"lrsYhKkVK2OxwM3kFqjoBBY0CZoZCsSQ3LDH5WeZqPArlsS6xa2zqJBuuoKjMrdpELl3eXSjP8K54eDJCbeetCZNKWLL3DPahTPB7LZ" +
"ikfYmslb0QUvCgGapD0xkS7eVq70NaL1G57MWABs4tbfWgxike4Daj3EfUrzIVspQxj7w8HEj9WozJPgL88kSJSits0pqD3n5r8HSuseQIDAQAB");
// 创建客户端
// TODO @tina= 前后要有空格哈
@InjectMocks
AlipayQrPayClient client=new AlipayQrPayClient(10L,config);
@ -66,7 +67,8 @@ public class AlipayQrPayClientTest extends BaseMockitoUnitTest {
}
@Test
public void create() throws AlipayApiException {
// TODO @tina参数可以尽量随机一点使用随机方法。这样的好处是避免对固定参数的依赖导致可能仅仅满足固定参数的结果
// 这里,设置可以直接随机整个对象。
Long shopOrderId = System.currentTimeMillis();
PayOrderUnifiedReqDTO reqDTO=new PayOrderUnifiedReqDTO();
reqDTO.setMerchantOrderId(String.valueOf(System.currentTimeMillis()));
@ -88,6 +90,7 @@ public class AlipayQrPayClientTest extends BaseMockitoUnitTest {
// 断言
assertEquals(response.getCode(), result.getApiCode());
assertEquals(response.getMsg(), result.getApiMsg());
// TODO @tina这个断言木有过
assertEquals(GlobalErrorCodeConstants.SUCCESS.getCode(), result.getCode());
assertEquals(GlobalErrorCodeConstants.SUCCESS.getMsg(), result.getMsg());

View File

@ -22,7 +22,6 @@ public class PayRefundReqVO {
@NotEmpty(message = "退款金额")
private Long amount;
@ApiModelProperty(value = "退款原因", required = true, example = "不喜欢")
@NotEmpty(message = "退款原因")
private String reason;

View File

@ -8,7 +8,7 @@ import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* 退 Convert
* 退 Convert // TODO @jason类注释和下面有一个空行哈
* @author jason
*/
@Mapper

View File

@ -58,7 +58,7 @@ public class ShopOrderController {
}
// TODO @jason方法之间空一行即可哈
@PostMapping("/pay-notify")
@ApiOperation("支付回调")
public CommonResult<Boolean> payNotify(@RequestBody @Valid PayNotifyOrderReqVO reqVO) {