本文整理汇总了PHP中AlipayNotify::verifyReturn方法的典型用法代码示例。如果您正苦于以下问题:PHP AlipayNotify::verifyReturn方法的具体用法?PHP AlipayNotify::verifyReturn怎么用?PHP AlipayNotify::verifyReturn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AlipayNotify
的用法示例。
在下文中一共展示了AlipayNotify::verifyReturn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: respond
function respond() {
ini_set("display_errors","On");
$where = array('ologin_code'=>front::$get['ologin_code']);
$ologins = ologin::getInstance()->getrows($where);
$ologin = unserialize_config($ologins[0]['ologin_config']);
//var_dump($ologin);
$aliapy_config['partner'] = $ologin['alipaylogin_id'];
$aliapy_config['key'] = $ologin['alipaylogin_key'];
$aliapy_config['return_url'] = ologin::url(basename(__FILE__,'.php'));
$aliapy_config['sign_type'] = 'MD5';
$aliapy_config['input_charset']= 'utf-8';
$aliapy_config['transport'] = 'http';
$aliapy_config['cacert'] = getcwd().'/lib/plugins/alipayauth/cacert.pem';
//var_dump($aliapy_config);
unset($_GET['case']);unset($_GET['act']);unset($_GET['ologin_code']);unset($_GET['site']);
require_once("alipayauth/alipay_notify.class.php");
$alipayNotify = new AlipayNotify($aliapy_config);
//var_dump($alipayNotify);
$verify_result = $alipayNotify->verifyReturn();
//var_dump($verify_result);
if($verify_result) {//验证成功
$user_id = front::$get['user_id'];
$token = front::$get['token'];
session::set('access_token',$token);
session::set("openid",$user_id);
return array('nickname'=> front::get('real_name'));
}
else {
echo "验证失败";exit;
}
}
示例2: verifyAlipayReturn
function verifyAlipayReturn(array $alipayConfig)
{
$alipayConfig = getAlipayConfig($alipayConfig);
$alipayNotify = new AlipayNotify($alipayConfig);
$verifyResult = $alipayNotify->verifyReturn();
return (bool) $verifyResult;
}
示例3: return_url
public function return_url()
{
import("@.ORG.Alipay.AlipayNotify");
$alipayNotify = new AlipayNotify($this->setconfig());
$verify_result = $alipayNotify->verifyReturn();
if ($verify_result) {
//商户订单号
$out_trade_no = $_GET['out_trade_no'];
//支付宝交易号
$trade_no = $_GET['trade_no'];
//交易状态
$trade_status = $_GET['trade_status'];
if ($_GET['trade_status'] == 'WAIT_SELLER_SEND_GOODS') {
$indent = M('Indent')->field('id,price')->where(array('index_id' => $out_trade_no))->find();
if ($indent !== false) {
//$back=M('Users')->where(array('id'=>$indent['uid']))->setInc('money',$indent['price']);
$back = M('Indent')->where(array('id' => $indent['id']))->setField('status', 1);
if ($back != false) {
$this->success('充值成功', U('Home/Index/index'));
} else {
$this->error('充值失败,请在线客服,为您处理', U('Home/Index/index'));
}
} else {
$this->error('订单不存在', U('Home/Index/index'));
}
} else {
$this->error('请勿重复操作', U('Home/Index/index'));
}
} else {
$this->error('充值失败 ,请在线客服,为您处理', U('Home/Index/index'));
}
}
示例4: actionVerify
function actionVerify()
{
unset($_GET['action']);
unset($_GET['module']);
unset($_GET['controller']);
$root_dir = Q::ini('app_config/ROOT_DIR');
require_once $root_dir . Q::ini('appini/alipay_dir') . "lib/alipay_notify.class.php";
//计算得出通知验证结果
$alipayNotify = new AlipayNotify(Q::ini('appini/payment/alipay'));
$verify_result = $alipayNotify->verifyReturn();
if ($verify_result) {
$out_trade_no = $_GET['out_trade_no'];
//获取订单号
$trade_no = $_GET['trade_no'];
//获取支付宝交易号
$total_fee = $_GET['price'];
//获取总价格
$rs = Invoice::find('order_number = ?', $_GET['out_trade_no'])->getOne();
if ($rs->id()) {
#$rs->total_fee = $total_fee;
$rs->trade_time = time();
$rs->trade_no = $trade_no;
$rs->trade_status = $_GET['trade_status'];
$rs->buyer_email = $_GET['buyer_email'];
$rs->trade_ip = $_SERVER['REMOTE_ADDR'];
$rs->save();
}
$msg = "付款成功!如果您选择的是即时到帐服务那么您的帐号已经生效。";
return $this->msg($msg, url('default::service/index'));
} else {
#dump($_GET);
return $this->msg('您好,为了保障数据有效性,我们采用异步通知收款,如果您的帐号未生效,请联系我们。', url('default::service/index'));
}
}
示例5: actionAlipayOrderReturn
public function actionAlipayOrderReturn()
{
require_once Yii::getAlias('@vendor') . "/payment/alipay/alipay.config.php";
require_once Yii::getAlias('@vendor') . "/payment/alipay/lib/alipay_notify.class.php";
$alipayNotify = new \AlipayNotify($alipay_config);
$verify_result = $alipayNotify->verifyReturn();
if ($verify_result) {
$out_trade_no = $_GET['out_trade_no'];
$trade_no = $_GET['trade_no'];
$trade_status = $_GET['trade_status'];
$model = Order::findOne(['order_sn' => $out_trade_no]);
if ($model) {
if ($trade_status === 'TRADE_SUCCESS' || $trade_status === 'TRADE_FINISHED') {
if ($model->pay()) {
$this->_sendMsg($model);
Yii::info("订单支付成功!订单号:{$out_trade_no}");
} else {
Yii::error("订单支付失败!订单号:{$out_trade_no}");
Yii::$app->session->setFlash('danger', '订单支付失败!');
}
} elseif ($trade_status === 'TRADE_CLOSED') {
Yii::$app->session->setFlash('warning', '订单未支付!');
}
}
} else {
throw new ForbiddenHttpException('参数非法。');
}
return $this->redirect(['/order/detail', 'order' => $model->order_sn]);
}
示例6: verifyReturn
public function verifyReturn()
{
require_once "alipay.config.php";
require_once "lib/alipay_notify.class.php";
$alipayNotify = new \AlipayNotify($alipay_config);
return $alipayNotify->verifyReturn();
}
示例7: paying_return
/**
* 支付宝即时即时跳转返回的结果
* @param string &$msg 提示信息
* @return bool 返回处理成功与否
*/
public static function paying_return(&$msg)
{
$alipay_config = AlipayConfig::config();
//计算得出通知验证结果
$alipayNotify = new AlipayNotify($alipay_config);
$verify_result = $alipayNotify->verifyReturn();
if (!$verify_result) {
/* TODO 由于验证总是失败,这里将其提示信息显示得友好些
$msg = '验证失败,请稍候查询余额';
return false;
*/
$msg = "系统正在处理,请稍候查询余额";
return true;
}
//验证成功
//商户订单号
$out_trade_no = $_GET['out_trade_no'];
//支付宝交易号
$trade_no = $_GET['trade_no'];
//交易状态
$trade_status = $_GET['trade_status'];
if (!in_array($_GET['trade_status'], array('TRADE_FINISHED', 'TRADE_SUCCESS'))) {
$msg = "验证失败(trade_status:" . $_GET['trade_status'] . ')';
return false;
}
//判断该笔订单是否在商户网站中已经做过处理
//如果没有做过处理,根据订单号(out_trade_no)在商户网站的
//订单系统中查到该笔订单的详细,并执行商户的业务程序
//如果有做过处理,不执行商户的业务程序
$db = Fn::db();
$time = time();
$row = TransactionRecordModel::transactionRecordInfoByTrNo($out_trade_no);
if (!$row) {
$msg = "查无未订单{$out_trade_no}";
return false;
}
if ($row['tr_flag'] == 1) {
$msg = '订单已更新';
return true;
}
if (!$db->beginTransaction()) {
$msg = "更新订单失败(事务启动失败)";
return false;
}
$param = array('tr_flag' => 1, 'tr_finishtime' => $time);
TransactionRecordModel::setTransactionRecordByTrNo($out_trade_no, $param);
$sql = <<<EOT
UPDATE rd_student SET account = account + ({$row['tr_trade_amount']})
WHERE uid = {$row['tr_uid']}
EOT;
$flag = $db->exec($sql);
if (!$db->commit()) {
$db->rollBack();
$msg = "更新订单失败(事务执行失败)";
return false;
}
$msg = "更新订单成功" . $_GET['trade_status'];
return true;
}
示例8: return_url
public function return_url()
{
import("@.ORG.Alipay.AlipayNotify");
$alipayNotify = new AlipayNotify($this->setconfig());
$verify_result = $alipayNotify->verifyReturn();
if ($verify_result) {
$out_trade_no = $this->_get('out_trade_no');
$trade_no = $this->_get('trade_no');
$trade_status = $this->_get('trade_status');
if ($this->_get('trade_status') == 'TRADE_FINISHED' || $this->_get('trade_status') == 'TRADE_SUCCESS') {
$product_cart_model = M('product_cart');
$order = $product_cart_model->where(array('orderid' => $out_trade_no))->find();
if (!$this->wecha_id) {
$this->wecha_id = $order['wecha_id'];
}
$sepOrder = 0;
if (!$order) {
$order = $product_cart_model->where(array('id' => $out_trade_no))->find();
$sepOrder = 1;
}
if ($order) {
if ($order['paid'] == 1) {
exit('该订单已经支付,请勿重复操作');
}
if (!$sepOrder) {
$product_cart_model->where(array('orderid' => $out_trade_no))->setField('paid', 1);
} else {
$product_cart_model->where(array('id' => $out_trade_no))->setField('paid', 1);
}
$member_card_create_db = M('Member_card_create');
$userCard = $member_card_create_db->where(array('token' => $this->token, 'wecha_id' => $this->wecha_id))->find();
$member_card_set_db = M('Member_card_set');
$thisCard = $member_card_set_db->where(array('id' => intval($userCard['cardid'])))->find();
$set_exchange = M('Member_card_exchange')->where(array('cardid' => intval($thisCard['id'])))->find();
$arr['token'] = $this->token;
$arr['wecha_id'] = $this->wecha_id;
$arr['expense'] = $order['price'];
$arr['time'] = time();
$arr['cat'] = 99;
$arr['staffid'] = 0;
$arr['score'] = intval($set_exchange['reward']) * $order['price'];
M('Member_card_use_record')->add($arr);
$userinfo_db = M('Userinfo');
$thisUser = $userinfo_db->where(array('token' => $thisCard['token'], 'wecha_id' => $arr['wecha_id']))->find();
$userArr = array();
$userArr['total_score'] = $thisUser['total_score'] + $arr['score'];
$userArr['expensetotal'] = $thisUser['expensetotal'] + $arr['expense'];
$userinfo_db->where(array('token' => $thisCard['token'], 'wecha_id' => $arr['wecha_id']))->save($userArr);
$this->redirect(U('Product/my', array('token' => $order['token'], 'wecha_id' => $order['wecha_id'], 'success' => 1)));
} else {
exit('订单不存在:' . $out_trade_no);
}
} else {
exit('付款失败');
}
} else {
exit('不存在的订单');
}
}
示例9: check
function check($result)
{
require_once "alipay/config.php";
require_once "alipay/lib/alipay_notify.class.php";
$alipayNotify = new \AlipayNotify($alipay_config);
$verify_result = $alipayNotify->verifyReturn($result);
return $verify_result;
}
示例10: returnVerify
public function returnVerify()
{
require_once "alipay/alipay_notify.class.php";
$alipayNotify = new AlipayNotify($this->_config);
$verify_result = $alipayNotify->verifyReturn();
//验证
if ($verify_result) {
return $_GET;
} else {
return false;
}
}
示例11: callback
public function callback()
{
es_session::start();
$aliapy_config['partner'] = $this->api['config']['app_key'];
$aliapy_config['key'] = $this->api['config']['app_secret'];
$aliapy_config['return_url'] = SITE_DOMAIN . APP_ROOT . "/api_callback.php?c=Taobao";
$aliapy_config['sign_type'] = 'MD5';
$aliapy_config['input_charset'] = 'utf-8';
$aliapy_config['transport'] = 'http';
require_once APP_ROOT_PATH . "system/api_login/taobao/alipay_notify.class.php";
unset($_GET['c']);
$alipayNotify = new AlipayNotify($aliapy_config);
$verify_result = $alipayNotify->verifyReturn();
if ($verify_result) {
//验证成功
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//请在这里加上商户的业务逻辑程序代码
//——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
//获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表
$user_id = $_GET['user_id'];
//支付宝用户id
$token = $_GET['token'];
//授权令牌
$real_name = $_GET['real_name'];
//执行商户的业务程序
$msg['id'] = $user_id;
$msg['name'] = $real_name;
$msg['field'] = 'taobao_id';
es_session::set("api_user_info", $msg);
$user_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where taobao_id = '" . $msg['id'] . "' and taobao_id <> ''");
if ($user_data) {
$user_current_group = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_group where id = " . intval($user_data['group_id']));
$user_group = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_group where score <=" . intval($user_data['score']) . " order by score desc");
if ($user_current_group['score'] < $user_group['score']) {
$user_data['group_id'] = intval($user_group['id']);
}
es_session::set("user_info", $user_data);
$GLOBALS['db']->query("update " . DB_PREFIX . "user set login_ip = '" . CLIENT_IP . "',login_time= " . TIME_UTC . ",group_id=" . intval($user_data['group_id']) . " where id =" . $user_data['id']);
//$GLOBALS['db']->query("update ".DB_PREFIX."deal_cart set user_id = ".intval($user_data['id'])." where session_id = '".es_session::id()."'");
es_session::delete("api_user_info");
app_recirect_preview();
} else {
app_redirect(url("shop", "user#api_login"));
}
//——请根据您的业务逻辑来编写程序(以上代码仅作参考)——
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
} else {
//验证失败
//如要调试,请看alipay_notify.php页面的return_verify函数,比对sign和mysign的值是否相等,或者检查$veryfy_result有没有返回true
echo "验证失败";
}
}
示例12: callback
public function callback()
{
es_session::start();
$aliapy_config['partner'] = $this->api['config']['app_key'];
$aliapy_config['key'] = $this->api['config']['app_secret'];
$aliapy_config['return_url'] = get_domain() . APP_ROOT . "/api_callback.php?c=Taobao";
$aliapy_config['sign_type'] = 'MD5';
$aliapy_config['input_charset'] = 'utf-8';
$aliapy_config['transport'] = 'http';
require_once APP_ROOT_PATH . "system/api_login/taobao/alipay_notify.class.php";
unset($_GET['c']);
$alipayNotify = new AlipayNotify($aliapy_config);
$verify_result = $alipayNotify->verifyReturn();
if ($verify_result) {
//验证成功
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//请在这里加上商户的业务逻辑程序代码
//——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
//获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表
$user_id = $_GET['user_id'];
//支付宝用户id
$token = $_GET['token'];
//授权令牌
$real_name = $_GET['real_name'];
//执行商户的业务程序
$msg['id'] = $user_id;
$msg['name'] = $real_name;
$msg['field'] = 'taobao_id';
es_session::set("api_user_info", $msg);
if (!$msg['name']) {
app_redirect(url("index"));
}
$user_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where taobao_id = '" . $msg['id'] . "' and taobao_id <> ''");
if ($user_data) {
require_once APP_ROOT_PATH . "system/libs/user.php";
auto_do_login_user($user_data['user_name'], $user_data['user_pwd'], $from_cookie = false);
es_session::delete("api_user_info");
app_recirect_preview();
} else {
$this->create_user();
app_redirect(url("shop", "user#stepone"));
}
//——请根据您的业务逻辑来编写程序(以上代码仅作参考)——
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
} else {
//验证失败
//如要调试,请看alipay_notify.php页面的return_verify函数,比对sign和mysign的值是否相等,或者检查$veryfy_result有没有返回true
echo "验证失败";
}
}
示例13: alipay_callback
function alipay_callback()
{
require_once "alipay/wap/alipay.config.php";
require_once "alipay/wap/lib/alipay_notify.class.php";
$out_trade_no = $_GET['out_trade_no'];
//商户订单号
$trade_no = $_GET['trade_no'];
//支付宝交易号
$result = $_GET['result'];
//交易状态
$alipayNotify = new AlipayNotify($alipay_config);
$verify_result = $alipayNotify->verifyReturn();
if ($verify_result) {
goto_app_callback(0, $out_trade_no);
} else {
//验证失败
//echo "验证失败";
goto_app_callback(1, $out_trade_no);
}
}
示例14: callback
public function callback()
{
require_once ROOT . '/libs/alipay_lib/alipay_notify.class.php';
$alipayNotify = new AlipayNotify($this->alipay_config);
$verify_result = $alipayNotify->verifyReturn();
$ret = array();
$ret["out_trade_no"] = $_REQUEST['out_trade_no'];
$ret["trade_no"] = $_REQUEST['trade_no'];
$trade_status = $_REQUEST['trade_status'];
//$verify_result=true;
if ($verify_result) {
if ($trade_status == 'TRADE_SUCCESS' || $trade_status == 'TRADE_FINISHED') {
$ret["result"] = "SUCCESS";
} else {
$ret["result"] = "FAIL";
}
} else {
$ret["result"] = "FAIL";
}
return $ret;
}
示例15: actionReturn
public function actionReturn()
{
// $alipayconf=new AlipayConfig();
// $alipay_config=$alipayconf->getAlipayConfig();
//计算得出通知验证结果
$alipayNotify = new AlipayNotify($this->alipay_config);
$verify_result = $alipayNotify->verifyReturn();
$ret_status = "";
$trade_status = "";
if ($verify_result) {
//验证成功
//商户订单号
$out_trade_no = $_GET['out_trade_no'];
//支付宝交易号
$trade_no = $_GET['trade_no'];
//交易状态
$trade_status = $_GET['trade_status'];
//交易目前所处的状态。成功状态的值只有两个:
//TRADE_FINISHED(普通即时到账的交易成功状态)
//TRADE_SUCCESS(开通了高级即时到账或机票分销产品后的交易成功状态)
if ($_GET['trade_status'] == 'TRADE_FINISHED' || $_GET['trade_status'] == 'TRADE_SUCCESS') {
//判断该笔订单是否在商户网站中已经做过处理
//如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
//如果有做过处理,不执行商户的业务程序
//下单,返回页面,单元清单。。。
$this->endTrade($out_trade_no, $trade_no, $trade_no);
$ret_status = "正常返回,下单成功";
//下单成功
} else {
//echo "trade_status=".$_GET['trade_status'];
$ret_status = "非正常返回,验证成功。";
}
} else {
//验证失败
//如要调试,请看alipay_notify.php页面的verifyReturn函数
$ret_status = "验证失败";
}
//var_dump($trade_status);exit;
$this->render('return', array('trade_status' => $trade_status, 'ret_status' => $ret_status));
}