添加后台代理代码
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/* *
|
||||
* 功能:支付宝手机网站alipay.data.dataservice.bill.downloadurl.query (查询对账单下载地址)接口业务参数封装
|
||||
* 版本:2.0
|
||||
* 修改日期:2016-11-01
|
||||
* 说明:
|
||||
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
|
||||
*/
|
||||
|
||||
|
||||
class AlipayDataDataserviceBillDownloadurlQueryContentBuilder
|
||||
{
|
||||
|
||||
// 账单类型
|
||||
private $billType;
|
||||
|
||||
// 账单时间
|
||||
private $billDate;
|
||||
|
||||
private $bizContentarr = array();
|
||||
|
||||
private $bizContent = NULL;
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
if(!empty($this->bizContentarr)){
|
||||
$this->bizContent = json_encode($this->bizContentarr,JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getBillType()
|
||||
{
|
||||
return $this->billType;
|
||||
}
|
||||
|
||||
public function setBillType($billType)
|
||||
{
|
||||
$this->billType = $billType;
|
||||
$this->bizContentarr['bill_type'] = $billType;
|
||||
}
|
||||
|
||||
public function getBillDate()
|
||||
{
|
||||
return $this->billDate;
|
||||
}
|
||||
|
||||
public function setBillDate($billDate)
|
||||
{
|
||||
$this->billDate = $billDate;
|
||||
$this->bizContentarr['bill_date'] = $billDate;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/* *
|
||||
* 功能:支付宝手机网站alipay.trade.close (统一收单交易关闭接口)业务参数封装
|
||||
* 版本:2.0
|
||||
* 修改日期:2016-11-01
|
||||
* 说明:
|
||||
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
|
||||
*/
|
||||
|
||||
|
||||
class AlipayTradeCloseContentBuilder
|
||||
{
|
||||
|
||||
// 商户订单号.
|
||||
private $outTradeNo;
|
||||
|
||||
// 支付宝交易号
|
||||
private $tradeNo;
|
||||
//卖家端自定义的的操作员 ID
|
||||
private $operatorId;
|
||||
|
||||
private $bizContentarr = array();
|
||||
|
||||
private $bizContent = NULL;
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
if(!empty($this->bizContentarr)){
|
||||
$this->bizContent = json_encode($this->bizContentarr,JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getTradeNo()
|
||||
{
|
||||
return $this->tradeNo;
|
||||
}
|
||||
|
||||
public function setTradeNo($tradeNo)
|
||||
{
|
||||
$this->tradeNo = $tradeNo;
|
||||
$this->bizContentarr['trade_no'] = $tradeNo;
|
||||
}
|
||||
|
||||
public function getOutTradeNo()
|
||||
{
|
||||
return $this->outTradeNo;
|
||||
}
|
||||
|
||||
public function setOutTradeNo($outTradeNo)
|
||||
{
|
||||
$this->outTradeNo = $outTradeNo;
|
||||
$this->bizContentarr['out_trade_no'] = $outTradeNo;
|
||||
}
|
||||
public function getOperatorId()
|
||||
{
|
||||
return $this->operatorId;
|
||||
}
|
||||
|
||||
public function setOperatorId($operatorId)
|
||||
{
|
||||
$this->operatorId = $operatorId;
|
||||
$this->bizContentarr['operator_id'] = $operatorId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/* *
|
||||
* 功能:支付宝手机网站alipay.trade.fastpay.refund.query (统一收单交易退款查询)业务参数封装
|
||||
* 版本:2.0
|
||||
* 修改日期:2016-11-01
|
||||
* 说明:
|
||||
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
|
||||
*/
|
||||
|
||||
|
||||
class AlipayTradeFastpayRefundQueryContentBuilder
|
||||
{
|
||||
|
||||
// 商户订单号.
|
||||
private $outTradeNo;
|
||||
// 支付宝交易号
|
||||
private $tradeNo;
|
||||
// 请求退款接口时,传入的退款请求号,如果在退款请求时未传入,则该值为创建交易时的外部交易号
|
||||
private $outRequestNo;
|
||||
|
||||
private $bizContentarr = array();
|
||||
|
||||
private $bizContent = NULL;
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
if(!empty($this->bizContentarr)){
|
||||
$this->bizContent = json_encode($this->bizContentarr,JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getTradeNo()
|
||||
{
|
||||
return $this->tradeNo;
|
||||
}
|
||||
|
||||
public function setTradeNo($tradeNo)
|
||||
{
|
||||
$this->tradeNo = $tradeNo;
|
||||
$this->bizContentarr['trade_no'] = $tradeNo;
|
||||
}
|
||||
|
||||
public function getOutTradeNo()
|
||||
{
|
||||
return $this->outTradeNo;
|
||||
}
|
||||
|
||||
public function setOutTradeNo($outTradeNo)
|
||||
{
|
||||
$this->outTradeNo = $outTradeNo;
|
||||
$this->bizContentarr['out_trade_no'] = $outTradeNo;
|
||||
}
|
||||
public function getOutRequestNo()
|
||||
{
|
||||
return $this->outRequestNo;
|
||||
}
|
||||
public function setOutRequestNo($outRequestNo)
|
||||
{
|
||||
$this->outRequestNo = $outRequestNo;
|
||||
$this->bizContentarr['out_request_no'] = $outRequestNo;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/* *
|
||||
* 功能:支付宝手机网站查询接口(alipay.trade.query)接口业务参数封装
|
||||
* 版本:2.0
|
||||
* 修改日期:2016-11-01
|
||||
* 说明:
|
||||
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
|
||||
*/
|
||||
|
||||
|
||||
class AlipayTradeQueryContentBuilder
|
||||
{
|
||||
|
||||
// 商户订单号.
|
||||
private $outTradeNo;
|
||||
|
||||
// 支付宝交易号
|
||||
private $tradeNo;
|
||||
|
||||
private $bizContentarr = array();
|
||||
|
||||
private $bizContent = NULL;
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
if(!empty($this->bizContentarr)){
|
||||
$this->bizContent = json_encode($this->bizContentarr,JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getTradeNo()
|
||||
{
|
||||
return $this->tradeNo;
|
||||
}
|
||||
|
||||
public function setTradeNo($tradeNo)
|
||||
{
|
||||
$this->tradeNo = $tradeNo;
|
||||
$this->bizContentarr['trade_no'] = $tradeNo;
|
||||
}
|
||||
|
||||
public function getOutTradeNo()
|
||||
{
|
||||
return $this->outTradeNo;
|
||||
}
|
||||
|
||||
public function setOutTradeNo($outTradeNo)
|
||||
{
|
||||
$this->outTradeNo = $outTradeNo;
|
||||
$this->bizContentarr['out_trade_no'] = $outTradeNo;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
/* *
|
||||
* 功能:支付宝手机网站退款接口(alipay.trade.refund)接口业务参数封装
|
||||
* 版本:2.0
|
||||
* 修改日期:2016-11-01
|
||||
* 说明:
|
||||
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
|
||||
*/
|
||||
|
||||
|
||||
class AlipayTradeRefundContentBuilder_wappay
|
||||
{
|
||||
// 商户订单号.
|
||||
private $outTradeNo;
|
||||
|
||||
// 支付宝交易号
|
||||
private $tradeNo;
|
||||
|
||||
// 退款的金额
|
||||
private $refundAmount;
|
||||
|
||||
// 退款原因说明
|
||||
private $refundReason;
|
||||
|
||||
// 标识一次退款请求号,同一笔交易多次退款保证唯一,部分退款此参数必填
|
||||
private $outRequestNo;
|
||||
|
||||
private $bizContentarr = array();
|
||||
|
||||
private $bizContent = null;
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
if (!empty($this->bizContentarr))
|
||||
{
|
||||
$this->bizContent = json_encode($this->bizContentarr, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getTradeNo()
|
||||
{
|
||||
return $this->tradeNo;
|
||||
}
|
||||
|
||||
public function setTradeNo($tradeNo)
|
||||
{
|
||||
$this->tradeNo = $tradeNo;
|
||||
$this->bizContentarr['trade_no'] = $tradeNo;
|
||||
}
|
||||
|
||||
public function getOutTradeNo()
|
||||
{
|
||||
return $this->outTradeNo;
|
||||
}
|
||||
|
||||
public function setOutTradeNo($outTradeNo)
|
||||
{
|
||||
$this->outTradeNo = $outTradeNo;
|
||||
$this->bizContentarr['out_trade_no'] = $outTradeNo;
|
||||
}
|
||||
|
||||
public function getRefundAmount()
|
||||
{
|
||||
return $this->refundAmount;
|
||||
}
|
||||
|
||||
public function setRefundAmount($refundAmount)
|
||||
{
|
||||
$this->refundAmount = $refundAmount;
|
||||
$this->bizContentarr['refund_amount'] = $refundAmount;
|
||||
}
|
||||
|
||||
public function getRefundReason()
|
||||
{
|
||||
return $this->refundReason;
|
||||
}
|
||||
|
||||
public function setRefundReason($refundReason)
|
||||
{
|
||||
$this->refundReason = $refundReason;
|
||||
$this->bizContentarr['refund_reason'] = $refundReason;
|
||||
}
|
||||
|
||||
public function getOutRequestNo()
|
||||
{
|
||||
return $this->outRequestNo;
|
||||
}
|
||||
|
||||
public function setOutRequestNo($outRequestNo)
|
||||
{
|
||||
$this->outRequestNo = $outRequestNo;
|
||||
$this->bizContentarr['out_request_no'] = $outRequestNo;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
/* *
|
||||
* 功能:支付宝手机网站支付接口(alipay.trade.wap.pay)接口业务参数封装
|
||||
* 版本:2.0
|
||||
* 修改日期:2016-11-01
|
||||
* 说明:
|
||||
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
|
||||
*/
|
||||
|
||||
|
||||
class AlipayTradeWapPayContentBuilder
|
||||
{
|
||||
// 订单描述,可以对交易或商品进行一个详细地描述,比如填写"购买商品2件共15.00元"
|
||||
private $body;
|
||||
|
||||
// 订单标题,粗略描述用户的支付目的。
|
||||
private $subject;
|
||||
|
||||
// 商户订单号.
|
||||
private $outTradeNo;
|
||||
|
||||
// (推荐使用,相对时间) 支付超时时间,5m 5分钟
|
||||
private $timeExpress;
|
||||
|
||||
// 订单总金额,整形,此处单位为元,精确到小数点后2位,不能超过1亿元
|
||||
private $totalAmount;
|
||||
|
||||
// 如果该字段为空,则默认为与支付宝签约的商户的PID,也就是appid对应的PID
|
||||
private $sellerId;
|
||||
|
||||
// 产品标示码,固定值:QUICK_WAP_PAY
|
||||
private $productCode;
|
||||
|
||||
// 回传参数
|
||||
private $passbackParams;
|
||||
|
||||
private $bizContentarr = array();
|
||||
|
||||
private $bizContent = NULL;
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
if (!empty($this->bizContentarr))
|
||||
$this->bizContent = json_encode($this->bizContentarr, JSON_UNESCAPED_UNICODE);
|
||||
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->bizContentarr['productCode'] = 'QUICK_WAP_PAY';
|
||||
}
|
||||
|
||||
public function AlipayTradeWapPayContentBuilder()
|
||||
{
|
||||
$this->__construct();
|
||||
}
|
||||
|
||||
public function getBody()
|
||||
{
|
||||
return $this->body;
|
||||
}
|
||||
|
||||
public function setBody($body)
|
||||
{
|
||||
$this->body = $body;
|
||||
$this->bizContentarr['body'] = $body;
|
||||
}
|
||||
|
||||
public function setSubject($subject)
|
||||
{
|
||||
$this->subject = $subject;
|
||||
$this->bizContentarr['subject'] = $subject;
|
||||
}
|
||||
|
||||
public function getSubject()
|
||||
{
|
||||
return $this->subject;
|
||||
}
|
||||
|
||||
public function getOutTradeNo()
|
||||
{
|
||||
return $this->outTradeNo;
|
||||
}
|
||||
|
||||
public function setOutTradeNo($outTradeNo)
|
||||
{
|
||||
$this->outTradeNo = $outTradeNo;
|
||||
$this->bizContentarr['out_trade_no'] = $outTradeNo;
|
||||
}
|
||||
|
||||
public function setTimeExpress($timeExpress)
|
||||
{
|
||||
$this->timeExpress = $timeExpress;
|
||||
$this->bizContentarr['timeout_express'] = $timeExpress;
|
||||
}
|
||||
|
||||
public function getTimeExpress()
|
||||
{
|
||||
return $this->timeExpress;
|
||||
}
|
||||
|
||||
public function setTotalAmount($totalAmount)
|
||||
{
|
||||
$this->totalAmount = $totalAmount;
|
||||
$this->bizContentarr['total_amount'] = $totalAmount;
|
||||
}
|
||||
|
||||
public function getTotalAmount()
|
||||
{
|
||||
return $this->totalAmount;
|
||||
}
|
||||
|
||||
public function setSellerId($sellerId)
|
||||
{
|
||||
$this->sellerId = $sellerId;
|
||||
$this->bizContentarr['seller_id'] = $sellerId;
|
||||
}
|
||||
|
||||
public function getSellerId()
|
||||
{
|
||||
return $this->sellerId;
|
||||
}
|
||||
|
||||
public function setPassbackParams($passbackParams)
|
||||
{
|
||||
$this->passbackParams = $passbackParams;
|
||||
$this->bizContentarr['passback_params'] = $passbackParams;
|
||||
}
|
||||
|
||||
public function getPassbackParams()
|
||||
{
|
||||
return $this->passbackParams;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/* *
|
||||
* 功能:共有有参数,暂未使用本页面
|
||||
* 版本:2.0
|
||||
* 修改日期:2016-11-01
|
||||
* 说明:
|
||||
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
|
||||
*/
|
||||
class ContentBuilder
|
||||
{
|
||||
//第三方应用授权令牌
|
||||
private $appAuthToken;
|
||||
|
||||
//异步通知地址(仅扫码支付使用)
|
||||
private $notifyUrl;
|
||||
|
||||
//同步跳转地址
|
||||
private $returnUrl;
|
||||
|
||||
public function setAppAuthToken($appAuthToken)
|
||||
{
|
||||
$this->appAuthToken = $appAuthToken;
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl = $notifyUrl;
|
||||
}
|
||||
|
||||
public function getAppAuthToken()
|
||||
{
|
||||
return $this->appAuthToken;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
}
|
||||
215
codes/agent/game/api/payment/alipay/wappay/close.php
Normal file
215
codes/agent/game/api/payment/alipay/wappay/close.php
Normal file
@@ -0,0 +1,215 @@
|
||||
<?php
|
||||
/* *
|
||||
* 功能:支付宝手机网站alipay.trade.close (统一收单交易关闭接口)调试入口页面
|
||||
* 版本:2.0
|
||||
* 修改日期:2016-11-01
|
||||
* 说明:
|
||||
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
|
||||
请确保项目文件有可写权限,不然打印不了日志。
|
||||
*/
|
||||
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
|
||||
|
||||
require_once dirname ( __FILE__ ).DIRECTORY_SEPARATOR.'service/AlipayTradeService.php';
|
||||
require_once dirname ( __FILE__ ).DIRECTORY_SEPARATOR.'buildermodel/AlipayTradeCloseContentBuilder.php';
|
||||
require dirname ( __FILE__ ).DIRECTORY_SEPARATOR.'./../config.php';
|
||||
if (!empty($_POST['WIDout_trade_no']) || !empty($_POST['WIDtrade_no'])){
|
||||
|
||||
//商户订单号和支付宝交易号不能同时为空。 trade_no、 out_trade_no如果同时存在优先取trade_no
|
||||
//商户订单号,和支付宝交易号二选一
|
||||
$out_trade_no = trim($_POST['WIDout_trade_no']);
|
||||
|
||||
//支付宝交易号,和商户订单号二选一
|
||||
$trade_no = trim($_POST['WIDtrade_no']);
|
||||
|
||||
$RequestBuilder = new AlipayTradeCloseContentBuilder();
|
||||
$RequestBuilder->setTradeNo($trade_no);
|
||||
$RequestBuilder->setOutTradeNo($out_trade_no);
|
||||
|
||||
$Response = new AlipayTradeService($config);
|
||||
$result=$Response->Close($RequestBuilder);
|
||||
return ;
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>支付宝手机网站alipay.trade.close(统一收单交易关闭接口)</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<style>
|
||||
*{
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
ul,ol{
|
||||
list-style:none;
|
||||
}
|
||||
body{
|
||||
font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif;
|
||||
}
|
||||
.hidden{
|
||||
display:none;
|
||||
}
|
||||
.new-btn-login-sp{
|
||||
padding: 1px;
|
||||
display: inline-block;
|
||||
width: 75%;
|
||||
}
|
||||
.new-btn-login {
|
||||
background-color: #02aaf1;
|
||||
color: #FFFFFF;
|
||||
font-weight: bold;
|
||||
border: none;
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
border-radius: 5px;
|
||||
font-size: 16px;
|
||||
}
|
||||
#main{
|
||||
width:100%;
|
||||
margin:0 auto;
|
||||
font-size:14px;
|
||||
}
|
||||
.red-star{
|
||||
color:#f00;
|
||||
width:10px;
|
||||
display:inline-block;
|
||||
}
|
||||
.null-star{
|
||||
color:#fff;
|
||||
}
|
||||
.content{
|
||||
margin-top:5px;
|
||||
}
|
||||
.content dt{
|
||||
width:100px;
|
||||
display:inline-block;
|
||||
float: left;
|
||||
margin-left: 20px;
|
||||
color: #666;
|
||||
font-size: 13px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.content dd{
|
||||
margin-left:120px;
|
||||
margin-bottom:5px;
|
||||
}
|
||||
.content dd input {
|
||||
width: 85%;
|
||||
height: 28px;
|
||||
border: 0;
|
||||
-webkit-border-radius: 0;
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
#foot{
|
||||
margin-top:10px;
|
||||
position: absolute;
|
||||
bottom: 15px;
|
||||
width: 100%;
|
||||
}
|
||||
.foot-ul{
|
||||
width: 100%;
|
||||
}
|
||||
.foot-ul li {
|
||||
width: 100%;
|
||||
text-align:center;
|
||||
color: #666;
|
||||
}
|
||||
.note-help {
|
||||
color: #999999;
|
||||
font-size: 12px;
|
||||
line-height: 130%;
|
||||
margin-top: 5px;
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
#btn-dd{
|
||||
margin: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
.foot-ul{
|
||||
width: 100%;
|
||||
}
|
||||
.one_line{
|
||||
display: block;
|
||||
height: 1px;
|
||||
border: 0;
|
||||
border-top: 1px solid #eeeeee;
|
||||
width: 100%;
|
||||
margin-left: 20px;
|
||||
}
|
||||
.am-header {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: box;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
padding: 7px 0;
|
||||
-webkit-box-sizing: border-box;
|
||||
-ms-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
background: #1D222D;
|
||||
height: 50px;
|
||||
text-align: center;
|
||||
-webkit-box-pack: center;
|
||||
-ms-flex-pack: center;
|
||||
box-pack: center;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
box-align: center;
|
||||
}
|
||||
.am-header h1 {
|
||||
-webkit-box-flex: 1;
|
||||
-ms-flex: 1;
|
||||
box-flex: 1;
|
||||
line-height: 18px;
|
||||
text-align: center;
|
||||
font-size: 18px;
|
||||
font-weight: 300;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body text=#000000 bgColor="#ffffff" leftMargin=0 topMargin=4>
|
||||
<header class="am-header">
|
||||
<h1>支付宝手机网站交易关闭接口(接口名:alipay.trade.close )</h1>
|
||||
</header>
|
||||
<div id="main">
|
||||
<form name=alipayment action='' method=post target="_blank">
|
||||
<div id="body" style="clear:left">
|
||||
<dl class="content">
|
||||
<dt>商户订单号
|
||||
:</dt>
|
||||
<dd>
|
||||
<input id="WIDout_trade_no" name="WIDout_trade_no" />
|
||||
</dd>
|
||||
<hr class="one_line">
|
||||
<dt>支付宝交易号:</dt>
|
||||
<dd>
|
||||
<input id="WIDtrade_no" name="WIDtrade_no" />
|
||||
</dd>
|
||||
<hr class="one_line">
|
||||
<dt></dt>
|
||||
<dd>
|
||||
<span style="line-height: 28px; color:red;">注意:商户订单号和支付宝交易号不能同时为空。 trade_no、 out_trade_no如果同时存在优先取trade_no</span>
|
||||
</dd>
|
||||
<dd id="btn-dd">
|
||||
<span class="new-btn-login-sp">
|
||||
<button class="new-btn-login" type="submit" style="text-align:center;">确 认</button>
|
||||
</span>
|
||||
<span class="note-help">如果您点击“确认”按钮,即表示您同意该次的执行操作。</span>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</form>
|
||||
<div id="foot">
|
||||
<ul class="foot-ul">
|
||||
<li>
|
||||
支付宝版权所有 2015-2018 ALIPAY.COM
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
211
codes/agent/game/api/payment/alipay/wappay/datadownioad.php
Normal file
211
codes/agent/game/api/payment/alipay/wappay/datadownioad.php
Normal file
@@ -0,0 +1,211 @@
|
||||
<?php
|
||||
/* *
|
||||
* 功能:支付宝手机网站alipay.data.dataservice.bill.downloadurl.query (查询对账单下载地址)接口调试入口页面
|
||||
* 版本:2.0
|
||||
* 修改日期:2016-11-01
|
||||
* 说明:
|
||||
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
|
||||
请确保项目文件有可写权限,不然打印不了日志。
|
||||
*/
|
||||
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
|
||||
|
||||
require_once dirname ( __FILE__ ).DIRECTORY_SEPARATOR.'service/AlipayTradeService.php';
|
||||
require_once dirname ( __FILE__ ).DIRECTORY_SEPARATOR.'buildermodel/AlipayDataDataserviceBillDownloadurlQueryContentBuilder.php';
|
||||
require dirname ( __FILE__ ).DIRECTORY_SEPARATOR.'./../config.php';
|
||||
if (!empty($_POST['WIDbill_type']) && !empty($_POST['WIDbill_date'])){
|
||||
//账单类型,商户通过接口或商户经开放平台授权后其所属服务商通过接口可以获取以下账单类型:trade、signcustomer;
|
||||
//trade指商户基于支付宝交易收单的业务账单;signcustomer是指基于商户支付宝余额收入及支出等资金变动的帐务账单;
|
||||
$bill_type = trim($_POST['WIDbill_type']);
|
||||
//账单时间:日账单格式为yyyy-MM-dd,月账单格式为yyyy-MM。
|
||||
$bill_date = trim($_POST['WIDbill_date']);
|
||||
|
||||
$RequestBuilder = new AlipayDataDataserviceBillDownloadurlQueryContentBuilder();
|
||||
$RequestBuilder->setBillType($bill_type);
|
||||
$RequestBuilder->setBillDate($bill_date);
|
||||
$Response = new AlipayTradeService($config);
|
||||
$result=$Response->downloadurlQuery($RequestBuilder);
|
||||
return ;
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>alipay.data.dataservice.bill.downloadurl.query(查询对账单下载地址)</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<style>
|
||||
*{
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
ul,ol{
|
||||
list-style:none;
|
||||
}
|
||||
body{
|
||||
font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif;
|
||||
}
|
||||
.hidden{
|
||||
display:none;
|
||||
}
|
||||
.new-btn-login-sp{
|
||||
padding: 1px;
|
||||
display: inline-block;
|
||||
width: 75%;
|
||||
}
|
||||
.new-btn-login {
|
||||
background-color: #02aaf1;
|
||||
color: #FFFFFF;
|
||||
font-weight: bold;
|
||||
border: none;
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
border-radius: 5px;
|
||||
font-size: 16px;
|
||||
}
|
||||
#main{
|
||||
width:100%;
|
||||
margin:0 auto;
|
||||
font-size:14px;
|
||||
}
|
||||
.red-star{
|
||||
color:#f00;
|
||||
width:10px;
|
||||
display:inline-block;
|
||||
}
|
||||
.null-star{
|
||||
color:#fff;
|
||||
}
|
||||
.content{
|
||||
margin-top:5px;
|
||||
}
|
||||
.content dt{
|
||||
width:100px;
|
||||
display:inline-block;
|
||||
float: left;
|
||||
margin-left: 20px;
|
||||
color: #666;
|
||||
font-size: 13px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.content dd{
|
||||
margin-left:120px;
|
||||
margin-bottom:5px;
|
||||
}
|
||||
.content dd input {
|
||||
width: 85%;
|
||||
height: 28px;
|
||||
border: 0;
|
||||
-webkit-border-radius: 0;
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
#foot{
|
||||
margin-top:10px;
|
||||
position: absolute;
|
||||
bottom: 15px;
|
||||
width: 100%;
|
||||
}
|
||||
.foot-ul{
|
||||
width: 100%;
|
||||
}
|
||||
.foot-ul li {
|
||||
width: 100%;
|
||||
text-align:center;
|
||||
color: #666;
|
||||
}
|
||||
.note-help {
|
||||
color: #999999;
|
||||
font-size: 12px;
|
||||
line-height: 130%;
|
||||
margin-top: 5px;
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
#btn-dd{
|
||||
margin: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
.foot-ul{
|
||||
width: 100%;
|
||||
}
|
||||
.one_line{
|
||||
display: block;
|
||||
height: 1px;
|
||||
border: 0;
|
||||
border-top: 1px solid #eeeeee;
|
||||
width: 100%;
|
||||
margin-left: 20px;
|
||||
}
|
||||
.am-header {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: box;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
padding: 7px 0;
|
||||
-webkit-box-sizing: border-box;
|
||||
-ms-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
background: #1D222D;
|
||||
height: 50px;
|
||||
text-align: center;
|
||||
-webkit-box-pack: center;
|
||||
-ms-flex-pack: center;
|
||||
box-pack: center;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
box-align: center;
|
||||
}
|
||||
.am-header h1 {
|
||||
-webkit-box-flex: 1;
|
||||
-ms-flex: 1;
|
||||
box-flex: 1;
|
||||
line-height: 18px;
|
||||
text-align: center;
|
||||
font-size: 18px;
|
||||
font-weight: 300;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body text=#000000 bgColor="#ffffff" leftMargin=0 topMargin=4>
|
||||
<header class="am-header">
|
||||
<h1>支付宝手机网站查询对账单下载地址(接口名:alipay.data.dataservice.bill.downloadurl.query)</h1>
|
||||
</header>
|
||||
<div id="main">
|
||||
<form name=alipayment action='' method=post target="_blank">
|
||||
<div id="body" style="clear:left">
|
||||
<dl class="content">
|
||||
<dt>账单类型:</dt>
|
||||
<dd>
|
||||
<input id="WIDbill_type" name="WIDbill_type" value="trade" />
|
||||
</dd>
|
||||
<hr class="one_line">
|
||||
<dt>账单时间:</dt>
|
||||
<dd>
|
||||
<input id="WIDbill_date" name="WIDbill_date" />
|
||||
</dd>
|
||||
<hr class="one_line">
|
||||
<dt></dt>
|
||||
<dd>
|
||||
<span style="line-height: 28px; color:red;">注意:账单类型和账单时间不能为空!账单时间:日账单格式为yyyy-MM-dd,月账单格式为yyyy-MM。</span>
|
||||
</dd>
|
||||
<dd id="btn-dd">
|
||||
<span class="new-btn-login-sp">
|
||||
<button class="new-btn-login" type="submit" style="text-align:center;">确 认</button>
|
||||
</span>
|
||||
<span class="note-help">如果您点击“确认”按钮,即表示您同意该次的执行操作。</span>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</form>
|
||||
<div id="foot">
|
||||
<ul class="foot-ul">
|
||||
<li>
|
||||
支付宝版权所有 2015-2018 ALIPAY.COM
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
253
codes/agent/game/api/payment/alipay/wappay/pay.php
Normal file
253
codes/agent/game/api/payment/alipay/wappay/pay.php
Normal file
@@ -0,0 +1,253 @@
|
||||
<?php
|
||||
/* *
|
||||
* 功能:支付宝手机网站支付接口(alipay.trade.wap.pay)接口调试入口页面
|
||||
* 版本:2.0
|
||||
* 修改日期:2016-11-01
|
||||
* 说明:
|
||||
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
|
||||
请确保项目文件有可写权限,不然打印不了日志。
|
||||
*/
|
||||
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
|
||||
|
||||
require_once dirname ( __FILE__ ).DIRECTORY_SEPARATOR.'service/AlipayTradeService.php';
|
||||
require_once dirname ( __FILE__ ).DIRECTORY_SEPARATOR.'buildermodel/AlipayTradeWapPayContentBuilder.php';
|
||||
require dirname ( __FILE__ ).DIRECTORY_SEPARATOR.'./../config.php';
|
||||
if (!empty($_POST['WIDout_trade_no'])&& trim($_POST['WIDout_trade_no'])!=""){
|
||||
//商户订单号,商户网站订单系统中唯一订单号,必填
|
||||
$out_trade_no = $_POST['WIDout_trade_no'];
|
||||
|
||||
//订单名称,必填
|
||||
$subject = $_POST['WIDsubject'];
|
||||
|
||||
//付款金额,必填
|
||||
$total_amount = $_POST['WIDtotal_amount'];
|
||||
|
||||
//商品描述,可空
|
||||
$body = $_POST['WIDbody'];
|
||||
|
||||
//超时时间
|
||||
$timeout_express="1m";
|
||||
|
||||
$payRequestBuilder = new AlipayTradeWapPayContentBuilder();
|
||||
$payRequestBuilder->setBody($body);
|
||||
$payRequestBuilder->setSubject($subject);
|
||||
$payRequestBuilder->setOutTradeNo($out_trade_no);
|
||||
$payRequestBuilder->setTotalAmount($total_amount);
|
||||
$payRequestBuilder->setTimeExpress($timeout_express);
|
||||
|
||||
$payResponse = new AlipayTradeService($config);
|
||||
$result=$payResponse->wapPay($payRequestBuilder, $config['return_url'], $config['notify_url']);
|
||||
|
||||
return ;
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>支付宝手机网站支付接口</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<style>
|
||||
*{
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
ul,ol{
|
||||
list-style:none;
|
||||
}
|
||||
body{
|
||||
font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif;
|
||||
}
|
||||
.hidden{
|
||||
display:none;
|
||||
}
|
||||
.new-btn-login-sp{
|
||||
padding: 1px;
|
||||
display: inline-block;
|
||||
width: 75%;
|
||||
}
|
||||
.new-btn-login {
|
||||
background-color: #02aaf1;
|
||||
color: #FFFFFF;
|
||||
font-weight: bold;
|
||||
border: none;
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
border-radius: 5px;
|
||||
font-size: 16px;
|
||||
}
|
||||
#main{
|
||||
width:100%;
|
||||
margin:0 auto;
|
||||
font-size:14px;
|
||||
}
|
||||
.red-star{
|
||||
color:#f00;
|
||||
width:10px;
|
||||
display:inline-block;
|
||||
}
|
||||
.null-star{
|
||||
color:#fff;
|
||||
}
|
||||
.content{
|
||||
margin-top:5px;
|
||||
}
|
||||
.content dt{
|
||||
width:100px;
|
||||
display:inline-block;
|
||||
float: left;
|
||||
margin-left: 20px;
|
||||
color: #666;
|
||||
font-size: 13px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.content dd{
|
||||
margin-left:120px;
|
||||
margin-bottom:5px;
|
||||
}
|
||||
.content dd input {
|
||||
width: 85%;
|
||||
height: 28px;
|
||||
border: 0;
|
||||
-webkit-border-radius: 0;
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
#foot{
|
||||
margin-top:10px;
|
||||
position: absolute;
|
||||
bottom: 15px;
|
||||
width: 100%;
|
||||
}
|
||||
.foot-ul{
|
||||
width: 100%;
|
||||
}
|
||||
.foot-ul li {
|
||||
width: 100%;
|
||||
text-align:center;
|
||||
color: #666;
|
||||
}
|
||||
.note-help {
|
||||
color: #999999;
|
||||
font-size: 12px;
|
||||
line-height: 130%;
|
||||
margin-top: 5px;
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
#btn-dd{
|
||||
margin: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
.foot-ul{
|
||||
width: 100%;
|
||||
}
|
||||
.one_line{
|
||||
display: block;
|
||||
height: 1px;
|
||||
border: 0;
|
||||
border-top: 1px solid #eeeeee;
|
||||
width: 100%;
|
||||
margin-left: 20px;
|
||||
}
|
||||
.am-header {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: box;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
padding: 7px 0;
|
||||
-webkit-box-sizing: border-box;
|
||||
-ms-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
background: #1D222D;
|
||||
height: 50px;
|
||||
text-align: center;
|
||||
-webkit-box-pack: center;
|
||||
-ms-flex-pack: center;
|
||||
box-pack: center;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
box-align: center;
|
||||
}
|
||||
.am-header h1 {
|
||||
-webkit-box-flex: 1;
|
||||
-ms-flex: 1;
|
||||
box-flex: 1;
|
||||
line-height: 18px;
|
||||
text-align: center;
|
||||
font-size: 18px;
|
||||
font-weight: 300;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body text=#000000 bgColor="#ffffff" leftMargin=0 topMargin=4>
|
||||
<header class="am-header">
|
||||
<h1>支付宝手机网站支付接口快速通道(接口名:alipay.trade.wap.pay)</h1>
|
||||
</header>
|
||||
<div id="main">
|
||||
<form name=alipayment action='' method=post target="_blank">
|
||||
<div id="body" style="clear:left">
|
||||
<dl class="content">
|
||||
<dt>商户订单号
|
||||
:</dt>
|
||||
<dd>
|
||||
<input id="WIDout_trade_no" name="WIDout_trade_no" />
|
||||
</dd>
|
||||
<hr class="one_line">
|
||||
<dt>订单名称
|
||||
:</dt>
|
||||
<dd>
|
||||
<input id="WIDsubject" name="WIDsubject" />
|
||||
</dd>
|
||||
<hr class="one_line">
|
||||
<dt>付款金额
|
||||
:</dt>
|
||||
<dd>
|
||||
<input id="WIDtotal_amount" name="WIDtotal_amount" />
|
||||
</dd>
|
||||
<hr class="one_line">
|
||||
<dt>商品描述:</dt>
|
||||
<dd>
|
||||
<input id="WIDbody" name="WIDbody" />
|
||||
</dd>
|
||||
<hr class="one_line">
|
||||
<dt></dt>
|
||||
<dd id="btn-dd">
|
||||
<span class="new-btn-login-sp">
|
||||
<button class="new-btn-login" type="submit" style="text-align:center;">确 认</button>
|
||||
</span>
|
||||
<span class="note-help">如果您点击“确认”按钮,即表示您同意该次的执行操作。</span>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</form>
|
||||
<div id="foot">
|
||||
<ul class="foot-ul">
|
||||
<li>
|
||||
支付宝版权所有 2015-2018 ALIPAY.COM
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script language="javascript">
|
||||
function GetDateNow() {
|
||||
var vNow = new Date();
|
||||
var sNow = "";
|
||||
sNow += String(vNow.getFullYear());
|
||||
sNow += String(vNow.getMonth() + 1);
|
||||
sNow += String(vNow.getDate());
|
||||
sNow += String(vNow.getHours());
|
||||
sNow += String(vNow.getMinutes());
|
||||
sNow += String(vNow.getSeconds());
|
||||
sNow += String(vNow.getMilliseconds());
|
||||
document.getElementById("WIDout_trade_no").value = sNow;
|
||||
document.getElementById("WIDsubject").value = "测试";
|
||||
document.getElementById("WIDtotal_amount").value = "0.01";
|
||||
document.getElementById("WIDbody").value = "购买测试商品0.01元";
|
||||
}
|
||||
GetDateNow();
|
||||
</script>
|
||||
</html>
|
||||
215
codes/agent/game/api/payment/alipay/wappay/query.php
Normal file
215
codes/agent/game/api/payment/alipay/wappay/query.php
Normal file
@@ -0,0 +1,215 @@
|
||||
<?php
|
||||
/* *
|
||||
* 功能:支付宝手机网站alipay.trade.query (统一收单线下交易查询)调试入口页面
|
||||
* 版本:2.0
|
||||
* 修改日期:2016-11-01
|
||||
* 说明:
|
||||
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
|
||||
请确保项目文件有可写权限,不然打印不了日志。
|
||||
*/
|
||||
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
|
||||
|
||||
require_once dirname ( __FILE__ ).DIRECTORY_SEPARATOR.'service/AlipayTradeService.php';
|
||||
require_once dirname ( __FILE__ ).DIRECTORY_SEPARATOR.'buildermodel/AlipayTradeQueryContentBuilder.php';
|
||||
require dirname ( __FILE__ ).DIRECTORY_SEPARATOR.'./../config.php';
|
||||
if (!empty($_POST['WIDout_trade_no']) || !empty($_POST['WIDtrade_no'])){
|
||||
|
||||
//商户订单号和支付宝交易号不能同时为空。 trade_no、 out_trade_no如果同时存在优先取trade_no
|
||||
//商户订单号,和支付宝交易号二选一
|
||||
$out_trade_no = trim($_POST['WIDout_trade_no']);
|
||||
|
||||
//支付宝交易号,和商户订单号二选一
|
||||
$trade_no = trim($_POST['WIDtrade_no']);
|
||||
|
||||
$RequestBuilder = new AlipayTradeQueryContentBuilder();
|
||||
$RequestBuilder->setTradeNo($trade_no);
|
||||
$RequestBuilder->setOutTradeNo($out_trade_no);
|
||||
|
||||
$Response = new AlipayTradeService($config);
|
||||
$result=$Response->Query($RequestBuilder);
|
||||
return ;
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>支付宝手机网站alipay.trade.query (统一收单线下交易查询)</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<style>
|
||||
*{
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
ul,ol{
|
||||
list-style:none;
|
||||
}
|
||||
body{
|
||||
font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif;
|
||||
}
|
||||
.hidden{
|
||||
display:none;
|
||||
}
|
||||
.new-btn-login-sp{
|
||||
padding: 1px;
|
||||
display: inline-block;
|
||||
width: 75%;
|
||||
}
|
||||
.new-btn-login {
|
||||
background-color: #02aaf1;
|
||||
color: #FFFFFF;
|
||||
font-weight: bold;
|
||||
border: none;
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
border-radius: 5px;
|
||||
font-size: 16px;
|
||||
}
|
||||
#main{
|
||||
width:100%;
|
||||
margin:0 auto;
|
||||
font-size:14px;
|
||||
}
|
||||
.red-star{
|
||||
color:#f00;
|
||||
width:10px;
|
||||
display:inline-block;
|
||||
}
|
||||
.null-star{
|
||||
color:#fff;
|
||||
}
|
||||
.content{
|
||||
margin-top:5px;
|
||||
}
|
||||
.content dt{
|
||||
width:100px;
|
||||
display:inline-block;
|
||||
float: left;
|
||||
margin-left: 20px;
|
||||
color: #666;
|
||||
font-size: 13px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.content dd{
|
||||
margin-left:120px;
|
||||
margin-bottom:5px;
|
||||
}
|
||||
.content dd input {
|
||||
width: 85%;
|
||||
height: 28px;
|
||||
border: 0;
|
||||
-webkit-border-radius: 0;
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
#foot{
|
||||
margin-top:10px;
|
||||
position: absolute;
|
||||
bottom: 15px;
|
||||
width: 100%;
|
||||
}
|
||||
.foot-ul{
|
||||
width: 100%;
|
||||
}
|
||||
.foot-ul li {
|
||||
width: 100%;
|
||||
text-align:center;
|
||||
color: #666;
|
||||
}
|
||||
.note-help {
|
||||
color: #999999;
|
||||
font-size: 12px;
|
||||
line-height: 130%;
|
||||
margin-top: 5px;
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
#btn-dd{
|
||||
margin: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
.foot-ul{
|
||||
width: 100%;
|
||||
}
|
||||
.one_line{
|
||||
display: block;
|
||||
height: 1px;
|
||||
border: 0;
|
||||
border-top: 1px solid #eeeeee;
|
||||
width: 100%;
|
||||
margin-left: 20px;
|
||||
}
|
||||
.am-header {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: box;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
padding: 7px 0;
|
||||
-webkit-box-sizing: border-box;
|
||||
-ms-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
background: #1D222D;
|
||||
height: 50px;
|
||||
text-align: center;
|
||||
-webkit-box-pack: center;
|
||||
-ms-flex-pack: center;
|
||||
box-pack: center;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
box-align: center;
|
||||
}
|
||||
.am-header h1 {
|
||||
-webkit-box-flex: 1;
|
||||
-ms-flex: 1;
|
||||
box-flex: 1;
|
||||
line-height: 18px;
|
||||
text-align: center;
|
||||
font-size: 18px;
|
||||
font-weight: 300;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body text=#000000 bgColor="#ffffff" leftMargin=0 topMargin=4>
|
||||
<header class="am-header">
|
||||
<h1>支付宝手机网站alipay.trade.query (统一收单线下交易查询)</h1>
|
||||
</header>
|
||||
<div id="main">
|
||||
<form name=alipayment action='' method=post target="_blank">
|
||||
<div id="body" style="clear:left">
|
||||
<dl class="content">
|
||||
<dt>商户订单号
|
||||
:</dt>
|
||||
<dd>
|
||||
<input id="WIDout_trade_no" name="WIDout_trade_no" />
|
||||
</dd>
|
||||
<hr class="one_line">
|
||||
<dt>支付宝交易号:</dt>
|
||||
<dd>
|
||||
<input id="WIDtrade_no" name="WIDtrade_no" />
|
||||
</dd>
|
||||
<hr class="one_line">
|
||||
<dt></dt>
|
||||
<dd>
|
||||
<span style="line-height: 28px; color:red;">注意:商户订单号和支付宝交易号不能同时为空。 trade_no、 out_trade_no如果同时存在优先取trade_no</span>
|
||||
</dd>
|
||||
<dd id="btn-dd">
|
||||
<span class="new-btn-login-sp">
|
||||
<button class="new-btn-login" type="submit" style="text-align:center;">确 认</button>
|
||||
</span>
|
||||
<span class="note-help">如果您点击“确认”按钮,即表示您同意该次的执行操作。</span>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</form>
|
||||
<div id="foot">
|
||||
<ul class="foot-ul">
|
||||
<li>
|
||||
支付宝版权所有 2015-2018 ALIPAY.COM
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
248
codes/agent/game/api/payment/alipay/wappay/refund.php
Normal file
248
codes/agent/game/api/payment/alipay/wappay/refund.php
Normal file
@@ -0,0 +1,248 @@
|
||||
<?php
|
||||
/* *
|
||||
* 功能:支付宝手机网站alipay.trade.refund (统一收单交易退款接口)调试入口页面
|
||||
* 版本:2.0
|
||||
* 修改日期:2016-11-01
|
||||
* 说明:
|
||||
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
|
||||
请确保项目文件有可写权限,不然打印不了日志。
|
||||
*/
|
||||
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
|
||||
|
||||
require_once dirname ( __FILE__ ).DIRECTORY_SEPARATOR.'service/AlipayTradeService.php';
|
||||
require_once dirname ( __FILE__ ).DIRECTORY_SEPARATOR.'buildermodel/AlipayTradeRefundContentBuilder.php';
|
||||
require dirname ( __FILE__ ).DIRECTORY_SEPARATOR.'./../config.php';
|
||||
if (!empty($_POST['WIDout_trade_no']) || !empty($_POST['WIDtrade_no'])){
|
||||
|
||||
//商户订单号和支付宝交易号不能同时为空。 trade_no、 out_trade_no如果同时存在优先取trade_no
|
||||
//商户订单号,和支付宝交易号二选一
|
||||
$out_trade_no = trim($_POST['WIDout_trade_no']);
|
||||
|
||||
//支付宝交易号,和商户订单号二选一
|
||||
$trade_no = trim($_POST['WIDtrade_no']);
|
||||
|
||||
//退款金额,不能大于订单总金额
|
||||
$refund_amount=trim($_POST['WIDrefund_amount']);
|
||||
|
||||
//退款的原因说明
|
||||
$refund_reason=trim($_POST['WIDrefund_reason']);
|
||||
|
||||
//标识一次退款请求,同一笔交易多次退款需要保证唯一,如需部分退款,则此参数必传。
|
||||
$out_request_no=trim($_POST['WIDout_request_no']);
|
||||
|
||||
$RequestBuilder = new AlipayTradeRefundContentBuilder();
|
||||
$RequestBuilder->setTradeNo($trade_no);
|
||||
$RequestBuilder->setOutTradeNo($out_trade_no);
|
||||
$RequestBuilder->setRefundAmount($refund_amount);
|
||||
$RequestBuilder->setRefundReason($refund_reason);
|
||||
$RequestBuilder->setOutRequestNo($out_request_no);
|
||||
|
||||
$Response = new AlipayTradeService($config);
|
||||
$result=$Response->Refund($RequestBuilder);
|
||||
return ;
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>支付宝手机网站alipay.trade.refund (统一收单交易退款接口)</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<style>
|
||||
*{
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
ul,ol{
|
||||
list-style:none;
|
||||
}
|
||||
body{
|
||||
font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif;
|
||||
}
|
||||
.hidden{
|
||||
display:none;
|
||||
}
|
||||
.new-btn-login-sp{
|
||||
padding: 1px;
|
||||
display: inline-block;
|
||||
width: 75%;
|
||||
}
|
||||
.new-btn-login {
|
||||
background-color: #02aaf1;
|
||||
color: #FFFFFF;
|
||||
font-weight: bold;
|
||||
border: none;
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
border-radius: 5px;
|
||||
font-size: 16px;
|
||||
}
|
||||
#main{
|
||||
width:100%;
|
||||
margin:0 auto;
|
||||
font-size:14px;
|
||||
}
|
||||
.red-star{
|
||||
color:#f00;
|
||||
width:10px;
|
||||
display:inline-block;
|
||||
}
|
||||
.null-star{
|
||||
color:#fff;
|
||||
}
|
||||
.content{
|
||||
margin-top:5px;
|
||||
}
|
||||
.content dt{
|
||||
width:100px;
|
||||
display:inline-block;
|
||||
float: left;
|
||||
margin-left: 20px;
|
||||
color: #666;
|
||||
font-size: 13px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.content dd{
|
||||
margin-left:120px;
|
||||
margin-bottom:5px;
|
||||
}
|
||||
.content dd input {
|
||||
width: 85%;
|
||||
height: 28px;
|
||||
border: 0;
|
||||
-webkit-border-radius: 0;
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
#foot{
|
||||
margin-top:10px;
|
||||
position: absolute;
|
||||
bottom: 15px;
|
||||
width: 100%;
|
||||
}
|
||||
.foot-ul{
|
||||
width: 100%;
|
||||
}
|
||||
.foot-ul li {
|
||||
width: 100%;
|
||||
text-align:center;
|
||||
color: #666;
|
||||
}
|
||||
.note-help {
|
||||
color: #999999;
|
||||
font-size: 12px;
|
||||
line-height: 130%;
|
||||
margin-top: 5px;
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
#btn-dd{
|
||||
margin: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
.foot-ul{
|
||||
width: 100%;
|
||||
}
|
||||
.one_line{
|
||||
display: block;
|
||||
height: 1px;
|
||||
border: 0;
|
||||
border-top: 1px solid #eeeeee;
|
||||
width: 100%;
|
||||
margin-left: 20px;
|
||||
}
|
||||
.am-header {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: box;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
padding: 7px 0;
|
||||
-webkit-box-sizing: border-box;
|
||||
-ms-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
background: #1D222D;
|
||||
height: 50px;
|
||||
text-align: center;
|
||||
-webkit-box-pack: center;
|
||||
-ms-flex-pack: center;
|
||||
box-pack: center;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
box-align: center;
|
||||
}
|
||||
.am-header h1 {
|
||||
-webkit-box-flex: 1;
|
||||
-ms-flex: 1;
|
||||
box-flex: 1;
|
||||
line-height: 18px;
|
||||
text-align: center;
|
||||
font-size: 18px;
|
||||
font-weight: 300;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body text=#000000 bgColor="#ffffff" leftMargin=0 topMargin=4>
|
||||
<header class="am-header">
|
||||
<h1>支付宝手机网站alipay.trade.refund (统一收单交易退款接口)</h1>
|
||||
</header>
|
||||
<div id="main">
|
||||
<form name=alipayment action='' method=post target="_blank">
|
||||
<div id="body" style="clear:left">
|
||||
<dl class="content">
|
||||
<dt>商户订单号
|
||||
:</dt>
|
||||
<dd>
|
||||
<input id="WIDout_trade_no" name="WIDout_trade_no" />
|
||||
</dd>
|
||||
<hr class="one_line">
|
||||
<dt>支付宝交易号:</dt>
|
||||
<dd>
|
||||
<input id="WIDtrade_no" name="WIDtrade_no" />
|
||||
</dd>
|
||||
<hr class="one_line">
|
||||
<dt></dt>
|
||||
<dd>
|
||||
<span style="line-height: 28px; color:red;">注意:商户订单号和支付宝交易号不能同时为空。 trade_no、 out_trade_no如果同时存在优先取trade_no</span>
|
||||
</dd>
|
||||
<hr class="one_line">
|
||||
<dt>退款金额:</dt>
|
||||
<dd>
|
||||
<input id="WIDrefund_amount" name="WIDrefund_amount" />
|
||||
</dd>
|
||||
<hr class="one_line">
|
||||
<dt>退款原因:</dt>
|
||||
<dd>
|
||||
<input id="WIDrefund_reason" name="WIDrefund_reason" />
|
||||
</dd>
|
||||
<hr class="one_line">
|
||||
<dt>退款单号:</dt>
|
||||
<dd>
|
||||
<input id="WIDout_request_no" name="WIDout_request_no" />
|
||||
</dd>
|
||||
<hr class="one_line">
|
||||
<dt></dt>
|
||||
<dd>
|
||||
<span style="line-height: 28px; color:red;">注意:如是部分退款,则参数退款单号(out_request_no)必传。</span>
|
||||
</dd>
|
||||
<hr class="one_line">
|
||||
<dd id="btn-dd">
|
||||
<span class="new-btn-login-sp">
|
||||
<button class="new-btn-login" type="submit" style="text-align:center;">确 认</button>
|
||||
</span>
|
||||
<span class="note-help">如果您点击“确认”按钮,即表示您同意该次的执行操作。</span>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</form>
|
||||
<div id="foot">
|
||||
<ul class="foot-ul">
|
||||
<li>
|
||||
支付宝版权所有 2015-2018 ALIPAY.COM
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
220
codes/agent/game/api/payment/alipay/wappay/refundquery.php
Normal file
220
codes/agent/game/api/payment/alipay/wappay/refundquery.php
Normal file
@@ -0,0 +1,220 @@
|
||||
<?php
|
||||
/* *
|
||||
* 功能:支付宝手机网站alipay.trade.fastpay.refund.query (统一收单交易退款查询)调试入口页面
|
||||
* 版本:2.0
|
||||
* 修改日期:2016-11-01
|
||||
* 说明:
|
||||
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
|
||||
请确保项目文件有可写权限,不然打印不了日志。
|
||||
*/
|
||||
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
|
||||
|
||||
require_once dirname ( __FILE__ ).DIRECTORY_SEPARATOR.'service/AlipayTradeService.php';
|
||||
require_once dirname ( __FILE__ ).DIRECTORY_SEPARATOR.'buildermodel/AlipayTradeFastpayRefundQueryContentBuilder.php';
|
||||
require dirname ( __FILE__ ).DIRECTORY_SEPARATOR.'./../config.php';
|
||||
if (!empty($_POST['WIDout_trade_no']) || !empty($_POST['WIDtrade_no'])&&!empty($_POST['WIDout_request_no'])){
|
||||
|
||||
//商户订单号和支付宝交易号不能同时为空。 trade_no、 out_trade_no如果同时存在优先取trade_no
|
||||
//商户订单号,和支付宝交易号二选一
|
||||
$out_trade_no = trim($_POST['WIDout_trade_no']);
|
||||
//支付宝交易号,和商户订单号二选一
|
||||
$trade_no = trim($_POST['WIDtrade_no']);
|
||||
//请求退款接口时,传入的退款请求号,如果在退款请求时未传入,则该值为创建交易时的外部交易号
|
||||
$out_request_no = trim($_POST['WIDout_request_no']);
|
||||
|
||||
$RequestBuilder = new AlipayTradeFastpayRefundQueryContentBuilder();
|
||||
$RequestBuilder->setTradeNo($trade_no);
|
||||
$RequestBuilder->setOutTradeNo($out_trade_no);
|
||||
$RequestBuilder->setOutRequestNo($out_request_no);
|
||||
|
||||
$Response = new AlipayTradeService($config);
|
||||
$result=$Response->refundQuery($RequestBuilder);
|
||||
return ;
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>支付宝手机网站交易退款查询 (alipay.trade.fastpay.refund.query)</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<style>
|
||||
*{
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
ul,ol{
|
||||
list-style:none;
|
||||
}
|
||||
body{
|
||||
font-family: "Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif;
|
||||
}
|
||||
.hidden{
|
||||
display:none;
|
||||
}
|
||||
.new-btn-login-sp{
|
||||
padding: 1px;
|
||||
display: inline-block;
|
||||
width: 75%;
|
||||
}
|
||||
.new-btn-login {
|
||||
background-color: #02aaf1;
|
||||
color: #FFFFFF;
|
||||
font-weight: bold;
|
||||
border: none;
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
border-radius: 5px;
|
||||
font-size: 16px;
|
||||
}
|
||||
#main{
|
||||
width:100%;
|
||||
margin:0 auto;
|
||||
font-size:14px;
|
||||
}
|
||||
.red-star{
|
||||
color:#f00;
|
||||
width:10px;
|
||||
display:inline-block;
|
||||
}
|
||||
.null-star{
|
||||
color:#fff;
|
||||
}
|
||||
.content{
|
||||
margin-top:5px;
|
||||
}
|
||||
.content dt{
|
||||
width:100px;
|
||||
display:inline-block;
|
||||
float: left;
|
||||
margin-left: 20px;
|
||||
color: #666;
|
||||
font-size: 13px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.content dd{
|
||||
margin-left:120px;
|
||||
margin-bottom:5px;
|
||||
}
|
||||
.content dd input {
|
||||
width: 85%;
|
||||
height: 28px;
|
||||
border: 0;
|
||||
-webkit-border-radius: 0;
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
#foot{
|
||||
margin-top:10px;
|
||||
position: absolute;
|
||||
bottom: 15px;
|
||||
width: 100%;
|
||||
}
|
||||
.foot-ul{
|
||||
width: 100%;
|
||||
}
|
||||
.foot-ul li {
|
||||
width: 100%;
|
||||
text-align:center;
|
||||
color: #666;
|
||||
}
|
||||
.note-help {
|
||||
color: #999999;
|
||||
font-size: 12px;
|
||||
line-height: 130%;
|
||||
margin-top: 5px;
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
#btn-dd{
|
||||
margin: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
.foot-ul{
|
||||
width: 100%;
|
||||
}
|
||||
.one_line{
|
||||
display: block;
|
||||
height: 1px;
|
||||
border: 0;
|
||||
border-top: 1px solid #eeeeee;
|
||||
width: 100%;
|
||||
margin-left: 20px;
|
||||
}
|
||||
.am-header {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: box;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
padding: 7px 0;
|
||||
-webkit-box-sizing: border-box;
|
||||
-ms-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
background: #1D222D;
|
||||
height: 50px;
|
||||
text-align: center;
|
||||
-webkit-box-pack: center;
|
||||
-ms-flex-pack: center;
|
||||
box-pack: center;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
box-align: center;
|
||||
}
|
||||
.am-header h1 {
|
||||
-webkit-box-flex: 1;
|
||||
-ms-flex: 1;
|
||||
box-flex: 1;
|
||||
line-height: 18px;
|
||||
text-align: center;
|
||||
font-size: 18px;
|
||||
font-weight: 300;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body text=#000000 bgColor="#ffffff" leftMargin=0 topMargin=4>
|
||||
<header class="am-header">
|
||||
<h1>支付宝手机网站交易退款查询 (alipay.trade.fastpay.refund.query)</h1>
|
||||
</header>
|
||||
<div id="main">
|
||||
<form name=alipayment action='' method=post target="_blank">
|
||||
<div id="body" style="clear:left">
|
||||
<dl class="content">
|
||||
<dt>退款请求号:</dt>
|
||||
<dd>
|
||||
<input id="WIDout_request_no" name="WIDout_request_no" />
|
||||
</dd>
|
||||
<dt>商户订单号:</dt>
|
||||
<dd>
|
||||
<input id="WIDout_trade_no" name="WIDout_trade_no" />
|
||||
</dd>
|
||||
<hr class="one_line">
|
||||
<dt>支付宝交易号:</dt>
|
||||
<dd>
|
||||
<input id="WIDtrade_no" name="WIDtrade_no" />
|
||||
</dd>
|
||||
<hr class="one_line">
|
||||
<dt></dt>
|
||||
<dd>
|
||||
<span style="line-height: 28px; color:red;">注意:退款请求号值(必传,退款时传的值,如果退款时没传则无法查询)商户订单号和支付宝交易号不能同时为空。 trade_no、 out_trade_no如果同时存在优先取trade_no</span>
|
||||
</dd>
|
||||
<dd id="btn-dd">
|
||||
<span class="new-btn-login-sp">
|
||||
<button class="new-btn-login" type="submit" style="text-align:center;">确 认</button>
|
||||
</span>
|
||||
<span class="note-help">如果您点击“确认”按钮,即表示您同意该次的执行操作。</span>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</form>
|
||||
<div id="foot">
|
||||
<ul class="foot-ul">
|
||||
<li>
|
||||
支付宝版权所有 2015-2018 ALIPAY.COM
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,260 @@
|
||||
<?php
|
||||
/* *
|
||||
* 功能:支付宝手机网站alipay.trade.close (统一收单交易关闭接口)业务参数封装
|
||||
* 版本:2.0
|
||||
* 修改日期:2016-11-01
|
||||
* 说明:
|
||||
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
|
||||
*/
|
||||
|
||||
require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'AopSdk.php';
|
||||
//require dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'config.php';
|
||||
|
||||
class AlipayTradeService_wappay
|
||||
{
|
||||
//支付宝网关地址
|
||||
public $gateway_url = "https://openapi.alipay.com/gateway.do";
|
||||
|
||||
//支付宝公钥
|
||||
public $alipay_public_key;
|
||||
|
||||
public $alipay_public_key_filepath;
|
||||
|
||||
//商户私钥
|
||||
public $private_key;
|
||||
|
||||
//
|
||||
public $private_key_filepath;
|
||||
|
||||
//应用id
|
||||
public $appid;
|
||||
|
||||
//编码格式
|
||||
public $charset = "UTF-8";
|
||||
|
||||
public $token = null;
|
||||
|
||||
//返回数据格式
|
||||
public $format = "json";
|
||||
|
||||
//签名方式
|
||||
public $signtype = "RSA";
|
||||
|
||||
function __construct($alipay_config)
|
||||
{
|
||||
$this->gateway_url = $alipay_config['gatewayUrl'];
|
||||
$this->appid = $alipay_config['app_id'];
|
||||
$this->private_key = $alipay_config['merchant_private_key'];
|
||||
$this->private_key_filepath = $alipay_config['merchant_private_key_filepath'];
|
||||
$this->alipay_public_key = $alipay_config['alipay_public_key'];
|
||||
$this->alipay_public_key_filepath = $alipay_config['alipay_public_key_filepath'];
|
||||
$this->charset = $alipay_config['charset'];
|
||||
$this->signtype = $alipay_config['sign_type'];
|
||||
|
||||
if (empty($this->appid) || trim($this->appid) == "")
|
||||
throw new Exception("appid should not be NULL!");
|
||||
if ((empty($this->private_key) || trim($this->private_key) == "") && (empty($this->private_key_filepath) || trim($this->private_key_filepath) == ''))
|
||||
throw new Exception("private_key should not be NULL!");
|
||||
if ((empty($this->alipay_public_key) || trim($this->alipay_public_key) == "") && (empty($this->alipay_public_key_filepath) || trim($this->alipay_public_key_filepath) == ''))
|
||||
throw new Exception("alipay_public_key should not be NULL!");
|
||||
if (empty($this->charset) || trim($this->charset) == "")
|
||||
throw new Exception("charset should not be NULL!");
|
||||
if (empty($this->gateway_url) || trim($this->gateway_url) == "")
|
||||
throw new Exception("gateway_url should not be NULL!");
|
||||
}
|
||||
|
||||
function AlipayWapPayService($alipay_config)
|
||||
{
|
||||
$this->__construct($alipay_config);
|
||||
}
|
||||
|
||||
/**
|
||||
* alipay.trade.wap.pay
|
||||
* @param AlipayTradeWapPayContentBuilder $builder 业务参数,使用buildmodel中的对象生成。
|
||||
* @param string $return_url 同步跳转地址,公网可访问
|
||||
* @param string $notify_url 异步通知地址,公网可以访问
|
||||
* @return string $response 支付宝返回的信息
|
||||
*/
|
||||
function wapPay($builder, $return_url, $notify_url)
|
||||
{
|
||||
$biz_content = $builder->getBizContent();
|
||||
/// 打印业务参数
|
||||
//$this->writeLog($biz_content);
|
||||
|
||||
$request = new AlipayTradeWapPayRequest();
|
||||
|
||||
$request->setNotifyUrl($notify_url);
|
||||
$request->setReturnUrl($return_url);
|
||||
$request->setBizContent($biz_content);
|
||||
|
||||
// 首先调用支付api
|
||||
$response = $this->aopclientRequestExecute($request, true);
|
||||
// $response = $response->alipay_trade_wap_pay_response;
|
||||
return $response;
|
||||
}
|
||||
|
||||
function aopclientRequestExecute($request, $ispage = false)
|
||||
{
|
||||
$aop = new AopClient();
|
||||
$aop->gatewayUrl = $this->gateway_url;
|
||||
$aop->appId = $this->appid;
|
||||
$aop->rsaPrivateKey = $this->private_key;
|
||||
$aop->rsaPrivateKeyFilePath = $this->private_key_filepath;
|
||||
$aop->alipayrsaPublicKey = $this->alipay_public_key;
|
||||
$aop->alipayPublicKey = $this->alipay_public_key_filepath;
|
||||
$aop->apiVersion = "1.0";
|
||||
$aop->postCharset = $this->charset;
|
||||
$aop->format = $this->format;
|
||||
$aop->signType = $this->signtype;
|
||||
// 开启页面信息输出
|
||||
$aop->debugInfo = true;
|
||||
if ($ispage)
|
||||
{
|
||||
$result = $aop->pageExecute($request, "post");
|
||||
echo $result;
|
||||
}
|
||||
else
|
||||
$result = $aop->Execute($request);
|
||||
|
||||
/// 打开后,将报文写入log文件
|
||||
//$this->writeLog("response: " . var_export($result, true));
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* alipay.trade.query (统一收单线下交易查询)
|
||||
* @param $builder 业务参数,使用buildmodel中的对象生成。
|
||||
* @return $response 支付宝返回的信息
|
||||
*/
|
||||
function Query($builder)
|
||||
{
|
||||
$biz_content = $builder->getBizContent();
|
||||
/// 打印业务参数
|
||||
//$this->writeLog($biz_content);
|
||||
$request = new AlipayTradeQueryRequest();
|
||||
$request->setBizContent($biz_content);
|
||||
|
||||
// 首先调用支付api
|
||||
$response = $this->aopclientRequestExecute($request);
|
||||
$response = $response->alipay_trade_query_response;
|
||||
//var_dump($response);
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* alipay.trade.refund (统一收单交易退款接口)
|
||||
* @param AlipayTradeRefundContentBuilder_wappay $builder 业务参数,使用buildmodel中的对象生成。
|
||||
* @return string $response 支付宝返回的信息
|
||||
*/
|
||||
function Refund($builder)
|
||||
{
|
||||
$biz_content = $builder->getBizContent();
|
||||
/// 打印业务参数
|
||||
//$this->writeLog($biz_content);
|
||||
$request = new AlipayTradeRefundRequest();
|
||||
$request->setBizContent($biz_content);
|
||||
|
||||
/// 首先调用支付api
|
||||
$response = $this->aopclientRequestExecute($request);
|
||||
$response = $response->alipay_trade_refund_response;
|
||||
//var_dump($response);
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* alipay.trade.close (统一收单交易关闭接口)
|
||||
* @param $builder 业务参数,使用buildmodel中的对象生成。
|
||||
* @return string $response 支付宝返回的信息
|
||||
*/
|
||||
function Close($builder)
|
||||
{
|
||||
$biz_content = $builder->getBizContent();
|
||||
/// 打印业务参数
|
||||
//$this->writeLog($biz_content);
|
||||
$request = new AlipayTradeCloseRequest();
|
||||
$request->setBizContent($biz_content);
|
||||
|
||||
// 首先调用支付api
|
||||
$response = $this->aopclientRequestExecute($request);
|
||||
$response = $response->alipay_trade_close_response;
|
||||
//var_dump($response);
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 退款查询 alipay.trade.fastpay.refund.query (统一收单交易退款查询)
|
||||
* @param $builder 业务参数,使用buildmodel中的对象生成。
|
||||
* @return $response 支付宝返回的信息
|
||||
*/
|
||||
function refundQuery($builder)
|
||||
{
|
||||
$biz_content = $builder->getBizContent();
|
||||
/// 打印业务参数
|
||||
//$this->writeLog($biz_content);
|
||||
$request = new AlipayTradeFastpayRefundQueryRequest();
|
||||
$request->setBizContent($biz_content);
|
||||
|
||||
// 首先调用支付api
|
||||
$response = $this->aopclientRequestExecute($request);
|
||||
//var_dump($response);
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* alipay.data.dataservice.bill.downloadurl.query (查询对账单下载地址)
|
||||
* @param $builder 业务参数,使用buildmodel中的对象生成。
|
||||
* @return $response 支付宝返回的信息
|
||||
*/
|
||||
function downloadurlQuery($builder)
|
||||
{
|
||||
$biz_content = $builder->getBizContent();
|
||||
/// 打印业务参数
|
||||
//$this->writeLog($biz_content);
|
||||
$request = new alipaydatadataservicebilldownloadurlqueryRequest();
|
||||
$request->setBizContent($biz_content);
|
||||
|
||||
// 首先调用支付api
|
||||
$response = $this->aopclientRequestExecute($request);
|
||||
$response = $response->alipay_data_dataservice_bill_downloadurl_query_response;
|
||||
//var_dump($response);
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验签方法
|
||||
* @param $arr 验签支付宝返回的信息,使用支付宝公钥。
|
||||
* @return boolean
|
||||
*/
|
||||
function check($arr)
|
||||
{
|
||||
$aop = new AopClient();
|
||||
$aop->alipayrsaPublicKey = $this->alipay_public_key;
|
||||
$aop->alipayPublicKey = $this->alipay_public_key_filepath;
|
||||
$result = $aop->rsaCheckV1($arr, $this->alipay_public_key_filepath, $this->signtype);
|
||||
return $result;
|
||||
}
|
||||
|
||||
//请确保项目文件有可写权限,不然打印不了日志。
|
||||
function writeLog($text)
|
||||
{
|
||||
// $text=iconv("GBK", "UTF-8//IGNORE", $text);
|
||||
//$text = characet ( $text );
|
||||
file_put_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . "./../../log.txt", date("Y-m-d H:i:s") . " " . $text . "\r\n", FILE_APPEND);
|
||||
}
|
||||
|
||||
|
||||
/** *利用google api生成二维码图片
|
||||
* $content:二维码内容参数
|
||||
* $size:生成二维码的尺寸,宽度和高度的值
|
||||
* $lev:可选参数,纠错等级
|
||||
* $margin:生成的二维码离边框的距离
|
||||
*/
|
||||
function create_erweima($content, $size = '200', $lev = 'L', $margin = '0')
|
||||
{
|
||||
$content = urlencode($content);
|
||||
$image = '<img src="http://chart.apis.google.com/chart?chs=' . $size . 'x' . $size . '&cht=qr&chld=' . $lev . '|' . $margin . '&chl=' . $content . '" widht="' . $size . '" height="' . $size . '" />';
|
||||
return $image;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user