|
ROOT_PATH."includes/modules/payment/icbc/ebb2cpublic.crt",
//私有证书地址
'cert_private_file' => ROOT_PATH."includes/modules/payment/icbc/chamago.crt",
//私钥地址
'cert_key_file' => ROOT_PATH."includes/modules/payment/icbc/chamago.key",
);
//解析数据
$s_notify_data = base64_decode($s_notify_data);
//验证签名
$o_icbc_b2cutil = new COM('ICBCEBANKUTIL.B2CUtil');
$o_icbc_b2cutil->init($a_parameter['cert_public_file'], $a_parameter['cert_private_file'], $a_parameter['cert_key_file'], '12345678');
$i_is_ok = $o_icbc_b2cutil->verifySignC($s_notify_data, strlen($s_notify_data), $s_sign_msg, strlen($s_sign_msg));
if ($i_is_ok != 0) {
return FALSE;
}
$o_xml = new DOMDocument();
$o_xml->loadXML($s_notify_data);
$i_trade_status = $o_xml->getElementsByTagName('tranStat')->item(0)->textContent;
$d_pay_price = $o_xml->getElementsByTagName('amount')->item(0)->textContent;
$d_pay_price = number_format($d_pay_price / 100, 2, '.', '');
if ($i_trade_status != 1) {
##########################################################
$content =@ file_get_contents(ROOT_PATH.'_icbc_data.txt');
$content .= "order trade status! log_id: $i_log_id , trade_status : false, $i_trade_status \n";
@ file_put_contents(ROOT_PATH.'_icbc_data.txt', $content);
##########################################################
return FALSE;
}
/* 检查支付的金额是否相符 */
if (! check_money($i_log_id, $d_pay_price)) {
##########################################################
$content =@ file_get_contents(ROOT_PATH.'_icbc_data.txt');
$content .= "order check money! log_id: $i_log_id , money : error, $d_pay_price \n";
@ file_put_contents(ROOT_PATH.'_icbc_data.txt', $content);
##########################################################
return false;
}
/* 改变订单状态 */
order_paid($i_log_id);
##########################################################
$content =@ file_get_contents(ROOT_PATH.'_icbc_data.txt');
$content .= "order pay success! log_id: $i_log_id , pay_price: $d_pay_price \n";
@ file_put_contents(ROOT_PATH.'_icbc_data.txt', $content);
##########################################################
return TRUE;
}
}
?>
|
|
|