初始上传
This commit is contained in:
38
addon/alipay/config/diy_view.php
Executable file
38
addon/alipay/config/diy_view.php
Executable file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
return [
|
||||
|
||||
// 自定义模板页面类型,格式:[ 'title' => '页面类型名称', 'name' => '页面标识', 'path' => '页面路径', 'value' => '页面数据,json格式' ]
|
||||
'template' => [],
|
||||
|
||||
// 后台自定义组件——装修
|
||||
'util' => [],
|
||||
|
||||
// 自定义页面路径
|
||||
'link' => [],
|
||||
|
||||
// 自定义图标库
|
||||
'icon_library' => [],
|
||||
|
||||
// uni-app 组件,格式:[ 'name' => '组件名称/文件夹名称', 'path' => '文件路径/目录路径' ],多个逗号隔开,自定义组件名称前缀必须是diy-,也可以引用第三方组件
|
||||
'component' => [],
|
||||
|
||||
// uni-app 页面,多个逗号隔开
|
||||
'pages' => [],
|
||||
|
||||
// 模板信息,格式:'title' => '模板名称', 'name' => '模板标识', 'cover' => '模板封面图', 'preview' => '模板预览图', 'desc' => '模板描述'
|
||||
'info' => [],
|
||||
|
||||
// 主题风格配色,格式可以自由定义扩展,【在uni-app中通过:this.themeStyle... 获取定义的颜色字段,例如:this.themeStyle.main_color】
|
||||
'theme' => [],
|
||||
|
||||
// 自定义页面数据,格式:[ 'title' => '页面名称', 'name' => "页面标识", 'value' => [页面数据,json格式] ]
|
||||
'data' => []
|
||||
];
|
||||
50
addon/alipay/config/event.php
Executable file
50
addon/alipay/config/event.php
Executable file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
return [
|
||||
'bind' => [
|
||||
|
||||
],
|
||||
|
||||
'listen' => [
|
||||
//支付异步回调
|
||||
'PayNotify' => [
|
||||
'addon\alipay\event\PayNotify'
|
||||
],
|
||||
//支付方式,后台查询
|
||||
'PayType' => [
|
||||
'addon\alipay\event\PayType'
|
||||
],
|
||||
//支付,前台应用
|
||||
'Pay' => [
|
||||
'addon\alipay\event\Pay'
|
||||
],
|
||||
'PayClose' => [
|
||||
'addon\alipay\event\PayClose'
|
||||
],
|
||||
'PayRefund' => [
|
||||
'addon\alipay\event\PayRefund'
|
||||
],
|
||||
'PayTransfer' => [
|
||||
'addon\alipay\event\PayTransfer'
|
||||
],
|
||||
'TransferType' => [
|
||||
'addon\alipay\event\TransferType'
|
||||
],
|
||||
'AuthcodePay' => [
|
||||
'addon\alipay\event\AuthcodePay'
|
||||
],
|
||||
'PayOrderQuery' => [
|
||||
'addon\alipay\event\PayOrderQuery'
|
||||
],
|
||||
],
|
||||
|
||||
'subscribe' => [
|
||||
],
|
||||
];
|
||||
21
addon/alipay/config/info.php
Executable file
21
addon/alipay/config/info.php
Executable file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
return [
|
||||
'name' => 'alipay',
|
||||
'title' => '支付宝支付',
|
||||
'description' => '支付宝支付功能',
|
||||
'type' => 'system', //插件类型 system :系统插件(自动安装), promotion:营销插件 tool:工具插件
|
||||
'status' => 1,
|
||||
'author' => '',
|
||||
'version' => '5.5.3',
|
||||
'version_no' => '553250709001',
|
||||
'content' => '',
|
||||
];
|
||||
24
addon/alipay/config/menu_shop.php
Executable file
24
addon/alipay/config/menu_shop.php
Executable file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
return [
|
||||
[
|
||||
'name' => 'ALI_PAY_CONFIG',
|
||||
'title' => '支付宝支付编辑',
|
||||
'url' => 'alipay://shop/pay/config',
|
||||
'parent' => 'CONFIG_PAY',
|
||||
'is_show' => 0,
|
||||
'is_control' => 1,
|
||||
'is_icon' => 0,
|
||||
'picture' => '',
|
||||
'picture_select' => '',
|
||||
'sort' => 1,
|
||||
'type' => 'button',
|
||||
],
|
||||
];
|
||||
231
addon/alipay/data/sdk/AlipayMobilePublicMultiMediaClient.php
Executable file
231
addon/alipay/data/sdk/AlipayMobilePublicMultiMediaClient.php
Executable file
@@ -0,0 +1,231 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 多媒体文件客户端
|
||||
* @author yikai.hu
|
||||
* @version $Id: AlipayMobilePublicMultiMediaClient.php, v 0.1 Aug 15, 2014 10:19:01 AM yikai.hu Exp $
|
||||
*/
|
||||
|
||||
//namespace alipay\api ;
|
||||
|
||||
include("AlipayMobilePublicMultiMediaExecute.php");
|
||||
|
||||
|
||||
class AlipayMobilePublicMultiMediaClient{
|
||||
|
||||
private $DEFAULT_CHARSET = 'UTF-8';
|
||||
private $METHOD_POST = "POST";
|
||||
private $METHOD_GET = "GET";
|
||||
private $SIGN = 'sign'; //get name
|
||||
|
||||
private $timeout = 10 ;// 超时时间
|
||||
private $serverUrl;
|
||||
private $appId;
|
||||
private $privateKey;
|
||||
private $prodCode;
|
||||
private $format = 'json'; //todo
|
||||
private $sign_type = 'RSA'; //todo
|
||||
|
||||
private $charset;
|
||||
private $apiVersion = "1.0";
|
||||
private $apiMethodName = "alipay.mobile.public.multimedia.download";
|
||||
private $media_id = "L21pZnMvVDFQV3hYWGJKWFhYYUNucHJYP3Q9YW13ZiZ4c2lnPTU0MzRhYjg1ZTZjNWJmZTMxZGJiNjIzNDdjMzFkNzkw575";
|
||||
//此处写死的,实际开发中,请传入
|
||||
|
||||
private $connectTimeout = 3000;
|
||||
private $readTimeout = 15000;
|
||||
|
||||
|
||||
|
||||
function __construct($serverUrl = '', $appId = '', $partner_private_key = '', $format = '', $charset = 'GBK'){
|
||||
$this -> serverUrl = $serverUrl;
|
||||
$this -> appId = $appId;
|
||||
$this -> privateKey = $partner_private_key;
|
||||
$this -> format = $format;
|
||||
$this -> charset = $charset;
|
||||
}
|
||||
|
||||
/**
|
||||
* getContents 获取网址内容
|
||||
* @param $request
|
||||
* @return text | bin
|
||||
*/
|
||||
public function getContents(){
|
||||
//自己的服务器如果没有 curl,可用:fsockopen() 等
|
||||
|
||||
|
||||
//1:
|
||||
//2: 私钥格式
|
||||
$datas = array(
|
||||
"app_id" => $this -> appId,
|
||||
"method" => $this -> METHOD_POST,
|
||||
"sign_type" => $this -> sign_type,
|
||||
"version" => $this -> apiVersion,
|
||||
"timestamp" => date('Y-m-d H:i:s') ,//yyyy-MM-dd HH:mm:ss
|
||||
"biz_content" => '{"mediaId":"'. $this -> media_id .'"}',
|
||||
"charset" => $this -> charset
|
||||
);
|
||||
|
||||
|
||||
|
||||
//要提交的数据
|
||||
$data_sign = $this -> buildGetUrl( $datas );
|
||||
|
||||
$post_data = $data_sign;
|
||||
//初始化 curl
|
||||
$ch = curl_init();
|
||||
//设置目标服务器
|
||||
curl_setopt($ch, CURLOPT_URL, $this -> serverUrl );
|
||||
curl_setopt($ch, CURLOPT_HEADER, TRUE);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
//超时时间
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, $this-> timeout);
|
||||
|
||||
if( $this-> METHOD_POST == 'POST'){
|
||||
// post数据
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
// post的变量
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$output = curl_exec($ch);
|
||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
|
||||
echo $output;
|
||||
|
||||
//分离头部
|
||||
//list($header, $body) = explode("\r\n\r\n", $output, 2);
|
||||
$datas = explode("\r\n\r\n", $output, 2);
|
||||
$header = $datas[0];
|
||||
|
||||
if( $httpCode == '200'){
|
||||
$body = $datas[1];
|
||||
}else{
|
||||
$body = '';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return $this -> execute( $header, $body, $httpCode );
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param $request
|
||||
* @return text | bin
|
||||
*/
|
||||
public function execute( $header = '', $body = '', $httpCode = '' ){
|
||||
$exe = new AlipayMobilePublicMultiMediaExecute( $header, $body, $httpCode );
|
||||
return $exe;
|
||||
}
|
||||
|
||||
public function buildGetUrl( $query = array() ){
|
||||
|
||||
if( ! is_array( $query ) ){
|
||||
//exit;
|
||||
}
|
||||
|
||||
//排序参数,
|
||||
$data = $this -> buildQuery( $query );
|
||||
|
||||
|
||||
|
||||
// 私钥密码
|
||||
$passphrase = '';
|
||||
$key_width = 64;
|
||||
|
||||
//私钥
|
||||
$privateKey = $this -> privateKey;
|
||||
$p_key = array();
|
||||
//如果私钥是 1行
|
||||
if( ! stripos( $privateKey, "\n" ) ){
|
||||
$i = 0;
|
||||
while( $key_str = substr( $privateKey , $i * $key_width , $key_width) ){
|
||||
$p_key[] = $key_str;
|
||||
$i ++ ;
|
||||
}
|
||||
}else{
|
||||
//echo '一行?';
|
||||
}
|
||||
$privateKey = "-----BEGIN RSA PRIVATE KEY-----\n" . implode("\n", $p_key) ;
|
||||
$privateKey = $privateKey ."\n-----END RSA PRIVATE KEY-----";
|
||||
|
||||
// echo "\n\n私钥:\n";
|
||||
// echo( $privateKey );
|
||||
// echo "\n\n\n";
|
||||
|
||||
//私钥
|
||||
$private_id = openssl_pkey_get_private( $privateKey , $passphrase);
|
||||
|
||||
|
||||
// 签名
|
||||
$signature = '';
|
||||
|
||||
if("RSA2"==$this->sign_type){
|
||||
|
||||
openssl_sign($data, $signature, $private_id, OPENSSL_ALGO_SHA256 );
|
||||
}else{
|
||||
|
||||
openssl_sign($data, $signature, $private_id, OPENSSL_ALGO_SHA1 );
|
||||
}
|
||||
|
||||
openssl_free_key( $private_id );
|
||||
|
||||
//加密后的内容通常含有特殊字符,需要编码转换下
|
||||
$signature = base64_encode($signature);
|
||||
|
||||
$signature = urlencode( $signature );
|
||||
|
||||
//$signature = 'XjUN6YM1Mc9HXebKMv7GTLy7gmyhktyOgKk2/Jf+cz4DtP6udkzTdpkjW2j/Z4ZSD7xD6CNYI1Spz4yS93HPT0a5X9LgFWYY8SaADqe+ArXg+FBSiTwUz49SE//Xd9+LEiIRsSFkbpkuiGoO6mqJmB7vXjlD5lx6qCM3nb41wb8=';
|
||||
|
||||
$out = $data .'&'. $this -> SIGN .'='. $signature;
|
||||
|
||||
// echo "\n\n 加密后:\n";
|
||||
// echo( $out );
|
||||
// echo "\n\n\n";
|
||||
|
||||
return $out ;
|
||||
}
|
||||
|
||||
/*
|
||||
* 查询参数排序 a-z
|
||||
* */
|
||||
public function buildQuery( $query ){
|
||||
if ( !$query ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
//将要 参数 排序
|
||||
ksort( $query );
|
||||
|
||||
//重新组装参数
|
||||
$params = array();
|
||||
foreach($query as $key => $value){
|
||||
$params[] = $key .'='. $value ;
|
||||
}
|
||||
$data = implode('&', $params);
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
108
addon/alipay/data/sdk/AlipayMobilePublicMultiMediaExecute.php
Executable file
108
addon/alipay/data/sdk/AlipayMobilePublicMultiMediaExecute.php
Executable file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 多媒体文件客户端
|
||||
* @author yuanwai.wang
|
||||
* @version $Id: AlipayMobilePublicMultiMediaExecute.php, v 0.1 Aug 15, 2014 10:19:01 AM yuanwai.wang Exp $
|
||||
*/
|
||||
|
||||
//namespace alipay\api ;
|
||||
|
||||
|
||||
|
||||
class AlipayMobilePublicMultiMediaExecute{
|
||||
|
||||
private $code = 200 ;
|
||||
private $msg = '';
|
||||
private $body = '';
|
||||
private $params = '';
|
||||
|
||||
private $fileSuffix = array(
|
||||
"image/jpeg" => 'jpg', //+
|
||||
"text/plain" => 'text'
|
||||
);
|
||||
|
||||
/*
|
||||
* @$header : 头部
|
||||
* */
|
||||
function __construct( $header, $body, $httpCode ){
|
||||
$this -> code = $httpCode;
|
||||
$this -> msg = '';
|
||||
$this -> params = $header ;
|
||||
$this -> body = $body;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return text | bin
|
||||
*/
|
||||
public function getCode(){
|
||||
return $this -> code ;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return text | bin
|
||||
*/
|
||||
public function getMsg(){
|
||||
return $this -> msg ;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return text | bin
|
||||
*/
|
||||
public function getType(){
|
||||
$subject = $this -> params ;
|
||||
$pattern = '/Content\-Type:([^;]+)/';
|
||||
preg_match($pattern, $subject, $matches);
|
||||
if( $matches ){
|
||||
$type = $matches[1];
|
||||
}else{
|
||||
$type = 'application/download';
|
||||
}
|
||||
|
||||
return str_replace( ' ', '', $type );
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return text | bin
|
||||
*/
|
||||
public function getContentLength(){
|
||||
$subject = $this -> params ;
|
||||
$pattern = '/Content-Length:\s*([^\n]+)/';
|
||||
preg_match($pattern, $subject, $matches);
|
||||
return (int)( isset($matches[1] ) ? $matches[1] : '' );
|
||||
}
|
||||
|
||||
|
||||
public function getFileSuffix( $fileType ){
|
||||
$type = isset( $this -> fileSuffix[ $fileType ] ) ? $this -> fileSuffix[ $fileType ] : 'text/plain' ;
|
||||
if( !$type ){
|
||||
$type = 'json';
|
||||
}
|
||||
return $type;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return text | bin
|
||||
*/
|
||||
public function getBody(){
|
||||
//header('Content-type: image/jpeg');
|
||||
return $this -> body ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取参数
|
||||
* @return text | bin
|
||||
*/
|
||||
public function getParams(){
|
||||
return $this -> params ;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
1241
addon/alipay/data/sdk/AopCertClient.php
Executable file
1241
addon/alipay/data/sdk/AopCertClient.php
Executable file
File diff suppressed because it is too large
Load Diff
527
addon/alipay/data/sdk/AopCertification.php
Executable file
527
addon/alipay/data/sdk/AopCertification.php
Executable file
@@ -0,0 +1,527 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 验证支付宝公钥证书是否可信
|
||||
* @param $alipayCert 支付宝公钥证书
|
||||
* @param $rootCert 支付宝根证书
|
||||
*/
|
||||
function isTrusted($alipayCert, $rootCert)
|
||||
{
|
||||
$alipayCerts = readPemCertChain($alipayCert);
|
||||
$rootCerts = readPemCertChain($rootCert);
|
||||
if (verifyCertChain($alipayCerts, $rootCerts)) {
|
||||
return verifySignature($alipayCert, $rootCert);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function verifySignature($alipayCert, $rootCert)
|
||||
{
|
||||
$alipayCertArray = explode("-----END CERTIFICATE-----", $alipayCert);
|
||||
$rootCertArray = explode("-----END CERTIFICATE-----", $rootCert);
|
||||
$length = count($rootCertArray) - 1;
|
||||
$checkSign = isCertSigner($alipayCertArray[0] . "-----END CERTIFICATE-----", $alipayCertArray[1] . "-----END CERTIFICATE-----");
|
||||
if (!$checkSign) {
|
||||
$checkSign = isCertSigner($alipayCertArray[1] . "-----END CERTIFICATE-----", $alipayCertArray[0] . "-----END CERTIFICATE-----");
|
||||
if ($checkSign) {
|
||||
$issuer = openssl_x509_parse($alipayCertArray[0] . "-----END CERTIFICATE-----")['issuer'];
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$subject = openssl_x509_parse($rootCertArray[$i] . "-----END CERTIFICATE-----")['subject'];
|
||||
if ($issuer == $subject) {
|
||||
isCertSigner($alipayCertArray[0] . "-----END CERTIFICATE-----", $rootCertArray[$i] . $rootCertArray);
|
||||
return $checkSign;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return $checkSign;
|
||||
}
|
||||
} else {
|
||||
$issuer = openssl_x509_parse($alipayCertArray[1] . "-----END CERTIFICATE-----")['issuer'];
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$subject = openssl_x509_parse($rootCertArray[$i] . "-----END CERTIFICATE-----")['subject'];
|
||||
if ($issuer == $subject) {
|
||||
$checkSign = isCertSigner($alipayCertArray[1] . "-----END CERTIFICATE-----", $rootCertArray[$i] . "-----END CERTIFICATE-----");
|
||||
return $checkSign;
|
||||
}
|
||||
}
|
||||
return $checkSign;
|
||||
}
|
||||
}
|
||||
|
||||
function readPemCertChain($cert)
|
||||
{
|
||||
$array = explode("-----END CERTIFICATE-----", $cert);
|
||||
$certs[] = null;
|
||||
for ($i = 0; $i < count($array) - 1; $i++) {
|
||||
$certs[$i] = openssl_x509_parse($array[$i] . "-----END CERTIFICATE-----");
|
||||
}
|
||||
return $certs;
|
||||
}
|
||||
|
||||
function verifyCert($prev, $rootCerts)
|
||||
{
|
||||
$nowTime = time();
|
||||
if ($nowTime < $prev['validFrom_time_t']) {
|
||||
echo "证书未激活";
|
||||
return false;
|
||||
}
|
||||
if ($nowTime > $prev['validTo_time_t']) {
|
||||
echo "证书已经过期";
|
||||
return false;
|
||||
}
|
||||
$subjectMap = null;
|
||||
for ($i = 0; $i < count($rootCerts); $i++) {
|
||||
$subjectDN = array2string($rootCerts[$i]['subject']);
|
||||
$subjectMap[$subjectDN] = $rootCerts[$i];
|
||||
}
|
||||
$issuerDN = array2string(($prev['issuer']));
|
||||
if (!array_key_exists($issuerDN, $subjectMap)) {
|
||||
echo "证书链验证失败";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证证书链是否是信任证书库中证书签发的
|
||||
* @param $alipayCerts 目标验证证书列表
|
||||
* @param $rootCerts 可信根证书列表
|
||||
*/
|
||||
function verifyCertChain($alipayCerts, $rootCerts)
|
||||
{
|
||||
$sorted = sortByDn($alipayCerts);
|
||||
if (!$sorted) {
|
||||
echo "证书链验证失败:不是完整的证书链";
|
||||
return false;
|
||||
}
|
||||
//先验证第一个证书是不是信任库中证书签发的
|
||||
$prev = $alipayCerts[0];
|
||||
$firstOK = verifyCert($prev, $rootCerts);
|
||||
$length = count($alipayCerts);
|
||||
if (!$firstOK || $length == 1) {
|
||||
return $firstOK;
|
||||
}
|
||||
|
||||
$nowTime = time();
|
||||
//验证证书链
|
||||
for ($i = 1; $i < $length; $i++) {
|
||||
$cert = $alipayCerts[$i];
|
||||
if ($nowTime < $cert['validFrom_time_t']) {
|
||||
echo "证书未激活";
|
||||
return false;
|
||||
}
|
||||
if ($nowTime > $cert['validTo_time_t']) {
|
||||
echo "证书已经过期";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将证书链按照完整的签发顺序进行排序,排序后证书链为:[issuerA, subjectA]-[issuerA, subjectB]-[issuerB, subjectC]-[issuerC, subjectD]...
|
||||
* @param $certs 证书链
|
||||
*/
|
||||
function sortByDn(&$certs)
|
||||
{
|
||||
//是否包含自签名证书
|
||||
$hasSelfSignedCert = false;
|
||||
$subjectMap = null;
|
||||
$issuerMap = null;
|
||||
for ($i = 0; $i < count($certs); $i++) {
|
||||
if (isSelfSigned($certs[$i])) {
|
||||
if ($hasSelfSignedCert) {
|
||||
return false;
|
||||
}
|
||||
$hasSelfSignedCert = true;
|
||||
}
|
||||
$subjectDN = array2string($certs[$i]['subject']);
|
||||
$issuerDN = array2string(($certs[$i]['issuer']));
|
||||
$subjectMap[$subjectDN] = $certs[$i];
|
||||
$issuerMap[$issuerDN] = $certs[$i];
|
||||
}
|
||||
$certChain = null;
|
||||
addressingUp($subjectMap, $certChain, $certs[0]);
|
||||
addressingDown($issuerMap, $certChain, $certs[0]);
|
||||
|
||||
//说明证书链不完整
|
||||
if (count($certs) != count($certChain)) {
|
||||
return false;
|
||||
}
|
||||
//将证书链复制到原先的数据
|
||||
for ($i = 0; $i < count($certs); $i++) {
|
||||
$certs[$i] = $certChain[count($certs) - $i - 1];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证证书是否是自签发的
|
||||
* @param $cert 目标证书
|
||||
*/
|
||||
function isSelfSigned($cert)
|
||||
{
|
||||
$subjectDN = array2string($cert['subject']);
|
||||
$issuerDN = array2string($cert['issuer']);
|
||||
return ($subjectDN == $issuerDN);
|
||||
}
|
||||
|
||||
|
||||
function array2string($array)
|
||||
{
|
||||
$string = [];
|
||||
if ($array && is_array($array)) {
|
||||
foreach ($array as $key => $value) {
|
||||
$string[] = $key . '=' . $value;
|
||||
}
|
||||
}
|
||||
return implode(',', $string);
|
||||
}
|
||||
|
||||
/**
|
||||
* 向上构造证书链
|
||||
* @param $subjectMap 主题和证书的映射
|
||||
* @param $certChain 证书链
|
||||
* @param $current 当前需要插入证书链的证书,include
|
||||
*/
|
||||
function addressingUp($subjectMap, &$certChain, $current)
|
||||
{
|
||||
$certChain[] = $current;
|
||||
if (isSelfSigned($current)) {
|
||||
return;
|
||||
}
|
||||
$issuerDN = array2string($current['issuer']);
|
||||
|
||||
if (!array_key_exists($issuerDN, $subjectMap)) {
|
||||
return;
|
||||
}
|
||||
addressingUp($subjectMap, $certChain, $subjectMap[$issuerDN]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 向下构造证书链
|
||||
* @param $issuerMap 签发者和证书的映射
|
||||
* @param $certChain 证书链
|
||||
* @param $current 当前需要插入证书链的证书,exclude
|
||||
*/
|
||||
function addressingDown($issuerMap, &$certChain, $current)
|
||||
{
|
||||
$subjectDN = array2string($current['subject']);
|
||||
if (!array_key_exists($subjectDN, $issuerMap)) {
|
||||
return $certChain;
|
||||
}
|
||||
$certChain[] = $issuerMap[$subjectDN];
|
||||
addressingDown($issuerMap, $certChain, $issuerMap[$subjectDN]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extract signature from der encoded cert.
|
||||
* Expects x509 der encoded certificate consisting of a section container
|
||||
* containing 2 sections and a bitstream. The bitstream contains the
|
||||
* original encrypted signature, encrypted by the public key of the issuing
|
||||
* signer.
|
||||
* @param string $der
|
||||
* @return string on success
|
||||
* @return bool false on failures
|
||||
*/
|
||||
function extractSignature($der = false)
|
||||
{
|
||||
if (strlen($der) < 5) {
|
||||
return false;
|
||||
}
|
||||
// skip container sequence
|
||||
$der = substr($der, 4);
|
||||
// now burn through two sequences and the return the final bitstream
|
||||
while (strlen($der) > 1) {
|
||||
$class = ord($der[0]);
|
||||
$classHex = dechex($class);
|
||||
switch ($class) {
|
||||
// BITSTREAM
|
||||
case 0x03:
|
||||
$len = ord($der[1]);
|
||||
$bytes = 0;
|
||||
if ($len & 0x80) {
|
||||
$bytes = $len & 0x0f;
|
||||
$len = 0;
|
||||
for ($i = 0; $i < $bytes; $i++) {
|
||||
$len = ($len << 8) | ord($der[$i + 2]);
|
||||
}
|
||||
}
|
||||
return substr($der, 3 + $bytes, $len);
|
||||
break;
|
||||
// SEQUENCE
|
||||
case 0x30:
|
||||
$len = ord($der[1]);
|
||||
$bytes = 0;
|
||||
if ($len & 0x80) {
|
||||
$bytes = $len & 0x0f;
|
||||
$len = 0;
|
||||
for ($i = 0; $i < $bytes; $i++) {
|
||||
$len = ($len << 8) | ord($der[$i + 2]);
|
||||
}
|
||||
}
|
||||
$contents = substr($der, 2 + $bytes, $len);
|
||||
$der = substr($der, 2 + $bytes + $len);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get signature algorithm oid from der encoded signature data.
|
||||
* Expects decrypted signature data from a certificate in der format.
|
||||
* This ASN1 data should contain the following structure:
|
||||
* SEQUENCE
|
||||
* SEQUENCE
|
||||
* OID (signature algorithm)
|
||||
* NULL
|
||||
* OCTET STRING (signature hash)
|
||||
* @return bool false on failures
|
||||
* @return string oid
|
||||
*/
|
||||
function getSignatureAlgorithmOid($der = null)
|
||||
{
|
||||
// Validate this is the der we need...
|
||||
if (!is_string($der) or strlen($der) < 5) {
|
||||
return false;
|
||||
}
|
||||
$bit_seq1 = 0;
|
||||
$bit_seq2 = 2;
|
||||
$bit_oid = 4;
|
||||
if (ord($der[$bit_seq1]) !== 0x30) {
|
||||
die('Invalid DER passed to getSignatureAlgorithmOid()');
|
||||
}
|
||||
if (ord($der[$bit_seq2]) !== 0x30) {
|
||||
die('Invalid DER passed to getSignatureAlgorithmOid()');
|
||||
}
|
||||
if (ord($der[$bit_oid]) !== 0x06) {
|
||||
die('Invalid DER passed to getSignatureAlgorithmOid');
|
||||
}
|
||||
// strip out what we don't need and get the oid
|
||||
$der = substr($der, $bit_oid);
|
||||
// Get the oid
|
||||
$len = ord($der[1]);
|
||||
$bytes = 0;
|
||||
if ($len & 0x80) {
|
||||
$bytes = $len & 0x0f;
|
||||
$len = 0;
|
||||
for ($i = 0; $i < $bytes; $i++) {
|
||||
$len = ($len << 8) | ord($der[$i + 2]);
|
||||
}
|
||||
}
|
||||
$oid_data = substr($der, 2 + $bytes, $len);
|
||||
// Unpack the OID
|
||||
$oid = floor(ord($oid_data[0]) / 40);
|
||||
$oid .= '.' . ord($oid_data[0]) % 40;
|
||||
$value = 0;
|
||||
$i = 1;
|
||||
while ($i < strlen($oid_data)) {
|
||||
$value = $value << 7;
|
||||
$value = $value | (ord($oid_data[$i]) & 0x7f);
|
||||
if (!(ord($oid_data[$i]) & 0x80)) {
|
||||
$oid .= '.' . $value;
|
||||
$value = 0;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
return $oid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get signature hash from der encoded signature data.
|
||||
* Expects decrypted signature data from a certificate in der format.
|
||||
* This ASN1 data should contain the following structure:
|
||||
* SEQUENCE
|
||||
* SEQUENCE
|
||||
* OID (signature algorithm)
|
||||
* NULL
|
||||
* OCTET STRING (signature hash)
|
||||
* @return bool false on failures
|
||||
* @return string hash
|
||||
*/
|
||||
function getSignatureHash($der = null)
|
||||
{
|
||||
// Validate this is the der we need...
|
||||
if (!is_string($der) or strlen($der) < 5) {
|
||||
return false;
|
||||
}
|
||||
if (ord($der[0]) !== 0x30) {
|
||||
die('Invalid DER passed to getSignatureHash()');
|
||||
}
|
||||
// strip out the container sequence
|
||||
$der = substr($der, 2);
|
||||
if (ord($der[0]) !== 0x30) {
|
||||
die('Invalid DER passed to getSignatureHash()');
|
||||
}
|
||||
// Get the length of the first sequence so we can strip it out.
|
||||
$len = ord($der[1]);
|
||||
$bytes = 0;
|
||||
if ($len & 0x80) {
|
||||
$bytes = $len & 0x0f;
|
||||
$len = 0;
|
||||
for ($i = 0; $i < $bytes; $i++) {
|
||||
$len = ($len << 8) | ord($der[$i + 2]);
|
||||
}
|
||||
}
|
||||
$der = substr($der, 2 + $bytes + $len);
|
||||
// Now we should have an octet string
|
||||
if (ord($der[0]) !== 0x04) {
|
||||
die('Invalid DER passed to getSignatureHash()');
|
||||
}
|
||||
$len = ord($der[1]);
|
||||
$bytes = 0;
|
||||
if ($len & 0x80) {
|
||||
$bytes = $len & 0x0f;
|
||||
$len = 0;
|
||||
for ($i = 0; $i < $bytes; $i++) {
|
||||
$len = ($len << 8) | ord($der[$i + 2]);
|
||||
}
|
||||
}
|
||||
return bin2hex(substr($der, 2 + $bytes, $len));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if one cert was used to sign another
|
||||
* Note that more than one CA cert can give a positive result, some certs
|
||||
* re-issue signing certs after having only changed the expiration dates.
|
||||
* @param string $cert - PEM encoded cert
|
||||
* @param string $caCert - PEM encoded cert that possibly signed $cert
|
||||
* @return bool
|
||||
*/
|
||||
function isCertSigner($certPem = null, $caCertPem = null)
|
||||
{
|
||||
if (!function_exists('openssl_pkey_get_public')) {
|
||||
die('Need the openssl_pkey_get_public() function.');
|
||||
}
|
||||
if (!function_exists('openssl_public_decrypt')) {
|
||||
die('Need the openssl_public_decrypt() function.');
|
||||
}
|
||||
if (!function_exists('hash')) {
|
||||
die('Need the php hash() function.');
|
||||
}
|
||||
if (empty($certPem) or empty($caCertPem)) {
|
||||
return false;
|
||||
}
|
||||
// Convert the cert to der for feeding to extractSignature.
|
||||
$certDer = pemToDer($certPem);
|
||||
if (!is_string($certDer)) {
|
||||
die('invalid certPem');
|
||||
}
|
||||
// Grab the encrypted signature from the der encoded cert.
|
||||
$encryptedSig = extractSignature($certDer);
|
||||
if (!is_string($encryptedSig)) {
|
||||
die('Failed to extract encrypted signature from certPem.');
|
||||
}
|
||||
// Extract the public key from the ca cert, which is what has
|
||||
// been used to encrypt the signature in the cert.
|
||||
$pubKey = openssl_pkey_get_public($caCertPem);
|
||||
if ($pubKey === false) {
|
||||
die('Failed to extract the public key from the ca cert.');
|
||||
}
|
||||
// Attempt to decrypt the encrypted signature using the CA's public
|
||||
// key, returning the decrypted signature in $decryptedSig. If
|
||||
// it can't be decrypted, this ca was not used to sign it for sure...
|
||||
$rc = openssl_public_decrypt($encryptedSig, $decryptedSig, $pubKey);
|
||||
if ($rc === false) {
|
||||
return false;
|
||||
}
|
||||
// We now have the decrypted signature, which is der encoded
|
||||
// asn1 data containing the signature algorithm and signature hash.
|
||||
// Now we need what was originally hashed by the issuer, which is
|
||||
// the original DER encoded certificate without the issuer and
|
||||
// signature information.
|
||||
$origCert = stripSignerAsn($certDer);
|
||||
if ($origCert === false) {
|
||||
die('Failed to extract unsigned cert.');
|
||||
}
|
||||
// Get the oid of the signature hash algorithm, which is required
|
||||
// to generate our own hash of the original cert. This hash is
|
||||
// what will be compared to the issuers hash.
|
||||
$oid = getSignatureAlgorithmOid($decryptedSig);
|
||||
if ($oid === false) {
|
||||
die('Failed to determine the signature algorithm.');
|
||||
}
|
||||
switch ($oid) {
|
||||
case '1.2.840.113549.2.2':
|
||||
$algo = 'md2';
|
||||
break;
|
||||
case '1.2.840.113549.2.4':
|
||||
$algo = 'md4';
|
||||
break;
|
||||
case '1.2.840.113549.2.5':
|
||||
$algo = 'md5';
|
||||
break;
|
||||
case '1.3.14.3.2.18':
|
||||
$algo = 'sha';
|
||||
break;
|
||||
case '1.3.14.3.2.26':
|
||||
$algo = 'sha1';
|
||||
break;
|
||||
case '2.16.840.1.101.3.4.2.1':
|
||||
$algo = 'sha256';
|
||||
break;
|
||||
case '2.16.840.1.101.3.4.2.2':
|
||||
$algo = 'sha384';
|
||||
break;
|
||||
case '2.16.840.1.101.3.4.2.3':
|
||||
$algo = 'sha512';
|
||||
break;
|
||||
default:
|
||||
die('Unknown signature hash algorithm oid: ' . $oid);
|
||||
break;
|
||||
}
|
||||
// Get the issuer generated hash from the decrypted signature.
|
||||
$decryptedHash = getSignatureHash($decryptedSig);
|
||||
// Ok, hash the original unsigned cert with the same algorithm
|
||||
// and if it matches $decryptedHash we have a winner.
|
||||
$certHash = hash($algo, $origCert);
|
||||
return ($decryptedHash === $certHash);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert pem encoded certificate to DER encoding
|
||||
* @return string $derEncoded on success
|
||||
* @return bool false on failures
|
||||
*/
|
||||
function pemToDer($pem = null)
|
||||
{
|
||||
if (!is_string($pem)) {
|
||||
return false;
|
||||
}
|
||||
$cert_split = preg_split('/(-----((BEGIN)|(END)) CERTIFICATE-----)/', $pem);
|
||||
if (!isset($cert_split[1])) {
|
||||
return false;
|
||||
}
|
||||
return base64_decode($cert_split[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain der cert with issuer and signature sections stripped.
|
||||
* @param string $der - der encoded certificate
|
||||
* @return string $der on success
|
||||
* @return bool false on failures.
|
||||
*/
|
||||
function stripSignerAsn($der = null)
|
||||
{
|
||||
if (!is_string($der) or strlen($der) < 8) {
|
||||
return false;
|
||||
}
|
||||
$bit = 4;
|
||||
$len = ord($der[($bit + 1)]);
|
||||
$bytes = 0;
|
||||
if ($len & 0x80) {
|
||||
$bytes = $len & 0x0f;
|
||||
$len = 0;
|
||||
for ($i = 0; $i < $bytes; $i++) {
|
||||
$len = ($len << 8) | ord($der[$bit + $i + 2]);
|
||||
}
|
||||
}
|
||||
return substr($der, 4, $len + 4);
|
||||
}
|
||||
1251
addon/alipay/data/sdk/AopClient.php
Executable file
1251
addon/alipay/data/sdk/AopClient.php
Executable file
File diff suppressed because it is too large
Load Diff
71
addon/alipay/data/sdk/AopEncrypt.php
Executable file
71
addon/alipay/data/sdk/AopEncrypt.php
Executable file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* 加密工具类
|
||||
*
|
||||
* User: jiehua
|
||||
* Date: 16/3/30
|
||||
* Time: 下午3:25
|
||||
*/
|
||||
|
||||
/**
|
||||
* 加密方法
|
||||
* @param string $str
|
||||
* @return string
|
||||
*/
|
||||
function new_encrypt($str,$screct_key){
|
||||
//AES, 128 模式加密数据 CBC
|
||||
$screct_key = base64_decode($screct_key);
|
||||
$str = trim($str);
|
||||
$str = addPKCS7Padding($str);
|
||||
$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128,MCRYPT_MODE_CBC),1);
|
||||
$encrypt_str = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $screct_key, $str, MCRYPT_MODE_CBC);
|
||||
return base64_encode($encrypt_str);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密方法
|
||||
* @param string $str
|
||||
* @return string
|
||||
*/
|
||||
function new_decrypt($str,$screct_key){
|
||||
//AES, 128 模式加密数据 CBC
|
||||
$str = base64_decode($str);
|
||||
$screct_key = base64_decode($screct_key);
|
||||
$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128,MCRYPT_MODE_CBC),1);
|
||||
$encrypt_str = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $screct_key, $str, MCRYPT_MODE_CBC);
|
||||
$encrypt_str = trim($encrypt_str);
|
||||
|
||||
$encrypt_str = stripPKSC7Padding($encrypt_str);
|
||||
return $encrypt_str;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充算法
|
||||
* @param string $source
|
||||
* @return string
|
||||
*/
|
||||
function addPKCS7Padding($source){
|
||||
$source = trim($source);
|
||||
$block = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
|
||||
|
||||
$pad = $block - (strlen($source) % $block);
|
||||
if ($pad <= $block) {
|
||||
$char = chr($pad);
|
||||
$source .= str_repeat($char, $pad);
|
||||
}
|
||||
return $source;
|
||||
}
|
||||
/**
|
||||
* 移去填充算法
|
||||
* @param string $source
|
||||
* @return string
|
||||
*/
|
||||
function stripPKSC7Padding($source){
|
||||
$source = trim($source);
|
||||
$char = substr($source, -1);
|
||||
$num = ord($char);
|
||||
if($num==62)return $source;
|
||||
$source = substr($source,0,-$num);
|
||||
return $source;
|
||||
}
|
||||
19
addon/alipay/data/sdk/EncryptParseItem.php
Executable file
19
addon/alipay/data/sdk/EncryptParseItem.php
Executable file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* TODO 补充说明
|
||||
*
|
||||
* User: jiehua
|
||||
* Date: 16/3/30
|
||||
* Time: 下午8:55
|
||||
*/
|
||||
|
||||
class EncryptParseItem {
|
||||
|
||||
|
||||
public $startIndex;
|
||||
|
||||
public $endIndex;
|
||||
|
||||
public $encryptContent;
|
||||
|
||||
}
|
||||
18
addon/alipay/data/sdk/EncryptResponseData.php
Executable file
18
addon/alipay/data/sdk/EncryptResponseData.php
Executable file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* TODO 补充说明
|
||||
*
|
||||
* User: jiehua
|
||||
* Date: 16/3/30
|
||||
* Time: 下午8:51
|
||||
*/
|
||||
|
||||
class EncryptResponseData {
|
||||
|
||||
|
||||
public $realContent;
|
||||
|
||||
public $returnContent;
|
||||
|
||||
|
||||
}
|
||||
17
addon/alipay/data/sdk/SignData.php
Executable file
17
addon/alipay/data/sdk/SignData.php
Executable file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
namespace addon\alipay\data\sdk;
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: jiehua
|
||||
* Date: 15/5/2
|
||||
* Time: 下午6:21
|
||||
*/
|
||||
|
||||
class SignData {
|
||||
|
||||
public $signSourceData=null;
|
||||
|
||||
|
||||
public $sign=null;
|
||||
|
||||
}
|
||||
120
addon/alipay/data/sdk/request/AlipayFundTransToaccountTransferRequest.php
Executable file
120
addon/alipay/data/sdk/request/AlipayFundTransToaccountTransferRequest.php
Executable file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
namespace addon\alipay\data\sdk\request;
|
||||
|
||||
/**
|
||||
* ALIPAY API: alipay.fund.trans.toaccount.transfer request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2018-08-14 14:05:00
|
||||
*/
|
||||
class AlipayFundTransToaccountTransferRequest
|
||||
{
|
||||
/**
|
||||
* 单笔转账到支付宝账户接口
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.fund.trans.toaccount.transfer";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
119
addon/alipay/data/sdk/request/AlipayFundTransUniTransferRequest.php
Executable file
119
addon/alipay/data/sdk/request/AlipayFundTransUniTransferRequest.php
Executable file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
namespace addon\alipay\data\sdk\request;
|
||||
/**
|
||||
* ALIPAY API: alipay.fund.trans.uni.transfer request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2020-04-02 22:40:08
|
||||
*/
|
||||
class AlipayFundTransUniTransferRequest
|
||||
{
|
||||
/**
|
||||
* 支付宝转账支付接口
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.fund.trans.uni.transfer";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
119
addon/alipay/data/sdk/request/AlipayTradeAppPayRequest.php
Executable file
119
addon/alipay/data/sdk/request/AlipayTradeAppPayRequest.php
Executable file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
namespace addon\alipay\data\sdk\request;
|
||||
/**
|
||||
* ALIPAY API: alipay.trade.app.pay request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2018-07-16 16:20:00
|
||||
*/
|
||||
class AlipayTradeAppPayRequest
|
||||
{
|
||||
/**
|
||||
* app支付接口2.0
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.trade.app.pay";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
119
addon/alipay/data/sdk/request/AlipayTradeCancelRequest.php
Executable file
119
addon/alipay/data/sdk/request/AlipayTradeCancelRequest.php
Executable file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ALIPAY API: alipay.trade.cancel request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2018-07-13 17:18:06
|
||||
*/
|
||||
class AlipayTradeCancelRequest
|
||||
{
|
||||
/**
|
||||
* 统一收单交易撤销接口
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array ();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion = "1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt = false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas[ "biz_content" ] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.trade.cancel";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl = $notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl = $returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion = $apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt = $needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
120
addon/alipay/data/sdk/request/AlipayTradeCloseRequest.php
Executable file
120
addon/alipay/data/sdk/request/AlipayTradeCloseRequest.php
Executable file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
namespace addon\alipay\data\sdk\request;
|
||||
|
||||
/**
|
||||
* ALIPAY API: alipay.trade.close request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2018-07-13 17:18:06
|
||||
*/
|
||||
class AlipayTradeCloseRequest
|
||||
{
|
||||
/**
|
||||
* 统一收单交易关闭接口
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.trade.close";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
119
addon/alipay/data/sdk/request/AlipayTradeCreateRequest.php
Executable file
119
addon/alipay/data/sdk/request/AlipayTradeCreateRequest.php
Executable file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
namespace addon\alipay\data\sdk\request;
|
||||
/**
|
||||
* ALIPAY API: alipay.trade.create request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2018-09-01 17:05:01
|
||||
*/
|
||||
class AlipayTradeCreateRequest
|
||||
{
|
||||
/**
|
||||
* 商户通过该接口进行交易的创建下单
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.trade.create";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
118
addon/alipay/data/sdk/request/AlipayTradeCustomsDeclareRequest.php
Executable file
118
addon/alipay/data/sdk/request/AlipayTradeCustomsDeclareRequest.php
Executable file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: alipay.trade.customs.declare request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2016-12-08 00:48:24
|
||||
*/
|
||||
class AlipayTradeCustomsDeclareRequest
|
||||
{
|
||||
/**
|
||||
* 统一收单报关接口
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.trade.customs.declare";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
118
addon/alipay/data/sdk/request/AlipayTradeCustomsQueryRequest.php
Executable file
118
addon/alipay/data/sdk/request/AlipayTradeCustomsQueryRequest.php
Executable file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: alipay.trade.customs.query request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2018-03-02 14:37:16
|
||||
*/
|
||||
class AlipayTradeCustomsQueryRequest
|
||||
{
|
||||
/**
|
||||
* 查询报关详细信息
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.trade.customs.query";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
118
addon/alipay/data/sdk/request/AlipayTradeFastpayRefundQueryRequest.php
Executable file
118
addon/alipay/data/sdk/request/AlipayTradeFastpayRefundQueryRequest.php
Executable file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: alipay.trade.fastpay.refund.query request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2018-07-25 17:25:00
|
||||
*/
|
||||
class AlipayTradeFastpayRefundQueryRequest
|
||||
{
|
||||
/**
|
||||
* 商户可使用该接口查询自已通过alipay.trade.refund提交的退款请求是否执行成功。
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.trade.fastpay.refund.query";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
118
addon/alipay/data/sdk/request/AlipayTradeOrderSettleRequest.php
Executable file
118
addon/alipay/data/sdk/request/AlipayTradeOrderSettleRequest.php
Executable file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: alipay.trade.order.settle request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2018-07-13 17:18:06
|
||||
*/
|
||||
class AlipayTradeOrderSettleRequest
|
||||
{
|
||||
/**
|
||||
* 统一收单交易结算接口
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.trade.order.settle";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
118
addon/alipay/data/sdk/request/AlipayTradeOrderinfoSyncRequest.php
Executable file
118
addon/alipay/data/sdk/request/AlipayTradeOrderinfoSyncRequest.php
Executable file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: alipay.trade.orderinfo.sync request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2018-07-23 11:40:00
|
||||
*/
|
||||
class AlipayTradeOrderinfoSyncRequest
|
||||
{
|
||||
/**
|
||||
* 支付宝订单信息同步接口
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.trade.orderinfo.sync";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
120
addon/alipay/data/sdk/request/AlipayTradePagePayRequest.php
Executable file
120
addon/alipay/data/sdk/request/AlipayTradePagePayRequest.php
Executable file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
namespace addon\alipay\data\sdk\request;
|
||||
/**
|
||||
* ALIPAY API: alipay.trade.page.pay request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2018-08-14 15:31:43
|
||||
*/
|
||||
class AlipayTradePagePayRequest
|
||||
{
|
||||
/**
|
||||
* 统一收单下单并支付页面接口
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.trade.page.pay";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
120
addon/alipay/data/sdk/request/AlipayTradePayRequest.php
Executable file
120
addon/alipay/data/sdk/request/AlipayTradePayRequest.php
Executable file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
namespace addon\alipay\data\sdk\request;
|
||||
/**
|
||||
* ALIPAY API: alipay.trade.pay request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2018-08-31 11:20:00
|
||||
*/
|
||||
class AlipayTradePayRequest
|
||||
{
|
||||
/**
|
||||
* 用于在线下场景交易一次创建并支付掉
|
||||
修改路由策略到R
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.trade.pay";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
120
addon/alipay/data/sdk/request/AlipayTradePrecreateRequest.php
Executable file
120
addon/alipay/data/sdk/request/AlipayTradePrecreateRequest.php
Executable file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
namespace addon\alipay\data\sdk\request;
|
||||
/**
|
||||
* ALIPAY API: alipay.trade.precreate request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2018-06-14 17:32:25
|
||||
*/
|
||||
class AlipayTradePrecreateRequest
|
||||
{
|
||||
/**
|
||||
* 收银员通过收银台或商户后台调用支付宝接口,生成二维码后,展示给伤脑筋户,由用户扫描二维码完成订单支付。
|
||||
修改路由策略到R
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.trade.precreate";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
121
addon/alipay/data/sdk/request/AlipayTradeQueryRequest.php
Executable file
121
addon/alipay/data/sdk/request/AlipayTradeQueryRequest.php
Executable file
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
namespace addon\alipay\data\sdk\request;
|
||||
/**
|
||||
* ALIPAY API: alipay.trade.query request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2018-05-11 18:28:47
|
||||
*/
|
||||
class AlipayTradeQueryRequest
|
||||
{
|
||||
/**
|
||||
* 统一收单线下交易查询
|
||||
* 修改路由策略到R
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array ();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion = "1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt = false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas[ "biz_content" ] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.trade.query";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl = $notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl = $returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion = $apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt = $needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
120
addon/alipay/data/sdk/request/AlipayTradeRefundRequest.php
Executable file
120
addon/alipay/data/sdk/request/AlipayTradeRefundRequest.php
Executable file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
namespace addon\alipay\data\sdk\request;
|
||||
/**
|
||||
* ALIPAY API: alipay.trade.refund request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2018-09-01 17:20:00
|
||||
*/
|
||||
class AlipayTradeRefundRequest
|
||||
{
|
||||
/**
|
||||
* 统一收单交易退款接口
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.trade.refund";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
118
addon/alipay/data/sdk/request/AlipayTradeVendorpayDevicedataUploadRequest.php
Executable file
118
addon/alipay/data/sdk/request/AlipayTradeVendorpayDevicedataUploadRequest.php
Executable file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: alipay.trade.vendorpay.devicedata.upload request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2016-12-08 00:51:39
|
||||
*/
|
||||
class AlipayTradeVendorpayDevicedataUploadRequest
|
||||
{
|
||||
/**
|
||||
* 厂商支付授权时上传设备数据接口,目前主要包含三星支付。com
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.trade.vendorpay.devicedata.upload";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
120
addon/alipay/data/sdk/request/AlipayTradeWapPayRequest.php
Executable file
120
addon/alipay/data/sdk/request/AlipayTradeWapPayRequest.php
Executable file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
namespace addon\alipay\data\sdk\request;
|
||||
/**
|
||||
* ALIPAY API: alipay.trade.wap.pay request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2018-08-06 12:35:00
|
||||
*/
|
||||
class AlipayTradeWapPayRequest
|
||||
{
|
||||
/**
|
||||
* 手机网站支付接口2.0
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.trade.wap.pay";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
47
addon/alipay/event/AuthcodePay.php
Executable file
47
addon/alipay/event/AuthcodePay.php
Executable file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
// +---------------------------------------------------------------------+
|
||||
// | NiuCloud | [ WE CAN DO IT JUST NiuCloud ] |
|
||||
// +---------------------------------------------------------------------+
|
||||
// | Copy right 2019-2029 www.niucloud.com |
|
||||
// +---------------------------------------------------------------------+
|
||||
// | Author | NiuCloud <niucloud@outlook.com> |
|
||||
// +---------------------------------------------------------------------+
|
||||
// | Repository | https://github.com/niucloud/framework.git |
|
||||
// +---------------------------------------------------------------------+
|
||||
|
||||
namespace addon\alipay\event;
|
||||
|
||||
use addon\alipay\model\Pay as PayModel;
|
||||
use app\model\system\Pay as PayCommon;
|
||||
|
||||
/**
|
||||
* 支付回调
|
||||
*/
|
||||
class AuthcodePay
|
||||
{
|
||||
/**
|
||||
* 支付方式及配置
|
||||
*/
|
||||
public function handle($params)
|
||||
{
|
||||
$out_trade_no = $params[ 'out_trade_no' ] ?? '';
|
||||
$auth_code_array = [ 25, 26, 27, 28, 29, 30 ];
|
||||
if (!empty($out_trade_no)) {
|
||||
$auth_code = $params[ 'auth_code' ];
|
||||
$sub_str = substr($auth_code, 0, 2);
|
||||
if (in_array($sub_str, $auth_code_array)) {
|
||||
$pay = new PayCommon();
|
||||
$pay_info = $pay->getPayInfo($out_trade_no)[ 'data' ] ?? [];
|
||||
if (!empty($pay_info)) {
|
||||
$site_id = $pay_info[ 'site_id' ] ?? 0;
|
||||
$pay_model = new PayModel($site_id);
|
||||
$result = $pay_model->micropay(array_merge($params, $pay_info));
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
27
addon/alipay/event/Install.php
Executable file
27
addon/alipay/event/Install.php
Executable file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
|
||||
namespace addon\alipay\event;
|
||||
|
||||
/**
|
||||
* 应用安装
|
||||
*/
|
||||
class Install
|
||||
{
|
||||
/**
|
||||
* 执行安装
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
return success();
|
||||
}
|
||||
}
|
||||
33
addon/alipay/event/Pay.php
Executable file
33
addon/alipay/event/Pay.php
Executable file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\alipay\event;
|
||||
|
||||
use addon\alipay\model\Pay as PayModel;
|
||||
|
||||
/**
|
||||
* 生成支付
|
||||
*/
|
||||
class Pay
|
||||
{
|
||||
/**
|
||||
* 支付方式及配置
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
if ($param[ "pay_type" ] == "alipay") {
|
||||
if (in_array($param[ "app_type" ], [ "h5", "app", "pc", "aliapp", 'wechat' ])) {
|
||||
$pay_model = new PayModel($param[ 'site_id' ], $param[ "app_type" ] == 'aliapp');
|
||||
$res = $pay_model->pay($param);
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
41
addon/alipay/event/PayClose.php
Executable file
41
addon/alipay/event/PayClose.php
Executable file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\alipay\event;
|
||||
|
||||
use addon\alipay\model\Pay as PayModel;
|
||||
|
||||
/**
|
||||
* 关闭支付
|
||||
*/
|
||||
class PayClose
|
||||
{
|
||||
/**
|
||||
* 关闭支付
|
||||
* @param $params
|
||||
* @return \addon\alipay\model\multitype|array
|
||||
*/
|
||||
public function handle($params)
|
||||
{
|
||||
$mch_info = json_decode($params['mch_info'], true);
|
||||
$pay_type = $mch_info['pay_type'] ?? '';
|
||||
if($pay_type == 'alipay'){
|
||||
try {
|
||||
$pay_model = new PayModel($params[ 'site_id' ]);
|
||||
$result = $pay_model->close($params);
|
||||
return $result;
|
||||
} catch (\Exception $e) {
|
||||
return error(-1, $e->getMessage());
|
||||
} catch (\Throwable $e) {
|
||||
return error(-1, $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
41
addon/alipay/event/PayNotify.php
Executable file
41
addon/alipay/event/PayNotify.php
Executable file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\alipay\event;
|
||||
|
||||
use addon\alipay\model\Pay as PayModel;
|
||||
use app\model\system\Pay as PayCommon;
|
||||
|
||||
/**
|
||||
* 支付回调
|
||||
*/
|
||||
class PayNotify
|
||||
{
|
||||
/**
|
||||
* 支付方式及配置
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if (isset($_POST[ 'out_trade_no' ])) {
|
||||
$out_trade_no = $_POST[ 'out_trade_no' ];
|
||||
$pay = new PayCommon();
|
||||
$pay_info = $pay->getPayInfo($out_trade_no)[ 'data' ];
|
||||
if (empty($pay_info)) return false;
|
||||
|
||||
if ($_POST[ 'total_amount' ] != $pay_info[ 'pay_money' ]) {
|
||||
return false;
|
||||
}
|
||||
$mch_info = empty($pay_info[ 'mch_info' ]) ? [] : json_decode($pay_info[ 'mch_info' ], true);
|
||||
|
||||
$pay_model = new PayModel($pay_info[ 'site_id' ], $mch_info[ 'is_aliapp' ] ?? 0);
|
||||
$pay_model->payNotify();
|
||||
}
|
||||
}
|
||||
}
|
||||
47
addon/alipay/event/PayOrderQuery.php
Executable file
47
addon/alipay/event/PayOrderQuery.php
Executable file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\alipay\event;
|
||||
|
||||
use addon\alipay\model\Config as ConfigModel;
|
||||
use addon\alipay\model\Pay as PayModel;
|
||||
use addon\wechat\model\Config as WechatConfig;
|
||||
use addon\wechatpay\model\Config;
|
||||
use addon\wechatpay\model\V2;
|
||||
use app\model\system\Pay;
|
||||
|
||||
/**
|
||||
* 查询支付结果
|
||||
*/
|
||||
class PayOrderQuery
|
||||
{
|
||||
public function handle(array $params)
|
||||
{
|
||||
try {
|
||||
$res = success();
|
||||
$pay_info = ( new Pay() )->getInfo([ [ 'id', '=', $params[ 'relate_id' ] ] ])[ 'data' ];
|
||||
if (!empty($pay_info) && $pay_info['is_delete'] == 0) {
|
||||
$mch_info = json_decode($pay_info['mch_info'], true);
|
||||
$pay_type = $mch_info['pay_type'] ?? 'alipay';
|
||||
if($pay_type == 'alipay'){
|
||||
$config_model = new ConfigModel();
|
||||
$pay_config = $config_model->getPayConfig($pay_info[ 'site_id' ])[ 'data' ][ 'value' ];
|
||||
if (!empty($pay_config) && $pay_config[ 'pay_status' ] != 2) {
|
||||
$pay_common = new PayModel($pay_info[ 'site_id' ]);
|
||||
$res = $pay_common->orderQuery($pay_info);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $res;
|
||||
}catch (\Throwable $e) {
|
||||
return error(-1, $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
33
addon/alipay/event/PayRefund.php
Executable file
33
addon/alipay/event/PayRefund.php
Executable file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\alipay\event;
|
||||
|
||||
use addon\alipay\model\Pay as PayModel;
|
||||
|
||||
/**
|
||||
* 原路退款
|
||||
*/
|
||||
class PayRefund
|
||||
{
|
||||
/**
|
||||
* 关闭支付
|
||||
*/
|
||||
public function handle($params)
|
||||
{
|
||||
if ($params[ "pay_info" ][ "pay_type" ] == "alipay") {
|
||||
$mch_info = empty($params[ 'pay_info' ][ 'mch_info' ]) ? [] : json_decode($params[ 'pay_info' ][ 'mch_info' ], true);
|
||||
|
||||
$pay_model = new PayModel($params[ 'site_id' ], $mch_info[ 'is_aliapp' ] ?? 0);
|
||||
$result = $pay_model->refund($params);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
42
addon/alipay/event/PayTransfer.php
Executable file
42
addon/alipay/event/PayTransfer.php
Executable file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\alipay\event;
|
||||
|
||||
use addon\alipay\model\Pay;
|
||||
use addon\alipay\model\Config;
|
||||
|
||||
class PayTransfer
|
||||
{
|
||||
public function handle(array $params)
|
||||
{
|
||||
if ($params[ 'transfer_type' ] == 'alipay') {
|
||||
$pay = new Pay($params[ 'site_id' ]);
|
||||
|
||||
$config_model = new Config();
|
||||
$config_result = $config_model->getPayConfig($params[ 'site_id' ]);
|
||||
$config = $config_result[ "data" ];
|
||||
if (!empty($config[ 'value' ])) {
|
||||
$config_info = $config[ "value" ];
|
||||
$countersign_type = $config_info['countersign_type'] ?? 0;
|
||||
if ($countersign_type == 0) {
|
||||
$res = $pay->payTransfer($params);
|
||||
return $res;
|
||||
} else {
|
||||
$res = $pay->payNewTransfer($params);
|
||||
return $res;
|
||||
}
|
||||
} else {
|
||||
$res = $pay->payTransfer($params);
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
51
addon/alipay/event/PayType.php
Executable file
51
addon/alipay/event/PayType.php
Executable file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\alipay\event;
|
||||
|
||||
use addon\alipay\model\Config;
|
||||
|
||||
/**
|
||||
* 支付方式 (后台调用)
|
||||
*/
|
||||
class PayType
|
||||
{
|
||||
/**
|
||||
* 支付方式及配置
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
$config_model = new Config();
|
||||
$config_result = $config_model->getPayConfig($param[ 'site_id' ] ?? 1);
|
||||
$config = $config_result[ "data" ][ "value" ] ?? [];
|
||||
$pay_status = $config[ "pay_status" ] ?? 0;
|
||||
|
||||
$app_type = $param['app_type'] ?? '';
|
||||
if (!empty($app_type)) {
|
||||
if (!in_array($app_type, [ "h5", "app", "pc", "aliapp", 'wechat' ])) {
|
||||
return '';
|
||||
}
|
||||
if ($app_type != 'aliapp' && $pay_status == 0) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
$info = array (
|
||||
"pay_type" => "alipay",
|
||||
"pay_type_name" => "支付宝支付",
|
||||
"edit_url" => "alipay://shop/pay/config",
|
||||
"shop_url" => "alipay://shop/pay/config",
|
||||
"logo" => "addon/alipay/icon.png",
|
||||
"desc" => "支付宝网站(www.alipay.com) 是国内先进的网上支付平台。",
|
||||
"pay_status" => $pay_status,
|
||||
);
|
||||
return $info;
|
||||
}
|
||||
}
|
||||
39
addon/alipay/event/TransferType.php
Executable file
39
addon/alipay/event/TransferType.php
Executable file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\alipay\event;
|
||||
|
||||
use addon\alipay\model\Config;
|
||||
|
||||
class TransferType
|
||||
{
|
||||
public function handle(array $param)
|
||||
{
|
||||
|
||||
$app_type = $param['app_type'] ?? '';
|
||||
if (!empty($app_type)) {
|
||||
if (!in_array($app_type, [ "h5", "app", "pc", "aliapp" ])) {
|
||||
return '';
|
||||
}
|
||||
$config_model = new Config();
|
||||
$config_result = $config_model->getPayConfig($param[ 'site_id' ]);
|
||||
$config = $config_result[ "data" ][ "value" ] ?? [];
|
||||
$transfer_status = $config[ "transfer_status" ] ?? 0;
|
||||
if ($transfer_status == 0) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
$info = array (
|
||||
"type" => "alipay",
|
||||
"type_name" => "支付宝",
|
||||
);
|
||||
return $info;
|
||||
}
|
||||
}
|
||||
26
addon/alipay/event/UnInstall.php
Executable file
26
addon/alipay/event/UnInstall.php
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\alipay\event;
|
||||
|
||||
/**
|
||||
* 应用卸载
|
||||
*/
|
||||
class UnInstall
|
||||
{
|
||||
/**
|
||||
* 执行卸载
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
return error(-1, "系统插件不得删除");
|
||||
}
|
||||
}
|
||||
BIN
addon/alipay/icon.png
Executable file
BIN
addon/alipay/icon.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
96
addon/alipay/model/Config.php
Executable file
96
addon/alipay/model/Config.php
Executable file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\alipay\model;
|
||||
|
||||
use app\model\system\Config as ConfigModel;
|
||||
use app\model\BaseModel;
|
||||
|
||||
/**
|
||||
* 支付宝支付配置
|
||||
*/
|
||||
class Config extends BaseModel
|
||||
{
|
||||
|
||||
private $encrypt = '******';
|
||||
|
||||
/**
|
||||
* 设置支付配置
|
||||
* @param $data
|
||||
* @param int $site_id
|
||||
* @param string $app_module
|
||||
* @return array
|
||||
*/
|
||||
public function setPayConfig($data, $site_id = 0, $app_module = 'shop')
|
||||
{
|
||||
$config = new ConfigModel();
|
||||
|
||||
// 未加密前的数据
|
||||
$original_config = $this->getPayConfig($site_id)[ 'data' ][ 'value' ];
|
||||
|
||||
// 检测数据是否发生变化,如果没有变化,则保持未加密前的数据
|
||||
if (!empty($data[ 'private_key' ]) && $data[ 'private_key' ] == $this->encrypt) {
|
||||
$data[ 'private_key' ] = $original_config[ 'private_key' ]; // 应用私钥
|
||||
}
|
||||
if (!empty($data[ 'public_key' ]) && $data[ 'public_key' ] == $this->encrypt) {
|
||||
$data[ 'public_key' ] = $original_config[ 'public_key' ]; // 应用公钥
|
||||
}
|
||||
if (!empty($data[ 'alipay_public_key' ]) && $data[ 'alipay_public_key' ] == $this->encrypt) {
|
||||
$data[ 'alipay_public_key' ] = $original_config[ 'alipay_public_key' ]; // 支付宝公钥
|
||||
}
|
||||
if (!empty($data[ 'public_key_crt' ]) && $data[ 'public_key_crt' ] == $this->encrypt) {
|
||||
$data[ 'public_key_crt' ] = $original_config[ 'public_key_crt' ]; // 应用公钥证书
|
||||
}
|
||||
if (!empty($data[ 'alipay_public_key_crt' ]) && $data[ 'alipay_public_key_crt' ] == $this->encrypt) {
|
||||
$data[ 'alipay_public_key_crt' ] = $original_config[ 'alipay_public_key_crt' ]; // 支付宝公钥证书
|
||||
}
|
||||
if (!empty($data[ 'alipay_with_crt' ]) && $data[ 'alipay_with_crt' ] == $this->encrypt) {
|
||||
$data[ 'alipay_with_crt' ] = $original_config[ 'alipay_with_crt' ]; // 支付宝根证书
|
||||
}
|
||||
|
||||
$res = $config->setConfig($data, '支付宝支付配置', 1, [ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'ALI_PAY_CONFIG' ] ]);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取支付配置
|
||||
* @param int $site_id
|
||||
* @param string $app_module
|
||||
* @param bool $need_encrypt 是否需要加密数据,true:加密、false:不加密
|
||||
* @return array
|
||||
*/
|
||||
public function getPayConfig($site_id = 0, $app_module = 'shop', $need_encrypt = false)
|
||||
{
|
||||
$config = new ConfigModel();
|
||||
$res = $config->getConfig([ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'ALI_PAY_CONFIG' ] ]);
|
||||
if (!empty($res[ 'data' ][ 'value' ]) && $need_encrypt) {
|
||||
// 加密敏感信息
|
||||
if (!empty($res[ 'data' ][ 'value' ][ 'private_key' ])) {
|
||||
$res[ 'data' ][ 'value' ][ 'private_key' ] = $this->encrypt; // 应用私钥
|
||||
}
|
||||
if (!empty($res[ 'data' ][ 'value' ][ 'public_key' ])) {
|
||||
$res[ 'data' ][ 'value' ][ 'public_key' ] = $this->encrypt; // 应用公钥
|
||||
}
|
||||
if (!empty($res[ 'data' ][ 'value' ][ 'alipay_public_key' ])) {
|
||||
$res[ 'data' ][ 'value' ][ 'alipay_public_key' ] = $this->encrypt; // 支付宝公钥
|
||||
}
|
||||
if (!empty($res[ 'data' ][ 'value' ][ 'public_key_crt' ])) {
|
||||
$res[ 'data' ][ 'value' ][ 'public_key_crt' ] = $this->encrypt; // 应用公钥证书
|
||||
}
|
||||
if (!empty($res[ 'data' ][ 'value' ][ 'alipay_public_key_crt' ])) {
|
||||
$res[ 'data' ][ 'value' ][ 'alipay_public_key_crt' ] = $this->encrypt; // 支付宝公钥证书
|
||||
}
|
||||
if (!empty($res[ 'data' ][ 'value' ][ 'alipay_with_crt' ])) {
|
||||
$res[ 'data' ][ 'value' ][ 'alipay_with_crt' ] = $this->encrypt; // 支付宝根证书
|
||||
}
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
508
addon/alipay/model/Pay.php
Executable file
508
addon/alipay/model/Pay.php
Executable file
@@ -0,0 +1,508 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\alipay\model;
|
||||
|
||||
use addon\alipay\data\sdk\AopClient;
|
||||
use addon\alipay\data\sdk\request\AlipayFundTransToaccountTransferRequest;
|
||||
use addon\alipay\data\sdk\request\AlipayTradeAppPayRequest;
|
||||
use addon\alipay\data\sdk\request\AlipayTradeCloseRequest;
|
||||
use addon\alipay\data\sdk\request\AlipayTradeCreateRequest;
|
||||
use addon\alipay\data\sdk\request\AlipayTradePagePayRequest;
|
||||
use addon\alipay\data\sdk\request\AlipayTradeRefundRequest;
|
||||
use addon\alipay\data\sdk\request\AlipayTradeWapPayRequest;
|
||||
use addon\alipay\data\sdk\request\AlipayTradePrecreateRequest;
|
||||
use addon\alipay\data\sdk\request\AlipayTradePayRequest;
|
||||
use addon\alipay\data\sdk\request\AlipayTradeQueryRequest;
|
||||
use app\model\BaseModel;
|
||||
use app\model\system\Cron;
|
||||
use app\model\system\Pay as PayCommon;
|
||||
use addon\alipay\data\sdk\request\AlipayFundTransUniTransferRequest;
|
||||
use addon\alipay\data\sdk\AopCertClient;
|
||||
use app\model\system\Pay as PayModel;
|
||||
use addon\aliapp\model\Config as AliappConfig;
|
||||
use think\facade\Log;
|
||||
|
||||
/**
|
||||
* 支付宝支付配置
|
||||
*/
|
||||
class Pay extends BaseModel
|
||||
{
|
||||
|
||||
public $aop;
|
||||
|
||||
private $is_aliapp = 0;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param $site_id
|
||||
* @param int $is_aliapp 是否是小程序
|
||||
*/
|
||||
function __construct($site_id, $is_aliapp = 0)
|
||||
{
|
||||
$this->is_aliapp = $is_aliapp;
|
||||
|
||||
try {
|
||||
// 获取支付宝支付参数(统一支付到平台账户)
|
||||
if ($is_aliapp) {
|
||||
$config_info = ( new AliappConfig() )->getAliappConfig($site_id)[ 'data' ][ 'value' ];
|
||||
} else {
|
||||
$config_info = ( new Config() )->getPayConfig($site_id)[ 'data' ][ 'value' ];
|
||||
}
|
||||
|
||||
if (!empty($config_info)) {
|
||||
$countersign_type = $config_info[ 'countersign_type' ] ?? 0;
|
||||
|
||||
if ($countersign_type == 1) {
|
||||
$appCertPath = $config_info[ "public_key_crt" ] ?? "";
|
||||
$alipayCertPath = $config_info[ "alipay_public_key_crt" ] ?? "";
|
||||
$rootCertPath = $config_info[ "alipay_with_crt" ] ?? "";
|
||||
|
||||
$this->aop = new AopCertClient();
|
||||
//调用getPublicKey从支付宝公钥证书中提取公钥
|
||||
$this->aop->alipayrsaPublicKey = $this->aop->getPublicKey($alipayCertPath);
|
||||
//是否校验自动下载的支付宝公钥证书,如果开启校验要保证支付宝根证书在有效期内
|
||||
$this->aop->isCheckAlipayPublicCert = false;
|
||||
//调用getCertSN获取证书序列号
|
||||
$this->aop->appCertSN = $this->aop->getCertSN($appCertPath);
|
||||
//调用getRootCertSN获取支付宝根证书序列号
|
||||
$this->aop->alipayRootCertSN = $this->aop->getRootCertSN($rootCertPath);
|
||||
|
||||
} else {
|
||||
// 获取支付宝支付参数(统一支付到平台账户)
|
||||
$this->aop = new AopClient();
|
||||
$this->aop->alipayrsaPublicKey = $config_info[ 'public_key' ] ?? "";
|
||||
$this->aop->alipayPublicKey = $config_info[ 'alipay_public_key' ] ?? "";
|
||||
}
|
||||
$this->aop->appId = $config_info[ "app_id" ] ?? "";
|
||||
$this->aop->rsaPrivateKey = $config_info[ 'private_key' ] ?? "";
|
||||
$this->aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
|
||||
$this->aop->apiVersion = '1.0';
|
||||
$this->aop->signType = 'RSA2';
|
||||
$this->aop->postCharset = 'UTF-8';
|
||||
$this->aop->format = 'json';
|
||||
|
||||
}
|
||||
// else{
|
||||
// return $this->error('', '支付宝支付未配置');
|
||||
// }
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->error('', '支付宝配置错误');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成支付
|
||||
* @param $param
|
||||
* @return array
|
||||
*/
|
||||
public function pay($param)
|
||||
{
|
||||
//构造要请求的参数数组,无需改动
|
||||
$parameter = array (
|
||||
"out_trade_no" => $param[ "out_trade_no" ],
|
||||
"subject" => str_sub($param[ "pay_body" ], 15),
|
||||
"total_amount" => (float) $param[ "pay_money" ],
|
||||
"body" => str_sub($param[ "pay_body" ], 60),
|
||||
"product_code" => 'FAST_INSTANT_TRADE_PAY',
|
||||
);
|
||||
|
||||
switch ( $param[ "app_type" ] ) {
|
||||
case "h5":
|
||||
$request = new AlipayTradeWapPayRequest();
|
||||
break;
|
||||
case "pc":
|
||||
$request = new AlipayTradePagePayRequest();
|
||||
break;
|
||||
case "app":
|
||||
$request = new AlipayTradeAppPayRequest();
|
||||
break;
|
||||
case 'wechat':
|
||||
$request = new AlipayTradeWapPayRequest();
|
||||
break;
|
||||
case 'cashier':
|
||||
$request = new AlipayTradePrecreateRequest();
|
||||
break;
|
||||
case 'aliapp':
|
||||
$parameter[ 'product_code' ] = 'FACE_TO_FACE_PAYMENT';
|
||||
|
||||
$member_info = model('member')->getInfo([ [ "member_id", "=", $param[ "member_id" ] ] ], 'ali_openid');
|
||||
if (empty($member_info)) return $this->error(-1, '未获取到会员信息');
|
||||
|
||||
$parameter[ 'buyer_id' ] = $member_info[ 'ali_openid' ];
|
||||
$request = new AlipayTradeCreateRequest();
|
||||
break;
|
||||
}
|
||||
|
||||
$parameter = json_encode($parameter);
|
||||
$request->setBizContent($parameter);
|
||||
$request->SetReturnUrl($param[ "return_url" ]);
|
||||
$request->SetNotifyUrl($param[ "notify_url" ]);
|
||||
|
||||
//清除绑定商户数据
|
||||
$pay_model = new PayModel();
|
||||
$clear_res = $pay_model->clearMchPay($param[ "out_trade_no" ], 'alipay');
|
||||
if($clear_res['code'] < 0) return $clear_res;
|
||||
|
||||
try {
|
||||
if ($param[ "app_type" ] == 'h5' || $param[ "app_type" ] == 'wechat' || $param[ "app_type" ] == 'pc') {
|
||||
$result = $this->aop->pageExecute($request, 'get');
|
||||
$pay_model->bindMchPay($param[ "out_trade_no" ], [
|
||||
"pay_type" => 'alipay',
|
||||
"is_aliapp" => $this->is_aliapp,
|
||||
]);
|
||||
return $this->success([
|
||||
'type' => 'url',
|
||||
'data' => $result
|
||||
]);
|
||||
} elseif ($param[ "app_type" ] == 'app') {
|
||||
$result = $this->aop->sdkExecute($request);
|
||||
if (strpos(get_class($this->aop), 'AopClient') !== false) {
|
||||
$pay_model->bindMchPay($param[ "out_trade_no" ], [
|
||||
"pay_type" => 'alipay',
|
||||
"is_aliapp" => $this->is_aliapp,
|
||||
]);
|
||||
return $this->success([
|
||||
'type' => 'url',
|
||||
'data' => $result
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
$result = $this->aop->execute($request);
|
||||
if($result !== false){
|
||||
$pay_model->bindMchPay($param[ "out_trade_no" ], [
|
||||
"pay_type" => 'alipay',
|
||||
"is_aliapp" => $this->is_aliapp,
|
||||
]);
|
||||
}
|
||||
}
|
||||
if ($result === false) return $this->error('', '支付宝发起支付失败');
|
||||
} catch (\Exception $e) {
|
||||
return $this->error('', $e->getMessage());
|
||||
}
|
||||
|
||||
$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
|
||||
$resultCode = $result->$responseNode->code;
|
||||
if (!empty($resultCode) && $resultCode == 10000) {
|
||||
switch ( $param[ "app_type" ] ) {
|
||||
case 'cashier':
|
||||
return $this->success([
|
||||
'type' => 'qrcode',
|
||||
'data' => [
|
||||
'qrcode' => $result->$responseNode->qr_code
|
||||
]
|
||||
]);
|
||||
break;
|
||||
case 'aliapp':
|
||||
return $this->success([
|
||||
'type' => 'data',
|
||||
'data' => [
|
||||
'orderInfo' => $result->$responseNode->trade_no
|
||||
]
|
||||
]);
|
||||
break;
|
||||
default:
|
||||
return $this->success();
|
||||
}
|
||||
} else {
|
||||
return $this->error("", $result->$responseNode->sub_msg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付关闭
|
||||
* @param $param
|
||||
* @return array
|
||||
* @throws \think\Exception
|
||||
*/
|
||||
public function close($param)
|
||||
{
|
||||
$pay_order_result = $this->get($param[ "out_trade_no" ]);
|
||||
if($pay_order_result['code'] >= 0 && $pay_order_result['data']['trade_status'] != 'TRADE_CLOSED'){
|
||||
if(in_array($pay_order_result['data']['trade_status'], ['TRADE_SUCCESS','TRADE_FINISHED'])){
|
||||
return $this->error([ 'is_paid' => 1, 'pay_type' => 'alipay'], '支付宝已支付不可关闭');
|
||||
}
|
||||
//关闭请求
|
||||
$parameter = array (
|
||||
"out_trade_no" => $param[ "out_trade_no" ]
|
||||
);
|
||||
$request = new AlipayTradeCloseRequest();
|
||||
$request->setBizContent(json_encode($parameter));
|
||||
$result = $this->aop->execute($request);
|
||||
$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
|
||||
$resultCode = $result->$responseNode->code;
|
||||
$sub_code = $result->$responseNode->sub_code;
|
||||
if($resultCode != 10000 && in_array($sub_code, ['ACQ.TRADE_STATUS_ERROR', 'ACQ.REASON_TRADE_STATUS_INVALID', 'ACQ.REASON_ILLEGAL_STATUS'])){
|
||||
return $this->error(null, $result->$responseNode->sub_msg);
|
||||
}
|
||||
}
|
||||
return $this->success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付宝支付原路返回
|
||||
* @param array $param 支付参数
|
||||
* @return array
|
||||
* @throws \think\Exception
|
||||
*/
|
||||
public function refund($param)
|
||||
{
|
||||
$pay_info = $param[ "pay_info" ];
|
||||
$refund_no = $param[ "refund_no" ];
|
||||
$out_trade_no = $pay_info[ "trade_no" ] ?? '';
|
||||
$refund_fee = $param[ "refund_fee" ];
|
||||
$parameter = array (
|
||||
'trade_no' => $out_trade_no,
|
||||
'refund_amount' => sprintf("%.2f", $refund_fee),
|
||||
'out_request_no' => $refund_no
|
||||
);
|
||||
// 建立请求
|
||||
$request = new AlipayTradeRefundRequest ();
|
||||
$request->setBizContent(json_encode($parameter));
|
||||
$result = $this->aop->execute($request);
|
||||
$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
|
||||
$resultCode = $result->$responseNode->code;
|
||||
if (!empty($resultCode) && $resultCode == 10000) {
|
||||
return $this->success();
|
||||
} else {
|
||||
return $this->error("", $result->$responseNode->sub_msg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付宝转账
|
||||
* @param $param
|
||||
* @return array
|
||||
*/
|
||||
public function payTransfer($param)
|
||||
{
|
||||
try {
|
||||
$config_model = new Config();
|
||||
$config_result = $config_model->getPayConfig($param[ 'site_id' ]);
|
||||
if ($config_result[ 'code' ] < 0) return $config_result;
|
||||
$config = $config_result[ 'data' ][ 'value' ];
|
||||
if (empty($config)) return $this->error([], '未配置支付宝支付');
|
||||
if (!$config[ 'transfer_status' ]) return $this->error([], '未启用支付宝转账');
|
||||
|
||||
$parameter = [
|
||||
'out_biz_no' => $param[ 'out_trade_no' ],
|
||||
'payee_type' => 'ALIPAY_LOGONID',
|
||||
'payee_account' => $param[ "account_number" ],
|
||||
'amount' => sprintf("%.2f", $param[ 'amount' ]),
|
||||
'payee_real_name' => $param[ "real_name" ],
|
||||
'remark' => $param[ "desc" ]
|
||||
];
|
||||
// 建立请求
|
||||
$request = new AlipayFundTransToaccountTransferRequest();
|
||||
$request->setBizContent(json_encode($parameter));
|
||||
$result = $this->aop->execute($request);
|
||||
$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
|
||||
$resultCode = $result->$responseNode->code;
|
||||
if (!empty($resultCode) && $resultCode == 10000) {
|
||||
return $this->success([
|
||||
'out_trade_no' => $result->$responseNode->out_biz_no, // 商户交易号
|
||||
'payment_no' => $result->$responseNode->order_id, // 微信付款单号
|
||||
'payment_time' => date_to_time($result->$responseNode->pay_date) // 付款成功时间
|
||||
]);
|
||||
} else {
|
||||
return $this->error([], $result->$responseNode->sub_msg);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return $this->error([], $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 异步完成支付
|
||||
* @param $param
|
||||
*/
|
||||
public function payNotify()
|
||||
{
|
||||
|
||||
// Log::write('pay_notifiy_log:alipay:'.json_encode(input()), 'notice');
|
||||
try {
|
||||
$res = $this->aop->rsaCheckV1($_POST, $this->aop->alipayrsaPublicKey, $this->aop->signType);
|
||||
if ($res) { // 验证成功
|
||||
$out_trade_no = $_POST[ 'out_trade_no' ];
|
||||
// 支付宝交易号
|
||||
$trade_no = $_POST[ 'trade_no' ];
|
||||
// 交易状态
|
||||
$trade_status = $_POST[ 'trade_status' ];
|
||||
$pay_common = new PayCommon();
|
||||
if ($trade_status == "TRADE_SUCCESS") {
|
||||
$retval = $pay_common->onlinePay($out_trade_no, "alipay", $trade_no, "alipay");
|
||||
}
|
||||
echo "success";
|
||||
} else {
|
||||
// 验证失败
|
||||
echo "fail";
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
echo "fail";
|
||||
}
|
||||
}
|
||||
|
||||
public function payNewTransfer($param)
|
||||
{
|
||||
try {
|
||||
$config_model = new Config();
|
||||
$config_result = $config_model->getPayConfig($param[ 'site_id' ]);
|
||||
if ($config_result[ 'code' ] < 0) return $config_result;
|
||||
$config = $config_result[ 'data' ][ 'value' ];
|
||||
if (empty($config)) return $this->error([], '未配置支付宝支付');
|
||||
if (!$config[ 'transfer_status' ]) return $this->error([], '未启用支付宝转账');
|
||||
|
||||
$parameter = [
|
||||
'out_biz_no' => $param[ 'out_trade_no' ],
|
||||
'trans_amount' => sprintf("%.2f", $param[ 'amount' ]),
|
||||
'product_code' => 'TRANS_ACCOUNT_NO_PWD',
|
||||
'biz_scene' => 'DIRECT_TRANSFER',
|
||||
'order_title' => '支付宝转账',
|
||||
'remark' => $param[ "desc" ],
|
||||
'payee_info' => [
|
||||
'identity' => $param[ "account_number" ],
|
||||
'identity_type' => "ALIPAY_LOGON_ID",
|
||||
'name' => $param[ "real_name" ]
|
||||
]
|
||||
];
|
||||
|
||||
// 建立请求
|
||||
$request = new AlipayFundTransUniTransferRequest();
|
||||
$request->setBizContent(json_encode($parameter));
|
||||
$result = $this->aop->execute($request);
|
||||
$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
|
||||
$resultCode = $result->$responseNode->code;
|
||||
if (!empty($resultCode) && $resultCode == 10000) {
|
||||
return $this->success([
|
||||
'out_trade_no' => $result->$responseNode->out_biz_no, // 商户交易号
|
||||
'payment_no' => $result->$responseNode->order_id, // 微信付款单号
|
||||
'payment_time' => date_to_time($result->$responseNode->trans_date) // 付款成功时间
|
||||
]);
|
||||
} else {
|
||||
return $this->error([], $result->$responseNode->sub_msg);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return $this->error([], $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 付款码支付
|
||||
* @param $param
|
||||
* @return array|mixed|void
|
||||
*/
|
||||
public function micropay($param)
|
||||
{
|
||||
try {
|
||||
$pay_model = new PayModel();
|
||||
|
||||
//清空绑定支付数据
|
||||
$clear_res = $pay_model->clearMchPay($param[ "out_trade_no" ], 'alipay');
|
||||
if($clear_res['code'] < 0) return $clear_res;
|
||||
//绑定支付数据
|
||||
$pay_model->bindMchPay($param[ "out_trade_no" ], [
|
||||
"pay_type" => 'alipay',
|
||||
"is_aliapp" => $this->is_aliapp,
|
||||
]);
|
||||
|
||||
//构造要请求的参数数组,无需改动
|
||||
$parameter = array (
|
||||
"out_trade_no" => $param[ "out_trade_no" ],
|
||||
"subject" => str_sub($param[ "pay_body" ], 15),
|
||||
"total_amount" => (float) $param[ "pay_money" ],
|
||||
"scene" => "bar_code",
|
||||
"auth_code" => $param[ 'auth_code' ],
|
||||
);
|
||||
$parameter = json_encode($parameter);
|
||||
$request = new AlipayTradePayRequest();
|
||||
$request->setBizContent($parameter);
|
||||
$result = $this->aop->execute($request);
|
||||
$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
|
||||
$resultCode = $result->$responseNode->code;
|
||||
Log::write('支付宝—付款码支付,result:' . json_encode($result));
|
||||
Log::write('支付宝—付款码支付,resultCode:' . json_encode($resultCode));
|
||||
if (!empty($resultCode)) {
|
||||
if ($resultCode == 10000) {
|
||||
return $pay_model->onlinePay($param[ 'out_trade_no' ], 'alipay', $result->$responseNode->trade_no, 'alipay');
|
||||
} else if ($resultCode == 10003) {
|
||||
// 等待用户付款
|
||||
( new Cron() )->addCron(1, 0, "查询付款码支付结果", "PayOrderQuery", time() + 3, $param[ 'id' ]);
|
||||
return $this->error([], $result->$responseNode->sub_msg);
|
||||
} else {
|
||||
return $this->error([], $result->$responseNode->sub_msg);
|
||||
}
|
||||
} else {
|
||||
return $this->error([], $result->$responseNode->sub_msg);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return $this->error([], $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// todo 查询交易信息【AlipayTradeQueryRequest】 https://opendocs.alipay.com/open/194/106039?pathHash=5b8cf9e6
|
||||
public function orderQuery($param)
|
||||
{
|
||||
try {
|
||||
//构造要请求的参数数组,无需改动
|
||||
$parameter = array (
|
||||
"out_trade_no" => $param[ "out_trade_no" ],
|
||||
);
|
||||
$parameter = json_encode($parameter);
|
||||
$request = new AlipayTradeQueryRequest();
|
||||
$request->setBizContent($parameter);
|
||||
$result = $this->aop->execute($request);
|
||||
$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
|
||||
$resultCode = $result->$responseNode->code;
|
||||
Log::write('alipay_orderQuery' . json_encode($result));
|
||||
Log::write('alipay_orderQuery_$resultCode' . json_encode($resultCode));
|
||||
if (!empty($resultCode) && $resultCode == 10000) {
|
||||
if ($result->$responseNode->trade_status == 'TRADE_SUCCESS') {
|
||||
$pay_common = new PayModel();
|
||||
return $res = $pay_common->onlinePay($param[ 'out_trade_no' ], 'alipay', $result->$responseNode->trade_no, 'alipay');
|
||||
} else {
|
||||
$cron_model = new Cron();
|
||||
$cron_model->deleteCron([ [ 'event', '=', 'PayOrderQuery' ], [ 'relate_id', '=', $param[ 'id' ] ] ]);
|
||||
$cron_model->addCron(1, 0, "查询付款码支付结果", "PayOrderQuery", time() + 3, $param[ 'id' ]);
|
||||
}
|
||||
|
||||
} else {
|
||||
return $this->error([], $result->$responseNode->sub_msg);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return $this->error([], $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单信息
|
||||
* @param $out_trade_no
|
||||
* @return array
|
||||
* @throws \think\Exception
|
||||
*/
|
||||
public function get($out_trade_no)
|
||||
{
|
||||
$parameter = array (
|
||||
"out_trade_no" => $out_trade_no
|
||||
);
|
||||
// 建立请求
|
||||
$request = new AlipayTradeQueryRequest();
|
||||
$request->setBizContent(json_encode($parameter));
|
||||
$result = $this->aop->execute($request);
|
||||
$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
|
||||
$resultCode = $result->$responseNode->code;
|
||||
|
||||
if (!empty($resultCode) && $resultCode == 10000) {
|
||||
return $this->success(json_decode(json_encode($result->$responseNode), true));
|
||||
} else {
|
||||
return $this->error([], $result->$responseNode->sub_msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
94
addon/alipay/shop/controller/Pay.php
Executable file
94
addon/alipay/shop/controller/Pay.php
Executable file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\alipay\shop\controller;
|
||||
|
||||
use addon\alipay\model\Config as ConfigModel;
|
||||
use app\shop\controller\BaseShop;
|
||||
use think\facade\Config;
|
||||
use app\model\upload\Upload;
|
||||
|
||||
/**
|
||||
* 支付宝 控制器
|
||||
*/
|
||||
class Pay extends BaseShop
|
||||
{
|
||||
public function config()
|
||||
{
|
||||
$config_model = new ConfigModel();
|
||||
if (request()->isJson()) {
|
||||
$app_id = input("app_id", "");//支付宝应用ID (支付宝分配给开发者的应用ID)
|
||||
$private_key = input("private_key", "");//应用私钥
|
||||
$public_key = input("public_key", "");//应用公钥
|
||||
$alipay_public_key = input("alipay_public_key", "");//支付宝公钥
|
||||
$app_type = input("app_type", "");//支持端口 如web app
|
||||
$pay_status = input("pay_status", 0);//支付启用状态
|
||||
$refund_status = input("refund_status", 0);//退款启用状态
|
||||
$transfer_status = input("transfer_status", 0);//转账启用状态
|
||||
$public_key_crt = input("public_key_crt", "");
|
||||
$alipay_public_key_crt = input("alipay_public_key_crt", "");
|
||||
$alipay_with_crt = input("alipay_with_crt", "");
|
||||
$countersign_type = input("countersign_type", 0);//加签模式
|
||||
|
||||
$data = array (
|
||||
"app_id" => $app_id,
|
||||
"private_key" => $private_key,
|
||||
"public_key" => $public_key,
|
||||
"alipay_public_key" => $alipay_public_key,
|
||||
"refund_status" => $refund_status,
|
||||
"pay_status" => $pay_status,
|
||||
"transfer_status" => $transfer_status,
|
||||
"app_type" => $app_type,
|
||||
"public_key_crt" => $public_key_crt,
|
||||
"alipay_public_key_crt" => $alipay_public_key_crt,
|
||||
"alipay_with_crt" => $alipay_with_crt,
|
||||
"countersign_type" => $countersign_type
|
||||
);
|
||||
$result = $config_model->setPayConfig($data, $this->site_id, $this->app_module);
|
||||
return $result;
|
||||
} else {
|
||||
$info = $config_model->getPayConfig($this->site_id, $this->app_module, true)[ 'data' ][ 'value' ];
|
||||
|
||||
if (!empty($info)) {
|
||||
$app_type_arr = [];
|
||||
if (!empty($info[ 'app_type' ])) {
|
||||
$app_type_arr = explode(',', $info[ 'app_type' ]);
|
||||
}
|
||||
$info[ 'app_type_arr' ] = $app_type_arr;
|
||||
if (empty($info[ 'countersign_type' ])) {
|
||||
$info[ 'countersign_type' ] = 0;
|
||||
}
|
||||
}
|
||||
$this->assign("info", $info);
|
||||
$this->assign("app_type", Config::get("app_type"));
|
||||
|
||||
return $this->fetch("pay/config");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传微信支付证书
|
||||
*/
|
||||
public function uploadAlipayCrt()
|
||||
{
|
||||
$upload_model = new Upload();
|
||||
$site_id = request()->siteid();
|
||||
$name = input("name", "");
|
||||
$extend_type = [ 'crt' ];
|
||||
$param = array (
|
||||
"name" => "file",
|
||||
"extend_type" => $extend_type
|
||||
);
|
||||
|
||||
$site_id = max($site_id, 0);
|
||||
$result = $upload_model->setPath("common/alipay/crt/" . $site_id . "/")->file($param);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
294
addon/alipay/shop/view/pay/config.html
Executable file
294
addon/alipay/shop/view/pay/config.html
Executable file
@@ -0,0 +1,294 @@
|
||||
<style>
|
||||
.input-text span{margin-right: 15px;}
|
||||
</style>
|
||||
|
||||
<div class="layui-form form-wrap">
|
||||
<div class="layui-form-item balance-boday">
|
||||
<label class="layui-form-label">加签模式:</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-input-inline">
|
||||
{if $info}
|
||||
<input type="radio" name="countersign_type" lay-filter="type" value="0" title="公钥" autocomplete="off" class="layui-input len-long" {if $info.countersign_type == 0} checked {/if} >
|
||||
<input type="radio" name="countersign_type" lay-filter="type" value="1" title="公钥证书" autocomplete="off" class="layui-input len-long" {if $info.countersign_type == 1} checked {/if} >
|
||||
{else/}
|
||||
<input type="radio" name="countersign_type" lay-filter="type" value="0" title="公钥" autocomplete="off" class="layui-input len-long" checked>
|
||||
<input type="radio" name="countersign_type" lay-filter="type" value="1" title="公钥证书" autocomplete="off" class="layui-input len-long">
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<div class="word-aux">支付宝配置规则加签模式。</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">支付宝应用ID:</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="app_id" type="text" value="{$info.app_id ?? ''}" class="layui-input len-long">
|
||||
</div>
|
||||
<div class="word-aux"><span>[API_ID]</span>支付宝分配给开发者的应用ID</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">应用私钥:</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="private_key" class="layui-textarea len-long" placeholder="请输入应用私钥">{$info.private_key ?? ''}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if empty($info) || $info.countersign_type == 0}
|
||||
<div class="countersign_type_zero" >
|
||||
<div class="layui-form-item " >
|
||||
<label class="layui-form-label">应用公钥:</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="public_key" class="layui-textarea len-long" placeholder="请输入应用公钥">{$info.public_key ?? ''}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">支付宝公钥:</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="alipay_public_key" class="layui-textarea len-long" placeholder="请输入支付宝公钥">{$info.alipay_public_key ?? ''}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="countersign_type_one" style="display: none">
|
||||
<div class="layui-form-item ">
|
||||
<label class="layui-form-label">应用公钥证书:</label>
|
||||
<div class="layui-input-block">
|
||||
{notempty name="$info.public_key_crt"}
|
||||
<p class="file-upload">已上传</p>
|
||||
{else/}
|
||||
<p class="file-upload">未上传</p>
|
||||
{/notempty}
|
||||
<button type="button" class="layui-btn" id="public_key_upload">
|
||||
<i class="layui-icon"></i>上传文件
|
||||
</button>
|
||||
<input type="hidden" name="public_key_crt" class="layui-input len-long" value="{$info.public_key_crt ?? ''}">
|
||||
</div>
|
||||
<div class="word-aux">上传appCertPublicKey文件</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">支付宝公钥证书:</label>
|
||||
<div class="layui-input-block">
|
||||
{notempty name="$info.alipay_public_key_crt"}
|
||||
<p class="file-upload">已上传</p>
|
||||
{else/}
|
||||
<p class="file-upload">未上传</p>
|
||||
{/notempty}
|
||||
<button type="button" class="layui-btn" id="alipay_public_key_upload">
|
||||
<i class="layui-icon"></i>上传文件
|
||||
</button>
|
||||
<input type="hidden" name="alipay_public_key_crt" class="layui-input len-long" value="{$info.alipay_public_key_crt ?? ''}">
|
||||
</div>
|
||||
<div class="word-aux">上传alipayCertPublicKey文件</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">支付宝根证书:</label>
|
||||
<div class="layui-input-block">
|
||||
{notempty name="$info.alipay_with_crt"}
|
||||
<p class="file-upload">已上传</p>
|
||||
{else/}
|
||||
<p class="file-upload">未上传</p>
|
||||
{/notempty}
|
||||
<button type="button" class="layui-btn" id="alipay_with_upload">
|
||||
<i class="layui-icon"></i>上传文件
|
||||
</button>
|
||||
<input type="hidden" name="alipay_with_crt" class="layui-input len-long" value="{$info.alipay_with_crt ?? ''}">
|
||||
</div>
|
||||
<div class="word-aux">上传alipayRootCert文件</div>
|
||||
</div>
|
||||
</div>
|
||||
{else/}
|
||||
<div class="countersign_type_zero" style="display: none">
|
||||
<div class="layui-form-item " >
|
||||
<label class="layui-form-label">应用公钥:</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="public_key" class="layui-textarea len-long" placeholder="请输入应用公钥">{$info.public_key ?? ''}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">支付宝公钥:</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="alipay_public_key" class="layui-textarea len-long" placeholder="请输入支付宝公钥">{$info.alipay_public_key ?? ''}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="countersign_type_one">
|
||||
<div class="layui-form-item ">
|
||||
<label class="layui-form-label">应用公钥证书:</label>
|
||||
<div class="layui-input-block">
|
||||
{notempty name="$info.public_key_crt"}
|
||||
<p class="file-upload">已上传</p>
|
||||
{else/}
|
||||
<p class="file-upload">未上传</p>
|
||||
{/notempty}
|
||||
<button type="button" class="layui-btn" id="public_key_upload">
|
||||
<i class="layui-icon"></i>上传文件
|
||||
</button>
|
||||
<input type="hidden" name="public_key_crt" class="layui-input len-long" value="{$info.public_key_crt ?? ''}">
|
||||
</div>
|
||||
<div class="word-aux">上传appCertPublicKey文件</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">支付宝公钥证书:</label>
|
||||
<div class="layui-input-block">
|
||||
{notempty name="$info.alipay_public_key_crt"}
|
||||
<p class="file-upload">已上传</p>
|
||||
{else/}
|
||||
<p class="file-upload">未上传</p>
|
||||
{/notempty}
|
||||
<button type="button" class="layui-btn" id="alipay_public_key_upload">
|
||||
<i class="layui-icon"></i>上传文件
|
||||
</button>
|
||||
<input type="hidden" name="alipay_public_key_crt" class="layui-input len-long" value="{$info.alipay_public_key_crt ?? ''}">
|
||||
</div>
|
||||
<div class="word-aux">上传alipayCertPublicKey文件</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">支付宝根证书:</label>
|
||||
<div class="layui-input-block">
|
||||
{notempty name="$info.alipay_with_crt"}
|
||||
<p class="file-upload">已上传</p>
|
||||
{else/}
|
||||
<p class="file-upload">未上传</p>
|
||||
{/notempty}
|
||||
<button type="button" class="layui-btn" id="alipay_with_upload">
|
||||
<i class="layui-icon"></i>上传文件
|
||||
</button>
|
||||
<input type="hidden" name="alipay_with_crt" class="layui-input len-long" value="{$info.alipay_with_crt ?? ''}">
|
||||
</div>
|
||||
<div class="word-aux">上传alipayRootCert文件</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">支持端口:</label>
|
||||
<div class="input-text">
|
||||
{foreach $app_type as $app_type_k => $app_type_v}
|
||||
{if condition="$app_type_v['name'] !='微信小程序' && $app_type_v['name'] !='微信公众号'"}
|
||||
<span>{$app_type_v['name']}</span>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否启用支付:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="pay_status" value="1" lay-skin="switch" {if condition="$info && $info.pay_status == 1"} checked {/if} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否启用退款:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="refund_status" value="1" lay-skin="switch" {if condition="$info && $info.refund_status == 1"} checked {/if} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否启用转账:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="transfer_status" value="1" lay-skin="switch" {if condition="$info && $info.transfer_status == 1"} checked {/if} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="back()">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
layui.use('form', function() {
|
||||
var form = layui.form;
|
||||
var repeat_flag = false; //防重复标识
|
||||
form.render();
|
||||
|
||||
layui.form.on('radio(type)', function(data){
|
||||
if(data.value == 0){
|
||||
$(".countersign_type_zero").show();
|
||||
$(".countersign_type_one").hide();
|
||||
}else{
|
||||
$(".countersign_type_one").show();
|
||||
$(".countersign_type_zero").hide();
|
||||
}
|
||||
});
|
||||
|
||||
var public_key_upload = new Upload({
|
||||
elem: '#public_key_upload',
|
||||
url: ns.url("alipay://shop/pay/uploadalipaycrt"), //改成您自己的上传接口
|
||||
accept: 'file',
|
||||
callback:function (res) {
|
||||
if (res.code >= 0) {
|
||||
$("input[name='public_key_crt']").val(res.data.path);
|
||||
$("input[name='public_key_crt']").siblings(".file-upload").text("已上传");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var alipay_public_key_upload = new Upload({
|
||||
elem: '#alipay_public_key_upload',
|
||||
url: ns.url("alipay://shop/pay/uploadalipaycrt"), //改成您自己的上传接口
|
||||
accept: 'file',
|
||||
callback:function (res) {
|
||||
if (res.code >= 0) {
|
||||
$("input[name='alipay_public_key_crt']").val(res.data.path);
|
||||
$("input[name='alipay_public_key_crt']").siblings(".file-upload").text("已上传");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var alipay_with_upload = new Upload({
|
||||
elem: '#alipay_with_upload',
|
||||
url: ns.url("alipay://shop/pay/uploadalipaycrt"), //改成您自己的上传接口
|
||||
accept: 'file',
|
||||
callback:function (res) {
|
||||
if (res.code >= 0) {
|
||||
$("input[name='alipay_with_crt']").val(res.data.path);
|
||||
$("input[name='alipay_with_crt']").siblings(".file-upload").text("已上传");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听提交
|
||||
*/
|
||||
form.on('submit(save)', function(data) {
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
$.ajax({
|
||||
url: ns.url("alipay://shop/pay/config"),
|
||||
data: data.field,
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res){
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
layer.confirm('编辑成功', {
|
||||
title:'操作提示',
|
||||
btn: ['返回列表', '继续编辑'],
|
||||
yes: function(index, layero) {
|
||||
location.hash = ns.hash("shop/config/pay");
|
||||
layer.close(index);
|
||||
},
|
||||
btn2: function(index, layero) {
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function back(){
|
||||
location.hash = ns.hash("shop/config/pay");
|
||||
}
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user