2234 lines
53 KiB
PHP
2234 lines
53 KiB
PHP
<?php
|
||
namespace wxpay\lib;
|
||
|
||
use wxpay\lib\WxPayException;
|
||
use wxpay\lib\WxPayConfig;
|
||
/**
|
||
* 2015-06-29 修复签名问题
|
||
**/
|
||
|
||
/**
|
||
*
|
||
* 数据对象基础类,该类中定义数据类最基本的行为,包括:
|
||
* 计算/设置/获取签名、输出xml格式的参数、从xml读取数据对象等
|
||
* @author widyhu
|
||
*
|
||
*/
|
||
class WxPayDataBase
|
||
{
|
||
protected $values = array();
|
||
|
||
/**
|
||
* 设置签名,详见签名生成算法
|
||
* @param string $value
|
||
**/
|
||
public function SetSign()
|
||
{
|
||
$sign = $this->MakeSign();
|
||
$this->values['sign'] = $sign;
|
||
return $sign;
|
||
}
|
||
|
||
/**
|
||
* 获取签名,详见签名生成算法的值
|
||
* @return 值
|
||
**/
|
||
public function GetSign()
|
||
{
|
||
return $this->values['sign'];
|
||
}
|
||
|
||
/**
|
||
* 判断签名,详见签名生成算法是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsSignSet()
|
||
{
|
||
return array_key_exists('sign', $this->values);
|
||
}
|
||
|
||
/**
|
||
* 输出xml字符
|
||
* @throws WxPayException
|
||
**/
|
||
public function ToXml()
|
||
{
|
||
if (!is_array($this->values)
|
||
|| count($this->values) <= 0) {
|
||
throw new WxPayException("数组数据异常!");
|
||
}
|
||
|
||
$xml = "<xml>";
|
||
foreach ($this->values as $key => $val) {
|
||
if (is_numeric($val)) {
|
||
$xml .= "<" . $key . ">" . $val . "</" . $key . ">";
|
||
} else {
|
||
$xml .= "<" . $key . "><![CDATA[" . $val . "]]></" . $key . ">";
|
||
}
|
||
}
|
||
$xml .= "</xml>";
|
||
return $xml;
|
||
}
|
||
|
||
/**
|
||
* 将xml转为array
|
||
* @param string $xml
|
||
* @throws WxPayException
|
||
*/
|
||
public function FromXml($xml)
|
||
{
|
||
if (!$xml) {
|
||
throw new WxPayException("xml数据异常!");
|
||
}
|
||
//将XML转为array
|
||
//禁止引用外部xml实体
|
||
libxml_disable_entity_loader(true);
|
||
$this->values = json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
|
||
return $this->values;
|
||
}
|
||
|
||
/**
|
||
* 格式化参数格式化成url参数
|
||
*/
|
||
public function ToUrlParams()
|
||
{
|
||
$buff = "";
|
||
foreach ($this->values as $k => $v) {
|
||
if ($k != "sign" && $v != "" && !is_array($v)) {
|
||
$buff .= $k . "=" . $v . "&";
|
||
}
|
||
}
|
||
|
||
$buff = trim($buff, "&");
|
||
return $buff;
|
||
}
|
||
|
||
/**
|
||
* 生成签名
|
||
* @return 签名,本函数不覆盖sign成员变量,如要设置签名需要调用SetSign方法赋值
|
||
*/
|
||
public function MakeSign()
|
||
{
|
||
//签名步骤一:按字典序排序参数
|
||
ksort($this->values);
|
||
$string = $this->ToUrlParams();
|
||
//签名步骤二:在string后加入KEY
|
||
$string = $string . "&key=" . WxPayConfig::$KEY;
|
||
//签名步骤三:MD5加密
|
||
$string = md5($string);
|
||
//签名步骤四:所有字符转为大写
|
||
$result = strtoupper($string);
|
||
return $result;
|
||
}
|
||
|
||
/**
|
||
* 获取设置的值
|
||
*/
|
||
public function GetValues()
|
||
{
|
||
return $this->values;
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
/**
|
||
*
|
||
* 统一下单输入对象
|
||
* @author widyhu
|
||
*
|
||
*/
|
||
|
||
|
||
|
||
|
||
|
||
/**
|
||
*
|
||
* 提交退款输入对象
|
||
* @author widyhu
|
||
*
|
||
*/
|
||
class WxPayRefund extends WxPayDataBase
|
||
{
|
||
/**
|
||
* 设置微信分配的公众账号ID
|
||
* @param string $value
|
||
**/
|
||
public function SetAppid($value)
|
||
{
|
||
$this->values['appid'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取微信分配的公众账号ID的值
|
||
* @return 值
|
||
**/
|
||
public function GetAppid()
|
||
{
|
||
return $this->values['appid'];
|
||
}
|
||
|
||
/**
|
||
* 判断微信分配的公众账号ID是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsAppidSet()
|
||
{
|
||
return array_key_exists('appid', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置微信支付分配的商户号
|
||
* @param string $value
|
||
**/
|
||
public function SetMch_id($value)
|
||
{
|
||
$this->values['mch_id'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取微信支付分配的商户号的值
|
||
* @return 值
|
||
**/
|
||
public function GetMch_id()
|
||
{
|
||
return $this->values['mch_id'];
|
||
}
|
||
|
||
/**
|
||
* 判断微信支付分配的商户号是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsMch_idSet()
|
||
{
|
||
return array_key_exists('mch_id', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置微信支付分配的终端设备号,与下单一致
|
||
* @param string $value
|
||
**/
|
||
public function SetDevice_info($value)
|
||
{
|
||
$this->values['device_info'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取微信支付分配的终端设备号,与下单一致的值
|
||
* @return 值
|
||
**/
|
||
public function GetDevice_info()
|
||
{
|
||
return $this->values['device_info'];
|
||
}
|
||
|
||
/**
|
||
* 判断微信支付分配的终端设备号,与下单一致是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsDevice_infoSet()
|
||
{
|
||
return array_key_exists('device_info', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置随机字符串,不长于32位。推荐随机数生成算法
|
||
* @param string $value
|
||
**/
|
||
public function SetNonce_str($value)
|
||
{
|
||
$this->values['nonce_str'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取随机字符串,不长于32位。推荐随机数生成算法的值
|
||
* @return 值
|
||
**/
|
||
public function GetNonce_str()
|
||
{
|
||
return $this->values['nonce_str'];
|
||
}
|
||
|
||
/**
|
||
* 判断随机字符串,不长于32位。推荐随机数生成算法是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsNonce_strSet()
|
||
{
|
||
return array_key_exists('nonce_str', $this->values);
|
||
}
|
||
|
||
/**
|
||
* 设置微信订单号
|
||
* @param string $value
|
||
**/
|
||
public function SetTransaction_id($value)
|
||
{
|
||
$this->values['transaction_id'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取微信订单号的值
|
||
* @return 值
|
||
**/
|
||
public function GetTransaction_id()
|
||
{
|
||
return $this->values['transaction_id'];
|
||
}
|
||
|
||
/**
|
||
* 判断微信订单号是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsTransaction_idSet()
|
||
{
|
||
return array_key_exists('transaction_id', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置商户系统内部的订单号,transaction_id、out_trade_no二选一,如果同时存在优先级:transaction_id> out_trade_no
|
||
* @param string $value
|
||
**/
|
||
public function SetOut_trade_no($value)
|
||
{
|
||
$this->values['out_trade_no'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取商户系统内部的订单号,transaction_id、out_trade_no二选一,如果同时存在优先级:transaction_id> out_trade_no的值
|
||
* @return 值
|
||
**/
|
||
public function GetOut_trade_no()
|
||
{
|
||
return $this->values['out_trade_no'];
|
||
}
|
||
|
||
/**
|
||
* 判断商户系统内部的订单号,transaction_id、out_trade_no二选一,如果同时存在优先级:transaction_id> out_trade_no是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsOut_trade_noSet()
|
||
{
|
||
return array_key_exists('out_trade_no', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置商户系统内部的退款单号,商户系统内部唯一,同一退款单号多次请求只退一笔
|
||
* @param string $value
|
||
**/
|
||
public function SetOut_refund_no($value)
|
||
{
|
||
$this->values['out_refund_no'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取商户系统内部的退款单号,商户系统内部唯一,同一退款单号多次请求只退一笔的值
|
||
* @return 值
|
||
**/
|
||
public function GetOut_refund_no()
|
||
{
|
||
return $this->values['out_refund_no'];
|
||
}
|
||
|
||
/**
|
||
* 判断商户系统内部的退款单号,商户系统内部唯一,同一退款单号多次请求只退一笔是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsOut_refund_noSet()
|
||
{
|
||
return array_key_exists('out_refund_no', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置订单总金额,单位为分,只能为整数,详见支付金额
|
||
* @param string $value
|
||
**/
|
||
public function SetTotal_fee($value)
|
||
{
|
||
$this->values['total_fee'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取订单总金额,单位为分,只能为整数,详见支付金额的值
|
||
* @return 值
|
||
**/
|
||
public function GetTotal_fee()
|
||
{
|
||
return $this->values['total_fee'];
|
||
}
|
||
|
||
/**
|
||
* 判断订单总金额,单位为分,只能为整数,详见支付金额是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsTotal_feeSet()
|
||
{
|
||
return array_key_exists('total_fee', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置退款总金额,订单总金额,单位为分,只能为整数,详见支付金额
|
||
* @param string $value
|
||
**/
|
||
public function SetRefund_fee($value)
|
||
{
|
||
$this->values['refund_fee'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取退款总金额,订单总金额,单位为分,只能为整数,详见支付金额的值
|
||
* @return 值
|
||
**/
|
||
public function GetRefund_fee()
|
||
{
|
||
return $this->values['refund_fee'];
|
||
}
|
||
|
||
/**
|
||
* 判断退款总金额,订单总金额,单位为分,只能为整数,详见支付金额是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsRefund_feeSet()
|
||
{
|
||
return array_key_exists('refund_fee', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置货币类型,符合ISO 4217标准的三位字母代码,默认人民币:CNY,其他值列表详见货币类型
|
||
* @param string $value
|
||
**/
|
||
public function SetRefund_fee_type($value)
|
||
{
|
||
$this->values['refund_fee_type'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取货币类型,符合ISO 4217标准的三位字母代码,默认人民币:CNY,其他值列表详见货币类型的值
|
||
* @return 值
|
||
**/
|
||
public function GetRefund_fee_type()
|
||
{
|
||
return $this->values['refund_fee_type'];
|
||
}
|
||
|
||
/**
|
||
* 判断货币类型,符合ISO 4217标准的三位字母代码,默认人民币:CNY,其他值列表详见货币类型是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsRefund_fee_typeSet()
|
||
{
|
||
return array_key_exists('refund_fee_type', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置操作员帐号, 默认为商户号
|
||
* @param string $value
|
||
**/
|
||
public function SetOp_user_id($value)
|
||
{
|
||
$this->values['op_user_id'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取操作员帐号, 默认为商户号的值
|
||
* @return 值
|
||
**/
|
||
public function GetOp_user_id()
|
||
{
|
||
return $this->values['op_user_id'];
|
||
}
|
||
|
||
/**
|
||
* 判断操作员帐号, 默认为商户号是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsOp_user_idSet()
|
||
{
|
||
return array_key_exists('op_user_id', $this->values);
|
||
}
|
||
}
|
||
|
||
/**
|
||
*
|
||
* 退款查询输入对象
|
||
* @author widyhu
|
||
*
|
||
*/
|
||
class WxPayRefundQuery extends WxPayDataBase
|
||
{
|
||
/**
|
||
* 设置微信分配的公众账号ID
|
||
* @param string $value
|
||
**/
|
||
public function SetAppid($value)
|
||
{
|
||
$this->values['appid'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取微信分配的公众账号ID的值
|
||
* @return 值
|
||
**/
|
||
public function GetAppid()
|
||
{
|
||
return $this->values['appid'];
|
||
}
|
||
|
||
/**
|
||
* 判断微信分配的公众账号ID是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsAppidSet()
|
||
{
|
||
return array_key_exists('appid', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置微信支付分配的商户号
|
||
* @param string $value
|
||
**/
|
||
public function SetMch_id($value)
|
||
{
|
||
$this->values['mch_id'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取微信支付分配的商户号的值
|
||
* @return 值
|
||
**/
|
||
public function GetMch_id()
|
||
{
|
||
return $this->values['mch_id'];
|
||
}
|
||
|
||
/**
|
||
* 判断微信支付分配的商户号是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsMch_idSet()
|
||
{
|
||
return array_key_exists('mch_id', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置微信支付分配的终端设备号
|
||
* @param string $value
|
||
**/
|
||
public function SetDevice_info($value)
|
||
{
|
||
$this->values['device_info'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取微信支付分配的终端设备号的值
|
||
* @return 值
|
||
**/
|
||
public function GetDevice_info()
|
||
{
|
||
return $this->values['device_info'];
|
||
}
|
||
|
||
/**
|
||
* 判断微信支付分配的终端设备号是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsDevice_infoSet()
|
||
{
|
||
return array_key_exists('device_info', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置随机字符串,不长于32位。推荐随机数生成算法
|
||
* @param string $value
|
||
**/
|
||
public function SetNonce_str($value)
|
||
{
|
||
$this->values['nonce_str'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取随机字符串,不长于32位。推荐随机数生成算法的值
|
||
* @return 值
|
||
**/
|
||
public function GetNonce_str()
|
||
{
|
||
return $this->values['nonce_str'];
|
||
}
|
||
|
||
/**
|
||
* 判断随机字符串,不长于32位。推荐随机数生成算法是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsNonce_strSet()
|
||
{
|
||
return array_key_exists('nonce_str', $this->values);
|
||
}
|
||
|
||
/**
|
||
* 设置微信订单号
|
||
* @param string $value
|
||
**/
|
||
public function SetTransaction_id($value)
|
||
{
|
||
$this->values['transaction_id'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取微信订单号的值
|
||
* @return 值
|
||
**/
|
||
public function GetTransaction_id()
|
||
{
|
||
return $this->values['transaction_id'];
|
||
}
|
||
|
||
/**
|
||
* 判断微信订单号是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsTransaction_idSet()
|
||
{
|
||
return array_key_exists('transaction_id', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置商户系统内部的订单号
|
||
* @param string $value
|
||
**/
|
||
public function SetOut_trade_no($value)
|
||
{
|
||
$this->values['out_trade_no'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取商户系统内部的订单号的值
|
||
* @return 值
|
||
**/
|
||
public function GetOut_trade_no()
|
||
{
|
||
return $this->values['out_trade_no'];
|
||
}
|
||
|
||
/**
|
||
* 判断商户系统内部的订单号是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsOut_trade_noSet()
|
||
{
|
||
return array_key_exists('out_trade_no', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置商户退款单号
|
||
* @param string $value
|
||
**/
|
||
public function SetOut_refund_no($value)
|
||
{
|
||
$this->values['out_refund_no'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取商户退款单号的值
|
||
* @return 值
|
||
**/
|
||
public function GetOut_refund_no()
|
||
{
|
||
return $this->values['out_refund_no'];
|
||
}
|
||
|
||
/**
|
||
* 判断商户退款单号是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsOut_refund_noSet()
|
||
{
|
||
return array_key_exists('out_refund_no', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置微信退款单号refund_id、out_refund_no、out_trade_no、transaction_id四个参数必填一个,如果同时存在优先级为:refund_id>out_refund_no>transaction_id>out_trade_no
|
||
* @param string $value
|
||
**/
|
||
public function SetRefund_id($value)
|
||
{
|
||
$this->values['refund_id'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取微信退款单号refund_id、out_refund_no、out_trade_no、transaction_id四个参数必填一个,如果同时存在优先级为:refund_id>out_refund_no>transaction_id>out_trade_no的值
|
||
* @return 值
|
||
**/
|
||
public function GetRefund_id()
|
||
{
|
||
return $this->values['refund_id'];
|
||
}
|
||
|
||
/**
|
||
* 判断微信退款单号refund_id、out_refund_no、out_trade_no、transaction_id四个参数必填一个,如果同时存在优先级为:refund_id>out_refund_no>transaction_id>out_trade_no是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsRefund_idSet()
|
||
{
|
||
return array_key_exists('refund_id', $this->values);
|
||
}
|
||
}
|
||
|
||
/**
|
||
*
|
||
* 下载对账单输入对象
|
||
* @author widyhu
|
||
*
|
||
*/
|
||
class WxPayDownloadBill extends WxPayDataBase
|
||
{
|
||
/**
|
||
* 设置微信分配的公众账号ID
|
||
* @param string $value
|
||
**/
|
||
public function SetAppid($value)
|
||
{
|
||
$this->values['appid'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取微信分配的公众账号ID的值
|
||
* @return 值
|
||
**/
|
||
public function GetAppid()
|
||
{
|
||
return $this->values['appid'];
|
||
}
|
||
|
||
/**
|
||
* 判断微信分配的公众账号ID是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsAppidSet()
|
||
{
|
||
return array_key_exists('appid', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置微信支付分配的商户号
|
||
* @param string $value
|
||
**/
|
||
public function SetMch_id($value)
|
||
{
|
||
$this->values['mch_id'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取微信支付分配的商户号的值
|
||
* @return 值
|
||
**/
|
||
public function GetMch_id()
|
||
{
|
||
return $this->values['mch_id'];
|
||
}
|
||
|
||
/**
|
||
* 判断微信支付分配的商户号是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsMch_idSet()
|
||
{
|
||
return array_key_exists('mch_id', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置微信支付分配的终端设备号,填写此字段,只下载该设备号的对账单
|
||
* @param string $value
|
||
**/
|
||
public function SetDevice_info($value)
|
||
{
|
||
$this->values['device_info'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取微信支付分配的终端设备号,填写此字段,只下载该设备号的对账单的值
|
||
* @return 值
|
||
**/
|
||
public function GetDevice_info()
|
||
{
|
||
return $this->values['device_info'];
|
||
}
|
||
|
||
/**
|
||
* 判断微信支付分配的终端设备号,填写此字段,只下载该设备号的对账单是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsDevice_infoSet()
|
||
{
|
||
return array_key_exists('device_info', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置随机字符串,不长于32位。推荐随机数生成算法
|
||
* @param string $value
|
||
**/
|
||
public function SetNonce_str($value)
|
||
{
|
||
$this->values['nonce_str'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取随机字符串,不长于32位。推荐随机数生成算法的值
|
||
* @return 值
|
||
**/
|
||
public function GetNonce_str()
|
||
{
|
||
return $this->values['nonce_str'];
|
||
}
|
||
|
||
/**
|
||
* 判断随机字符串,不长于32位。推荐随机数生成算法是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsNonce_strSet()
|
||
{
|
||
return array_key_exists('nonce_str', $this->values);
|
||
}
|
||
|
||
/**
|
||
* 设置下载对账单的日期,格式:20140603
|
||
* @param string $value
|
||
**/
|
||
public function SetBill_date($value)
|
||
{
|
||
$this->values['bill_date'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取下载对账单的日期,格式:20140603的值
|
||
* @return 值
|
||
**/
|
||
public function GetBill_date()
|
||
{
|
||
return $this->values['bill_date'];
|
||
}
|
||
|
||
/**
|
||
* 判断下载对账单的日期,格式:20140603是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsBill_dateSet()
|
||
{
|
||
return array_key_exists('bill_date', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置ALL,返回当日所有订单信息,默认值SUCCESS,返回当日成功支付的订单REFUND,返回当日退款订单REVOKED,已撤销的订单
|
||
* @param string $value
|
||
**/
|
||
public function SetBill_type($value)
|
||
{
|
||
$this->values['bill_type'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取ALL,返回当日所有订单信息,默认值SUCCESS,返回当日成功支付的订单REFUND,返回当日退款订单REVOKED,已撤销的订单的值
|
||
* @return 值
|
||
**/
|
||
public function GetBill_type()
|
||
{
|
||
return $this->values['bill_type'];
|
||
}
|
||
|
||
/**
|
||
* 判断ALL,返回当日所有订单信息,默认值SUCCESS,返回当日成功支付的订单REFUND,返回当日退款订单REVOKED,已撤销的订单是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsBill_typeSet()
|
||
{
|
||
return array_key_exists('bill_type', $this->values);
|
||
}
|
||
}
|
||
|
||
/**
|
||
*
|
||
* 测速上报输入对象
|
||
* @author widyhu
|
||
*
|
||
*/
|
||
class WxPayReport extends WxPayDataBase
|
||
{
|
||
/**
|
||
* 设置微信分配的公众账号ID
|
||
* @param string $value
|
||
**/
|
||
public function SetAppid($value)
|
||
{
|
||
$this->values['appid'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取微信分配的公众账号ID的值
|
||
* @return 值
|
||
**/
|
||
public function GetAppid()
|
||
{
|
||
return $this->values['appid'];
|
||
}
|
||
|
||
/**
|
||
* 判断微信分配的公众账号ID是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsAppidSet()
|
||
{
|
||
return array_key_exists('appid', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置微信支付分配的商户号
|
||
* @param string $value
|
||
**/
|
||
public function SetMch_id($value)
|
||
{
|
||
$this->values['mch_id'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取微信支付分配的商户号的值
|
||
* @return 值
|
||
**/
|
||
public function GetMch_id()
|
||
{
|
||
return $this->values['mch_id'];
|
||
}
|
||
|
||
/**
|
||
* 判断微信支付分配的商户号是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsMch_idSet()
|
||
{
|
||
return array_key_exists('mch_id', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置微信支付分配的终端设备号,商户自定义
|
||
* @param string $value
|
||
**/
|
||
public function SetDevice_info($value)
|
||
{
|
||
$this->values['device_info'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取微信支付分配的终端设备号,商户自定义的值
|
||
* @return 值
|
||
**/
|
||
public function GetDevice_info()
|
||
{
|
||
return $this->values['device_info'];
|
||
}
|
||
|
||
/**
|
||
* 判断微信支付分配的终端设备号,商户自定义是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsDevice_infoSet()
|
||
{
|
||
return array_key_exists('device_info', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置随机字符串,不长于32位。推荐随机数生成算法
|
||
* @param string $value
|
||
**/
|
||
public function SetNonce_str($value)
|
||
{
|
||
$this->values['nonce_str'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取随机字符串,不长于32位。推荐随机数生成算法的值
|
||
* @return 值
|
||
**/
|
||
public function GetNonce_str()
|
||
{
|
||
return $this->values['nonce_str'];
|
||
}
|
||
|
||
/**
|
||
* 判断随机字符串,不长于32位。推荐随机数生成算法是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsNonce_strSet()
|
||
{
|
||
return array_key_exists('nonce_str', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置上报对应的接口的完整URL,类似:https://api.mch.weixin.qq.com/pay/unifiedorder对于被扫支付,为更好的和商户共同分析一次业务行为的整体耗时情况,对于两种接入模式,请都在门店侧对一次被扫行为进行一次单独的整体上报,上报URL指定为:https://api.mch.weixin.qq.com/pay/micropay/total关于两种接入模式具体可参考本文档章节:被扫支付商户接入模式其它接口调用仍然按照调用一次,上报一次来进行。
|
||
* @param string $value
|
||
**/
|
||
public function SetInterface_url($value)
|
||
{
|
||
$this->values['interface_url'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取上报对应的接口的完整URL,类似:https://api.mch.weixin.qq.com/pay/unifiedorder对于被扫支付,为更好的和商户共同分析一次业务行为的整体耗时情况,对于两种接入模式,请都在门店侧对一次被扫行为进行一次单独的整体上报,上报URL指定为:https://api.mch.weixin.qq.com/pay/micropay/total关于两种接入模式具体可参考本文档章节:被扫支付商户接入模式其它接口调用仍然按照调用一次,上报一次来进行。的值
|
||
* @return 值
|
||
**/
|
||
public function GetInterface_url()
|
||
{
|
||
return $this->values['interface_url'];
|
||
}
|
||
|
||
/**
|
||
* 判断上报对应的接口的完整URL,类似:https://api.mch.weixin.qq.com/pay/unifiedorder对于被扫支付,为更好的和商户共同分析一次业务行为的整体耗时情况,对于两种接入模式,请都在门店侧对一次被扫行为进行一次单独的整体上报,上报URL指定为:https://api.mch.weixin.qq.com/pay/micropay/total关于两种接入模式具体可参考本文档章节:被扫支付商户接入模式其它接口调用仍然按照调用一次,上报一次来进行。是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsInterface_urlSet()
|
||
{
|
||
return array_key_exists('interface_url', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置接口耗时情况,单位为毫秒
|
||
* @param string $value
|
||
**/
|
||
public function SetExecute_time_($value)
|
||
{
|
||
$this->values['execute_time_'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取接口耗时情况,单位为毫秒的值
|
||
* @return 值
|
||
**/
|
||
public function GetExecute_time_()
|
||
{
|
||
return $this->values['execute_time_'];
|
||
}
|
||
|
||
/**
|
||
* 判断接口耗时情况,单位为毫秒是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsExecute_time_Set()
|
||
{
|
||
return array_key_exists('execute_time_', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置SUCCESS/FAIL此字段是通信标识,非交易标识,交易是否成功需要查看trade_state来判断
|
||
* @param string $value
|
||
**/
|
||
public function SetReturn_code($value)
|
||
{
|
||
$this->values['return_code'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取SUCCESS/FAIL此字段是通信标识,非交易标识,交易是否成功需要查看trade_state来判断的值
|
||
* @return 值
|
||
**/
|
||
public function GetReturn_code()
|
||
{
|
||
return $this->values['return_code'];
|
||
}
|
||
|
||
/**
|
||
* 判断SUCCESS/FAIL此字段是通信标识,非交易标识,交易是否成功需要查看trade_state来判断是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsReturn_codeSet()
|
||
{
|
||
return array_key_exists('return_code', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置返回信息,如非空,为错误原因签名失败参数格式校验错误
|
||
* @param string $value
|
||
**/
|
||
public function SetReturn_msg($value)
|
||
{
|
||
$this->values['return_msg'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取返回信息,如非空,为错误原因签名失败参数格式校验错误的值
|
||
* @return 值
|
||
**/
|
||
public function GetReturn_msg()
|
||
{
|
||
return $this->values['return_msg'];
|
||
}
|
||
|
||
/**
|
||
* 判断返回信息,如非空,为错误原因签名失败参数格式校验错误是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsReturn_msgSet()
|
||
{
|
||
return array_key_exists('return_msg', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置SUCCESS/FAIL
|
||
* @param string $value
|
||
**/
|
||
public function SetResult_code($value)
|
||
{
|
||
$this->values['result_code'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取SUCCESS/FAIL的值
|
||
* @return 值
|
||
**/
|
||
public function GetResult_code()
|
||
{
|
||
return $this->values['result_code'];
|
||
}
|
||
|
||
/**
|
||
* 判断SUCCESS/FAIL是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsResult_codeSet()
|
||
{
|
||
return array_key_exists('result_code', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置ORDERNOTEXIST—订单不存在SYSTEMERROR—系统错误
|
||
* @param string $value
|
||
**/
|
||
public function SetErr_code($value)
|
||
{
|
||
$this->values['err_code'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取ORDERNOTEXIST—订单不存在SYSTEMERROR—系统错误的值
|
||
* @return 值
|
||
**/
|
||
public function GetErr_code()
|
||
{
|
||
return $this->values['err_code'];
|
||
}
|
||
|
||
/**
|
||
* 判断ORDERNOTEXIST—订单不存在SYSTEMERROR—系统错误是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsErr_codeSet()
|
||
{
|
||
return array_key_exists('err_code', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置结果信息描述
|
||
* @param string $value
|
||
**/
|
||
public function SetErr_code_des($value)
|
||
{
|
||
$this->values['err_code_des'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取结果信息描述的值
|
||
* @return 值
|
||
**/
|
||
public function GetErr_code_des()
|
||
{
|
||
return $this->values['err_code_des'];
|
||
}
|
||
|
||
/**
|
||
* 判断结果信息描述是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsErr_code_desSet()
|
||
{
|
||
return array_key_exists('err_code_des', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置商户系统内部的订单号,商户可以在上报时提供相关商户订单号方便微信支付更好的提高服务质量。
|
||
* @param string $value
|
||
**/
|
||
public function SetOut_trade_no($value)
|
||
{
|
||
$this->values['out_trade_no'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取商户系统内部的订单号,商户可以在上报时提供相关商户订单号方便微信支付更好的提高服务质量。 的值
|
||
* @return 值
|
||
**/
|
||
public function GetOut_trade_no()
|
||
{
|
||
return $this->values['out_trade_no'];
|
||
}
|
||
|
||
/**
|
||
* 判断商户系统内部的订单号,商户可以在上报时提供相关商户订单号方便微信支付更好的提高服务质量。 是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsOut_trade_noSet()
|
||
{
|
||
return array_key_exists('out_trade_no', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置发起接口调用时的机器IP
|
||
* @param string $value
|
||
**/
|
||
public function SetUser_ip($value)
|
||
{
|
||
$this->values['user_ip'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取发起接口调用时的机器IP 的值
|
||
* @return 值
|
||
**/
|
||
public function GetUser_ip()
|
||
{
|
||
return $this->values['user_ip'];
|
||
}
|
||
|
||
/**
|
||
* 判断发起接口调用时的机器IP 是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsUser_ipSet()
|
||
{
|
||
return array_key_exists('user_ip', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置系统时间,格式为yyyyMMddHHmmss,如2009年12月27日9点10分10秒表示为20091227091010。其他详见时间规则
|
||
* @param string $value
|
||
**/
|
||
public function SetTime($value)
|
||
{
|
||
$this->values['time'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取系统时间,格式为yyyyMMddHHmmss,如2009年12月27日9点10分10秒表示为20091227091010。其他详见时间规则的值
|
||
* @return 值
|
||
**/
|
||
public function GetTime()
|
||
{
|
||
return $this->values['time'];
|
||
}
|
||
|
||
/**
|
||
* 判断系统时间,格式为yyyyMMddHHmmss,如2009年12月27日9点10分10秒表示为20091227091010。其他详见时间规则是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsTimeSet()
|
||
{
|
||
return array_key_exists('time', $this->values);
|
||
}
|
||
}
|
||
|
||
/**
|
||
*
|
||
* 短链转换输入对象
|
||
* @author widyhu
|
||
*
|
||
*/
|
||
class WxPayShortUrl extends WxPayDataBase
|
||
{
|
||
/**
|
||
* 设置微信分配的公众账号ID
|
||
* @param string $value
|
||
**/
|
||
public function SetAppid($value)
|
||
{
|
||
$this->values['appid'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取微信分配的公众账号ID的值
|
||
* @return 值
|
||
**/
|
||
public function GetAppid()
|
||
{
|
||
return $this->values['appid'];
|
||
}
|
||
|
||
/**
|
||
* 判断微信分配的公众账号ID是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsAppidSet()
|
||
{
|
||
return array_key_exists('appid', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置微信支付分配的商户号
|
||
* @param string $value
|
||
**/
|
||
public function SetMch_id($value)
|
||
{
|
||
$this->values['mch_id'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取微信支付分配的商户号的值
|
||
* @return 值
|
||
**/
|
||
public function GetMch_id()
|
||
{
|
||
return $this->values['mch_id'];
|
||
}
|
||
|
||
/**
|
||
* 判断微信支付分配的商户号是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsMch_idSet()
|
||
{
|
||
return array_key_exists('mch_id', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置需要转换的URL,签名用原串,传输需URL encode
|
||
* @param string $value
|
||
**/
|
||
public function SetLong_url($value)
|
||
{
|
||
$this->values['long_url'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取需要转换的URL,签名用原串,传输需URL encode的值
|
||
* @return 值
|
||
**/
|
||
public function GetLong_url()
|
||
{
|
||
return $this->values['long_url'];
|
||
}
|
||
|
||
/**
|
||
* 判断需要转换的URL,签名用原串,传输需URL encode是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsLong_urlSet()
|
||
{
|
||
return array_key_exists('long_url', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置随机字符串,不长于32位。推荐随机数生成算法
|
||
* @param string $value
|
||
**/
|
||
public function SetNonce_str($value)
|
||
{
|
||
$this->values['nonce_str'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取随机字符串,不长于32位。推荐随机数生成算法的值
|
||
* @return 值
|
||
**/
|
||
public function GetNonce_str()
|
||
{
|
||
return $this->values['nonce_str'];
|
||
}
|
||
|
||
/**
|
||
* 判断随机字符串,不长于32位。推荐随机数生成算法是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsNonce_strSet()
|
||
{
|
||
return array_key_exists('nonce_str', $this->values);
|
||
}
|
||
}
|
||
|
||
/**
|
||
*
|
||
* 提交被扫输入对象
|
||
* @author widyhu
|
||
*
|
||
*/
|
||
class WxPayMicroPay extends WxPayDataBase
|
||
{
|
||
/**
|
||
* 设置微信分配的公众账号ID
|
||
* @param string $value
|
||
**/
|
||
public function SetAppid($value)
|
||
{
|
||
$this->values['appid'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取微信分配的公众账号ID的值
|
||
* @return 值
|
||
**/
|
||
public function GetAppid()
|
||
{
|
||
return $this->values['appid'];
|
||
}
|
||
|
||
/**
|
||
* 判断微信分配的公众账号ID是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsAppidSet()
|
||
{
|
||
return array_key_exists('appid', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置微信支付分配的商户号
|
||
* @param string $value
|
||
**/
|
||
public function SetMch_id($value)
|
||
{
|
||
$this->values['mch_id'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取微信支付分配的商户号的值
|
||
* @return 值
|
||
**/
|
||
public function GetMch_id()
|
||
{
|
||
return $this->values['mch_id'];
|
||
}
|
||
|
||
/**
|
||
* 判断微信支付分配的商户号是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsMch_idSet()
|
||
{
|
||
return array_key_exists('mch_id', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置终端设备号(商户自定义,如门店编号)
|
||
* @param string $value
|
||
**/
|
||
public function SetDevice_info($value)
|
||
{
|
||
$this->values['device_info'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取终端设备号(商户自定义,如门店编号)的值
|
||
* @return 值
|
||
**/
|
||
public function GetDevice_info()
|
||
{
|
||
return $this->values['device_info'];
|
||
}
|
||
|
||
/**
|
||
* 判断终端设备号(商户自定义,如门店编号)是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsDevice_infoSet()
|
||
{
|
||
return array_key_exists('device_info', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置随机字符串,不长于32位。推荐随机数生成算法
|
||
* @param string $value
|
||
**/
|
||
public function SetNonce_str($value)
|
||
{
|
||
$this->values['nonce_str'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取随机字符串,不长于32位。推荐随机数生成算法的值
|
||
* @return 值
|
||
**/
|
||
public function GetNonce_str()
|
||
{
|
||
return $this->values['nonce_str'];
|
||
}
|
||
|
||
/**
|
||
* 判断随机字符串,不长于32位。推荐随机数生成算法是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsNonce_strSet()
|
||
{
|
||
return array_key_exists('nonce_str', $this->values);
|
||
}
|
||
|
||
/**
|
||
* 设置商品或支付单简要描述
|
||
* @param string $value
|
||
**/
|
||
public function SetBody($value)
|
||
{
|
||
$this->values['body'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取商品或支付单简要描述的值
|
||
* @return 值
|
||
**/
|
||
public function GetBody()
|
||
{
|
||
return $this->values['body'];
|
||
}
|
||
|
||
/**
|
||
* 判断商品或支付单简要描述是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsBodySet()
|
||
{
|
||
return array_key_exists('body', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置商品名称明细列表
|
||
* @param string $value
|
||
**/
|
||
public function SetDetail($value)
|
||
{
|
||
$this->values['detail'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取商品名称明细列表的值
|
||
* @return 值
|
||
**/
|
||
public function GetDetail()
|
||
{
|
||
return $this->values['detail'];
|
||
}
|
||
|
||
/**
|
||
* 判断商品名称明细列表是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsDetailSet()
|
||
{
|
||
return array_key_exists('detail', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置附加数据,在查询API和支付通知中原样返回,该字段主要用于商户携带订单的自定义数据
|
||
* @param string $value
|
||
**/
|
||
public function SetAttach($value)
|
||
{
|
||
$this->values['attach'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取附加数据,在查询API和支付通知中原样返回,该字段主要用于商户携带订单的自定义数据的值
|
||
* @return 值
|
||
**/
|
||
public function GetAttach()
|
||
{
|
||
return $this->values['attach'];
|
||
}
|
||
|
||
/**
|
||
* 判断附加数据,在查询API和支付通知中原样返回,该字段主要用于商户携带订单的自定义数据是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsAttachSet()
|
||
{
|
||
return array_key_exists('attach', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置商户系统内部的订单号,32个字符内、可包含字母, 其他说明见商户订单号
|
||
* @param string $value
|
||
**/
|
||
public function SetOut_trade_no($value)
|
||
{
|
||
$this->values['out_trade_no'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取商户系统内部的订单号,32个字符内、可包含字母, 其他说明见商户订单号的值
|
||
* @return 值
|
||
**/
|
||
public function GetOut_trade_no()
|
||
{
|
||
return $this->values['out_trade_no'];
|
||
}
|
||
|
||
/**
|
||
* 判断商户系统内部的订单号,32个字符内、可包含字母, 其他说明见商户订单号是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsOut_trade_noSet()
|
||
{
|
||
return array_key_exists('out_trade_no', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置订单总金额,单位为分,只能为整数,详见支付金额
|
||
* @param string $value
|
||
**/
|
||
public function SetTotal_fee($value)
|
||
{
|
||
$this->values['total_fee'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取订单总金额,单位为分,只能为整数,详见支付金额的值
|
||
* @return 值
|
||
**/
|
||
public function GetTotal_fee()
|
||
{
|
||
return $this->values['total_fee'];
|
||
}
|
||
|
||
/**
|
||
* 判断订单总金额,单位为分,只能为整数,详见支付金额是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsTotal_feeSet()
|
||
{
|
||
return array_key_exists('total_fee', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置符合ISO 4217标准的三位字母代码,默认人民币:CNY,其他值列表详见货币类型
|
||
* @param string $value
|
||
**/
|
||
public function SetFee_type($value)
|
||
{
|
||
$this->values['fee_type'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取符合ISO 4217标准的三位字母代码,默认人民币:CNY,其他值列表详见货币类型的值
|
||
* @return 值
|
||
**/
|
||
public function GetFee_type()
|
||
{
|
||
return $this->values['fee_type'];
|
||
}
|
||
|
||
/**
|
||
* 判断符合ISO 4217标准的三位字母代码,默认人民币:CNY,其他值列表详见货币类型是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsFee_typeSet()
|
||
{
|
||
return array_key_exists('fee_type', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置调用微信支付API的机器IP
|
||
* @param string $value
|
||
**/
|
||
public function SetSpbill_create_ip($value)
|
||
{
|
||
$this->values['spbill_create_ip'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取调用微信支付API的机器IP 的值
|
||
* @return 值
|
||
**/
|
||
public function GetSpbill_create_ip()
|
||
{
|
||
return $this->values['spbill_create_ip'];
|
||
}
|
||
|
||
/**
|
||
* 判断调用微信支付API的机器IP 是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsSpbill_create_ipSet()
|
||
{
|
||
return array_key_exists('spbill_create_ip', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置订单生成时间,格式为yyyyMMddHHmmss,如2009年12月25日9点10分10秒表示为20091225091010。详见时间规则
|
||
* @param string $value
|
||
**/
|
||
public function SetTime_start($value)
|
||
{
|
||
$this->values['time_start'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取订单生成时间,格式为yyyyMMddHHmmss,如2009年12月25日9点10分10秒表示为20091225091010。详见时间规则的值
|
||
* @return 值
|
||
**/
|
||
public function GetTime_start()
|
||
{
|
||
return $this->values['time_start'];
|
||
}
|
||
|
||
/**
|
||
* 判断订单生成时间,格式为yyyyMMddHHmmss,如2009年12月25日9点10分10秒表示为20091225091010。详见时间规则是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsTime_startSet()
|
||
{
|
||
return array_key_exists('time_start', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置订单失效时间,格式为yyyyMMddHHmmss,如2009年12月27日9点10分10秒表示为20091227091010。详见时间规则
|
||
* @param string $value
|
||
**/
|
||
public function SetTime_expire($value)
|
||
{
|
||
$this->values['time_expire'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取订单失效时间,格式为yyyyMMddHHmmss,如2009年12月27日9点10分10秒表示为20091227091010。详见时间规则的值
|
||
* @return 值
|
||
**/
|
||
public function GetTime_expire()
|
||
{
|
||
return $this->values['time_expire'];
|
||
}
|
||
|
||
/**
|
||
* 判断订单失效时间,格式为yyyyMMddHHmmss,如2009年12月27日9点10分10秒表示为20091227091010。详见时间规则是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsTime_expireSet()
|
||
{
|
||
return array_key_exists('time_expire', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置商品标记,代金券或立减优惠功能的参数,说明详见代金券或立减优惠
|
||
* @param string $value
|
||
**/
|
||
public function SetGoods_tag($value)
|
||
{
|
||
$this->values['goods_tag'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取商品标记,代金券或立减优惠功能的参数,说明详见代金券或立减优惠的值
|
||
* @return 值
|
||
**/
|
||
public function GetGoods_tag()
|
||
{
|
||
return $this->values['goods_tag'];
|
||
}
|
||
|
||
/**
|
||
* 判断商品标记,代金券或立减优惠功能的参数,说明详见代金券或立减优惠是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsGoods_tagSet()
|
||
{
|
||
return array_key_exists('goods_tag', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置扫码支付授权码,设备读取用户微信中的条码或者二维码信息
|
||
* @param string $value
|
||
**/
|
||
public function SetAuth_code($value)
|
||
{
|
||
$this->values['auth_code'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取扫码支付授权码,设备读取用户微信中的条码或者二维码信息的值
|
||
* @return 值
|
||
**/
|
||
public function GetAuth_code()
|
||
{
|
||
return $this->values['auth_code'];
|
||
}
|
||
|
||
/**
|
||
* 判断扫码支付授权码,设备读取用户微信中的条码或者二维码信息是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsAuth_codeSet()
|
||
{
|
||
return array_key_exists('auth_code', $this->values);
|
||
}
|
||
}
|
||
|
||
/**
|
||
*
|
||
* 撤销输入对象
|
||
* @author widyhu
|
||
*
|
||
*/
|
||
class WxPayReverse extends WxPayDataBase
|
||
{
|
||
/**
|
||
* 设置微信分配的公众账号ID
|
||
* @param string $value
|
||
**/
|
||
public function SetAppid($value)
|
||
{
|
||
$this->values['appid'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取微信分配的公众账号ID的值
|
||
* @return 值
|
||
**/
|
||
public function GetAppid()
|
||
{
|
||
return $this->values['appid'];
|
||
}
|
||
|
||
/**
|
||
* 判断微信分配的公众账号ID是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsAppidSet()
|
||
{
|
||
return array_key_exists('appid', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置微信支付分配的商户号
|
||
* @param string $value
|
||
**/
|
||
public function SetMch_id($value)
|
||
{
|
||
$this->values['mch_id'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取微信支付分配的商户号的值
|
||
* @return 值
|
||
**/
|
||
public function GetMch_id()
|
||
{
|
||
return $this->values['mch_id'];
|
||
}
|
||
|
||
/**
|
||
* 判断微信支付分配的商户号是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsMch_idSet()
|
||
{
|
||
return array_key_exists('mch_id', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置微信的订单号,优先使用
|
||
* @param string $value
|
||
**/
|
||
public function SetTransaction_id($value)
|
||
{
|
||
$this->values['transaction_id'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取微信的订单号,优先使用的值
|
||
* @return 值
|
||
**/
|
||
public function GetTransaction_id()
|
||
{
|
||
return $this->values['transaction_id'];
|
||
}
|
||
|
||
/**
|
||
* 判断微信的订单号,优先使用是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsTransaction_idSet()
|
||
{
|
||
return array_key_exists('transaction_id', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置商户系统内部的订单号,transaction_id、out_trade_no二选一,如果同时存在优先级:transaction_id> out_trade_no
|
||
* @param string $value
|
||
**/
|
||
public function SetOut_trade_no($value)
|
||
{
|
||
$this->values['out_trade_no'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取商户系统内部的订单号,transaction_id、out_trade_no二选一,如果同时存在优先级:transaction_id> out_trade_no的值
|
||
* @return 值
|
||
**/
|
||
public function GetOut_trade_no()
|
||
{
|
||
return $this->values['out_trade_no'];
|
||
}
|
||
|
||
/**
|
||
* 判断商户系统内部的订单号,transaction_id、out_trade_no二选一,如果同时存在优先级:transaction_id> out_trade_no是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsOut_trade_noSet()
|
||
{
|
||
return array_key_exists('out_trade_no', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置随机字符串,不长于32位。推荐随机数生成算法
|
||
* @param string $value
|
||
**/
|
||
public function SetNonce_str($value)
|
||
{
|
||
$this->values['nonce_str'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取随机字符串,不长于32位。推荐随机数生成算法的值
|
||
* @return 值
|
||
**/
|
||
public function GetNonce_str()
|
||
{
|
||
return $this->values['nonce_str'];
|
||
}
|
||
|
||
/**
|
||
* 判断随机字符串,不长于32位。推荐随机数生成算法是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsNonce_strSet()
|
||
{
|
||
return array_key_exists('nonce_str', $this->values);
|
||
}
|
||
}
|
||
|
||
/**
|
||
*
|
||
* 提交JSAPI输入对象
|
||
* @author widyhu
|
||
*
|
||
*/
|
||
class WxPayJsApiPay extends WxPayDataBase
|
||
{
|
||
/**
|
||
* 设置微信分配的公众账号ID
|
||
* @param string $value
|
||
**/
|
||
public function SetAppid($value)
|
||
{
|
||
$this->values['appId'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取微信分配的公众账号ID的值
|
||
* @return 值
|
||
**/
|
||
public function GetAppid()
|
||
{
|
||
return $this->values['appId'];
|
||
}
|
||
|
||
/**
|
||
* 判断微信分配的公众账号ID是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsAppidSet()
|
||
{
|
||
return array_key_exists('appId', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置支付时间戳
|
||
* @param string $value
|
||
**/
|
||
public function SetTimeStamp($value)
|
||
{
|
||
$this->values['timeStamp'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取支付时间戳的值
|
||
* @return 值
|
||
**/
|
||
public function GetTimeStamp()
|
||
{
|
||
return $this->values['timeStamp'];
|
||
}
|
||
|
||
/**
|
||
* 判断支付时间戳是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsTimeStampSet()
|
||
{
|
||
return array_key_exists('timeStamp', $this->values);
|
||
}
|
||
|
||
/**
|
||
* 随机字符串
|
||
* @param string $value
|
||
**/
|
||
public function SetNonceStr($value)
|
||
{
|
||
$this->values['nonceStr'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取notify随机字符串值
|
||
* @return 值
|
||
**/
|
||
public function GetReturn_code()
|
||
{
|
||
return $this->values['nonceStr'];
|
||
}
|
||
|
||
/**
|
||
* 判断随机字符串是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsReturn_codeSet()
|
||
{
|
||
return array_key_exists('nonceStr', $this->values);
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置订单详情扩展字符串
|
||
* @param string $value
|
||
**/
|
||
public function SetPackage($value)
|
||
{
|
||
$this->values['package'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取订单详情扩展字符串的值
|
||
* @return 值
|
||
**/
|
||
public function GetPackage()
|
||
{
|
||
return $this->values['package'];
|
||
}
|
||
|
||
/**
|
||
* 判断订单详情扩展字符串是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsPackageSet()
|
||
{
|
||
return array_key_exists('package', $this->values);
|
||
}
|
||
|
||
/**
|
||
* 设置签名方式
|
||
* @param string $value
|
||
**/
|
||
public function SetSignType($value)
|
||
{
|
||
$this->values['signType'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取签名方式
|
||
* @return 值
|
||
**/
|
||
public function GetSignType()
|
||
{
|
||
return $this->values['signType'];
|
||
}
|
||
|
||
/**
|
||
* 判断签名方式是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsSignTypeSet()
|
||
{
|
||
return array_key_exists('signType', $this->values);
|
||
}
|
||
|
||
/**
|
||
* 设置签名方式
|
||
* @param string $value
|
||
**/
|
||
public function SetPaySign($value)
|
||
{
|
||
$this->values['paySign'] = $value;
|
||
}
|
||
|
||
/**
|
||
* 获取签名方式
|
||
* @return 值
|
||
**/
|
||
public function GetPaySign()
|
||
{
|
||
return $this->values['paySign'];
|
||
}
|
||
|
||
/**
|
||
* 判断签名方式是否存在
|
||
* @return true 或 false
|
||
**/
|
||
public function IsPaySignSet()
|
||
{
|
||
return array_key_exists('paySign', $this->values);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
/**
|
||
* 现金红包类
|
||
* 参数以及使用方法请查看发红包函数
|
||
* @author Geeson <314835050@qq.com>
|
||
* Class Redpack
|
||
*/
|
||
class Redpack extends WxPayDataBase
|
||
{
|
||
|
||
function trimString($value)
|
||
{
|
||
$ret = null;
|
||
if (null != $value) {
|
||
$ret = $value;
|
||
if (strlen($ret) == 0) {
|
||
$ret = null;
|
||
}
|
||
}
|
||
return $ret;
|
||
}
|
||
|
||
public function setParments($parameter, $parameterValue)
|
||
{
|
||
$this->values[$this->trimString($parameter)] = $this->trimString($parameterValue);
|
||
}
|
||
|
||
public function createRedpackXml()
|
||
{
|
||
$this->values['wxappid'] = WxPayConfig::$APPID;
|
||
$this->values['mch_id'] = WxPayConfig::$MCHID;
|
||
$this->values['sign'] = $this->MakeSign();
|
||
return $this->ToXml($this->values);
|
||
}
|
||
|
||
/**
|
||
* 以post方式提交xml到对应的接口url
|
||
*
|
||
* @param string $xml 需要post的xml数据
|
||
* @param string $url url
|
||
* @param bool $useCert 是否需要证书,默认不需要
|
||
* @param int $second url执行超时时间,默认30s
|
||
* @throws WxPayException
|
||
*/
|
||
public function postXmlCurl($xml, $url, $useCert = false, $second = 30)
|
||
{
|
||
$ch = curl_init();
|
||
//设置超时
|
||
curl_setopt($ch, CURLOPT_TIMEOUT, $second);
|
||
|
||
//如果有配置代理这里就设置代理
|
||
if(WxPayConfig::$CURL_PROXY_HOST != "0.0.0.0"
|
||
&& WxPayConfig::$CURL_PROXY_PORT != 0){
|
||
curl_setopt($ch,CURLOPT_PROXY, WxPayConfig::$CURL_PROXY_HOST);
|
||
curl_setopt($ch,CURLOPT_PROXYPORT, WxPayConfig::$CURL_PROXY_PORT);
|
||
}
|
||
curl_setopt($ch,CURLOPT_URL, $url);
|
||
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,TRUE);
|
||
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,2);//严格校验
|
||
//设置header
|
||
curl_setopt($ch, CURLOPT_HEADER, FALSE);
|
||
//要求结果为字符串且输出到屏幕上
|
||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
|
||
|
||
if($useCert == true){
|
||
//设置证书
|
||
//使用证书:cert 与 key 分别属于两个.pem文件
|
||
curl_setopt($ch,CURLOPT_SSLCERTTYPE,'PEM');
|
||
curl_setopt($ch,CURLOPT_SSLCERT, WxPayConfig::$SSLCERT_PATH);
|
||
curl_setopt($ch,CURLOPT_SSLKEYTYPE,'PEM');
|
||
curl_setopt($ch,CURLOPT_SSLKEY, WxPayConfig::$SSLKEY_PATH);
|
||
}
|
||
//post提交方式
|
||
curl_setopt($ch, CURLOPT_POST, TRUE);
|
||
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
|
||
//运行curl
|
||
$data = curl_exec($ch);
|
||
//返回结果
|
||
if($data){
|
||
curl_close($ch);
|
||
return $data;
|
||
} else {
|
||
$error = curl_errno($ch);
|
||
curl_close($ch);
|
||
throw new WxPayException("curl出错,错误码:$error");
|
||
}
|
||
}
|
||
|
||
public function xmlToArray($xml)
|
||
{
|
||
//将XML转为array
|
||
$array_data = json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
|
||
return $array_data;
|
||
}
|
||
|
||
|
||
}
|