Toggle navigation
Toggle navigation
This project
Loading...
Sign in
jiujian
/
client-customer-order-api
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
zhuyifan
2025-02-25 17:10:21 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f5f41162b419b849af498ae4ee02717d39127224
f5f41162
1 parent
ccf9e0c0
支付回调对接
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
src/main/java/com/infoloop/tianting/controller/PayController.java
src/main/java/com/infoloop/tianting/service/client/PayServiceClient.java
src/main/java/com/infoloop/tianting/controller/PayController.java
View file @
f5f4116
...
...
@@ -42,8 +42,8 @@ public class PayController {
@ApiOperation
(
value
=
"支付通知"
)
@PostMapping
(
value
=
"/pay/callback"
)
@ResponseStatus
(
HttpStatus
.
OK
)
public
void
callback
(
@Valid
@RequestBody
PaymentCallbackDTO
paymentCallbackDTO
)
{
payServiceClient
.
callback
(
paymentCallbackDTO
);
public
boolean
callback
(
@Valid
@RequestBody
PaymentCallbackDTO
paymentCallbackDTO
)
{
return
payServiceClient
.
callback
(
paymentCallbackDTO
);
}
}
\ No newline at end of file
...
...
src/main/java/com/infoloop/tianting/service/client/PayServiceClient.java
View file @
f5f4116
...
...
@@ -105,7 +105,7 @@ public class PayServiceClient {
}
}
public
void
callback
(
PaymentCallbackDTO
paymentCallbackDTO
)
{
public
boolean
callback
(
PaymentCallbackDTO
paymentCallbackDTO
)
{
log
.
info
(
"callback request received: {}"
,
paymentCallbackDTO
);
try
{
final
var
paymentCallbackResult
=
xmlMapper
.
readValue
(
paymentCallbackDTO
.
getPayResult
(),
PaymentCallbackResult
.
class
);
...
...
@@ -114,11 +114,11 @@ public class PayServiceClient {
final
var
orderById
=
orderServiceRpcClient
.
getOrderById
(
orderId
);
if
(
orderById
==
null
)
{
log
.
error
(
"Order not found, orderId: {}"
,
orderId
);
return
;
return
false
;
}
if
(
orderById
.
getPayStatus
()
==
PayStatusEnum
.
SUCCEED
||
orderById
.
getPayStatus
()
==
PayStatusEnum
.
FAILED
)
{
log
.
info
(
"Order {} already processed, skipping."
,
orderId
);
return
;
return
true
;
}
long
payTime
;
try
{
...
...
@@ -146,6 +146,7 @@ public class PayServiceClient {
.
build
();
final
var
updateResponse
=
orderServiceRpcClient
.
updateClientCustomerOrderPaymentResult
(
orderById
,
build
);
log
.
info
(
"callback updateClientCustomerOrder result: {}"
,
updateResponse
.
getIsUpdated
());
return
updateResponse
.
getIsUpdated
();
}
catch
(
JsonProcessingException
e
)
{
log
.
error
(
"Failed to parse XML response, raw XML: {}"
,
paymentCallbackDTO
.
getPayResult
(),
e
);
throw
new
RuntimeException
(
"支付通知结果解析失败"
,
e
);
...
...
Please
register
or
login
to post a comment