示例#1
0
 /**
  * Tests HashMap->put()
  */
 public function testPut()
 {
     //组织请求参数
     //		$map = new HashMap();
     //		$map->put("merId","9996");
     //		$map->put("orderId",rand(100000,999999));
     //		$map->put("merDate",date("Ymd"));
     //		$map->put("amount","1");
     //		$map->put("version","3.0");
     //后台直连下订单
     //		$map = new HashMap();
     //		$map->put("merId", "9996");
     //		$map->put("goodsId", "1001");
     //		$map->put("mobileId", "13720040275");
     //		$map->put("orderId", "467242");
     //		$map->put("merDate", "20100402");
     //		$map->put("amount", "1");
     //		$map->put("amtType", "01");
     //		$map->put("bankType", "3");
     //		$map->put("notyfuUrl", "http://pay.test.umpay.com/pay/test/testNotify.jsp");
     //		$map->put("merPriv", "");
     //		$map->put("expand", "");
     //		$map->put("version", "3.0");
     //订单查询
     $map = new HashMap();
     $map->put("merId", "9996");
     $map->put("goodsId", "100");
     $map->put("orderId", "236798");
     $map->put("merDate", "20100302");
     $map->put("mobileId", "13910173623");
     $map->put("version", "3.0");
     //获取请求数据对象
     //		$reqData = MerToPlat::cancelByGet($map);//商户撤销
     //		$reqData = MerToPlat::directPayByGet($map);//后台直连下单
     $reqData = MerToPlat::queryTransByGet($map);
     //订单
     //获取请求URL
     $url = $reqData->getUrl();
     //		echo "\n" . $url;
     //请求平台取得平台响应结果
     $html = file_get_contents($url);
     //		echo "\n".$html;
     //解析平台响应数据
     //		$resData = PlatToMer::getCancelByHtml($html);//商户撤销职务
     //		$resData = PlatToMer::getDirectPayByHtml($html);//后台直连下单
     $resData = PlatToMer::getQueryTransByHtml($html);
     $retCode = $resData->get("retCode");
     //判断退费结果,retCode=0000为成功,其他为失败,
     if ($retCode == "0000") {
         echo "\n商户退费成功";
     } else {
         echo "\n商户退失败,响应码:" . $retCode;
     }
 }
$mer_cust_id = $_REQUEST['mer_cust_id'];
$usr_busi_agreement_id = $_REQUEST['usr_busi_agreement_id'];
$usr_pay_agreement_id = $_REQUEST['usr_pay_agreement_id'];
$map = new HashMap();
$map->put("service", $service);
$map->put("charset", $charset);
$map->put("mer_id", $mer_id);
$map->put("sign_type", $sign_type);
$map->put("res_format", $res_format);
$map->put("version", $version);
$map->put("trade_no", $trade_no);
//使用协议进行支付,上送如下参数:支付协议号必填、商户用户标识和用户业务协议号必填其一
$map->put("mer_cust_id", $mer_cust_id);
$map->put("usr_busi_agreement_id", $usr_busi_agreement_id);
$map->put("usr_pay_agreement_id", $usr_pay_agreement_id);
$reqData = MerToPlat::makeRequestDataByGet($map);
//这个是重要的
$sign = $reqData->getSign();
//这个是为了在本DEMO中显示签名结果。
$plain = $reqData->getPlain();
//这个是为了在本DEMO中显示签名原串
$url = $reqData->getUrl();
?>

  <body>
	<div id="HEADA"><?php 
include "./head.php";
?>
</div>
	<div id="MAINA">
		<div class="mindexa">
示例#3
0
try {
    //获取UMPAY平台请求商户的支付结果通知数据,并对请求数据进行验签
    //如验证平台签名正确,即应响应UMPAY平台返回码为0000。【响应返回码代表通知是否成功,和通知的交易结果(支付失败、支付成功)无关】
    //验签支付结果通知 如验签成功,则返回ret_code=0000
    $reqData = PlatToMer::getNotifyRequestData($data);
    $resData->put("ret_code", "0000");
} catch (Exception $e) {
    //如果验签失败,则抛出异常,返回ret_code=1111
    System . out . printf("验证签名发生异常" + $e);
    $resData->put("ret_code", "1111");
}
//验签后的数据都组织在resData中。
//生成平台响应UMPAY平台数据,将该串放入META标签,以下几个参数为结果通知必备参数
//生成平台响应UMPAY平台数据,将该串放入META标签
$resData->put("mer_id", $data->get("mer_id"));
$resData->put("sign_type", $data->get("sign_type"));
$resData->put("mer_date", $data->get("mer_date"));
$resData->put("order_id", $data->get("order_id"));
$resData->put("version", $data->get("version"));
$resData->put("ret_msg", "success");
$data = MerToPlat::notifyResponseData($resData);
//注意!商户在自己开发的过程中,请删除所有的中文注释,保证服务器接收响应的过程中不会英文导致乱码。
?>
<head>
<META NAME="MobilePayPlatform" CONTENT="<?php 
echo $data;
?>
" />
</head>
</html>
示例#4
0
$service = $_REQUEST['service'];
$charset = $_REQUEST['charset'];
$mer_id = $_REQUEST['mer_id'];
$sign_type = $_REQUEST['sign_type'];
$res_format = $_REQUEST['res_format'];
$version = $_REQUEST['version'];
$refund_no = $_REQUEST['refund_no'];
$map = new HashMap();
$map->put("service", $service);
$map->put("charset", $charset);
$map->put("mer_id", $mer_id);
$map->put("sign_type", $sign_type);
$map->put("res_format", $res_format);
$map->put("refund_no", $refund_no);
$map->put("version", $version);
$reqData = MerToPlat::requestTransactionsByGet($map);
$sign = $reqData->getSign();
//这个是为了在本DEMO中显示签名结果。
$plain = $reqData->getPlain();
//这个是为了在本DEMO中显示签名原串
$url = $reqData->getUrl();
?>

  <body>
    <div id="HEADA"><?php 
include "./head.php";
?>
</div>
    <div id="MAINA">
      <div class="mindexa">
        <div class="mleft">
示例#5
0
    //验签支付结果通知 如验签成功,则返回ret_code=0000
    $reqData = PlatToMer::getNotifyRequestData($data);
    $resData->put("ret_code", "0000");
} catch (Exception $e) {
    //如果验签失败,则抛出异常,返回ret_code=1111
    System . out . printf("验证签名发生异常" + $e);
    $resData->put("ret_code", "1111");
}
//验签后的数据都组织在resData中。
//生成平台响应UMPAY平台数据,将该串放入META标签,以下几个参数为结果通知必备参数
//生成平台响应UMPAY平台数据,将该串放入META标签
$resData->put("mer_id", $data->get("mer_id"));
$resData->put("sign_type", $data->get("sign_type"));
$resData->put("version", $data->get("version"));
$resData->put("ret_msg", "success");
$data = MerToPlat::RefundnotifyResponseData($resData);
//注意!商户在自己开发的过程中,请删除head里的中文,保证服务器接收响应的过程中不会英文导致乱码。商户开发请参照merNotify_3页面。
?>
 

  <head>
<!-- 商户响应平台支付结果通知,以此来告知平台收到了平台的支付结果通知,否则平台会继续发送支付结果通知 -->
<META NAME="MobilePayPlatform" CONTENT="<?php 
echo $data;
?>
" />

<title>商户接收退款结果通知验签及响组织响应平台数据</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="keywords" content="" />
<meta name="description" content="" />