* : : ,
* : 2015-09
* : 1.0.0
* :
* : , , 。 ,
* : :open.unionpay.com 《 》,
* 《 - 5 - 》( , - )
* 《 3 》( )
* :1) open :
* https://open.unionpay.com/ajweb/help/faq/list FAQ
* 6 https://open.unionpay.com/ajweb/help/respCode/respCodeList
* 2) : open.unionpay.com “ ”, QQ 。
* :1) , .
* 2) (Form_6_5_Query) : (5 、10 、30 、60 、120 ) , , 。( , , )。 payTimeout( ), , 。
*/
public function getsubmit(){
header ( 'Content-type:text/html;charset=utf-8' );
//include_once $_SERVER ['DOCUMENT_ROOT'] . '/upacp_demo_b2c/sdk/acp_service.php';
$order = M('order');
$data = $order->where(array('payNum'=>$_GET['order']))->select();
$money =0;
foreach($data as $k=>$v){
$money+=$data[$k]['money'];
}
/* dump($_GET['number']);
exit; */
//$money = $money*100;
$params = array(
//
'version' => '5.0.0', //
'encoding' => 'utf-8', //
'txnType' => '01', //
'txnSubType' => '01', //
'bizType' => '000201', //
'frontUrl' => 'http://wwww.****.com/UnionPay/frontUrl', //
'backUrl' => 'http://wwww.****.com/UnionPay/backUrl', //
'signMethod' => '01', //
'channelType' => '07', // ,07-PC,08-
'accessType' => '0', //
'currencyCode' => '156', // , 156
//TODO
'merId' => '********', // , , demo
'orderId' => $_GET['order'], // ,8-32 , “-” “_”, demo ,
'txnTime' => date('YmdHis',time()), // , YYYYMMDDhhmmss, , demo
'txnAmt' => '1', // , , demo
// 'reqReserved' =>' ', // , , 、 、 ,
//TODO special_use_purchase.php
);
com\unionpay\acp\sdk\AcpService::sign ( $params );
$uri = com\unionpay\acp\sdk\SDK_FRONT_TRANS_URL;
$html_form = com\unionpay\acp\sdk\AcpService::createAutoFormHtml( $params, $uri );
echo $html_form;
}
public function frontUrl(){
//dump($_GET);
//dump($_POST);
//dump(com\unionpay\acp\sdk\SDK_LOG_FILE_PATH);
vendor('UnionPay.sdk.acp_service');
if (isset ( $_POST ['signature'] )) {
$code = com\unionpay\acp\sdk\AcpService::validate ( $_POST ) ? ' ' : ' ';
if($code==' '){
$out_trade_no = $_POST ['orderId']; //
$respCode = $_POST ['respCode']; // respCode=00 A6
if($respCode=='00' || $respCode=='A6'){
$this ->redirect('Member/orderList');
}else{
echo ' ';
}
}else{
//echo $code;
}
} else {
echo ' ';
}
}
public function backUrl(){
if (isset ( $_POST ['signature'] )) {
vendor('UnionPay.sdk.acp_service');
//echo com\unionpay\acp\sdk\AcpService::validate ( $_POST ) ? ' ' : ' ';
$orderId = $_POST ['orderId']; //
$respCode = $_POST ['respCode']; // respCode=00 A6
$code = com\unionpay\acp\sdk\AcpService::validate ( $_POST ) ? ' ' : ' ';
if($code==' '){
if($respCode=='00' || $respCode=='A6'){
$this ->redirect('Member/orderList');
}else{
echo ' ';
}
}else{
//echo $code;
}
} else {
echo ' ';
}
//dump($_GET);
}
}