Commit a4e26945 authored by 陈泉's avatar 陈泉 Committed by StringKE
Browse files

style: 调整代码风格

parent 4576597c
...@@ -31,7 +31,8 @@ public class PppayChannelNoticeService extends AbstractChannelNoticeService { ...@@ -31,7 +31,8 @@ public class PppayChannelNoticeService extends AbstractChannelNoticeService {
} }
@Override @Override
public MutablePair<String, Object> parseParams(HttpServletRequest request, String urlOrderId, NoticeTypeEnum noticeTypeEnum) { public MutablePair<String, Object> parseParams(HttpServletRequest request, String urlOrderId,
NoticeTypeEnum noticeTypeEnum) {
// 同步和异步需要不同的解析方案 // 同步和异步需要不同的解析方案
// 异步需要从 webhook 中读取,所有这里读取方式不太一样 // 异步需要从 webhook 中读取,所有这里读取方式不太一样
if (noticeTypeEnum == NoticeTypeEnum.DO_NOTIFY) { if (noticeTypeEnum == NoticeTypeEnum.DO_NOTIFY) {
...@@ -53,7 +54,8 @@ public class PppayChannelNoticeService extends AbstractChannelNoticeService { ...@@ -53,7 +54,8 @@ public class PppayChannelNoticeService extends AbstractChannelNoticeService {
} }
@Override @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 { try {
if (noticeTypeEnum == NoticeTypeEnum.DO_RETURN) { if (noticeTypeEnum == NoticeTypeEnum.DO_RETURN) {
return doReturn(request, params, payOrder, mchAppConfigContext); return doReturn(request, params, payOrder, mchAppConfigContext);
...@@ -65,7 +67,8 @@ public class PppayChannelNoticeService extends AbstractChannelNoticeService { ...@@ -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; JSONObject object = (JSONObject) params;
// 获取 Paypal 订单 ID // 获取 Paypal 订单 ID
String ppOrderId = object.getStr("token"); String ppOrderId = object.getStr("token");
...@@ -73,7 +76,8 @@ public class PppayChannelNoticeService extends AbstractChannelNoticeService { ...@@ -73,7 +76,8 @@ public class PppayChannelNoticeService extends AbstractChannelNoticeService {
return mchAppConfigContext.getPaypalWrapper().processOrder(ppOrderId, payOrder); 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; JSONObject object = (JSONObject) params;
// 获取 Paypal 订单 ID // 获取 Paypal 订单 ID
String ppOrderId = object.getByPath("resource.id", String.class); String ppOrderId = object.getByPath("resource.id", String.class);
......
...@@ -36,7 +36,8 @@ public class PppayChannelRefundNoticeService extends AbstractChannelRefundNotice ...@@ -36,7 +36,8 @@ public class PppayChannelRefundNoticeService extends AbstractChannelRefundNotice
} }
@Override @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()); JSONObject params = JSONUtil.parseObj(getReqParamJSON().toJSONString());
// 获取退款订单 Paypal ID // 获取退款订单 Paypal ID
String orderId = params.getByPath("resource.invoice_id", String.class); String orderId = params.getByPath("resource.invoice_id", String.class);
...@@ -44,7 +45,8 @@ public class PppayChannelRefundNoticeService extends AbstractChannelRefundNotice ...@@ -44,7 +45,8 @@ public class PppayChannelRefundNoticeService extends AbstractChannelRefundNotice
} }
@Override @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 { try {
JSONObject object = (JSONObject) params; JSONObject object = (JSONObject) params;
String orderId = object.getByPath("resource.id", String.class); String orderId = object.getByPath("resource.id", String.class);
......
...@@ -34,7 +34,8 @@ public class PppayPaymentService extends AbstractPaymentService { ...@@ -34,7 +34,8 @@ public class PppayPaymentService extends AbstractPaymentService {
} }
@Override @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); return PaywayUtil.getRealPaywayService(this, payOrder.getWayCode()).pay(bizRQ, payOrder, mchAppConfigContext);
} }
} }
...@@ -34,7 +34,8 @@ public class PppayRefundService extends AbstractRefundService { ...@@ -34,7 +34,8 @@ public class PppayRefundService extends AbstractRefundService {
} }
@Override @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) { if (payOrder.getChannelOrderNo() == null) {
return ChannelRetMsg.confirmFail(); return ChannelRetMsg.confirmFail();
} }
......
...@@ -41,7 +41,8 @@ public class PpPc extends PppayPaymentService { ...@@ -41,7 +41,8 @@ public class PpPc extends PppayPaymentService {
} }
@Override @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; PPPcOrderRQ bizRQ = (PPPcOrderRQ) rq;
OrderRequest orderRequest = new OrderRequest(); OrderRequest orderRequest = new OrderRequest();
......
...@@ -61,14 +61,14 @@ public class PaypalWrapper { ...@@ -61,14 +61,14 @@ public class PaypalWrapper {
} }
} }
} }
if (afterOrderId != null && !afterOrderId.equalsIgnoreCase("null")) { if (afterOrderId != null && !"null".equalsIgnoreCase(afterOrderId)) {
ppOrderId = afterOrderId; ppOrderId = afterOrderId;
} }
if (ppCatptId.equalsIgnoreCase("null")) { if ("null".equalsIgnoreCase(ppCatptId)) {
ppCatptId = null; ppCatptId = null;
} }
if (ppOrderId.equalsIgnoreCase("null")) { if ("null".equalsIgnoreCase(ppOrderId)) {
ppOrderId = null; ppOrderId = null;
} }
...@@ -167,17 +167,17 @@ public class PaypalWrapper { ...@@ -167,17 +167,17 @@ public class PaypalWrapper {
* @return 通知信息 * @return 通知信息
*/ */
public ChannelRetMsg dispatchCode(String status, ChannelRetMsg channelRetMsg) { public ChannelRetMsg dispatchCode(String status, ChannelRetMsg channelRetMsg) {
if (status.equalsIgnoreCase("SAVED")) { if ("SAVED".equalsIgnoreCase(status)) {
channelRetMsg.setChannelState(ChannelRetMsg.ChannelState.WAITING); channelRetMsg.setChannelState(ChannelRetMsg.ChannelState.WAITING);
} else if (status.equalsIgnoreCase("APPROVED")) { } else if ("APPROVED".equalsIgnoreCase(status)) {
channelRetMsg.setChannelState(ChannelRetMsg.ChannelState.WAITING); channelRetMsg.setChannelState(ChannelRetMsg.ChannelState.WAITING);
} else if (status.equalsIgnoreCase("VOIDED")) { } else if ("VOIDED".equalsIgnoreCase(status)) {
channelRetMsg.setChannelState(ChannelRetMsg.ChannelState.CONFIRM_FAIL); channelRetMsg.setChannelState(ChannelRetMsg.ChannelState.CONFIRM_FAIL);
} else if (status.equalsIgnoreCase("COMPLETED")) { } else if ("COMPLETED".equalsIgnoreCase(status)) {
channelRetMsg.setChannelState(ChannelRetMsg.ChannelState.CONFIRM_SUCCESS); 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); channelRetMsg.setChannelState(ChannelRetMsg.ChannelState.WAITING);
} else if (status.equalsIgnoreCase("CREATED")) { } else if ("CREATED".equalsIgnoreCase(status)) {
channelRetMsg.setChannelState(ChannelRetMsg.ChannelState.WAITING); channelRetMsg.setChannelState(ChannelRetMsg.ChannelState.WAITING);
} else { } else {
channelRetMsg.setChannelState(ChannelRetMsg.ChannelState.UNKNOWN); channelRetMsg.setChannelState(ChannelRetMsg.ChannelState.UNKNOWN);
......
...@@ -326,13 +326,19 @@ public class ConfigContextService { ...@@ -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(); PaypalWrapper paypalWrapper = new PaypalWrapper();
PayPalEnvironment environment = new PayPalEnvironment.Live(clientID, secret); PayPalEnvironment environment = new PayPalEnvironment.Live(clientId, secret);
if (sandbox == 1) { if (sandbox == 1) {
environment = new PayPalEnvironment.Sandbox(clientID, secret); environment = new PayPalEnvironment.Sandbox(clientId, secret);
} }
paypalWrapper.setEnvironment(environment); paypalWrapper.setEnvironment(environment);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment