Server : Apache System : Linux iZ2vcgyutqttsd1p850kl8Z 3.10.0-1160.92.1.el7.x86_64 #1 SMP Tue Jun 20 11:48:01 UTC 2023 x86_64 User : www ( 1000) PHP Version : 5.6.40 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv Directory : /www/wwwroot/saimikebio.com/includes/modules/payment/ |
<?php /** * ECSHOP 支付宝插件 * ============================================================================ * * 版权所有 2005-2012 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: douqinghua $ * $Id: alipay.php 17217 2011-01-19 06:29:08Z douqinghua $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/payment/alipay.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /* 模块的基本信息 */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'alipay_desc'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '1'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.alipay.com'; /* 版本号 */ $modules[$i]['version'] = '1.0.2'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => 'alipay_account', 'type' => 'text', 'value' => ''), array('name' => 'alipay_key', 'type' => 'text', 'value' => ''), array('name' => 'alipay_partner', 'type' => 'text', 'value' => '') ); return; } /** * 类 */ class alipay { /** * 构造函数 * * @access public * @param * * @return void */ function __construct() { $this->alipay(); } function alipay() { } /** * 生成支付代码 * @param array $order 订单信息 * @param array $payment 支付方式信息 */ function get_code($order, $payment) { if (!defined('EC_CHARSET')) { $charset = 'utf-8'; } else { $charset = EC_CHARSET; } $extend_param = 'isv^sh22'; $parameter = array( 'extend_param' => $extend_param, 'service' => 'create_direct_pay_by_user', 'partner' => $payment['alipay_partner'], //'partner' => ALIPAY_ID, '_input_charset' => $charset, 'notify_url' => return_url(basename(__FILE__, '.php')), 'return_url' => return_url(basename(__FILE__, '.php')), /* 业务参数 */ 'subject' => $order['order_sn'], 'out_trade_no' => $order['order_sn'] . $order['log_id'], 'price' => $order['order_amount'], 'quantity' => 1, 'payment_type' => 1, /* 物流参数 */ 'logistics_type' => 'EXPRESS', 'logistics_fee' => 0, 'logistics_payment' => 'BUYER_PAY_AFTER_RECEIVE', /* 买卖双方信息 */ 'seller_email' => $payment['alipay_account'] ); ksort($parameter); reset($parameter); $param = ''; $sign = ''; foreach ($parameter AS $key => $val) { $param .= "$key=" .urlencode($val). "&"; $sign .= "$key=$val&"; } $param = substr($param, 0, -1); $sign = substr($sign, 0, -1). $payment['alipay_key']; //$sign = substr($sign, 0, -1). ALIPAY_AUTH; $button = '<input class="btn-buy" type="button" onclick="javascript:window.location.href=\'https://mapi.alipay.com/gateway.do?'.$param. '&sign='.md5($sign).'&sign_type=MD5\'" value="' .$GLOBALS['_LANG']['pay_button']. '" />'; return $button; } /** * 响应操作 */ function respond() { if (!empty($_POST)) { foreach($_POST as $key => $data) { $_GET[$key] = $data; } } $payment = get_payment($_GET['code']); $seller_email = rawurldecode($_GET['seller_email']); $order_sn = str_replace($_GET['subject'], '', $_GET['out_trade_no']); $order_sn = trim(addslashes($order_sn)); /* 检查数字签名是否正确 */ ksort($_GET); reset($_GET); $sign = ''; foreach ($_GET AS $key=>$val) { if ($key != 'sign' && $key != 'sign_type' && $key != 'code') { $sign .= "$key=$val&"; } } $sign = substr($sign, 0, -1) . $payment['alipay_key']; //$sign = substr($sign, 0, -1) . ALIPAY_AUTH; if (md5($sign) != $_GET['sign']) { return false; } /* 检查支付的金额是否相符 */ if (!check_money($order_sn, $_GET['total_fee'])) { return false; } if ($_GET['trade_status'] == 'WAIT_SELLER_SEND_GOODS') { /* 改变订单状态 */ order_paid($order_sn, 2); return true; } elseif ($_GET['trade_status'] == 'TRADE_FINISHED') { /* 改变订单状态 */ order_paid($order_sn); return true; } elseif ($_GET['trade_status'] == 'TRADE_SUCCESS') { /* 改变订单状态 */ order_paid($order_sn, 2); return true; } else { return false; } } } ?>