本文整理汇总了PHP中AlipayNotify类的典型用法代码示例。如果您正苦于以下问题:PHP AlipayNotify类的具体用法?PHP AlipayNotify怎么用?PHP AlipayNotify使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AlipayNotify类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: alipay_notify_app
/**
* App支付Notify
*/
function alipay_notify_app()
{
$alipay_config_app = $this->config->item('alipay_config_app');
$alipayNotify = new AlipayNotify($alipay_config_app);
$verify_result = $alipayNotify->verifyNotify();
if ($verify_result) {
//验证成功
$out_trade_no = $_POST['out_trade_no'];
//支付宝交易号
$trade_no = $_POST['trade_no'];
//交易状态
$trade_status = $_POST['trade_status'];
$this->log_result('alipay_notify', "【支付宝回调App】:\n" . json_encode($_POST) . "\n");
if ($trade_status == 'TRADE_FINISHED' || $trade_status == 'TRADE_SUCCESS') {
//判断该笔订单是否在商户网站中已经做过处理
//如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
//如果有做过处理,不执行商户的业务程序
$order = $this->order_model->get_order_info($out_trade_no);
if ($order['TradeStatus'] != 'TRADE_FINISHED' && $order['TradeStatus'] != 'TRADE_SUCCESS') {
$data = array('TradeStatus' => $trade_status, 'TradeNo' => $trade_no, 'PayTime' => time(), 'PayType' => 'alipay');
$this->order_model->update_order_info($out_trade_no, $data);
}
}
//——请根据您的业务逻辑来编写程序(以上代码仅作参考)——
echo "success";
//请不要修改或删除
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
} else {
//验证失败
echo "fail";
//调试用,写文本函数记录程序运行情况是否正常
//logResult("这里写入想要调试的代码变量值,或其他运行的结果记录");
}
}
示例2: 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;
}
}
示例3: verifyReturn
public function verifyReturn()
{
require_once "alipay.config.php";
require_once "lib/alipay_notify.class.php";
$alipayNotify = new \AlipayNotify($alipay_config);
return $alipayNotify->verifyReturn();
}
示例4: ValidateNotification
public function ValidateNotification($txn_id = null)
{
parent::ValidateNotification($txn_id);
$alipay_config = $this->_getConfig();
$alipayNotify = new AlipayNotify($alipay_config);
return $alipayNotify->getResponse($txn_id);
}
示例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: notify
public function notify($req)
{
require_once __DIR__ . '/mobiAlipay/lib/alipay_notify.class.php';
//计算得出通知验证结果
$alipayNotify = new AlipayNotify($this->mobiAlipayConfig);
$verifyResult = $alipayNotify->verifyNotify();
if ($verifyResult) {
//商户订单号
$out_trade_no = $req['out_trade_no'];
//支付宝交易号
$trade_no = $req['trade_no'];
//交易状态
$trade_status = $req['trade_status'];
if ($req['trade_status'] == 'TRADE_FINISHED' || $req['trade_status'] == 'TRADE_SUCCESS') {
//处理订单状态
$uid = (new \Mall\Mdu\OrderModule())->setOrderStatus($out_trade_no, $_SERVER['REQUEST_TIME']);
if ($uid != 0) {
(new \Mall\Mdu\OrderLogsModule())->addOrderLogBySn($out_trade_no, $this->di['sysconfig']['orderActType']['successPayment'], $uid, '用户', '支付成功');
echo 'success';
} else {
echo 'fail';
}
}
} else {
echo "fail";
}
}
示例7: notify
function notify()
{
//计算得出通知验证结果
$alipayNotify = new AlipayNotify($this->alipay_config);
$verify_result = $alipayNotify->verifyNotify();
$this->log('deposit/notify ' . 'verify:' . ($verify_result ? 'true' : 'false') . ' ' . json_encode($_POST, JSON_UNESCAPED_UNICODE));
if ($verify_result) {
//验证成功
//商户订单号
$out_trade_no = $_POST['out_trade_no'];
//支付宝交易号
$trade_no = $_POST['trade_no'];
//交易状态
$trade_status = $_POST['trade_status'];
$deposit_id = intval($out_trade_no);
if (!$deposit_id) {
echo "fail";
return FALSE;
}
$record = DB::fetch_first('SELECT * FROM ' . DB::table('user_deposit') . ' WHERE ' . DB::implode(array('id' => $deposit_id)));
if (!$record) {
echo "fail";
return FALSE;
}
if ($record['status'] == TRADE_FINISHED) {
echo "success";
return TRUE;
}
switch ($trade_status) {
case 'WAIT_BUYER_PAY':
DB::update('user_deposit', array('trade_no' => $trade_no, 'status' => WAIT_BUYER_PAY, 'updatetime' => TIMESTAMP), array('id' => $deposit_id));
break;
case 'TRADE_CLOSED':
DB::update('user_deposit', array('status' => TRADE_CLOSED, 'updatetime' => TIMESTAMP), array('id' => $deposit_id));
break;
case 'WAIT_SELLER_SEND_GOODS':
$this->send_goods($record, $trade_no);
DB::update('user_deposit', array('status' => WAIT_BUYER_CONFIRM, 'updatetime' => TIMESTAMP), array('id' => $deposit_id));
break;
case 'WAIT_BUYER_CONFIRM_GOODS':
DB::update('user_deposit', array('status' => WAIT_BUYER_CONFIRM, 'updatetime' => TIMESTAMP), array('id' => $deposit_id));
break;
case 'TRADE_SUCCESS':
DB::update('user_deposit', array('status' => TRADE_UNSUPPORTED, 'updatetime' => TIMESTAMP), array('id' => $deposit_id));
break;
case 'TRADE_FINISHED':
DB::update('user_deposit', array('status' => TRADE_FINISHED, 'updatetime' => TIMESTAMP), array('id' => $deposit_id));
if ($record && $record['uid']) {
DB::query('UPDATE ' . DB::table('user_status') . ' SET ' . DB::quote_field('balance') . ' = ' . DB::quote_field('balance') . ' + ' . $record['price'] . ' WHERE ' . DB::implode(array('uid' => $record['uid'])));
}
break;
}
$this->log('deposit/notify id:' . $deposit_id . ' ' . $trade_status);
echo "success";
return TRUE;
} else {
echo "fail";
return FALSE;
}
}
示例8: actionNotifyUrl
public function actionNotifyUrl()
{
//计算得出通知验证结果
$alipayNotify = new \AlipayNotify($this->alipayConfig());
$verify_result = $alipayNotify->verifyNotify();
if ($verify_result) {
//验证成功
if ($_REQUEST['trade_status'] == 'TRADE_FINISHED') {
//退款日期超过可退款期限后(如三个月可退款),支付宝系统发送该交易状态通知
echo '退款';
} else {
if ($_REQUEST['trade_status'] == 'TRADE_SUCCESS') {
//付款完成后,支付宝系统发送该交易状态通知
if (ChargeOrder::getInstance()->setOrderStatus($_REQUEST['out_trade_no'])) {
// 设置订单状态
return $this->redirect('http://wechat.baihey.com/wap/site/main#/charge_order?orderId=' . $_REQUEST['out_trade_no'] . '&payType=4');
} else {
// 设置订单状态失败
return $this->redirect('http://wechat.baihey.com/wap/site/main#/charge_order?orderId=' . $_REQUEST['out_trade_no'] . '&payType=4');
}
} else {
// 未付款
return $this->redirect('http://wechat.baihey.com/wap/site/main#/charge_order?orderId=' . $_REQUEST['out_trade_no'] . '&payType=4');
}
}
echo "success";
//请不要修改或删除
} else {
//验证失败
echo "fail";
return $this->redirect('http://wechat.baihey.com/wap/site/main#/charge_order?orderId=' . $_REQUEST['out_trade_no'] . '&payType=4');
}
}
示例9: 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'));
}
}
示例10: alipayNotify
/**
* 支付宝回调
*/
public static function alipayNotify()
{
vendor('Alipay.Notify', COMMON_PATH . 'Vendor');
$alipay_config = C('ALIPAY');
$AlipayNotify = new \AlipayNotify($alipay_config);
return $AlipayNotify->verifyNotify();
}
示例11: 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('不存在的订单');
}
}
示例12: verifyAlipayNotify
function verifyAlipayNotify(array $alipayConfig)
{
$alipayConfig = getAlipayConfig($alipayConfig);
$alipayNotify = new AlipayNotify($alipayConfig);
$verifyResult = (bool) $alipayNotify->verifyNotify();
echo $verifyResult ? 'success' : 'fail';
return $verifyResult;
}
示例13: 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;
}
示例14: callback
/**
* 支付宝回调
* @param unknown $aParams
* @return Ambigous <验证结果, boolean>
*/
public static function callback($aParams)
{
require_once LIB_PATH . '/Payment/Alipay/alipay_service.class.php';
require_once LIB_PATH . '/Payment/Alipay/alipay_notify.class.php';
$alipay_config = Yaf_G::getConf('aliapy_config', null, 'alipay');
$alipayNotify = new AlipayNotify($alipay_config);
return $alipayNotify->verifyNotify($aParams);
}
示例15: endPay
function endPay($PassageInfo, $OrderInfo)
{
/* 商户号 */
$partner = $PassageInfo['StagePartnerId'];
/* 密钥 */
$key = $PassageInfo['StageSecureCode'];
require "AliPayClass/notify_url.php";
//计算得出通知验证结果
$alipayNotify = new AlipayNotify($aliapy_config);
$verify_result = $alipayNotify->verifyNotify();
if ($verify_result) {
//验证成功
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//请在这里加上商户的业务逻辑程序代
//——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
//获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表
$out_trade_no = $_REQUEST['out_trade_no'];
//获取订单号
$trade_no = $_REQUEST['trade_no'];
//获取支付宝交易号
$total_fee = $_REQUEST['total_fee'];
//获取总价格
if ($OrderInfo['OrderId'] == $out_trade_no && $total_fee == $OrderInfo['Coin']) {
$Pay['OrderId'] = $OrderInfo['OrderId'];
$Pay['PayUserId'] = $OrderInfo['PayUserId'];
$Pay['AcceptUserId'] = $OrderInfo['AcceptUserId'];
$Pay['PassageId'] = $OrderInfo['PassageId'];
$Pay['AppId'] = $OrderInfo['AppId'];
$Pay['PartnerId'] = $OrderInfo['PartnerId'];
$Pay['SubPassageId'] = $OrderInfo['SubPassageId'];
$Pay['Amount'] = $OrderInfo['Amount'];
$Pay['Coin'] = $OrderInfo['Coin'];
$Pay['Credit'] = $OrderInfo['Credit'];
$Pay['PayIP'] = $OrderInfo['PayIP'];
$Pay['PayTime'] = $OrderInfo['PayTime'];
$Pay['UserSourceId'] = $OrderInfo['UserSourceId'];
$Pay['UserSourceDetail'] = $OrderInfo['UserSourceDetail'];
$Pay['UserSourceProjectId'] = $OrderInfo['UserSourceProjectId'];
$Pay['UserSourceActionId'] = $OrderInfo['UserSourceActionId'];
$Pay['UserRegTime'] = $OrderInfo['UserRegTime'];
$Pay['PayedTime'] = strtotime($_REQUEST['notify_time']);
$Pay['StageOrder'] = $trade_no;
$Pay['comment'] = json_encode(array('buyer_email' => $_REQUEST['buyer_email'], 'buyer_id' => $_REQUEST['buyer_id']));
return $Pay;
} else {
return false;
}
//——请根据您的业务逻辑来编写程序(以上代码仅作参考)——
echo "success";
//请不要修改或删除
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
} else {
//验证失败
echo "fail";
//调试用,写文本函数记录程序运行情况是否正常
//logResult("这里写入想要调试的代码变量值,或其他运行的结果记录");
}
}