Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
mall.oytour.com
Commits
2b22a78d
Commit
2b22a78d
authored
Jun 16, 2020
by
吴春
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交
parent
a93d5429
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
PayUtil.cs
Mall.WebApi/App_Code/PayUtil.cs
+7
-5
No files found.
Mall.WebApi/App_Code/PayUtil.cs
View file @
2b22a78d
...
...
@@ -46,7 +46,7 @@ namespace Mall.WebApi.App_Code
/// <param name="CustomerId"></param>
/// <param name="openid"></param>
/// <returns></returns>
public
static
string
GetMinUnifiedOrder
(
string
sOrderNo
,
string
sProductName
,
decimal
dPrice
,
string
CustomerId
,
string
openid
,
string
notify_url
,
RB_MiniProgram_Extend
model
,
IHttpContextAccessor
_accessor
,
string
IPAddress
)
public
static
string
GetMinUnifiedOrder
(
string
sOrderNo
,
string
sProductName
,
decimal
dPrice
,
string
CustomerId
,
string
openid
,
string
notify_url
,
RB_MiniProgram_Extend
model
,
IHttpContextAccessor
_accessor
,
string
IPAddress
)
{
var
req
=
new
Common
.
Pay
.
WeChatPat
.
RequestHandler
();
req
.
SetKey
(
model
.
WeChatApiSecret
);
...
...
@@ -60,7 +60,7 @@ namespace Mall.WebApi.App_Code
req
.
SetParameter
(
"spbill_create_ip"
,
IPAddress
);
req
.
SetParameter
(
"time_start"
,
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
));
req
.
SetParameter
(
"time_expire"
,
DateTime
.
Now
.
AddMinutes
(
10
).
ToString
(
"yyyyMMddHHmmss"
));
req
.
SetParameter
(
"notify_url"
,
notify_url
);
req
.
SetParameter
(
"notify_url"
,
notify_url
);
req
.
SetParameter
(
"trade_type"
,
"JSAPI"
);
req
.
SetParameter
(
"openid"
,
openid
);
req
.
SetParameter
(
"sign"
,
req
.
CreateMd5Sign
(
_accessor
,
model
.
WeChatApiSecret
));
...
...
@@ -76,7 +76,7 @@ namespace Mall.WebApi.App_Code
});
var
xe
=
XElement
.
Parse
(
result
,
LoadOptions
.
SetLineInfo
);
LogHelper
.
Write
(
null
,
"订单号【"
+
sOrderNo
+
"】
支付错误
:"
+
xe
);
LogHelper
.
Write
(
null
,
"订单号【"
+
sOrderNo
+
"】
成功回调
:"
+
xe
);
try
{
...
...
@@ -324,7 +324,7 @@ namespace Mall.WebApi.App_Code
packageReq
.
SetParameter
(
"refund_fee"
,
param
.
RefundFee
.
Value
.
ToString
(
System
.
Globalization
.
CultureInfo
.
InvariantCulture
));
packageReq
.
SetParameter
(
"sign"
,
packageReq
.
CreateMd5Sign
(
_accessor
,
model
.
WeChatApiSecret
));
var
reqXml
=
packageReq
.
ParseXml
();
LogHelper
.
WriteInfo
(
"退款正式路径"
+
Path
.
Combine
(
AppDomain
.
CurrentDomain
.
BaseDirectory
,
"App_Data/Certs/WeChatApp/"
+
model
.
WeChatPayCertificateUrl
));
var
result
=
Common
.
Pay
.
WeChatPat
.
HttpHelper
.
Post
(
new
HttpParam
()
{
Url
=
"https://api.mch.weixin.qq.com/secapi/pay/refund"
,
...
...
@@ -335,6 +335,7 @@ namespace Mall.WebApi.App_Code
});
var
xe
=
XElement
.
Parse
(
result
,
LoadOptions
.
SetLineInfo
);
LogHelper
.
Write
(
null
,
"退款申请【"
+
param
.
OrderNumber
+
"】回调接口:"
+
xe
);
var
returnCode
=
xe
.
GetElement
(
"return_code"
).
Value
;
//退款成功
if
(
returnCode
.
Equals
(
"SUCCESS"
))
...
...
@@ -395,6 +396,7 @@ namespace Mall.WebApi.App_Code
});
var
xe
=
XElement
.
Parse
(
result
,
LoadOptions
.
SetLineInfo
);
var
returnCode
=
xe
.
GetElement
(
"return_code"
).
Value
;
string
outTradeNo
=
xe
.
GetElement
(
"out_refund_no_0"
).
Value
;
if
(
returnCode
.
Equals
(
"SUCCESS"
))
...
...
@@ -534,7 +536,7 @@ namespace Mall.WebApi.App_Code
var
xe
=
XElement
.
Parse
(
result
,
LoadOptions
.
SetLineInfo
);
var
returnCode
=
xe
.
GetElement
(
"return_code"
)
==
null
?
""
:
xe
.
GetElement
(
"return_code"
).
Value
;
var
returnMsg
=
xe
.
GetElement
(
"return_msg"
)
==
null
?
""
:
xe
.
GetElement
(
"return_msg"
).
Value
;
if
(
returnCode
.
Equals
(
"SUCCESS"
)
&&
returnCode
.
Equals
(
"SUCCESS"
))
{
var
code_url
=
xe
.
GetElement
(
"code_url"
)
==
null
?
""
:
xe
.
GetElement
(
"code_url"
).
Value
;
...
...
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