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
aab1cccd
Commit
aab1cccd
authored
Jul 04, 2021
by
wanjilong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add: post
parent
a963c378
Changes
23
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
422 additions
and
626 deletions
+422
-626
PayException.php
application/exception/custom/PayException.php
+5
-0
Logger.php
application/library/Helpers/Logger.php
+1
-1
Sdk.php
application/library/Helpers/Sdk.php
+1
-1
helper.php
application/library/helper.php
+1
-0
Test.php
application/models/demo/mongo/Test.php
+0
-54
User.php
application/models/demo/mongo/User.php
+0
-38
TestMysql.php
application/models/demo/mysql/TestMysql.php
+0
-127
User.php
application/models/demo/mysql/User.php
+0
-38
PayOrder.php
application/models/order/mysql/PayOrder.php
+12
-39
PayOrderClearing.php
application/models/order/mysql/PayOrderClearing.php
+2
-15
PayOrderClearingItem.php
application/models/order/mysql/PayOrderClearingItem.php
+2
-15
PayOrderItem.php
application/models/order/mysql/PayOrderItem.php
+2
-15
RefundOrder.php
application/models/order/mysql/RefundOrder.php
+2
-15
Callback.php
application/modules/Pay/controllers/Callback.php
+8
-4
OrderService.php
application/services/order/OrderService.php
+14
-3
PayService.php
application/services/pay/PayService.php
+289
-242
PingxxService.php
application/services/pingxx/PingxxService.php
+30
-16
RefundService.php
application/services/refund/RefundService.php
+2
-2
WalletService.php
application/services/wallet/WalletService.php
+1
-0
application.ini
conf/application.ini
+5
-1
pingpp_rsa_public_key.pem
conf/pingpp_rsa_public_key.pem
+9
-0
your_rsa_private_key.pem
conf/your_rsa_private_key.pem
+27
-0
your_rsa_public_key.pem
conf/your_rsa_public_key.pem
+9
-0
No files found.
application/exception/custom/PayException.php
View file @
aab1cccd
...
@@ -15,5 +15,10 @@ class PayException extends BaseException
...
@@ -15,5 +15,10 @@ class PayException extends BaseException
3
=>
'该订单已经支付,请刷新确认'
,
3
=>
'该订单已经支付,请刷新确认'
,
4
=>
'费率计算错误,费率分母为0'
,
4
=>
'费率计算错误,费率分母为0'
,
5
=>
'支付回调失败,请核对订单'
,
5
=>
'支付回调失败,请核对订单'
,
6
=>
'回调参数错误,请管理员关注'
,
7
=>
'制定订单回调类型错误,请管理员关注'
,
8
=>
'退款中订单不允许核销,请管理员关注'
,
9
=>
'未支付订单不允许核销,请管理员关注'
,
10
=>
'仅允许核销商家自己的订单,请管理员关注'
,
];
];
}
}
application/library/Helpers/Logger.php
View file @
aab1cccd
...
@@ -101,7 +101,7 @@ class Logger {
...
@@ -101,7 +101,7 @@ class Logger {
];
];
//$_SERVER['HTTP_X_FORWARDED_FOR']
//$_SERVER['HTTP_X_FORWARDED_FOR']
$string
=
json_encode
(
$log
)
.
"
\n
"
;
$string
=
json_encode
(
$log
,
JSON_UNESCAPED_UNICODE
)
.
"
\n
"
;
if
(
$fd
=
@
fopen
(
$file
,
'a'
))
{
if
(
$fd
=
@
fopen
(
$file
,
'a'
))
{
fputs
(
$fd
,
$string
);
fputs
(
$fd
,
$string
);
fclose
(
$fd
);
fclose
(
$fd
);
...
...
application/library/Helpers/Sdk.php
View file @
aab1cccd
...
@@ -28,7 +28,7 @@ class Sdk {
...
@@ -28,7 +28,7 @@ class Sdk {
Logger
::
info
(
'api request'
,
[
'url'
=>
$url
,
'params'
=>
$params
]);
Logger
::
info
(
'api request'
,
[
'url'
=>
$url
,
'params'
=>
$params
]);
$data
=
(
new
TimeOut
())
->
runPost
(
$url
,
$params
,
$headers
);
$data
=
(
new
TimeOut
())
->
runPost
(
$url
,
$params
,
$headers
);
Logger
::
info
(
'api re
quest
'
,
[
'ret'
=>
$data
]);
Logger
::
info
(
'api re
sponse
'
,
[
'ret'
=>
$data
]);
return
$data
;
return
$data
;
}
}
...
...
application/library/helper.php
View file @
aab1cccd
...
@@ -25,6 +25,7 @@ if (!function_exists('config')) {
...
@@ -25,6 +25,7 @@ if (!function_exists('config')) {
$key
=
$file
.
'.'
.
(
empty
(
$appid
)
?
$env
:
$env
.
'-'
.
$appid
);
$key
=
$file
.
'.'
.
(
empty
(
$appid
)
?
$env
:
$env
.
'-'
.
$appid
);
$key
=
$param
===
''
?
$key
:
$key
.
"."
.
$param
;
$key
=
$param
===
''
?
$key
:
$key
.
"."
.
$param
;
return
\Yaconf
::
get
(
$key
);
return
\Yaconf
::
get
(
$key
);
}
}
...
...
application/models/demo/mongo/Test.php
deleted
100644 → 0
View file @
a963c378
<?php
namespace
App\Models\demo\mongo
;
use
Api\PhpUtils\Mongo\MongoBase
;
class
Test
extends
MongoBase
{
protected
function
getConfigIndex
()
{
return
"demo"
;
}
protected
function
getDatabaseName
()
{
return
"demo"
;
}
protected
function
getCollectionName
()
{
return
"user"
;
}
protected
function
getWhere
(
$params
)
{
return
$params
;
}
protected
function
getQueryOptions
(
$fields
=
[],
$sort
=
[],
$limit
=
[])
{
$options
=
[
'maxTimeMS'
=>
800
,
'limit'
=>
100
];
if
(
is_array
(
$fields
)
&&
!
empty
(
$fields
))
{
$options
[
'projection'
]
=
$fields
;
}
if
(
is_array
(
$sort
)
&&
!
empty
(
$sort
))
{
$options
[
'sort'
]
=
$sort
;
}
if
(
is_array
(
$limit
))
{
if
(
isset
(
$limit
[
'start'
]))
{
$options
[
'skip'
]
=
intval
(
$limit
[
'start'
]);
}
if
(
isset
(
$limit
[
'count'
]))
{
$options
[
'limit'
]
=
intval
(
$limit
[
'count'
]);
}
}
return
$options
;
}
}
application/models/demo/mongo/User.php
deleted
100644 → 0
View file @
a963c378
<?php
namespace
App\Models\demo\mongo
;
use
Api\PhpUtils\Mongo\Base
;
class
User
extends
Base
{
protected
static
$instance
;
protected
static
$db_config_index
=
'metro'
;
protected
function
getCollectionName
()
{
return
'user'
;
}
protected
function
getWhere
(
$params
)
{
$where
=
[];
if
(
isset
(
$params
[
'name'
])
&&
!
empty
(
$params
[
'name'
]))
{
$where
[
'name'
]
=
$params
[
'name'
];
}
return
$where
;
}
protected
function
getQueryOptions
()
{
$options
=
[
'projection'
=>
[
'mobile'
=>
1
],
'maxTimeMS'
=>
800
,
'limit'
=>
5
,
'sort'
=>
[
'mobile'
=>
-
1
]
];
return
$options
;
}
}
application/models/demo/mysql/TestMysql.php
deleted
100644 → 0
View file @
a963c378
<?php
namespace
App\Models\demo\mysql
;
use
Api\PhpUtils\Mysql\MysqlBase2
;
class
TestMysql
extends
MysqlBase2
{
const
TABLE_NAME
=
'test'
;
const
CONFIG_INDEX
=
'merchant'
;
const
LIFE_ACCOUNT_TYPE_PERSIONAL
=
1
;
// 个人
const
LIFE_ACCOUNT_TYPE_ENTERPRISE
=
2
;
// 企业
const
LIFE_ACCOUNT_STATUS_ON
=
1
;
// 上线
const
LIFE_ACCOUNT_STATUS_OFF
=
2
;
// 下线
const
LIFE_ACCOUNT_STATUS_UPGRADE
=
3
;
// 升级中
const
LIFE_ACCOUNT_AUTH_STATUS_NO
=
1
;
// 未认证生活号
const
LIFE_ACCOUNT_AUTH_STATUS_YES
=
2
;
// 已认证生活号
const
ENTERPRISE_AUTH_STATUS_ING
=
1
;
// 升级审核中
const
ENTERPRISE_AUTH_STATUS_FAIL
=
2
;
// 升级失败
public
static
function
getRecord
(
$where
,
$colums
=
[])
{
if
(
empty
(
$colums
))
{
$colums
=
'*'
;
}
return
self
::
get
(
$colums
,
$where
);
}
public
static
function
getRecordMaster
(
$where
,
$colums
=
[])
{
if
(
empty
(
$colums
))
{
$colums
=
'*'
;
}
return
self
::
selectMaster
(
$colums
,
$where
);
}
public
static
function
insertRecord
(
$colums
)
{
return
self
::
insert
(
$colums
);
}
public
static
function
updateRecord
(
$colums
,
$where
)
{
return
self
::
update
(
$colums
,
$where
);
}
public
static
function
save
(
$data
,
$where
=
[])
{
if
(
empty
(
$where
))
{
return
self
::
insert
(
$data
);
}
return
self
::
update
(
$data
,
$where
);
}
public
static
function
deleteRecord
(
$where
)
{
return
self
::
delete
(
$where
);
}
public
static
function
getAccountList
(
$data
,
$colums
=
[])
{
$colums
=
" * "
;
$where
=
" 1=1 "
;
if
(
!
empty
(
$data
[
'life_account_name'
]))
{
$where
.=
" and (`life_account_name` LIKE '%
{
$data
[
'life_account_name'
]
}
%') "
;
}
if
(
!
empty
(
$data
[
'life_account_type'
]))
{
$where
.=
" and life_account_type = '
{
$data
[
'life_account_type'
]
}
'"
;
}
if
(
!
empty
(
$data
[
'ORDER'
]))
{
$where
.=
" ORDER BY `create_time` DESC "
;
}
if
(
!
empty
(
$data
[
'LIMIT'
]))
{
$where
.=
" LIMIT
{
$data
[
'LIMIT'
][
1
]
}
OFFSET
{
$data
[
'LIMIT'
][
0
]
}
"
;
}
return
$data
=
self
::
query
(
"SELECT
{
$colums
}
FROM `life_account` WHERE
$where
"
)
->
fetchAll
();
}
public
static
function
getAccountCount
(
$data
,
$colums
=
[])
{
$colums
=
" * "
;
$where
=
" 1=1 "
;
if
(
!
empty
(
$data
[
'life_account_name'
]))
{
$where
.=
" and (`life_account_name` LIKE '%
{
$data
[
'life_account_name'
]
}
%') "
;
}
if
(
!
empty
(
$data
[
'life_account_type'
]))
{
$where
.=
" and life_account_type = '
{
$data
[
'life_account_type'
]
}
'"
;
}
$data
=
self
::
query
(
"SELECT COUNT(*) as count FROM `life_account` WHERE
$where
"
)
->
fetch
();
return
!
empty
(
$data
[
'count'
])
?
$data
[
'count'
]
:
0
;
}
public
static
function
getRecords
(
$where
,
$colums
=
[])
{
if
(
empty
(
$colums
))
{
$colums
=
'*'
;
}
return
self
::
select
(
$colums
,
$where
);
}
public
static
function
getCount
(
$where
)
{
return
self
::
count
(
$where
);
}
public
static
function
duplicate
(
$data
,
$duplicate
)
{
return
self
::
insertDuplicate
(
$data
,
$duplicate
);
}
public
static
function
forupdate
(
$columns
,
$where
)
{
return
self
::
selectForUpdate
(
$columns
,
$where
);
}
}
application/models/demo/mysql/User.php
deleted
100644 → 0
View file @
a963c378
<?php
namespace
App\Models\demo\mysql
;
use
Api\PhpUtils\Mysql\Base
;
class
User
extends
Base
{
protected
static
$write
;
protected
static
$read
;
protected
static
$db_config_index
=
'metro'
;
protected
function
getTableName
()
{
return
'user'
;
}
protected
function
getPKey
()
{
return
'id'
;
}
protected
function
getWhere
(
$params
)
{
$where
=
[];
if
(
isset
(
$params
[
'ids'
])
&&
!
empty
(
$params
[
'ids'
]))
{
$where
[
'id'
]
=
$params
[
'ids'
];
}
if
(
isset
(
$params
[
'name'
])
&&
!
empty
(
$params
[
'name'
]))
{
$where
[
'name'
]
=
$params
[
'name'
];
}
if
(
isset
(
$params
[
'id[>]'
])
&&
!
empty
(
$params
[
'id[>]'
]))
{
$where
[
'id[>]'
]
=
$params
[
'id[>]'
];
}
return
$where
;
}
}
application/models/order/mysql/PayOrder.php
View file @
aab1cccd
...
@@ -2,24 +2,13 @@
...
@@ -2,24 +2,13 @@
namespace
App\Models\order\mysql
;
namespace
App\Models\order\mysql
;
use
Api\PhpUtils\Mysql\MysqlBase
;
use
Api\PhpUtils\Mysql\MysqlBase
;
use
App\Exception\custom\PayException
;
use
Helpers\Logger
;
class
PayOrder
extends
MysqlBase
class
PayOrder
extends
MysqlBase
{
{
protected
static
$write
;
const
TABLE_NAME
=
'pay_order'
;
const
CONFIG_INDEX
=
'pay'
;
protected
static
$read
;
protected
static
$db_config_index
=
'metro'
;
protected
function
getTableName
()
{
return
'pay_order'
;
}
protected
function
getPKey
()
{
return
'pay_order_id'
;
}
/**
/**
* @param $order_id
* @param $order_id
...
@@ -28,30 +17,14 @@ class PayOrder extends MysqlBase
...
@@ -28,30 +17,14 @@ class PayOrder extends MysqlBase
*/
*/
public
static
function
get_valid_order
(
$order_id
,
$pay_order
)
{
public
static
function
get_valid_order
(
$order_id
,
$pay_order
)
{
$link
=
self
::
getConnection
(
'write'
);
self
::
beginTransaction
();
$order
=
[];
$_date
=
date
(
'Y-m-d H:i:s'
);
$link
->
action
(
function
(
$link
,
$order_id
,
$pay_order
)
use
(
&
$order
)
{
$order
=
self
::
getMaster
(
'*'
,
[
'order_id'
=>
$order_id
,
'expire_time[>]'
=>
$_date
]);
$_date
=
date
(
'Y-h-m H:i:s'
);
$sql
=
"select * from "
.
self
::
getTableName
()
.
" where order_id = :order_id and expire_time >:date limit 1 for update"
;
$order
=
$link
->
query
(
$sql
,
[
":order_id"
=>
$order_id
,
":date"
=>
$_date
]
)
->
fetch
();
if
(
empty
(
$order
))
{
if
(
empty
(
$order
))
{
$link
->
insert
(
self
::
getTableName
(),
$pay_order
);
self
::
insert
(
$pay_order
,
[
'rowCount'
=>
true
]);
$order
=
$link
->
query
(
$order
=
$pay_order
;
$sql
,
[
":order_id"
=>
$order_id
,
":date"
=>
$_date
]
)
->
fetch
();
}
}
});
self
::
commit
();
return
$order
;
return
$order
;
}
}
}
}
application/models/order/mysql/PayOrderClearing.php
View file @
aab1cccd
...
@@ -5,19 +5,6 @@ use Api\PhpUtils\Mysql\MysqlBase;
...
@@ -5,19 +5,6 @@ use Api\PhpUtils\Mysql\MysqlBase;
class
PayOrderClearing
extends
MysqlBase
class
PayOrderClearing
extends
MysqlBase
{
{
protected
static
$write
;
const
TABLE_NAME
=
'pay_order_clearing'
;
const
CONFIG_INDEX
=
'pay'
;
protected
static
$read
;
protected
static
$db_config_index
=
'metro'
;
protected
function
getTableName
()
{
return
'pay_order_clearing'
;
}
protected
function
getPKey
()
{
return
'pay_order_clearing_id'
;
}
}
}
application/models/order/mysql/PayOrderClearingItem.php
View file @
aab1cccd
...
@@ -5,19 +5,6 @@ use Api\PhpUtils\Mysql\MysqlBase;
...
@@ -5,19 +5,6 @@ use Api\PhpUtils\Mysql\MysqlBase;
class
PayOrderClearingItem
extends
MysqlBase
class
PayOrderClearingItem
extends
MysqlBase
{
{
protected
static
$write
;
const
TABLE_NAME
=
'pay_order_clearing_item'
;
const
CONFIG_INDEX
=
'pay'
;
protected
static
$read
;
protected
static
$db_config_index
=
'metro'
;
protected
function
getTableName
()
{
return
'pay_order_clearing_item'
;
}
protected
function
getPKey
()
{
return
'pay_order_clearing_item_id'
;
}
}
}
application/models/order/mysql/PayOrderItem.php
View file @
aab1cccd
...
@@ -5,19 +5,6 @@ use Api\PhpUtils\Mysql\MysqlBase;
...
@@ -5,19 +5,6 @@ use Api\PhpUtils\Mysql\MysqlBase;
class
PayOrderItem
extends
MysqlBase
class
PayOrderItem
extends
MysqlBase
{
{
protected
static
$write
;
const
TABLE_NAME
=
'pay_order_item'
;
const
CONFIG_INDEX
=
'pay'
;
protected
static
$read
;
protected
static
$db_config_index
=
'metro'
;
protected
function
getTableName
()
{
return
'pay_order_item'
;
}
protected
function
getPKey
()
{
return
'pay_order_item_id'
;
}
}
}
application/models/order/mysql/RefundOrder.php
View file @
aab1cccd
...
@@ -5,19 +5,6 @@ use Api\PhpUtils\Mysql\MysqlBase;
...
@@ -5,19 +5,6 @@ use Api\PhpUtils\Mysql\MysqlBase;
class
RefundOrder
extends
MysqlBase
class
RefundOrder
extends
MysqlBase
{
{
protected
static
$write
;
const
TABLE_NAME
=
'refund_order'
;
const
CONFIG_INDEX
=
'pay'
;
protected
static
$read
;
protected
static
$db_config_index
=
'metro'
;
protected
function
getTableName
()
{
return
'refund_order'
;
}
protected
function
getPKey
()
{
return
'refund_order_id'
;
}
}
}
application/modules/Pay/controllers/Callback.php
View file @
aab1cccd
...
@@ -13,19 +13,23 @@ class CallbackController extends Base
...
@@ -13,19 +13,23 @@ class CallbackController extends Base
*/
*/
public
function
payAction
()
public
function
payAction
()
{
{
try
{
//
try{
$raw_data
=
file_get_contents
(
'php://input'
);
$raw_data
=
file_get_contents
(
'php://input'
);
$paySrv
=
new
PayService
();
$paySrv
=
new
PayService
();
$ret
=
$paySrv
->
call_back
(
$raw_data
);
//todo ping++ 回调数据验签
$this
->
success
([
'result'
=>
$ret
]);
$data
=
json_decode
(
$raw_data
,
true
);
$ret
=
$paySrv
->
call_back
(
$data
);
$this
->
success
([
'result'
=>
$ret
]);
/*
}catch (Exception $e) {
}catch (Exception $e) {
http_response_code(500);
http_response_code(500);
$this->failed('500');
$this->failed('500');
}
}
*/
}
}
public
function
refundAction
()
{
public
function
refundAction
()
{
...
...
application/services/order/OrderService.php
View file @
aab1cccd
...
@@ -13,17 +13,28 @@ class OrderService
...
@@ -13,17 +13,28 @@ class OrderService
* @param $userId
* @param $userId
* 调用内部服务获取用户订单、子单、分润信息
* 调用内部服务获取用户订单、子单、分润信息
*/
*/
public
static
function
getOrderData
(
$order_id
,
$user_id
)
{
public
static
function
get
Full
OrderData
(
$order_id
,
$user_id
)
{
$url
=
config
(
'interface'
,
'order.order.pay_order'
);
$url
=
config
(
'interface'
,
'order.order.pay_order'
);
if
(
!
$url
)
{
if
(
!
$url
)
{
throw
new
CodeSpecialException
(
"failed"
);
throw
new
CodeSpecialException
(
"failed"
.
__METHOD__
);
}
}
$params
=
[
'user_id'
=>
$user_id
,
'order_id'
=>
$order_id
];
$params
=
[
'user_id'
=>
$user_id
,
'order_id'
=>
$order_id
];
return
Sdk
::
call
(
$url
,
$params
);
return
Sdk
::
call
(
$url
,
$params
);
}
}
public
static
function
getOrderInfo
(
$order_id
,
$user_id
)
{
//pay_order_info
$url
=
config
(
'interface'
,
'order.order.pay_order_info'
);
if
(
!
$url
)
{
throw
new
CodeSpecialException
(
"failed"
.
__METHOD__
);
}
$params
=
[
'order_id'
=>
$order_id
,
'user_id'
=>
$user_id
];
return
Sdk
::
call
(
$url
,
$params
);
}
/**
/**
* @param $order_item_id
* @param $order_item_id
* @param $user_id
* @param $user_id
...
@@ -35,7 +46,7 @@ class OrderService
...
@@ -35,7 +46,7 @@ class OrderService
//merchant.account.get_role_list
//merchant.account.get_role_list
$url
=
config
(
'interface'
,
'order.order.pay_order_item'
);
$url
=
config
(
'interface'
,
'order.order.pay_order_item'
);
if
(
!
$url
)
{
if
(
!
$url
)
{
throw
new
CodeSpecialException
(
"failed"
);
throw
new
CodeSpecialException
(
"failed"
.
__METHOD__
);
}
}
$params
=
[
'user_id'
=>
$user_id
,
'order_item_id'
=>
$order_item_id
];
$params
=
[
'user_id'
=>
$user_id
,
'order_item_id'
=>
$order_item_id
];
...
...
application/services/pay/PayService.php
View file @
aab1cccd
This diff is collapsed.
Click to expand it.
application/services/pingxx/PingxxService.php
View file @
aab1cccd
...
@@ -4,13 +4,33 @@
...
@@ -4,13 +4,33 @@
namespace
App\Services\pingxx
;
namespace
App\Services\pingxx
;
use
Pingpp\Order
;
use
Pingpp\Order
;
use
Pingpp\Pingpp
;
use
Pingpp\OrderRefund
;
use
Pingpp\OrderRefund
;
use
Helpers\Logger
;
use
Helpers\Logger
;
use
Api\PhpUtils\Common\IP
;
class
PingxxService
class
PingxxService
{
{
private
static
$instance
=
null
;
private
function
__construct
()
{
Pingpp
::
setApiKey
(
'sk_test_ibbTe5jLGCi5rzfH4OqPW9KC'
);
// 设置 API Key
Pingpp
::
setPrivateKeyPath
(
ROOT_PATH
.
'/conf/your_rsa_private_key.pem'
);
// 设置私钥
Pingpp
::
setAppId
(
'app_1Gqj58ynP0mHeX1q'
);
// 设置 App ID
}
private
function
__clone
()
{}
public
static
function
getInstance
()
{
if
(
empty
(
self
::
$instance
))
{
self
::
$instance
=
new
self
;
}
return
self
::
$instance
;
}
/**
/**
* @param $order_item_id
* @param $order_item_id
...
@@ -18,7 +38,7 @@ class PingxxService
...
@@ -18,7 +38,7 @@ class PingxxService
* @throws RefundException
* @throws RefundException
* 发起退款请求
* 发起退款请求
*/
*/
public
static
function
sendRefund
(
$refundData
,
$chargeId
)
{
public
function
sendRefund
(
$refundData
,
$chargeId
)
{
try
{
try
{
Logger
::
info
(
'退款订单发起'
,
[
'chargeId'
=>
$chargeId
,
'refundData'
=>
$refundData
]);
Logger
::
info
(
'退款订单发起'
,
[
'chargeId'
=>
$chargeId
,
'refundData'
=>
$refundData
]);
...
@@ -36,7 +56,6 @@ class PingxxService
...
@@ -36,7 +56,6 @@ class PingxxService
'goods_sku_id'
=>
$refundData
[
'goods_sku_id'
]
??
''
'goods_sku_id'
=>
$refundData
[
'goods_sku_id'
]
??
''
],
],
'refund_mode'
=>
'to_source'
,
//退款模式。原路退回:to_source,退至余额:to_balance。默认为原路返回。
'refund_mode'
=>
'to_source'
,
//退款模式。原路退回:to_source,退至余额:to_balance。默认为原路返回。
'royalty_users'
=>
$royalty_users
,
]
]
);
);
...
@@ -89,7 +108,7 @@ class PingxxService
...
@@ -89,7 +108,7 @@ class PingxxService
* @return mixed
* @return mixed
* 退款信息查询
* 退款信息查询
*/
*/
public
static
function
getRefund
(
$orderId
,
$refundId
)
{
public
function
getRefund
(
$orderId
,
$refundId
)
{
try
{
try
{
Logger
::
info
(
'退款查询发起'
,
[
'orderId'
=>
$orderId
,
'refundId'
=>
$refundId
]);
Logger
::
info
(
'退款查询发起'
,
[
'orderId'
=>
$orderId
,
'refundId'
=>
$refundId
]);
$ret
=
OrderRefund
::
retrieve
(
$orderId
,
$refundId
);
$ret
=
OrderRefund
::
retrieve
(
$orderId
,
$refundId
);
...
@@ -112,27 +131,22 @@ class PingxxService
...
@@ -112,27 +131,22 @@ class PingxxService
* @return mixed
* @return mixed
* 创建订单
* 创建订单
*/
*/
public
static
function
createOrder
(
$order
)
{
public
function
createOrder
(
$order
)
{
try
{
try
{
Logger
::
info
(
'创建订单发起'
,
$order
);
Logger
::
info
(
'创建订单发起'
,
$order
);
$royalty_users
=
[];
$royalty_users
=
[];
$ret
=
Order
::
create
(
$ret
=
Order
::
create
(
[
[
"amount"
=>
$order
[
'pay_amount'
],
"amount"
=>
$order
[
'pay_amount'
],
"app"
=>
APP_ID
,
"app"
=>
Pingpp
::
getAppId
()
,
"merchant_order_no"
=>
$order
[
'pay_order_id'
],
"merchant_order_no"
=>
$order
[
'pay_order_id'
],
"subject"
=>
"用户购买"
,
"subject"
=>
"用户购买"
,
"currency"
=>
"cny"
,
"currency"
=>
"cny"
,
"body"
=>
"购买商品"
,
"body"
=>
"购买商品"
,
"uid"
=>
$order
[
'user_id'
],
"uid"
=>
$order
[
'user_id'
],
"client_ip"
=>
"192.168.0.101"
,
"client_ip"
=>
IP
::
ip
(),
'receipt_app'
=>
APP_ID
,
// 收款方应用
'receipt_app'
=>
Pingpp
::
getAppId
(),
// 收款方应用
'service_app'
=>
APP_ID
,
// 服务方应用
'service_app'
=>
Pingpp
::
getAppId
(),
// 服务方应用
'royalty_users'
=>
$royalty_users
,
//'balance_settlement' => [ // 可选参数,余额结算信息。
// 'user' => 'user_001',
// 'user_fee' => 1
//]
]
]
);
);
...
@@ -155,7 +169,7 @@ class PingxxService
...
@@ -155,7 +169,7 @@ class PingxxService
* @param $orderId
* @param $orderId
* 订单查询
* 订单查询
*/
*/
public
static
function
getOrder
(
$orderId
)
{
public
function
getOrder
(
$orderId
)
{
try
{
try
{
Logger
::
info
(
'查询订单发起'
,
[
'orderId'
=>
$orderId
]);
Logger
::
info
(
'查询订单发起'
,
[
'orderId'
=>
$orderId
]);
...
@@ -181,7 +195,7 @@ class PingxxService
...
@@ -181,7 +195,7 @@ class PingxxService
* @return int
* @return int
* 校验回调是否合法
* 校验回调是否合法
*/
*/
public
static
function
verifySignature
(
$raw
,
$headers
)
{
public
function
verifySignature
(
$raw
,
$headers
)
{
$signature
=
isset
(
$headers
[
'X-Pingplusplus-Signature'
])
?
$headers
[
'X-Pingplusplus-Signature'
]
:
null
;
$signature
=
isset
(
$headers
[
'X-Pingplusplus-Signature'
])
?
$headers
[
'X-Pingplusplus-Signature'
]
:
null
;
...
...
application/services/refund/RefundService.php
View file @
aab1cccd
...
@@ -58,7 +58,7 @@ class RefundService
...
@@ -58,7 +58,7 @@ class RefundService
],
],
];
];
try
{
try
{
$ret
=
PingxxService
::
sendRefund
(
$refund
);
$ret
=
PingxxService
::
getInstance
()
->
sendRefund
(
$refund
);
if
(
!
empty
(
$ret
[
"data"
]))
{
if
(
!
empty
(
$ret
[
"data"
]))
{
$edit
=
[
'request_pingxx_success_time'
=>
date
(
'Y-m-d H:i:s'
)];
$edit
=
[
'request_pingxx_success_time'
=>
date
(
'Y-m-d H:i:s'
)];
}
else
{
}
else
{
...
@@ -86,7 +86,7 @@ class RefundService
...
@@ -86,7 +86,7 @@ class RefundService
// 获取退款回调信息,确认订单ID
// 获取退款回调信息,确认订单ID
$charge
=
$object
[
'charges'
][
'data'
][
0
];
$charge
=
$object
[
'charges'
][
'data'
][
0
];
$ping_refund
=
PingxxService
::
getRefund
(
$charge
[
'id'
],
$object
[
'id'
]);
$ping_refund
=
PingxxService
::
get
Instance
()
->
get
Refund
(
$charge
[
'id'
],
$object
[
'id'
]);
if
(
$ping_refund
[
'status'
]
!=
'succeeded'
)
{
if
(
$ping_refund
[
'status'
]
!=
'succeeded'
)
{
throw
new
RefundException
([
'cus'
=>
6
]);
throw
new
RefundException
([
'cus'
=>
6
]);
}
}
...
...
application/services/wallet/WalletService.php
View file @
aab1cccd
...
@@ -18,6 +18,7 @@ class WalletService
...
@@ -18,6 +18,7 @@ class WalletService
*/
*/
public
static
function
send
(
$params
)
{
public
static
function
send
(
$params
)
{
return
true
;
$url
=
config
(
'interface'
,
'wallet.wallet.recharge'
);
$url
=
config
(
'interface'
,
'wallet.wallet.recharge'
);
if
(
!
$url
)
{
if
(
!
$url
)
{
throw
new
CodeSpecialException
(
"failed"
);
throw
new
CodeSpecialException
(
"failed"
);
...
...
conf/application.ini
View file @
aab1cccd
[common]
[common]
application.debug
=
TRUE
application.dispatcher.throwException
=
0
application.dispatcher.catchException
=
0
application.directory
=
APP_PATH
application.directory
=
APP_PATH
application.bootstrap
=
APP_PATH "/Bootstrap.php"
application.bootstrap
=
APP_PATH "/Bootstrap.php"
application.library
=
APP_PATH"/library"
application.library
=
APP_PATH"/library"
application.library.namespace
=
""
application.library.namespace
=
""
application.modules
=
"Index,
Test,Pay,Refund
"
application.modules
=
"Index,
Pay
"
appid
=
"pay"
appid
=
"pay"
...
...
conf/pingpp_rsa_public_key.pem
0 → 100644
View file @
aab1cccd
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0d0QxZFYeHXGeWWneib
4Q0jUFjj4ro7bMnIJ8DjZ4w2NtLJi8p1mcFMbrIS5g95U5FUBCfAZXFb2QIaJfft
BByCQRbon7Jb97XoTP6kfk65tLz8Q9Cank1Ah/qivPIY0aNwvq8stedq9rcuJ6OQ
ncbfQ1217/Za50vKotYa+MEcFo9Y65biEmzq7BZeNYzuU4dGrPaCi917cfwNa8ey
ZSpoIOBe8e5JGOtZKCfgsgfecbXxdh6jq8Qn6mmrJILapEdxlj4xfzBzAuM3snqt
5XnDzzFWlI5Z+4lhyZr7eFVmnQSqn1HWt4VPzz/EWvxP8Rkvy89XuRXBAiO3/7Ur
8wIDAQAB
-----END PUBLIC KEY-----
\ No newline at end of file
conf/your_rsa_private_key.pem
0 → 100644
View file @
aab1cccd
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAx2MktxcKBEqdYRi2IgYcupPQIN5cxgiBL5udCCBJBNBbXPaq
uOE1qspfhB1KUzHXATnCONiSzubLcBTnwi2tz0ErRCeJZSERRCpbKx4eu6b1neUT
Wkga7xpZxWONEvkmZo5Nlhf4fXRPUYnO/bdGCNGpQ/HSJfWLtzmhCqO1aJwVhcDm
DMYz4bTkZavhFBdVyXf/8n7UKylk03eymlKJ1swQpeFcxaKfzsk1mJU7mc93mCWj
aR+VWkNbw4AQHDyHgbzH+zYARzCluiy5hXdixGEP+iO4ZBk48rEs1hKTvGz1k+jh
LCdkdpBRjq0pK/htjA3Ce8pF2AJs+fgN6ZUumQIDAQABAoIBAFa4MEfRpXGoYjrQ
3KZ/sg8UKvmgvQkEuetS60GViSym0pXkUuyGRyk5S8HSW3lDvBe0X10KFRAYIXNm
JEa4R1hVJ9REveVWNIRJR83BE+zZ+QnrkDc8FTrZYyIO4lTWOHVyfxxA4Lrv02/L
WFPRWoyLY+tBSf1ohpPyZLCT81rDglT1Z4svX020y8tXvnQqQiOjl4q7Zu4b26HU
TQ463ntMEhM5u7y9MFcxGRaOpF/gARlMGqDu6T8h/oYMiOSLoXOuTR7B80yaX/Mj
RZfUBoZMb5thX9qBLQ7dYnTkwaxwerYPrYvQrW9vtsswZ5NeIbEmCZyorUe8DOmQ
hT1+HmECgYEA/iQERHhZKHXnP0gvhl/uEOGOvLjD5H1D6zClzOHMmOcIF5OuEQb0
VcSMV+8emN7SCp/b/LVgKa27Mla9eXm+EXABRFcI7qGYsYXfbCD7EYX3TaJSp/30
jyLBy+MsHCTEiLeylSh7kHqgTR8tKND8UIzXo9aM7JqwFqleeXGyh7MCgYEAyNiU
EUzyBAv9sui3ZgVYRiVvTilk2HVTY6u61/mMOLsTrX3eYQaqb4GRJJShJO9mmsxX
RHBEZQJvUqqF9PapOsyv8HKuF5+UP6svHnJo7sn9gCvV/h1HTHqzFcYSvUaXnrym
D/0Tthf8CDeuGp5UFWMoFZF14HTr1oQROGAASoMCgYA0bZmzxmAeSLR8CZhEUGX8
dYvMwxEmgfERA+gwbCSZJpA0zPKL8LNXPkT1nw7g2pbaOkBX0dMUxhJoQBy2grcD
QegBATOGhy/I76U32VXyN4DdMy96GJnrLXBtb2AaLjudOMhOnRtgouuO/W+DjBmB
RIz377sC1KafBjHHO/1ooQKBgDQqfJrZv2ppquVTKH9pF/pwMq68daL7JkOXERqT
iGYbwQqozJ+q2Y3Iu2gi6o/rVl0SggAWoM0TitKP0+dCQcYx7+imAK3GFv1KexyP
Xs3WzO8Dc7ti42fr3qPjJG7g7PSfzwoME5iSNjX0MFZdlT1Q2dJwS4uXEsJO3yIj
XS/9AoGBALRApgtUA7Odw4tjCLGvxXuLFnyRkg6hFqoXAP2j8H9bJDOlSSVwQTFd
ahbcIDtQJS57vXUGK2uspbFKLm1WCFzPVyuxDIW6oue/kO+YxxU3NA58zk8oaORq
eA3YvHc7ZmRjVnVkxnXjKofrL6jF5A+lXSXnXchrv2ZYI+1pOsIV
-----END RSA PRIVATE KEY-----
\ No newline at end of file
conf/your_rsa_public_key.pem
0 → 100644
View file @
aab1cccd
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2MktxcKBEqdYRi2IgYc
upPQIN5cxgiBL5udCCBJBNBbXPaquOE1qspfhB1KUzHXATnCONiSzubLcBTnwi2t
z0ErRCeJZSERRCpbKx4eu6b1neUTWkga7xpZxWONEvkmZo5Nlhf4fXRPUYnO/bdG
CNGpQ/HSJfWLtzmhCqO1aJwVhcDmDMYz4bTkZavhFBdVyXf/8n7UKylk03eymlKJ
1swQpeFcxaKfzsk1mJU7mc93mCWjaR+VWkNbw4AQHDyHgbzH+zYARzCluiy5hXdi
xGEP+iO4ZBk48rEs1hKTvGz1k+jhLCdkdpBRjq0pK/htjA3Ce8pF2AJs+fgN6ZUu
mQIDAQAB
-----END PUBLIC KEY-----
\ No newline at end of file
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