本文整理汇总了PHP中order_paid函数的典型用法代码示例。如果您正苦于以下问题:PHP order_paid函数的具体用法?PHP order_paid怎么用?PHP order_paid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了order_paid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: respond
/**
* 响应操作
*/
function respond()
{
$payment = get_payment_info('chinabank');
$v_oid = trim($_POST['v_oid']);
$v_pmode = trim($_POST['v_pmode']);
$v_pstatus = trim($_POST['v_pstatus']);
$v_pstring = trim($_POST['v_pstring']);
$v_amount = trim($_POST['v_amount']);
$v_moneytype = trim($_POST['v_moneytype']);
$remark1 = trim($_POST['remark1']);
$remark2 = trim($_POST['remark2']);
$v_md5str = trim($_POST['v_md5str']);
/**
* 重新计算md5的值
*/
$key = $payment['ytauthkey'];
$md5string = strtoupper(md5($v_oid . $v_pstatus . $v_amount . $v_moneytype . $key));
/* 检查秘钥是否正确 */
if ($v_md5str == $md5string) {
if ($v_pstatus == '20') {
/* 改变订单状态 */
if (!order_paid($v_oid)) {
return false;
}
return true;
}
} else {
return false;
}
}
示例2: respond
/**
* 响应操作
*/
function respond()
{
$payment = get_payment_info('alipay');
$partner = trim($payment['partnerid']);
$key = trim($payment['ytauthkey']);
$sign_type = "MD5";
$_input_charset = "GBK";
$transport = "http";
$alipay = new alipay_notify($partner, $key, $sign_type, $_input_charset, $transport);
$verify_result = $alipay->return_verify();
if ($verify_result) {
//验证成功
$dingdan = $_GET['out_trade_no'];
//获取订单号
$total_fee = $_GET['total_fee'];
//获取总价格
return order_paid($dingdan);
} else {
return false;
}
}
示例3: respond
/**
* 响应操作
*/
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($order_sn);
/* 检查支付的金额是否相符 */
if (!check_money($order_sn, $_GET['total_fee'])) {
return false;
}
/* 检查数字签名是否正确 */
ksort($_GET);
reset($_GET);
$sign = '';
foreach ($_GET as $key => $val) {
if ($key != 'sign' && $key != "n" && $key !== "h" && $key != "at" && $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 ($_GET['trade_status'] == 'TRADE_FINISHED') {
// echo $order_sn;
// exit;
/* 改变订单状态 */
return order_paid($order_sn);
// true;
} else {
return false;
}
}
示例4: respond
/**
* 响应操作
*/
function respond()
{
if (!empty($_POST)) {
foreach ($_POST as $key => $data) {
$_GET[$key] = $data;
}
}
$payment = 'alipaywap';
$order_sn = trim($_GET['out_trade_no']);
$sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('order_info') . " WHERE order_sn = '{$order_sn}'";
$order = $GLOBALS['db']->getRow($sql);
$order_id = $order['order_id'];
$sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('pay_log') . " WHERE order_id = '{$order_id}'";
$pay_log = $GLOBALS['db']->getRow($sql);
$log_id = $pay_log['log_id'];
if ($_GET['result'] == 'success') {
/* 改变订单状态 */
order_paid($log_id, 2);
return true;
} else {
return false;
}
}
示例5: respond
/**
* 响应操作
*/
function respond()
{
$payment = get_payment_info('tenpay');
$key = $payment['ytauthkey'];
/* 创建支付应答对象 */
$resHandler = new PayResponseHandler();
$resHandler->setKey($key);
if ($resHandler->isTenpaySign()) {
//商户单号
$sp_billno = $resHandler->getParameter("sp_billno");
//财付通交易单号
$transaction_id = $resHandler->getParameter("transaction_id");
//金额,以分为单位
$total_fee = $resHandler->getParameter("total_fee");
$pay_result = $resHandler->getParameter("pay_result");
if ("0" == $pay_result) {
return order_paid($sp_billno);
} else {
return false;
}
} else {
return false;
}
}
示例6: respond
/**
* 响应操作
*/
function respond()
{
if (!empty($_POST)) {
foreach ($_POST as $key => $data) {
$_GET[$key] = $data;
}
}
$payment = get_payment("alipay");
$payment = unserialize_config($payment['pay_config']);
$alipay_config = array();
$alipay_config['partner'] = $payment['alipay_partner'];
//安全检验码,以数字和字母组成的32位字符
//如果签名方式设置为“MD5”时,请设置该参数
$alipay_config['key'] = $payment['alipay_key'];
//商户的私钥(后缀是.pen)文件相对路径
//如果签名方式设置为“0001”时,请设置该参数
$alipay_config['private_key_path'] = '';
//$alipay_config['private_key_path'] = 'key/rsa_private_key.pem';
//支付宝公钥(后缀是.pen)文件相对路径
//如果签名方式设置为“0001”时,请设置该参数
$alipay_config['ali_public_key_path'] = '';
//$alipay_config['ali_public_key_path']= 'key/alipay_public_key.pem';
//签名方式 不需修改
$alipay_config['sign_type'] = 'MD5';
//字符编码格式 目前支持 gbk 或 utf-8
$alipay_config['input_charset'] = 'utf-8';
//$alipay_config['cacert'] = ROOT_PATH .'mobile/includes/modules/cacert.pem';
$alipay_config['cacert'] = '';
//ca证书路径地址,用于curl中ssl校验
//请保证cacert.pem文件在当前文件夹目录中
//$alipay_config['cacert'] = getcwd().'\\cacert.pem';
//访问模式,根据自己的服务器是否支持ssl访问,若支持请选择https;若不支持请选择http
$alipay_config['transport'] = 'http';
require_once ROOT_PATH . "includes/modules/lib/alipay_notify.class.php";
$alipayNotify = new AlipayNotify($alipay_config);
$verify_result = $alipayNotify->verifyReturn();
if ($verify_result) {
$out_trade_no = trim($_GET['out_trade_no']);
$order_sn = trim(substr($out_trade_no, 0, 13));
$log_id = get_order_id_by_sn($order_sn);
order_paid($log_id);
//$sql = "SELECT l.`log_id` FROM " . $GLOBALS['hhs']->table('order_info')." as info LEFT JOIN ". $GLOBALS['hhs']->table('pay_log') ." as l ON l.order_id=info.order_id WHERE info.order_sn = '$order_sn'";
//$order_log_id = $GLOBALS['db']->getOne($sql);
return true;
} else {
return false;
}
}
示例7: respond
/**
* 响应操作
*/
function respond()
{
$payment = get_payment(basename(__FILE__, '.php'));
$merchant_acctid = $payment['shenzhou_account'];
//收款帐号 不可空
$key = $payment['shenzhou_key'];
$get_merchant_acctid = trim($_REQUEST['merchantAcctId']);
//接收的收款帐号
$pay_result = trim($_REQUEST['payResult']);
$version = trim($_REQUEST['version']);
$language = trim($_REQUEST['language']);
$sign_type = trim($_REQUEST['signType']);
$pay_type = trim($_REQUEST['payType']);
//20代表神州行卡密直接支付;22代表快钱账户神州行余额支付
$card_umber = trim($_REQUEST['cardNumber']);
$card_pwd = trim($_REQUEST['cardPwd']);
$order_id = trim($_REQUEST['orderId']);
//订单号
$order_time = trim($_REQUEST['orderTime']);
$order_amount = trim($_REQUEST['orderAmount']);
$deal_id = trim($_REQUEST['dealId']);
//获取该交易在快钱的交易号
$ext1 = trim($_REQUEST['ext1']);
$ext2 = trim($_REQUEST['ext2']);
$pay_amount = trim($_REQUEST['payAmount']);
//获取实际支付金额
$bill_order_time = trim($_REQUEST['billOrderTime']);
$pay_result = trim($_REQUEST['payResult']);
//10代表支付成功; 11代表支付失败
$sign_type = trim($_REQUEST['signType']);
$sign_msg = trim($_REQUEST['signMsg']);
//生成加密串。必须保持如下顺序。
$merchant_signmsgval = $this->append_param($merchant_signmsgval, "merchantAcctId", $merchant_acctid);
$merchant_signmsgval = $this->append_param($merchant_signmsgval, "version", $version);
$merchant_signmsgval = $this->append_param($merchant_signmsgval, "language", $language);
$merchant_signmsgval = $this->append_param($merchant_signmsgval, "payType", $pay_type);
$merchant_signmsgval = $this->append_param($merchant_signmsgval, "cardNumber", $card_number);
$merchant_signmsgval = $this->append_param($merchant_signmsgval, "cardPwd", $card_pwd);
$merchant_signmsgval = $this->append_param($merchant_signmsgval, "orderId", $order_id);
$merchant_signmsgval = $this->append_param($merchant_signmsgval, "orderAmount", $order_amount);
$merchant_signmsgval = $this->append_param($merchant_signmsgval, "dealId", $deal_id);
$merchant_signmsgval = $this->append_param($merchant_signmsgval, "orderTime", $order_time);
$merchant_signmsgval = $this->append_param($merchant_signmsgval, "ext1", $ext1);
$merchant_signmsgval = $this->append_param($merchant_signmsgval, "ext2", $ext2);
$merchant_signmsgval = $this->append_param($merchant_signmsgval, "payAmount", $pay_amount);
$merchant_signmsgval = $this->append_param($merchant_signmsgval, "billOrderTime", $bill_order_time);
$merchant_signmsgval = $this->append_param($merchant_signmsgval, "payResult", $pay_result);
$merchant_signmsgval = $this->append_param($merchant_signmsgval, "signType", $sign_type);
$merchant_signmsgval = $this->append_param($merchant_signmsgval, "key", $key);
$merchant_signmsg = md5($merchant_signmsgval);
//首先对获得的商户号进行比对
if ($get_merchant_acctid != $merchant_acctid) {
//'商户号错误';
return false;
}
if (strtoupper($sign_msg) == strtoupper($merchant_signmsg)) {
if ($pay_result == 10) {
order_paid($ext1);
return true;
} elseif ($pay_result == 11 && $pay_amount > 0) {
$sql = "SELECT order_amount FROM " . $GLOBALS['ecs']->table('order_info') . "WHERE order_id = '{$order_id}'";
$get_order_amount = $GLOBALS['db']->getOne($sql);
if ($get_order_amount == $pay_amount && $get_order_amount == $order_amount) {
order_paid($ext1);
return true;
} elseif ($get_order_amount == $order_amount && $pay_amount > 0) {
$surplus_amount = $get_order_amount - $pay_amount;
//计算订单剩余金额
$sql = 'UPDATE' . $GLOBALS['ecs']->table('order_info') . "SET `money_paid` = (money_paid + '{$pay_amount}')," . " order_amount = (order_amount - '{$pay_amount}') WHERE order_id = '{$order_id}'";
$result = $GLOBALS['db']->query($sql);
$sql = 'UPDATE' . $GLOBALS['ecs']->table('order_info') . "SET `order_status` ='" . OS_CONFIRMED . "' WHERE order_id = '{$orderId}'";
$result = $GLOBALS['db']->query($sql);
//order_paid($orderId, PS_UNPAYED);
//'订单金额小于0';
return false;
} else {
//'订单金额不相等';
return false;
}
} else {
//'实际支付金额不能小于0';
return false;
}
} else {
//'签名校对错误';
return false;
}
}
示例8: respond
function respond()
{
$payment = get_payment($_GET['code']);
$billno = $_GET['billno'];
$amount = $_GET['amount'];
$mydate = $_GET['date'];
$succ = $_GET['succ'];
$msg = $_GET['msg'];
$ipsbillno = $_GET['ipsbillno'];
$retEncodeType = $_GET['retencodetype'];
$currency_type = $_GET['Currency_type'];
$signature = $_GET['signature'];
$order_sn = intval(substr($billno, 0, 10));
if ($succ == 'Y')
{
$content = $billno . $amount . $mydate . $succ . $ipsbillno . $currency_type;
$cert = $payment['ips_key'];
$signature_1ocal = md5($content . $cert);
if ($signature_1ocal == $signature)
{
if (!check_money($order_sn, $amount))
{
return false;
}
order_paid($order_sn);
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
示例9: respond
/**
* 接受通知处理订单。
* @param undefined $log_id
* 20141125
*/
function respond()
{
$notify = new Notify_pub();
//存储微信的回调
$xml = $GLOBALS['HTTP_RAW_POST_DATA'];
$notify->saveData($xml);
if ($notify->checkSign() == FALSE) {
$notify->setReturnParameter("return_code", "FAIL");
//返回状态码
$notify->setReturnParameter("return_msg", "签名失败");
//返回信息
} else {
$notify->setReturnParameter("return_code", "SUCCESS");
//设置返回码
}
$returnXml = $notify->returnXml();
echo $returnXml;
$log_ = new Log_();
$log_name = ROOT_PATH . "wxpay/demo/notify_url.log";
//log文件路径
if ($notify->checkSign() == TRUE) {
if ($notify->data["return_code"] == "FAIL") {
//此处应该更新一下订单状态,商户自行增删操作
$log_->log_result($log_name, "【通信出错】:\n" . $xml . "\n");
} elseif ($notify->data["result_code"] == "FAIL") {
//此处应该更新一下订单状态,商户自行增删操作
$log_->log_result($log_name, "【业务出错】:\n" . $xml . "\n");
} else {
$order = $notify->getData();
$log_id = $order["out_trade_no"];
order_paid($log_id);
//$wxpay = new wxpay();
//$wxpay->respond($order["out_trade_no"]);
//此处应该更新一下订单状态,商户自行增删操作
$log_->log_result($log_name, "【支付成功】:\n" . $order["out_trade_no"] . "\n");
}
}
}
示例10: respond
/**
* 处理函数
*/
function respond()
{
if ($_REQUEST['succ'] == '1') {
$_REQUEST['c_succmark'] = 'Y';
}
if ($_REQUEST['succ'] == '0') {
$_REQUEST['c_succmark'] = 'N';
}
//echo 'OK';
//exit;
$payment = get_payment('ecbank_webatm');
//驗證碼
$checkcode = trim($payment['ecbank_webatm_checkcode']);
// 組合字串
$serial = trim($_REQUEST['proc_date'] . $_REQUEST['proc_time'] . $_REQUEST['tsr']);
// 回傳的交易驗證壓碼
$tac = trim($_REQUEST['tac']);
$c_order = trim($_REQUEST['od_sob']);
$c_orderamount = $_REQUEST['amt'];
$ecbank_gateway = 'https://ecbank.com.tw/web_service/get_outmac_valid.php';
$post_parm = 'key=' . $checkcode . '&serial=' . $serial . '&tac=' . $tac;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $ecbank_gateway);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_parm);
$strAuth = curl_exec($ch);
if (curl_errno($ch)) {
$strAuth = false;
}
curl_close($ch);
if (check_money($c_order, $c_orderamount)) {
$checkAmount = "1";
}
//print_r($strAuth); echo "<hr>";
//echo "here:".$tac_valid; exit;
if ($strAuth == 'valid=1') {
if ($_REQUEST['succ'] == '1' && $checkAmount == "1") {
//$sql = 'UPDATE ' . $GLOBALS['ecs']->table('pay_log') . " SET is_paid = '0' WHERE log_id = '$c_order'";
//$GLOBALS['db']->query($sql);
if ($_REQUEST['inv_error'] == "0") {
$note .= ',發票開立成功。';
} else {
if ($_REQUEST['inv_error'] == "") {
$note .= ',未開立發票。';
} else {
$note .= ',發票錯誤代碼' . $_REQUEST['inv_error'];
}
}
order_paid($c_order, PS_PAYED, $note);
return true;
}
} else {
//print_r($_REQUEST);
$def_url = '不合法的交易';
return $def_url;
//echo '不合法的交易:'.$strAut;
return false;
exit;
}
}
示例11: respond
/**
* 处理函数
*/
function respond()
{
//exit;
$payment = get_payment('allpay_card24');
$timestamp = time();
$key = trim($payment['allpay_card24_key']);
$iv = trim($payment['allpay_card24_iv']);
$order_id = $_REQUEST['MerchantTradeNo'];
$log_id = $_REQUEST['log_id'];
$mer_id = $_REQUEST['MerchantID'];
$input_array = array("MerchantID" => $mer_id, "MerchantTradeNo" => $order_id, "TimeStamp" => $timestamp);
ksort($input_array);
$checkvalue = "HashKey={$key}&" . urldecode(http_build_query($input_array)) . "&HashIV={$iv}";
$checkvalue = strtolower(urlencode($checkvalue));
$checkvalue = md5($checkvalue);
$input_array["CheckMacValue"] = $checkvalue;
$sned_string = http_build_query($input_array);
$gateway = "https://payment.allpay.com.tw/Cashier/QueryTradeInfo";
//$gateway = "http://payment-stage.allpay.com.tw/Cashier/QueryTradeInfo";
$result = $this->get_result($gateway, $sned_string);
if (check_money($log_id, $_REQUEST['TradeAmt'])) {
$checkAmount = "1";
}
parse_str($result, $res);
//echo $_REQUEST['RtnCode'] . "||" . $checkAmount . "||" . $res["TradeStatus"] . "||" . $res["TradeAmt"] . "||" . $_REQUEST['TradeAmt'] . "||";
if ($_REQUEST['RtnCode'] == '1' && $checkAmount == '1' && $res["TradeStatus"] == "1" && $res["TradeAmt"] == $_REQUEST['TradeAmt']) {
$note = "付款完成" . date("Y-m-d H:i:s");
order_paid($log_id, PS_PAYED, $note);
return true;
} else {
return false;
}
}
示例12: do_incharge
public function do_incharge()
{
$order_id = intval($_REQUEST['order_id']);
$payment_id = intval($_REQUEST['payment_id']);
$payment_info = M("Payment")->getById($payment_id);
$memo = $_REQUEST['memo'];
$order_info = M("DealOrder")->where("id=" . $order_id . " and is_delete = 0 and type = 0")->find();
if (!$order_info) {
$this->error(l("INVALID_ORDER"));
}
if ($order_info['region_lv4'] > 0) {
$region_id = $order_info['region_lv4'];
} elseif ($order_info['region_lv3'] > 0) {
$region_id = $order_info['region_lv3'];
} elseif ($order_info['region_lv2'] > 0) {
$region_id = $order_info['region_lv2'];
} else {
$region_id = $order_info['region_lv1'];
}
$delivery_id = $order_info['delivery_id'];
$payment_id = intval($_REQUEST['payment_id']);
$goods_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_order_item where order_id = " . $order_id);
$GLOBALS['user_info']['id'] = $order_info['user_id'];
require_once APP_ROOT_PATH . "system/model/cart.php";
$result = count_buy_total($region_id, $delivery_id, $payment_id, $account_money = 0, $all_account_money = 0, $ecvsn, $ecvpassword, $goods_list, $order_info['account_money'], $order_info['ecv_money'], $order_info['bank_id']);
$user_money = M("User")->where("id=" . $order_info['user_id'])->getField("money");
//$pay_amount = $order_info['deal_total_price']+ $order_info['delivery_fee']-$order_info['account_money']-$order_info['ecv_money']+$payment_info['fee_amount'];
$pay_amount = $result['pay_price'];
if ($payment_info['class_name'] == 'Account' && $user_money < $pay_amount) {
$this->error(l("ACCOUNT_NOT_ENOUGH"));
}
$notice_id = make_payment_notice($pay_amount, $order_id, $payment_id, $memo);
$order_info['total_price'] = $result['pay_total_price'];
$order_info['payment_fee'] = $result['payment_fee'];
$order_info['delivery_fee'] = $result['delivery_fee'];
$order_info['discount_price'] = $result['user_discount'];
$order_info['payment_id'] = $payment_info['id'];
$order_info['update_time'] = NOW_TIME;
M("DealOrder")->save($order_info);
$payment_notice = M("PaymentNotice")->getById($notice_id);
$rs = payment_paid($payment_notice['id']);
if ($rs && $payment_info['class_name'] == 'Account') {
//余额支付
require_once APP_ROOT_PATH . "system/payment/Account_payment.php";
require_once APP_ROOT_PATH . "system/model/user.php";
$msg = sprintf($payment_lang['USER_ORDER_PAID'], $order_info['order_sn'], $payment_notice['notice_sn']);
modify_account(array('money' => "-" . $payment_notice['money'], 'score' => 0), $payment_notice['user_id'], $msg);
}
if ($rs) {
order_paid($order_id);
$msg = sprintf(l("MAKE_PAYMENT_NOTICE_LOG"), $order_info['order_sn'], $payment_notice['notice_sn']);
save_log($msg, 1);
order_log($msg . $_REQUEST['memo'], $order_id);
$this->assign("jumpUrl", U("DealOrder/view_order", array("id" => $order_id)));
$this->success(l("ORDER_INCHARGE_SUCCESS"));
} else {
$this->assign("jumpUrl", U("DealOrder/view_order", array("id" => $order_id)));
$this->success(l("ORDER_INCHARGE_FAILED"));
}
}
示例13: respond
/**
* 响应操作
*/
function respond()
{
$payment = get_payment(basename(__FILE__, '.php'));
$v_tempdate = explode('-', $_REQUEST['v_oid']);
//接受返回数据验证开始
//v_md5info验证
$md5info_paramet = $_REQUEST['v_oid'] . $_REQUEST['v_pstatus'] . $_REQUEST['v_pstring'] . $_REQUEST['v_pmode'];
$md5info_tem = $this->hmac_md5($payment['cappay_key'], $md5info_paramet);
//v_md5money验证
$md5money_paramet = $_REQUEST['v_amount'] . $_REQUEST['v_moneytype'];
$md5money_tem = $this->hmac_md5($payment['cappay_key'], $md5money_paramet);
if ($md5info_tem == $_REQUEST['v_md5info'] && $md5money_tem == $_REQUEST['v_md5money']) {
//改变订单状态
order_paid($v_tempdate[2]);
return true;
} else {
return false;
}
}
示例14: respond
/**
* 响应操作
*/
function respond()
{
$payment = get_payment('upop');
$arr_args = array();
$arr_reserved = array();
if (is_array($_POST)) {
$arr_args = $_POST;
$cupReserved = isset($arr_args['cupReserved']) ? $arr_args['cupReserved'] : '';
parse_str(substr($cupReserved, 1, -1), $arr_reserved);
//去掉前后的{}
} else {
$cupReserved = '';
$pattern = '/cupReserved=(\\{.*?\\})/';
if (preg_match($pattern, $_POST, $match)) {
//先提取cupReserved
$cupReserved = $match[1];
}
//将cupReserved的value清除(因为含有&, parse_str没法正常处理)
$args_r = preg_replace($pattern, 'cupReserved=', $_POST);
parse_str($args_r, $arr_args);
$arr_args['cupReserved'] = $cupReserved;
parse_str(substr($cupReserved, 1, -1), $arr_reserved);
//去掉前后的{}
}
//提取服务器端的签名
if (!isset($arr_args['signature'])) {
return false;
}
//验证签名
$signature = $this->sign($arr_args, $payment['upop_security_key'], 'md5');
if ($signature != $arr_args['signature']) {
return false;
}
$arr_ret = array_merge($arr_args, $arr_reserved);
unset($arr_ret['cupReserved']);
if ($arr_ret['respCode'] != '00') {
return false;
}
if (!strpos($arr_ret['orderNumber'], '-')) {
return false;
}
$order_sn_arr = explode('-', $arr_ret['orderNumber']);
$order_sn = $order_sn_arr['0'];
$pay_id = intval($order_sn_arr['1']);
$payment_amount = intval($arr_ret['settleAmount']);
// 检查商户账号是否一致。
if ($payment['upop_account'] != $arr_ret['merId']) {
return false;
}
// 检查价格是否一致
if (!check_money($pay_id, $payment_amount / 100)) {
return false;
}
// 如果未支付成功。
if ($arr_ret['respCode'] != '00') {
return false;
}
$action_note = $arr_ret['respCode'] . ':' . $arr_ret['respMsg'] . $GLOBALS['_LANG']['upop_txn_id'] . ':' . $arr_ret['qid'];
// 完成订单。
order_paid($pay_id, PS_PAYED, $action_note);
//告诉用户交易完成
return true;
}
示例15: respond
/**
* 處理函數
*/
function respond()
{
$arPayment = get_payment('ecshop_ecpay_barcode');
$isTestMode = $arPayment['ecshop_ecpay_barcode_test_mode'] == 'Yes';
$arFeedback = null;
$arQueryFeedback = null;
$szLogID = $_GET['log_id'];
$szOrderID = $_GET['order_id'];
//$isPaymentInfo = ($_GET['pi'] == 'true');
$this->HashKey = trim($arPayment['ecshop_ecpay_barcode_key']);
$this->HashIV = trim($arPayment['ecshop_ecpay_barcode_iv']);
try {
// 取得回傳的付款結果。
$arFeedback = $this->CheckOutFeedback();
if (sizeof($arFeedback) > 0) {
// 查詢付款結果資料。
$this->ServiceURL = $isTestMode ? "https://payment-stage.ecpay.com.tw/Cashier/QueryTradeInfo/v2" : "https://payment.ecpay.com.tw/Cashier/QueryTradeInfo/V2";
$this->MerchantID = trim($arPayment['ecshop_ecpay_barcode_account']);
$this->Query['MerchantTradeNo'] = $arFeedback['MerchantTradeNo'];
$arQueryFeedback = $this->QueryTradeInfo();
if (sizeof($arQueryFeedback) > 0) {
$arOrder = order_info($szOrderID);
// 檢查支付金額與訂單是否相符。
if (round($arOrder['order_amount']) == $arFeedback['TradeAmt'] && $arQueryFeedback['TradeAmt'] == $arFeedback['TradeAmt']) {
$szCheckAmount = '1';
}
// 確認產生條碼。
if ($arFeedback['RtnCode'] == '10100073' && $szCheckAmount == '1' && $arQueryFeedback["TradeStatus"] == '0') {
$szPaymentType = $arFeedback['PaymentType'];
$szTradeDate = $arFeedback['TradeDate'];
$szBankCode = $arFeedback['PaymentNo'];
$szExpireDate = $arFeedback['ExpireDate'];
$szBarcode1 = $arFeedback['Barcode1'];
$szBarcode2 = $arFeedback['Barcode2'];
$szBarcode3 = $arFeedback['Barcode3'];
$szNote = sprintf($GLOBALS['_LANG']['text_paying'], date("Y-m-d H:i:s"), $szPaymentType, $szTradeDate, $szBankCode, $szExpireDate, $szBarcode1, $szBarcode2, $szBarcode3);
order_paid($szLogID, PS_PAYING, $szNote);
/* 修改此次交易狀態為未付款 */
$sql = 'UPDATE ' . $GLOBALS['ecs']->table('pay_log') . " SET is_paid = '0' WHERE log_id = '{$szLogID}'";
$GLOBALS['db']->query($sql);
ob_get_clean();
print '1|OK';
exit;
}
// 確認付款結果。
if ($arFeedback['RtnCode'] == '1' && $szCheckAmount == '1' && $arQueryFeedback["TradeStatus"] == '1') {
$szNote = $GLOBALS['_LANG']['text_paid'] . date("Y-m-d H:i:s");
order_paid($szLogID, PS_PAYED, $szNote);
if ($_GET['background']) {
echo '1|OK';
exit;
} else {
return true;
}
} else {
if ($_GET['background']) {
echo !$szCheckAmount ? '0|訂單金額不符。' : $arFeedback['RtnMsg'];
exit;
} else {
return false;
}
}
} else {
throw new Exception('ECPay 查無訂單資料。');
}
}
} catch (Exception $ex) {
/* 例外處理 */
}
return false;
}