Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Jeepay
Commits
a4e26945
Commit
a4e26945
authored
Nov 29, 2021
by
陈泉
Committed by
StringKE
Nov 29, 2021
Browse files
style: 调整代码风格
parent
4576597c
Changes
7
Hide whitespace changes
Inline
Side-by-side
jeepay-payment/src/main/java/com/jeequan/jeepay/pay/channel/pppay/PppayChannelNoticeService.java
View file @
a4e26945
...
...
@@ -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
);
...
...
jeepay-payment/src/main/java/com/jeequan/jeepay/pay/channel/pppay/PppayChannelRefundNoticeService.java
View file @
a4e26945
...
...
@@ -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
);
...
...
jeepay-payment/src/main/java/com/jeequan/jeepay/pay/channel/pppay/PppayPaymentService.java
View file @
a4e26945
...
...
@@ -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
);
}
}
jeepay-payment/src/main/java/com/jeequan/jeepay/pay/channel/pppay/PppayRefundService.java
View file @
a4e26945
...
...
@@ -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
();
}
...
...
jeepay-payment/src/main/java/com/jeequan/jeepay/pay/channel/pppay/payway/PpPc.java
View file @
a4e26945
...
...
@@ -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
();
...
...
jeepay-payment/src/main/java/com/jeequan/jeepay/pay/model/PaypalWrapper.java
View file @
a4e26945
...
...
@@ -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
);
...
...
jeepay-payment/src/main/java/com/jeequan/jeepay/pay/service/ConfigContextService.java
View file @
a4e26945
...
...
@@ -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
(
clientI
D
,
secret
);
PayPalEnvironment
environment
=
new
PayPalEnvironment
.
Live
(
clientI
d
,
secret
);
if
(
sandbox
==
1
)
{
environment
=
new
PayPalEnvironment
.
Sandbox
(
clientI
D
,
secret
);
environment
=
new
PayPalEnvironment
.
Sandbox
(
clientI
d
,
secret
);
}
paypalWrapper
.
setEnvironment
(
environment
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment