...
|
...
|
@@ -7,7 +7,6 @@ use WebPlugin\Pay\Reqparams; |
|
|
use WebPlugin\Pay\Rspparams;
|
|
|
use WebPlugin\UdpLog;
|
|
|
use WebPlugin\Helpers;
|
|
|
use Api\Yohobuy;
|
|
|
|
|
|
class Service extends PayAbstract
|
|
|
{
|
...
|
...
|
@@ -15,8 +14,7 @@ class Service extends PayAbstract |
|
|
|
|
|
public function __construct(array $paymentParams)
|
|
|
{
|
|
|
$env = (APPLICATION_ENV === 'production' || APPLICATION_ENV === 'preview') ? 'release' : 'test';
|
|
|
include_once 'conf/' . $env . '/SDKConfig.php';
|
|
|
include_once 'conf/release/SDKConfig.php';
|
|
|
include_once 'Func/common.php';
|
|
|
include_once 'Func/secureUtil.php';
|
|
|
|
...
|
...
|
@@ -39,12 +37,21 @@ class Service extends PayAbstract |
|
|
$verify = false;
|
|
|
$responseData = new Rspparams();
|
|
|
|
|
|
if (!isset($package['respCode']) || $package['respCode'] !== '00') {
|
|
|
//https://open.unionpay.com/ajweb/help/faq/list?id=234&level=0&from=0&keyword=respCode 状态码
|
|
|
if (empty($package['respCode']) || in_array($package['respCode'], array('00', 'A6')) === false) {
|
|
|
$responseData->payResult = -1;
|
|
|
return $responseData;
|
|
|
}
|
|
|
|
|
|
if (isset($package['signature'])) { // TODO isset($package['signature']) && verify($package)验证签名待做
|
|
|
//去除为空的数组
|
|
|
foreach ($package as $key => $value) {
|
|
|
if ($value === '') {
|
|
|
unset($package[$key]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (verify($package)) {
|
|
|
//验证签名合法性
|
|
|
$verify = true;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -63,14 +70,16 @@ class Service extends PayAbstract |
|
|
} else {
|
|
|
$responseData->payResult = -1;
|
|
|
}
|
|
|
|
|
|
UdpLog::info("【{$this->logProjectPrefix}-银联支付】,function:parseResponse,处理结果", $responseData);
|
|
|
|
|
|
return $responseData;
|
|
|
}
|
|
|
|
|
|
//https://open.unionpay.com/ajweb/help/faq/list?id=38&level=0&from=0
|
|
|
public function getPayRequestPars(Reqparams $params)
|
|
|
{
|
|
|
$front_notify_url = SDK_FRONT_NOTIFY_URL . '?order_code=' . $params->orderCode;
|
|
|
// $front_notify_url = SDK_FRONT_NOTIFY_URL . '?order_code=' . $params->orderCode;
|
|
|
$requestParams = array(
|
|
|
'version' => '5.0.0', //版本号
|
|
|
'encoding' => 'utf-8', //编码方式
|
...
|
...
|
@@ -78,8 +87,8 @@ class Service extends PayAbstract |
|
|
'txnType' => '01', //交易类型
|
|
|
'txnSubType' => '01', //交易子类
|
|
|
'bizType' => '000201', //业务类型
|
|
|
'frontUrl' => $front_notify_url, //前台通知地址--同步地址
|
|
|
'backUrl' => SDK_BACK_NOTIFY_URL,//后台通知地址--异步地址
|
|
|
'frontUrl' => Helpers::getHttpOrHttps() . Helpers::url(SDK_FRONT_NOTIFY_URL), //前台通知地址--同步地址
|
|
|
'backUrl' => SERVICE_NOTIFY . SDK_BACK_NOTIFY_URL,//后台通知地址--异步地址
|
|
|
'signMethod' => '01', //签名方法
|
|
|
'channelType' => '07', //渠道类型,07-PC,08-手机
|
|
|
'accessType' => '0', //接入类型
|
...
|
...
|
@@ -88,8 +97,9 @@ class Service extends PayAbstract |
|
|
'txnTime' => date('YmdHis', $params->orderTime), //订单发送时间
|
|
|
'txnAmt' => $params->totalFee, //交易金额,单位分
|
|
|
'currencyCode' => '156', //交易币种
|
|
|
'defaultPayType' => '0201', //默认支付方式
|
|
|
'defaultPayType' => '0201', //默认支付方式-网银支付
|
|
|
//'orderDesc' => '订单描述', //订单描述,网关支付和wap支付暂时不起作用
|
|
|
// 'payTimeout' => '',//超时时间
|
|
|
'reqReserved' => $params->goodsName //请求方保留域,透传字段,查询、通知、对账文件中均会原样出现
|
|
|
);
|
|
|
// 签名
|
...
|
...
|
|