Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pay
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
bp
pay
Commits
aef1482e
Commit
aef1482e
authored
Sep 16, 2021
by
万继龙
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature_0916' into 'master'
add: pingxx 支持燕郊圈配置 See merge request bp/pay!75
parents
c45ec27a
512c0531
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
13 deletions
+26
-13
Order.php
application/modules/Pay/controllers/Order.php
+7
-1
PayService.php
application/services/pay/PayService.php
+7
-6
PingxxService.php
application/services/pingxx/PingxxService.php
+8
-3
RefundService.php
application/services/refund/RefundService.php
+3
-3
application.ini
conf/application.ini
+1
-0
No files found.
application/modules/Pay/controllers/Order.php
View file @
aef1482e
...
...
@@ -29,8 +29,14 @@ class OrderController extends Base
}
}
if
(
isset
(
$params
[
'pkg'
])
&&
(
$params
[
'pkg'
]
==
'com.yanjiaoquan.app965004'
))
{
$pingxx_id
=
\Yaf\Application
::
app
()
->
getConfig
()
->
get
(
'pingxx_yjq.appid'
);
}
else
{
$pingxx_id
=
\Yaf\Application
::
app
()
->
getConfig
()
->
get
(
'pingxx.appid'
);
}
$paySrv
=
new
PayService
();
$ret
=
$paySrv
->
do_pay
(
$order_id
,
$user_id
,
$pay_method_id
,
$extra
);
$ret
=
$paySrv
->
do_pay
(
$order_id
,
$user_id
,
$p
ingxx_id
,
$p
ay_method_id
,
$extra
);
//兼容C端客户端支付,调整返回结构,ping++ 返回 order,原生:微信、支付宝返回charge
$result
=
[];
...
...
application/services/pay/PayService.php
View file @
aef1482e
...
...
@@ -33,7 +33,7 @@ class PayService
private
$clear_list
=
[];
private
$clear_items_list
=
[];
public
function
do_pay
(
$order_id
,
$user_id
,
$pay_method_id
=
105
,
$extra
=
[])
public
function
do_pay
(
$order_id
,
$user_id
,
$p
ingxx_id
,
$p
ay_method_id
=
105
,
$extra
=
[])
{
if
(
empty
(
$order_id
))
{
throw
new
PayException
([
'cus'
=>
1
]);
...
...
@@ -64,7 +64,7 @@ class PayService
$metadata
=
[
'app_id'
=>
'merchant-c'
,
'pingxx_id'
=>
PingxxService
::
getInstance
()
->
getAppId
(),
'pingxx_id'
=>
PingxxService
::
getInstance
(
$pingxx_id
)
->
getAppId
(),
'environ'
=>
Application
::
app
()
->
environ
(),
'order_id'
=>
$order_id
,
'goods'
=>
[],
...
...
@@ -110,6 +110,7 @@ class PayService
'pay_amount'
=>
$order_info
[
'payment'
],
'pay_channel'
=>
$pay_method_id
,
'third_order_id'
=>
''
,
'pingxx_id'
=>
PingxxService
::
getInstance
(
$pingxx_id
)
->
getAppId
(),
'expire_time'
=>
date
(
'Y-m-d H:i:s'
,
$pay_expiration_time
),
'source_name'
=>
10
,
'service_name'
=>
1
,
...
...
@@ -134,9 +135,9 @@ class PayService
// 已经创建,需要查询返回
if
(
!
empty
(
$pay_order
[
'third_order_id'
]))
{
$ret
=
PingxxService
::
getInstance
()
->
getOrder
(
$pay_order
[
'third_order_id'
]);
$ret
=
PingxxService
::
getInstance
(
$pingxx_id
)
->
getOrder
(
$pay_order
[
'third_order_id'
]);
}
else
{
$ret
=
PingxxService
::
getInstance
()
->
createOrder
(
$pay_order
,
$metadata
);
$ret
=
PingxxService
::
getInstance
(
$pingxx_id
)
->
createOrder
(
$pay_order
,
$metadata
);
}
if
(
!
empty
(
$ret
[
'error'
]))
{
...
...
@@ -198,7 +199,7 @@ class PayService
'extra'
=>
$extra
,
];
$pay
=
PingxxService
::
getInstance
()
->
pay
(
$ret
[
'id'
],
$payment
);
$pay
=
PingxxService
::
getInstance
(
$pingxx_id
)
->
pay
(
$ret
[
'id'
],
$payment
);
if
(
!
empty
(
$pay
[
'error'
]))
{
throw
new
BaseException
([
'msg'
=>
$pay
[
'error'
][
'message'
],
'code'
=>
'2002'
]);
}
...
...
@@ -343,7 +344,7 @@ class PayService
}
//paid、refunded、canceled、created
$ret
=
PingxxService
::
getInstance
()
->
getOrder
(
$pay_order
[
'third_order_id'
]);
$ret
=
PingxxService
::
getInstance
(
$pay_order
[
'pingxx_id'
]
)
->
getOrder
(
$pay_order
[
'third_order_id'
]);
if
(
!
empty
(
$ret
[
'error'
]))
{
throw
new
BaseException
([
'msg'
=>
$ret
[
'error'
][
'message'
],
'code'
=>
'2301'
]);
}
...
...
application/services/pingxx/PingxxService.php
View file @
aef1482e
...
...
@@ -17,19 +17,24 @@ class PingxxService
private
function
__construct
()
{
$appId
=
\Yaf\Application
::
app
()
->
getConfig
()
->
get
(
'pingxx.appid'
);
//
$appId = \Yaf\Application::app()->getConfig()->get('pingxx.appid');
Pingpp
::
setApiKey
(
'sk_live_9q9iLCS4mvv1a9eTq190O8K4'
);
// 正式 API Key
Pingpp
::
setPrivateKeyPath
(
ROOT_PATH
.
'/conf/your_rsa_private_key.pem'
);
// 设置私钥
Pingpp
::
setAppId
(
$appId
);
// 设置 App ID
//
Pingpp::setAppId($appId); // 设置 App ID
}
private
function
__clone
()
{}
public
static
function
getInstance
()
{
public
static
function
getInstance
(
$appId
=
''
)
{
if
(
empty
(
self
::
$instance
))
{
self
::
$instance
=
new
self
;
}
if
(
empty
(
$appId
))
{
$appId
=
\Yaf\Application
::
app
()
->
getConfig
()
->
get
(
'pingxx.appid'
);
}
Pingpp
::
setAppId
(
$appId
);
// 设置 App ID$app_id
return
self
::
$instance
;
}
...
...
application/services/refund/RefundService.php
View file @
aef1482e
...
...
@@ -44,7 +44,7 @@ class RefundService
具体见ping++ 文档
*/
$pay
=
PingxxService
::
getInstance
()
->
getOrder
(
$data
[
'pay_order'
][
'third_order_id'
]);
$pay
=
PingxxService
::
getInstance
(
$data
[
'pay_order'
][
'pingxx_id'
]
)
->
getOrder
(
$data
[
'pay_order'
][
'third_order_id'
]);
if
(
empty
(
$pay
[
'paid'
])
||
$pay
[
'paid'
]
!=
true
)
{
throw
new
RefundException
([
'cus'
=>
12
]);
}
...
...
@@ -64,7 +64,7 @@ class RefundService
'charge_amount'
=>
$data
[
'refund_order'
][
'refund_amount'
],
'metadata'
=>
[
'app_id'
=>
'merchant-c'
,
'pingxx_id'
=>
PingxxService
::
getInstance
()
->
getAppId
(),
'pingxx_id'
=>
PingxxService
::
getInstance
(
$data
[
'pay_order'
][
'pingxx_id'
]
)
->
getAppId
(),
'environ'
=>
Application
::
app
()
->
environ
(),
'refund_order_id'
=>
$data
[
'refund_order'
][
'refund_order_id'
],
'order_item_id'
=>
$data
[
'order_item_id'
],
...
...
@@ -73,7 +73,7 @@ class RefundService
];
try
{
$ret
=
PingxxService
::
getInstance
()
->
sendRefund
(
$refund
);
$ret
=
PingxxService
::
getInstance
(
$data
[
'pay_order'
][
'pingxx_id'
]
)
->
sendRefund
(
$refund
);
if
(
!
empty
(
$ret
[
"data"
]))
{
$edit
=
[
'request_pingxx_success_time'
=>
date
(
'Y-m-d H:i:s'
)];
RefundOrder
::
update
(
$edit
,
[
'refund_order_id'
=>
$data
[
'refund_order'
][
'refund_order_id'
]]);
...
...
conf/application.ini
View file @
aef1482e
...
...
@@ -39,6 +39,7 @@ dingTalk.keys[]="SEC0298ad3f80e16df12cd4d6f6c39e961b500e2ff486f4c4377c0e2af8f453
[prod : common : exception : dingTalk]
pingxx.appid
=
"app_9m1ubDG4e1mPXLCG"
pingxx_yjq.appid
=
"app_vff1W1H0yr94Gefr"
wxApp.jw.order
=
"https://wx.appgc.cn/%23/bpmp/ticket/my"
wallet.appid
=
"21091014413030105002"
...
...
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