style: 调整代码风格

This commit is contained in:
陈泉 2021-11-29 15:02:40 +08:00 committed by StringKE
parent 4576597c2f
commit a4e26945fc
7 changed files with 36 additions and 21 deletions

View File

@ -31,7 +31,8 @@ public class PppayChannelNoticeService extends AbstractChannelNoticeService {
}
@Override
public MutablePair<String, Object> parseParams(HttpServletRequest request, String urlOrderId, NoticeTypeEnum noticeTypeEnum) {
public MutablePair<String, Object> parseParams(HttpServletRequest request, String urlOrderId,
NoticeTypeEnum noticeTypeEnum) {
// 同步和异步需要不同的解析方案
// 异步需要从 webhook 中读取所有这里读取方式不太一样
if (noticeTypeEnum == NoticeTypeEnum.DO_NOTIFY) {
@ -53,7 +54,8 @@ public class PppayChannelNoticeService extends AbstractChannelNoticeService {
}
@Override
public ChannelRetMsg doNotice(HttpServletRequest request, Object params, PayOrder payOrder, MchAppConfigContext mchAppConfigContext, NoticeTypeEnum noticeTypeEnum) {
public ChannelRetMsg doNotice(HttpServletRequest request, Object params, PayOrder payOrder,
MchAppConfigContext mchAppConfigContext, NoticeTypeEnum noticeTypeEnum) {
try {
if (noticeTypeEnum == NoticeTypeEnum.DO_RETURN) {
return doReturn(request, params, payOrder, mchAppConfigContext);
@ -65,7 +67,8 @@ public class PppayChannelNoticeService extends AbstractChannelNoticeService {
}
}
public ChannelRetMsg doReturn(HttpServletRequest request, Object params, PayOrder payOrder, MchAppConfigContext mchAppConfigContext) throws IOException {
public ChannelRetMsg doReturn(HttpServletRequest request, Object params, PayOrder payOrder,
MchAppConfigContext mchAppConfigContext) throws IOException {
JSONObject object = (JSONObject) params;
// 获取 Paypal 订单 ID
String ppOrderId = object.getStr("token");
@ -73,7 +76,8 @@ public class PppayChannelNoticeService extends AbstractChannelNoticeService {
return mchAppConfigContext.getPaypalWrapper().processOrder(ppOrderId, payOrder);
}
public ChannelRetMsg doNotify(HttpServletRequest request, Object params, PayOrder payOrder, MchAppConfigContext mchAppConfigContext) throws IOException {
public ChannelRetMsg doNotify(HttpServletRequest request, Object params, PayOrder payOrder,
MchAppConfigContext mchAppConfigContext) throws IOException {
JSONObject object = (JSONObject) params;
// 获取 Paypal 订单 ID
String ppOrderId = object.getByPath("resource.id", String.class);

View File

@ -36,7 +36,8 @@ public class PppayChannelRefundNoticeService extends AbstractChannelRefundNotice
}
@Override
public MutablePair<String, Object> parseParams(HttpServletRequest request, String urlOrderId, NoticeTypeEnum noticeTypeEnum) {
public MutablePair<String, Object> parseParams(HttpServletRequest request, String urlOrderId,
NoticeTypeEnum noticeTypeEnum) {
JSONObject params = JSONUtil.parseObj(getReqParamJSON().toJSONString());
// 获取退款订单 Paypal ID
String orderId = params.getByPath("resource.invoice_id", String.class);
@ -44,7 +45,8 @@ public class PppayChannelRefundNoticeService extends AbstractChannelRefundNotice
}
@Override
public ChannelRetMsg doNotice(HttpServletRequest request, Object params, RefundOrder refundOrder, MchAppConfigContext mchAppConfigContext, NoticeTypeEnum noticeTypeEnum) {
public ChannelRetMsg doNotice(HttpServletRequest request, Object params, RefundOrder refundOrder,
MchAppConfigContext mchAppConfigContext, NoticeTypeEnum noticeTypeEnum) {
try {
JSONObject object = (JSONObject) params;
String orderId = object.getByPath("resource.id", String.class);

View File

@ -34,7 +34,8 @@ public class PppayPaymentService extends AbstractPaymentService {
}
@Override
public AbstractRS pay(UnifiedOrderRQ bizRQ, PayOrder payOrder, MchAppConfigContext mchAppConfigContext) throws Exception {
public AbstractRS pay(UnifiedOrderRQ bizRQ, PayOrder payOrder, MchAppConfigContext mchAppConfigContext) throws
Exception {
return PaywayUtil.getRealPaywayService(this, payOrder.getWayCode()).pay(bizRQ, payOrder, mchAppConfigContext);
}
}

View File

@ -34,7 +34,8 @@ public class PppayRefundService extends AbstractRefundService {
}
@Override
public ChannelRetMsg refund(RefundOrderRQ bizRQ, RefundOrder refundOrder, PayOrder payOrder, MchAppConfigContext mchAppConfigContext) throws Exception {
public ChannelRetMsg refund(RefundOrderRQ bizRQ, RefundOrder refundOrder, PayOrder payOrder,
MchAppConfigContext mchAppConfigContext) throws Exception {
if (payOrder.getChannelOrderNo() == null) {
return ChannelRetMsg.confirmFail();
}

View File

@ -41,7 +41,8 @@ public class PpPc extends PppayPaymentService {
}
@Override
public AbstractRS pay(UnifiedOrderRQ rq, PayOrder payOrder, MchAppConfigContext mchAppConfigContext) throws Exception {
public AbstractRS pay(UnifiedOrderRQ rq, PayOrder payOrder, MchAppConfigContext mchAppConfigContext) throws
Exception {
PPPcOrderRQ bizRQ = (PPPcOrderRQ) rq;
OrderRequest orderRequest = new OrderRequest();

View File

@ -61,14 +61,14 @@ public class PaypalWrapper {
}
}
}
if (afterOrderId != null && !afterOrderId.equalsIgnoreCase("null")) {
if (afterOrderId != null && !"null".equalsIgnoreCase(afterOrderId)) {
ppOrderId = afterOrderId;
}
if (ppCatptId.equalsIgnoreCase("null")) {
if ("null".equalsIgnoreCase(ppCatptId)) {
ppCatptId = null;
}
if (ppOrderId.equalsIgnoreCase("null")) {
if ("null".equalsIgnoreCase(ppOrderId)) {
ppOrderId = null;
}
@ -167,17 +167,17 @@ public class PaypalWrapper {
* @return 通知信息
*/
public ChannelRetMsg dispatchCode(String status, ChannelRetMsg channelRetMsg) {
if (status.equalsIgnoreCase("SAVED")) {
if ("SAVED".equalsIgnoreCase(status)) {
channelRetMsg.setChannelState(ChannelRetMsg.ChannelState.WAITING);
} else if (status.equalsIgnoreCase("APPROVED")) {
} else if ("APPROVED".equalsIgnoreCase(status)) {
channelRetMsg.setChannelState(ChannelRetMsg.ChannelState.WAITING);
} else if (status.equalsIgnoreCase("VOIDED")) {
} else if ("VOIDED".equalsIgnoreCase(status)) {
channelRetMsg.setChannelState(ChannelRetMsg.ChannelState.CONFIRM_FAIL);
} else if (status.equalsIgnoreCase("COMPLETED")) {
} else if ("COMPLETED".equalsIgnoreCase(status)) {
channelRetMsg.setChannelState(ChannelRetMsg.ChannelState.CONFIRM_SUCCESS);
} else if (status.equalsIgnoreCase("PAYER_ACTION_REQUIRED")) {
} else if ("PAYER_ACTION_REQUIRED".equalsIgnoreCase(status)) {
channelRetMsg.setChannelState(ChannelRetMsg.ChannelState.WAITING);
} else if (status.equalsIgnoreCase("CREATED")) {
} else if ("CREATED".equalsIgnoreCase(status)) {
channelRetMsg.setChannelState(ChannelRetMsg.ChannelState.WAITING);
} else {
channelRetMsg.setChannelState(ChannelRetMsg.ChannelState.UNKNOWN);

View File

@ -326,13 +326,19 @@ public class ConfigContextService {
}
}
private PaypalWrapper buildPaypalWrapper(Byte sandbox, String secret, String clientID, String notifyHook, String refundHook) {
private PaypalWrapper buildPaypalWrapper(
Byte sandbox,
String secret,
String clientId,
String notifyHook,
String refundHook
) {
PaypalWrapper paypalWrapper = new PaypalWrapper();
PayPalEnvironment environment = new PayPalEnvironment.Live(clientID, secret);
PayPalEnvironment environment = new PayPalEnvironment.Live(clientId, secret);
if (sandbox == 1) {
environment = new PayPalEnvironment.Sandbox(clientID, secret);
environment = new PayPalEnvironment.Sandbox(clientId, secret);
}
paypalWrapper.setEnvironment(environment);