|
|
@ -138,39 +138,6 @@ class Api extends AbstractApi
|
|
|
|
return self::request($uri, $params, $sign);
|
|
|
|
return self::request($uri, $params, $sign);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static function certifiedPayment($params)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$outTradeNo = $params['outTradeNo'] ?? StringHelper::generateOrderNo();
|
|
|
|
|
|
|
|
$userName = $params['userName'] ?? '';
|
|
|
|
|
|
|
|
$phoneNum = $params['phoneNum'] ?? '';
|
|
|
|
|
|
|
|
$bankCardNo = $params['bankCardNo'] ?? '';
|
|
|
|
|
|
|
|
$certificatesNo = $params['certificatesNo'] ?? '';
|
|
|
|
|
|
|
|
$payAmount = $params['payAmount'] ?? 0;
|
|
|
|
|
|
|
|
$payCurrency = 'CNY';
|
|
|
|
|
|
|
|
$orderInfo = [];
|
|
|
|
|
|
|
|
$orderInfo['Id'] = $outTradeNo;
|
|
|
|
|
|
|
|
$orderInfo['businessType'] = '130001';
|
|
|
|
|
|
|
|
$orderInfo['goodsList'] = [['name' => 'pay', 'number' => 'one', 'amount' => $payAmount]];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$uri = '/api/txs/pay/CertifiedPayment';
|
|
|
|
|
|
|
|
$params = [
|
|
|
|
|
|
|
|
'version' => '2.0',
|
|
|
|
|
|
|
|
'customerCode' => self::getConfig('customerCode'),
|
|
|
|
|
|
|
|
'outTradeNo' => $outTradeNo,
|
|
|
|
|
|
|
|
'userName' => Signer::publicEncrypt($userName),
|
|
|
|
|
|
|
|
'certificatesType' => '01',
|
|
|
|
|
|
|
|
'certificatesNo' => Signer::publicEncrypt($certificatesNo),
|
|
|
|
|
|
|
|
'phoneNum' => Signer::publicEncrypt($phoneNum),
|
|
|
|
|
|
|
|
'bankCardNo' => Signer::publicEncrypt($bankCardNo),
|
|
|
|
|
|
|
|
'payAmount' => $payAmount,
|
|
|
|
|
|
|
|
'payCurrency' => $payCurrency,
|
|
|
|
|
|
|
|
'orderInfo' => $orderInfo,
|
|
|
|
|
|
|
|
'transactionStartTime' => date('YmdHis'),
|
|
|
|
|
|
|
|
'nonceStr' => StringHelper::getRandomString(32),
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
$sign = Signer::sign(json_encode($params));
|
|
|
|
|
|
|
|
return self::request($uri, $params, $sign);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function unBindCard($params)
|
|
|
|
public static function unBindCard($params)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$protocol = $params['protocol'] ?? '';
|
|
|
|
$protocol = $params['protocol'] ?? '';
|
|
|
@ -197,23 +164,27 @@ class Api extends AbstractApi
|
|
|
|
$orderInfo = [];
|
|
|
|
$orderInfo = [];
|
|
|
|
$orderInfo['Id'] = $outTradeNo;
|
|
|
|
$orderInfo['Id'] = $outTradeNo;
|
|
|
|
$orderInfo['businessType'] = '130001';
|
|
|
|
$orderInfo['businessType'] = '130001';
|
|
|
|
$orderInfo['goodsList'] = [['name' => 'pay', 'number' => 'one', 'amount' => $$payAmount]];
|
|
|
|
$orderInfo['goodsList'] = [['name' => 'pay', 'number' => '1', 'amount' => $payAmount]];
|
|
|
|
|
|
|
|
|
|
|
|
$uri = '/api/txs/protocol/protocolPayPre';
|
|
|
|
$uri = '/api/txs/protocol/protocolPayPre';
|
|
|
|
$params = [
|
|
|
|
$params = [
|
|
|
|
'version' => '3.0',
|
|
|
|
'version' => '3.0',
|
|
|
|
'customerCode' => self::getConfig('customerCode'),
|
|
|
|
'customerCode' => self::getConfig('customerCode'),
|
|
|
|
'outTradeNo' => $outTradeNo,
|
|
|
|
'outTradeNo' => $outTradeNo,
|
|
|
|
'protocol' => $protocol,
|
|
|
|
|
|
|
|
// 'smsNo' => $smsNo,
|
|
|
|
|
|
|
|
// 'smsCode' => $smsCode,
|
|
|
|
|
|
|
|
'orderInfo' => $orderInfo,
|
|
|
|
'orderInfo' => $orderInfo,
|
|
|
|
'payAmount' => $payAmount,
|
|
|
|
'payAmount' => $payAmount,
|
|
|
|
'payCurrency' => 'CNY',
|
|
|
|
'payCurrency' => 'CNY',
|
|
|
|
'isInstalments' => 0,
|
|
|
|
'isInstalments' => 0,
|
|
|
|
|
|
|
|
'notifyUrl' => 'http://146.70.113.165:9501/notify/payment',
|
|
|
|
'transactionStartTime' => date('YmdHis'),
|
|
|
|
'transactionStartTime' => date('YmdHis'),
|
|
|
|
'nonceStr' => StringHelper::getRandomString(32),
|
|
|
|
'nonceStr' => StringHelper::getRandomString(32),
|
|
|
|
];
|
|
|
|
];
|
|
|
|
|
|
|
|
if ($protocol) {
|
|
|
|
|
|
|
|
$params['protocol'] = $protocol;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$params['smsCode'] = $smsCode;
|
|
|
|
|
|
|
|
$params['smsNo'] = $smsNo;
|
|
|
|
|
|
|
|
}
|
|
|
|
$sign = Signer::sign(json_encode($params));
|
|
|
|
$sign = Signer::sign(json_encode($params));
|
|
|
|
return self::request($uri, $params, $sign);
|
|
|
|
return self::request($uri, $params, $sign);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -240,7 +211,6 @@ class Api extends AbstractApi
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$uri = '/api/txs/pay/Refund/V2';
|
|
|
|
$uri = '/api/txs/pay/Refund/V2';
|
|
|
|
$outRefundNo = $params['outRefundNo'] ?? '';
|
|
|
|
$outRefundNo = $params['outRefundNo'] ?? '';
|
|
|
|
$notifyUrl = $params['notifyUrl'] ?? '';
|
|
|
|
|
|
|
|
$outTradeNo = $params['outTradeNo'] ?? '';
|
|
|
|
$outTradeNo = $params['outTradeNo'] ?? '';
|
|
|
|
$refundAmount = $params['refundAmount'] ?? 0;
|
|
|
|
$refundAmount = $params['refundAmount'] ?? 0;
|
|
|
|
$amount = $params['amount'] ?? 0;
|
|
|
|
$amount = $params['amount'] ?? 0;
|
|
|
@ -254,7 +224,7 @@ class Api extends AbstractApi
|
|
|
|
'refundAmount' => $refundAmount,
|
|
|
|
'refundAmount' => $refundAmount,
|
|
|
|
'amount' => $amount,
|
|
|
|
'amount' => $amount,
|
|
|
|
'remark' => $remark,
|
|
|
|
'remark' => $remark,
|
|
|
|
'notifyUrl' => $notifyUrl,
|
|
|
|
'notifyUrl' => 'http://146.70.113.165:9501/notify/refund',
|
|
|
|
'nonceStr' => StringHelper::getRandomString(32),
|
|
|
|
'nonceStr' => StringHelper::getRandomString(32),
|
|
|
|
];
|
|
|
|
];
|
|
|
|
$sign = Signer::sign(json_encode($params));
|
|
|
|
$sign = Signer::sign(json_encode($params));
|
|
|
@ -275,33 +245,4 @@ class Api extends AbstractApi
|
|
|
|
$sign = Signer::sign(json_encode($params));
|
|
|
|
$sign = Signer::sign(json_encode($params));
|
|
|
|
return self::request($uri, $params, $sign);
|
|
|
|
return self::request($uri, $params, $sign);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static function unifiedPayment()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$uri = '/api/txs/pay/UnifiedPayment';
|
|
|
|
|
|
|
|
$orderNo = "123456".date('YmdHis');
|
|
|
|
|
|
|
|
$client_ip = "127.0.0.1";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$orderInfo = [];
|
|
|
|
|
|
|
|
$orderInfo['Id'] = $orderNo;
|
|
|
|
|
|
|
|
$orderInfo['businessType'] = '130001';
|
|
|
|
|
|
|
|
$orderInfo['goodsList'] = [['name'=>'pay', 'number'=>'one', 'amount'=>1]];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$params = [
|
|
|
|
|
|
|
|
'outTradeNo' => $orderNo,
|
|
|
|
|
|
|
|
'customerCode' => self::getConfig('customerCode'),
|
|
|
|
|
|
|
|
'clientIp' => $client_ip,
|
|
|
|
|
|
|
|
'orderInfo' => $orderInfo,
|
|
|
|
|
|
|
|
'payCurrency' => 'CNY',
|
|
|
|
|
|
|
|
'payAmount' => 10,
|
|
|
|
|
|
|
|
'payCurrency' => 'CNY',
|
|
|
|
|
|
|
|
'notifyUrl' => 'http://www.baidu.com',
|
|
|
|
|
|
|
|
'redirectUrl' => 'http://www.baidu.com',
|
|
|
|
|
|
|
|
'transactionStartTime' =>date('YmdHis'),
|
|
|
|
|
|
|
|
'nonceStr' => 'pay'.rand(100,999),
|
|
|
|
|
|
|
|
'version' => '3.0'
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
$sign = Signer::sign(json_encode($params));
|
|
|
|
|
|
|
|
return self::request($uri, $params, $sign);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|