First commit
This commit is contained in:
0
api/payment/notify/index.htm
Normal file
0
api/payment/notify/index.htm
Normal file
48
api/payment/notify/notify_alipay.php
Normal file
48
api/payment/notify/notify_alipay.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: notify_alipay.php 36342 2021-05-17 14:14:54Z dplugin $
|
||||
*/
|
||||
|
||||
define('IN_API', true);
|
||||
define('CURSCRIPT', 'api');
|
||||
define('DISABLEXSSCHECK', true);
|
||||
|
||||
require '../../../source/class/class_core.php';
|
||||
require '../payment_alipay.php';
|
||||
|
||||
$discuz = C::app();
|
||||
$discuz->init();
|
||||
|
||||
if(!$_POST['sign'] || !$_POST['sign_type']) {
|
||||
exit('fail');
|
||||
}
|
||||
$sign = $_POST['sign'];
|
||||
unset($_POST['sign']);
|
||||
|
||||
$payment = new payment_alipay();
|
||||
$isright = $payment->alipay_sign_verify($sign, $_POST);
|
||||
if(!$isright) {
|
||||
$_POST['sign'] = $sign;
|
||||
payment::paymentlog('alipay', 0, 0, 0, 50001, $_POST);
|
||||
exit('fail');
|
||||
}
|
||||
|
||||
if($_POST['trade_status'] == 'TRADE_SUCCESS') {
|
||||
$out_biz_no = $_POST['out_trade_no'];
|
||||
$payment_time = strtotime($_POST['gmt_payment']);
|
||||
|
||||
$is_success = payment::finish_order('alipay', $out_biz_no, $_POST['trade_no'], $payment_time);
|
||||
if($is_success) {
|
||||
exit('success');
|
||||
}
|
||||
} else {
|
||||
payment::paymentlog('alipay', 0, 0, 0, 50001, $_POST);
|
||||
}
|
||||
|
||||
exit('fail');
|
||||
|
||||
?>
|
37
api/payment/notify/notify_qpay.php
Normal file
37
api/payment/notify/notify_qpay.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
define('IN_API', true);
|
||||
define('CURSCRIPT', 'api');
|
||||
define('DISABLEXSSCHECK', true);
|
||||
|
||||
require '../../../source/class/class_core.php';
|
||||
require '../payment_qpay.php';
|
||||
|
||||
$discuz = C::app();
|
||||
$discuz->init();
|
||||
|
||||
$payment = new payment_qpay();
|
||||
|
||||
$data = $payment->qpay_sign_verify();
|
||||
if($data && $data['code'] == 200) {
|
||||
$data = $data['data'];
|
||||
$out_biz_no = $data['out_trade_no'];
|
||||
$payment_time = strtotime(preg_replace('/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/', '$1-$2-$3 $4:$5:$6', $data['time_end']));
|
||||
$is_success = payment::finish_order('qpay', $out_biz_no, $data['transaction_id'], $payment_time);
|
||||
if($is_success) {
|
||||
echo '<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>';
|
||||
exit();
|
||||
}
|
||||
} else {
|
||||
payment::paymentlog('qpay', 0, 0, 0, 50001, $data ? json_encode($data) : '');
|
||||
}
|
||||
|
||||
echo '<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[FAIL]]></return_msg></xml>';
|
||||
exit();
|
55
api/payment/notify/notify_wechat.php
Normal file
55
api/payment/notify/notify_wechat.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: notify_wechat.php 36342 2021-05-17 14:15:04Z dplugin $
|
||||
*/
|
||||
|
||||
define('IN_API', true);
|
||||
define('CURSCRIPT', 'api');
|
||||
define('DISABLEXSSCHECK', true);
|
||||
|
||||
require '../../../source/class/class_core.php';
|
||||
require '../payment_wechat.php';
|
||||
|
||||
$discuz = C::app();
|
||||
$discuz->init();
|
||||
|
||||
$payment = new payment_wechat();
|
||||
if($_SERVER['HTTP_WECHATPAY_SIGNATURE']) {
|
||||
$data = $payment->v3_wechat_sign_verify();
|
||||
if($data && $data['code'] == 200) {
|
||||
$data = json_decode($data['data'], true);
|
||||
if($data['trade_state'] == 'SUCCESS') {
|
||||
$out_biz_no = $data['out_trade_no'];
|
||||
$payment_time = strtotime($data['success_time']);
|
||||
$is_success = payment::finish_order('wechat', $out_biz_no, $data['transaction_id'], $payment_time);
|
||||
if($is_success) {
|
||||
exit('{"code":"SUCCESS","message":"ok"}');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
payment::paymentlog('wechat', 0, 0, 0, 50001, $data ? json_encode($data) : '');
|
||||
}
|
||||
exit('{"code":"fail","message":"fail"}');
|
||||
} else {
|
||||
$data = $payment->wechat_sign_verify();
|
||||
if($data && $data['code'] == 200) {
|
||||
$data = $data['data'];
|
||||
$out_biz_no = $data['out_trade_no'];
|
||||
$payment_time = strtotime(preg_replace('/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/', '$1-$2-$3 $4:$5:$6', $data['time_end']));
|
||||
$is_success = payment::finish_order('wechat', $out_biz_no, $data['transaction_id'], $payment_time);
|
||||
if($is_success) {
|
||||
echo '<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>';
|
||||
exit();
|
||||
}
|
||||
} else {
|
||||
payment::paymentlog('wechat', 0, 0, 0, 50001, $data ? json_encode($data) : '');
|
||||
}
|
||||
echo '<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[FAIL]]></return_msg></xml>';
|
||||
exit();
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user