Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
ldy
/
payment
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 79f04d3b
authored
Jan 14, 2023
by
“丁铜欣”
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增微诺付支付方式
1 parent
c43e9fb6
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
63 additions
and
12 deletions
src/Common/BaseData.php
src/Common/WNFpay/Data/Charge/ChargeData.php
src/Common/WNFpay/Data/Query/ChargeQueryData.php
src/Common/WNFpay/WNFBaseData.php
src/Common/WNFpay/WNFBaseStrategy.php
src/Common/WnfConfig.php
src/Query/WNF/WNFChargeQuery.php
src/QueryContext.php
src/Common/BaseData.php
View file @
79f04d3
...
...
@@ -70,7 +70,6 @@ abstract class BaseData
}
elseif
(
$config
instanceof
WnfConfig
)
{
$this
->
channel
=
Config
::
WNF_PAY
;
}
$this
->
data
=
array_merge
(
$config
->
toArray
(),
$reqData
);
//配置信息合并
try
{
$this
->
checkDataParam
();
...
...
src/Common/WNFpay/Data/Charge/ChargeData.php
View file @
79f04d3
...
...
@@ -6,7 +6,7 @@ use Payment\Common\PayException;
use
Payment\Common\WNFpay\WNFBaseData
;
use
Payment\Utils\ArrayUtil
;
abstract
class
ChargeData
extends
WNFBaseData
class
ChargeData
extends
WNFBaseData
{
/**
* 构建用于支付的签名相关数据
...
...
@@ -35,7 +35,6 @@ abstract class ChargeData extends WNFBaseData
* @throws PayException
*/
protected
function
checkDataParam
(){
parent
::
checkDataParam
();
if
(
empty
(
$this
->
callbackUrl
)){
throw
new
PayException
(
'支付通知地址不能为空'
);
}
...
...
src/Common/WNFpay/Data/Query/ChargeQueryData.php
0 → 100644
View file @
79f04d3
<?php
namespace
Payment\Common\WNFpay\Data\Query
;
use
Payment\Common\BaseData
;
use
Payment\Common\PayException
;
use
Payment\Common\WNFpay\WNFBaseData
;
class
ChargeQueryData
extends
WNFBaseData
{
/**
* 构建用于支付的签名相关数据
*
* @return void
*/
protected
function
buildData
(){
$data
=
[
'customerOrderNo'
=>
$this
->
customerOrderNo
,
];
$this
->
retData
=
$data
;
}
/**
* 检查传入的参数. $reqData是否正确.
*
* @return mixed
* @throws PayException
*/
protected
function
checkDataParam
(){
if
(
empty
(
$this
->
customerOrderNo
)){
throw
new
PayException
(
'订单号不能为空'
);
}
}
}
\ No newline at end of file
src/Common/WNFpay/WNFBaseData.php
View file @
79f04d3
...
...
@@ -6,7 +6,6 @@ use Payment\Common\BaseData;
abstract
class
WNFBaseData
extends
BaseData
{
protected
$key
=
'797cx89nlsaz98ljakntnm6712561'
;
protected
function
makeSign
(
$signStr
){
list
(
$microsecond
,
$time
)
=
explode
(
' '
,
microtime
());
//' '中间是一个空格
$timestamp
=
(
float
)
sprintf
(
'%.0f'
,(
floatval
(
$microsecond
)
+
floatval
(
$time
))
*
1000
);
...
...
src/Common/WNFpay/WNFBaseStrategy.php
View file @
79f04d3
...
...
@@ -51,11 +51,7 @@ abstract class WNFBaseStrategy implements BaseStrategy
if
(
is_null
(
$url
))
{
throw
new
PayException
(
'目前不支持该接口。请联系开发者添加'
);
}
$responseTxt
=
$this
->
curlPost
(
$body
,
$url
);
if
(
$responseTxt
[
'code'
]
!=
200
)
{
throw
new
PayException
(
'支付异常-信息'
.
$responseTxt
[
'message'
]);
}
return
$responseTxt
;
}
...
...
@@ -98,9 +94,9 @@ abstract class WNFBaseStrategy implements BaseStrategy
* @param null $url
* @return string
*/
protected
function
getReqUrl
()
protected
function
getReqUrl
(
$url
=
null
)
{
return
WnfConfig
::
PAY_URL
;
return
$url
??
WnfConfig
::
PAY_URL
;
}
/**
...
...
src/Common/WnfConfig.php
View file @
79f04d3
...
...
@@ -39,8 +39,8 @@ class WnfConfig extends ConfigInterface
*/
private
function
initConfig
(
array
$config
)
{
//
$config = ArrayUtil::paraFilter($config);
//
if (key_exists('key', $config) && !empty($config['key'])) $this->key = $config['key'];else throw new PayException('支付密钥不存在');
$config
=
ArrayUtil
::
paraFilter
(
$config
);
if
(
key_exists
(
'key'
,
$config
)
&&
!
empty
(
$config
[
'key'
]))
$this
->
key
=
$config
[
'key'
];
else
throw
new
PayException
(
'支付密钥不存在'
);
}
...
...
src/Query/WNF/WNFChargeQuery.php
0 → 100644
View file @
79f04d3
<?php
namespace
Payment\Query\WNF
;
use
Payment\Common\WNFpay\WNFBaseStrategy
;
use
Payment\Common\WnfConfig
;
use
Payment\Common\WNFpay\Data\Query\ChargeQueryData
;
class
WNFChargeQuery
extends
WNFBaseStrategy
{
public
function
getBuildDataClass
(){
return
ChargeQueryData
::
class
;
}
/**
* 返回
* @param null $url
* @return string
*/
public
function
getReqUrl
(
$url
=
null
){
return
parent
::
getReqUrl
(
$url
??
WnfConfig
::
QUERY_URL
);
// TODO: Change the autogenerated stub
}
}
\ No newline at end of file
src/QueryContext.php
View file @
79f04d3
...
...
@@ -29,6 +29,7 @@ use Payment\Query\Wx\WxRefundQuery;
use
Payment\Query\Wx\WxTransferQuery
;
use
Payment\Query\YS\YSChargeQuery
;
use
Payment\Query\YSE\YSEChargeQuery
;
use
Payment\Query\WNF\WNFChargeQuery
;
class
QueryContext
{
...
...
@@ -114,6 +115,7 @@ class QueryContext
$this
->
query
=
new
YSEChargeQuery
(
$config
);
break
;
case
Config
::
WNF_QUERY
://
微诺付
$this
->
query
=
new
WNFChargeQuery
(
$config
);
break
;
default
:
throw
new
PayException
(
'当前仅支持:ALI_CHARGE ALI_REFUND WX_CHARGE WX_REFUND WX_TRANSFER WX_PAY_BANK CMB_CHARGE CMB_REFUND TLPAY MI_QUERY SW_QUERY FU_CHARGE FU_REFUND WNF_QUERY'
);
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment