Files
kiri-wchat/wx/Notify.php
T
as2252258@163.com 33de57b515 add clear
2019-08-29 18:25:42 +08:00

599 lines
8.7 KiB
PHP

<?php
namespace wchat;
class Notify extends Miniprogarampage
{
public $appid = '';
public $mch_id = '';
public $device_info = '';
public $nonce_str = '';
public $sign = '';
public $sign_type = '';
public $result_code = '';
public $err_code = '';
public $err_code_des = '';
public $openid = '';
public $is_subscribe = '';
public $trade_type = '';
public $bank_type = '';
public $total_fee = '';
public $settlement_total_fee = '';
public $fee_type = '';
public $cash_fee = '';
public $cash_fee_type = '';
public $coupon_fee = '';
public $coupon_count = '';
public $coupon_type_n = '';
public $coupon_id_n = '';
public $coupon_fee_n = '';
public $transaction_id = '';
public $out_trade_no = '';
public $attach = '';
public $time_end = '';
public $return_code = '';
/**
* @return bool
* 判断是否完成支付
*/
public function isSuccess()
{
if ($this->getReturnCode() != "SUCCESS") {
return false;
}
if ($this->getResultCode() != 'SUCCESS') {
return false;
}
return true;
}
/**
* @param array $params
* @return $this
*/
public function setPayNotifyData(array $params)
{
if (!$this->validation($params)) {
$this->setResultCode('FAIL');
$this->setErrCodeDes('签名错误');
unset($params['result_code'], $params['err_code_des']);
}
foreach ($params as $key => $val) {
if (!property_exists($this, $key)) {
continue;
}
$this->$key = $val;
}
return $this;
}
/**
* @param array $params
* @return bool
*/
public function validation(array $params)
{
$sign = $params['sign'];
unset($params['sign']);
$signType = $this->config->getSignType();
$privateKey = $this->config->getKey();
$nowSign = Help::sign($params, $privateKey, $signType);
if ($sign === $nowSign) {
return true;
}
return false;
}
/**
* @return mixed
*/
public function getAppid()
{
return $this->appid;
}
/**
* @param mixed $appid
* @return Notify
*/
public function setAppid($appid)
{
$this->appid = $appid;
return $this;
}
/**
* @return mixed
*/
public function getMchId()
{
return $this->mch_id;
}
/**
* @param mixed $mch_id
* @return Notify
*/
public function setMchId($mch_id)
{
$this->mch_id = $mch_id;
return $this;
}
/**
* @return mixed
*/
public function getDeviceInfo()
{
return $this->device_info;
}
/**
* @param mixed $device_info
* @return Notify
*/
public function setDeviceInfo($device_info)
{
$this->device_info = $device_info;
return $this;
}
/**
* @return mixed
*/
public function getNonceStr()
{
return $this->nonce_str;
}
/**
* @param mixed $nonce_str
* @return Notify
*/
public function setNonceStr($nonce_str)
{
$this->nonce_str = $nonce_str;
return $this;
}
/**
* @return mixed
*/
public function getSign()
{
return $this->sign;
}
/**
* @param mixed $sign
* @return Notify
*/
public function setSign($sign)
{
$this->sign = $sign;
return $this;
}
/**
* @return mixed
*/
public function getSignType()
{
return $this->sign_type;
}
/**
* @param mixed $sign_type
* @return Notify
*/
public function setSignType($sign_type)
{
$this->sign_type = $sign_type;
return $this;
}
/**
* @return mixed
*/
public function getResultCode()
{
return $this->result_code;
}
/**
* @param mixed $result_code
* @return Notify
*/
public function setResultCode($result_code)
{
$this->result_code = $result_code;
return $this;
}
/**
* @return mixed
*/
public function getErrCode()
{
return $this->err_code;
}
/**
* @param mixed $err_code
* @return Notify
*/
public function setErrCode($err_code)
{
$this->err_code = $err_code;
return $this;
}
/**
* @return mixed
*/
public function getErrCodeDes()
{
return $this->err_code_des;
}
/**
* @param mixed $err_code_des
* @return Notify
*/
public function setErrCodeDes($err_code_des)
{
$this->err_code_des = $err_code_des;
return $this;
}
/**
* @return mixed
*/
public function getOpenid()
{
return $this->openid;
}
/**
* @param mixed $openid
* @return Notify
*/
public function setOpenid($openid)
{
$this->openid = $openid;
return $this;
}
/**
* @return mixed
*/
public function getIsSubscribe()
{
return $this->is_subscribe;
}
/**
* @param mixed $is_subscribe
* @return Notify
*/
public function setIsSubscribe($is_subscribe)
{
$this->is_subscribe = $is_subscribe;
return $this;
}
/**
* @return mixed
*/
public function getTradeType()
{
return $this->trade_type;
}
/**
* @param mixed $trade_type
* @return Notify
*/
public function setTradeType($trade_type)
{
$this->trade_type = $trade_type;
return $this;
}
/**
* @return mixed
*/
public function getBankType()
{
return $this->bank_type;
}
/**
* @param mixed $bank_type
* @return Notify
*/
public function setBankType($bank_type)
{
$this->bank_type = $bank_type;
return $this;
}
/**
* @return mixed
*/
public function getTotalFee()
{
return $this->total_fee;
}
/**
* @param mixed $total_fee
* @return Notify
*/
public function setTotalFee($total_fee)
{
$this->total_fee = $total_fee;
return $this;
}
/**
* @return mixed
*/
public function getSettlementTotalFee()
{
return $this->settlement_total_fee;
}
/**
* @param mixed $settlement_total_fee
* @return Notify
*/
public function setSettlementTotalFee($settlement_total_fee)
{
$this->settlement_total_fee = $settlement_total_fee;
return $this;
}
/**
* @return mixed
*/
public function getFeeType()
{
return $this->fee_type;
}
/**
* @param mixed $fee_type
* @return Notify
*/
public function setFeeType($fee_type)
{
$this->fee_type = $fee_type;
return $this;
}
/**
* @return mixed
*/
public function getCashFee()
{
return $this->cash_fee;
}
/**
* @param mixed $cash_fee
* @return Notify
*/
public function setCashFee($cash_fee)
{
$this->cash_fee = $cash_fee;
return $this;
}
/**
* @return mixed
*/
public function getCashFeeType()
{
return $this->cash_fee_type;
}
/**
* @param mixed $cash_fee_type
* @return Notify
*/
public function setCashFeeType($cash_fee_type)
{
$this->cash_fee_type = $cash_fee_type;
return $this;
}
/**
* @return mixed
*/
public function getCouponFee()
{
return $this->coupon_fee;
}
/**
* @param mixed $coupon_fee
* @return Notify
*/
public function setCouponFee($coupon_fee)
{
$this->coupon_fee = $coupon_fee;
return $this;
}
/**
* @return mixed
*/
public function getCouponCount()
{
return $this->coupon_count;
}
/**
* @param mixed $coupon_count
* @return Notify
*/
public function setCouponCount($coupon_count)
{
$this->coupon_count = $coupon_count;
return $this;
}
/**
* @return mixed
*/
public function getCouponTypeN()
{
return $this->coupon_type_n;
}
/**
* @param mixed $coupon_type_n
* @return Notify
*/
public function setCouponTypeN($coupon_type_n)
{
$this->coupon_type_n = $coupon_type_n;
return $this;
}
/**
* @return mixed
*/
public function getCouponIdN()
{
return $this->coupon_id_n;
}
/**
* @param mixed $coupon_id_n
* @return Notify
*/
public function setCouponIdN($coupon_id_n)
{
$this->coupon_id_n = $coupon_id_n;
return $this;
}
/**
* @return mixed
*/
public function getCouponFeeN()
{
return $this->coupon_fee_n;
}
/**
* @param mixed $coupon_fee_n
* @return Notify
*/
public function setCouponFeeN($coupon_fee_n)
{
$this->coupon_fee_n = $coupon_fee_n;
return $this;
}
/**
* @return mixed
*/
public function getTransactionId()
{
return $this->transaction_id;
}
/**
* @param mixed $transaction_id
* @return Notify
*/
public function setTransactionId($transaction_id)
{
$this->transaction_id = $transaction_id;
return $this;
}
/**
* @return mixed
*/
public function getOutTradeNo()
{
return $this->out_trade_no;
}
/**
* @param mixed $out_trade_no
* @return Notify
*/
public function setOutTradeNo($out_trade_no)
{
$this->out_trade_no = $out_trade_no;
return $this;
}
/**
* @return mixed
*/
public function getAttach()
{
return $this->attach;
}
/**
* @param mixed $attach
* @return Notify
*/
public function setAttach($attach)
{
$this->attach = $attach;
return $this;
}
/**
* @return mixed
*/
public function getTimeEnd()
{
return $this->time_end;
}
/**
* @param mixed $time_end
* @return Notify
*/
public function setTimeEnd($time_end)
{
$this->time_end = $time_end;
return $this;
}
/**
* @return mixed
*/
public function getReturnCode()
{
return $this->return_code;
}
/**
* @param mixed $return_code
* @return Notify
*/
public function setReturnCode($return_code)
{
$this->return_code = $return_code;
return $this;
}
}