Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
caosy
/
fun-common
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
2
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d743f0d5
authored
Sep 05, 2018
by
chongli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微信下单回调
parent
6fecf069
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
0 deletions
fun-common-soa/src/main/java/com/ctrip/fun/golf/api/payment/NotifyController.java
fun-common-soa/src/main/java/com/ctrip/fun/golf/service/payment/NotifyService.java
fun-common-soa/src/main/java/com/ctrip/fun/golf/api/payment/NotifyController.java
View file @
d743f0d5
...
@@ -43,6 +43,32 @@ public class NotifyController {
...
@@ -43,6 +43,32 @@ public class NotifyController {
return
notifyResponseBean
;
return
notifyResponseBean
;
}
}
/**
* 微信支付通知
*/
@RequestMapping
(
value
=
"/{orderType}/notifyForWeiXinPay"
,
produces
=
"application/json;charset=UTF-8"
)
@ResponseBody
public
String
notifyForWeiXinPay
(
HttpServletRequest
request
,
HttpServletResponse
response
,
@PathVariable
String
orderType
)
throws
Exception
{
BufferedReader
reader
=
null
;
reader
=
request
.
getReader
();
String
line
=
""
;
String
xmlString
=
null
;
StringBuffer
inputString
=
new
StringBuffer
();
while
((
line
=
reader
.
readLine
())
!=
null
)
{
inputString
.
append
(
line
);
}
xmlString
=
inputString
.
toString
();
request
.
getReader
().
close
();
System
.
out
.
println
(
"----接收到的数据如下:---"
+
xmlString
);
this
.
notifyService
.
notifyForWeiXinPay
(
orderType
,
xmlString
);
response
.
getWriter
().
write
(
"<xml><return_code><![CDATA[SUCCESS]]></return_code></xml>"
);
return
null
;
}
/**
/**
* 微信支付通知
* 微信支付通知
*/
*/
...
...
fun-common-soa/src/main/java/com/ctrip/fun/golf/service/payment/NotifyService.java
View file @
d743f0d5
...
@@ -42,6 +42,17 @@ public class NotifyService {
...
@@ -42,6 +42,17 @@ public class NotifyService {
* @param paymentResponse
* @param paymentResponse
* @return
* @return
*/
*/
public
String
notifyForWeiXinPay
(
String
orderType
,
String
xml
)
{
HttpEntity
<
String
>
entity
=
new
HttpEntity
<
String
>(
xml
);
String
response
=
restTemplate
.
exchange
(
this
.
getServerBaseNotifyPath
()+
"/"
+
orderType
+
"/notifyForWeiXinPay"
,
HttpMethod
.
POST
,
entity
,
new
ParameterizedTypeReference
<
String
>()
{
}).
getBody
();
return
null
;
}
/**
* @param paymentResponse
* @return
*/
public
String
notifyForMiniApp
(
String
xml
)
{
public
String
notifyForMiniApp
(
String
xml
)
{
HttpEntity
<
String
>
entity
=
new
HttpEntity
<
String
>(
xml
);
HttpEntity
<
String
>
entity
=
new
HttpEntity
<
String
>(
xml
);
String
response
=
restTemplate
.
exchange
(
this
.
getServerBaseNotifyPath
()+
"/communeOrder/notifyForMiniApp"
,
HttpMethod
.
POST
,
entity
,
new
ParameterizedTypeReference
<
String
>()
{
String
response
=
restTemplate
.
exchange
(
this
.
getServerBaseNotifyPath
()+
"/communeOrder/notifyForMiniApp"
,
HttpMethod
.
POST
,
entity
,
new
ParameterizedTypeReference
<
String
>()
{
...
@@ -49,6 +60,8 @@ public class NotifyService {
...
@@ -49,6 +60,8 @@ public class NotifyService {
return
response
;
return
response
;
}
}
public
RestTemplate
getRestTemplate
()
{
public
RestTemplate
getRestTemplate
()
{
return
restTemplate
;
return
restTemplate
;
}
}
...
...
Write
Preview
Markdown
is supported
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