|
@@ -21,25 +21,37 @@ header ( 'Content-type:text/html;charset=utf-8' );
|
|
|
* 2)对后台交易发起交易状态查询:后台类资金类交易同步返回00,成功银联有后台通知,商户也可以发起 查询交易,可查询N次(不超过6次),每次时间间隔2N秒发起,即间隔1,2,4,8,16,32S查询(查询到03,04,05继续查询,否则终止查询)。
|
|
|
* 后台类资金类同步返03 04 05响应码及未得到银联响应(读超时)需发起查询交易,可查询N次(不超过6次),每次时间间隔2N秒发起,即间隔1,2,4,8,16,32S查询(查询到03,04,05继续查询,否则终止查询)。
|
|
|
*/
|
|
|
+/*
|
|
|
+class UnionQuery{
|
|
|
+ public static function query($orderId,$txnTime){
|
|
|
+ $params = array(
|
|
|
+ //以下信息非特殊情况不需要改动
|
|
|
+ 'version' => com\unionpay\acp\sdk\SDKConfig::getSDKConfig()->version, //版本号
|
|
|
+ 'encoding' => 'utf-8', //编码方式
|
|
|
+ 'signMethod' => com\unionpay\acp\sdk\SDKConfig::getSDKConfig()->signMethod, //签名方法
|
|
|
+ 'txnType' => '00', //交易类型
|
|
|
+ 'txnSubType' => '00', //交易子类
|
|
|
+ 'bizType' => '000000', //业务类型
|
|
|
+ 'accessType' => '0', //接入类型
|
|
|
+ 'channelType' => '07', //渠道类型
|
|
|
|
|
|
-$params = array(
|
|
|
- //以下信息非特殊情况不需要改动
|
|
|
- 'version' => com\unionpay\acp\sdk\SDKConfig::getSDKConfig()->version, //版本号
|
|
|
- 'encoding' => 'utf-8', //编码方式
|
|
|
- 'signMethod' => com\unionpay\acp\sdk\SDKConfig::getSDKConfig()->signMethod, //签名方法
|
|
|
- 'txnType' => '00', //交易类型
|
|
|
- 'txnSubType' => '00', //交易子类
|
|
|
- 'bizType' => '000000', //业务类型
|
|
|
- 'accessType' => '0', //接入类型
|
|
|
- 'channelType' => '07', //渠道类型
|
|
|
+ //TODO 以下信息需要填写
|
|
|
+ 'orderId' => $orderId, //请修改被查询的交易的订单号,8-32位数字字母,不能含“-”或“_”,此处默认取demo演示页面传递的参数
|
|
|
+ 'merId' => file_get_contents(__DIR__.'/../../assets/roots/mid.txt'), //商户代码,请改自己的测试商户号,此处默认取demo演示页面传递的参数
|
|
|
+ 'txnTime' => date('YmdHis',$txnTime), //请修改被查询的交易的订单发送时间,格式为YYYYMMDDhhmmss,此处默认取demo演示页面传递的参数
|
|
|
+ );
|
|
|
|
|
|
- //TODO 以下信息需要填写
|
|
|
- 'orderId' => $_POST["orderId"], //请修改被查询的交易的订单号,8-32位数字字母,不能含“-”或“_”,此处默认取demo演示页面传递的参数
|
|
|
- 'merId' => '777290058200548', //商户代码,请改自己的测试商户号,此处默认取demo演示页面传递的参数
|
|
|
- 'txnTime' => $_POST["txnTime"], //请修改被查询的交易的订单发送时间,格式为YYYYMMDDhhmmss,此处默认取demo演示页面传递的参数
|
|
|
-);
|
|
|
+ com\unionpay\acp\sdk\AcpService::sign ( $params ); // 签名
|
|
|
+ $url = com\unionpay\acp\sdk\SDKConfig::getSDKConfig()->singleQueryUrl;
|
|
|
|
|
|
-com\unionpay\acp\sdk\AcpService::sign ( $params ); // 签名
|
|
|
+ $result_arr = com\unionpay\acp\sdk\AcpService::post ( $params, $url);
|
|
|
+ return is_array($result_arr) && $result_arr["origRespCode"] == "00";
|
|
|
+ }
|
|
|
+}*/
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+/*com\unionpay\acp\sdk\AcpService::sign ( $params ); // 签名
|
|
|
$url = com\unionpay\acp\sdk\SDKConfig::getSDKConfig()->singleQueryUrl;
|
|
|
|
|
|
$result_arr = com\unionpay\acp\sdk\AcpService::post ( $params, $url);
|
|
@@ -82,7 +94,7 @@ if ($result_arr["respCode"] == "00"){
|
|
|
//其他应答码做以失败处理
|
|
|
//TODO
|
|
|
echo "失败:" . $result_arr["respMsg"] . "。<br>\n";
|
|
|
-}
|
|
|
+}*/
|
|
|
|
|
|
/**
|
|
|
* 打印请求应答
|
|
@@ -94,12 +106,12 @@ if ($result_arr["respCode"] == "00"){
|
|
|
* @param
|
|
|
* $resp
|
|
|
*/
|
|
|
-function printResult($url, $req, $resp) {
|
|
|
+/*function printResult($url, $req, $resp) {
|
|
|
echo "=============<br>\n";
|
|
|
echo "地址:" . $url . "<br>\n";
|
|
|
echo "请求:" . str_replace ( "\n", "\n<br>", htmlentities ( com\unionpay\acp\sdk\createLinkString ( $req, false, true ) ) ) . "<br>\n";
|
|
|
echo "应答:" . str_replace ( "\n", "\n<br>", htmlentities ( com\unionpay\acp\sdk\createLinkString ( $resp , false, false )) ) . "<br>\n";
|
|
|
echo "=============<br>\n";
|
|
|
-}
|
|
|
+}*/
|
|
|
|
|
|
|