add clear

This commit is contained in:
2022-09-09 16:42:55 +08:00
parent ad76b45b45
commit 7273fe1ce5
63 changed files with 2625 additions and 5287 deletions
+29 -322
View File
@@ -12,31 +12,31 @@ use wchat\common\Help;
*/
class Notify extends SmallProgram
{
public $appid = null;
public $mch_id = null;
public $nonce_str = null;
public $sign = null;
public $device_info = null;
public $trade_type = null;
public $trade_state = null;
public $bank_type = null;
public $fee_type = null;
public $total_fee = null;
public $cash_fee = null;
public $coupon_fee = null;
public $transaction_id = null;
public $out_trade_no = null;
public $attach = null;
public $time_end = null;
public $openid = null;
public mixed $appid = null;
public mixed $mch_id = null;
public mixed $nonce_str = null;
public mixed $sign = null;
public mixed $device_info = null;
public mixed $trade_type = null;
public mixed $trade_state = null;
public mixed $bank_type = null;
public mixed $fee_type = null;
public mixed $total_fee = null;
public mixed $cash_fee = null;
public mixed $coupon_fee = null;
public mixed $transaction_id = null;
public mixed $out_trade_no = null;
public mixed $attach = null;
public mixed $time_end = null;
public mixed $openid = null;
/**
* @return bool
* 判断是否完成支付
*/
public function isSuccess()
public function isSuccess(): bool
{
return $this->getTradeState() === 'SUCCESS';
return $this->trade_state === 'SUCCESS';
}
/**
@@ -44,26 +44,31 @@ class Notify extends SmallProgram
* @return $this
* @throws Exception
*/
public function setPayNotifyData(array $params)
public function setPayNotifyData(array $params): static
{
if (!$this->validation($params)) {
throw new Exception('签名错误!');
}
foreach ($params as $key => $val) {
if (!property_exists($this, $key)) {
continue;
}
$this->$key = $val;
}
return $this;
}
public function __set(string $name, $value): void
{
if (property_exists($this, $name)) {
$this->{$name} = $value;
}
}
/**
* @param array $params
* @return bool
*/
public function validation(array $params)
public function validation(array $params): bool
{
$sign = $params['sign'];
unset($params['sign']);
@@ -85,303 +90,5 @@ class Notify extends SmallProgram
return $this->appid;
}
/**
* @param null $appid
* @return Notify
*/
public function setAppid($appid)
{
$this->appid = $appid;
return $this;
}
/**
* @return null
*/
public function getMchId()
{
return $this->mch_id;
}
/**
* @param null $mch_id
* @return Notify
*/
public function setMchId($mch_id)
{
$this->mch_id = $mch_id;
return $this;
}
/**
* @return null
*/
public function getNonceStr()
{
return $this->nonce_str;
}
/**
* @param null $nonce_str
* @return Notify
*/
public function setNonceStr($nonce_str)
{
$this->nonce_str = $nonce_str;
return $this;
}
/**
* @return null
*/
public function getSign()
{
return $this->sign;
}
/**
* @param null $sign
* @return Notify
*/
public function setSign($sign)
{
$this->sign = $sign;
return $this;
}
/**
* @return null
*/
public function getDeviceInfo()
{
return $this->device_info;
}
/**
* @param null $device_info
* @return Notify
*/
public function setDeviceInfo($device_info)
{
$this->device_info = $device_info;
return $this;
}
/**
* @return null
*/
public function getTradeType()
{
return $this->trade_type;
}
/**
* @param null $trade_type
* @return Notify
*/
public function setTradeType($trade_type)
{
$this->trade_type = $trade_type;
return $this;
}
/**
* @return null
*/
public function getTradeState()
{
return $this->trade_state;
}
/**
* @param null $trade_state
* @return Notify
*/
public function setTradeState($trade_state)
{
$this->trade_state = $trade_state;
return $this;
}
/**
* @return null
*/
public function getBankType()
{
return $this->bank_type;
}
/**
* @param null $bank_type
* @return Notify
*/
public function setBankType($bank_type)
{
$this->bank_type = $bank_type;
return $this;
}
/**
* @return null
*/
public function getFeeType()
{
return $this->fee_type;
}
/**
* @param null $fee_type
* @return Notify
*/
public function setFeeType($fee_type)
{
$this->fee_type = $fee_type;
return $this;
}
/**
* @return null
*/
public function getTotalFee()
{
return $this->total_fee;
}
/**
* @param null $total_fee
* @return Notify
*/
public function setTotalFee($total_fee)
{
$this->total_fee = $total_fee;
return $this;
}
/**
* @return null
*/
public function getCashFee()
{
return $this->cash_fee;
}
/**
* @param null $cash_fee
* @return Notify
*/
public function setCashFee($cash_fee)
{
$this->cash_fee = $cash_fee;
return $this;
}
/**
* @return null
*/
public function getCouponFee()
{
return $this->coupon_fee;
}
/**
* @param null $coupon_fee
* @return Notify
*/
public function setCouponFee($coupon_fee)
{
$this->coupon_fee = $coupon_fee;
return $this;
}
/**
* @return null
*/
public function getTransactionId()
{
return $this->transaction_id;
}
/**
* @param null $transaction_id
* @return Notify
*/
public function setTransactionId($transaction_id)
{
$this->transaction_id = $transaction_id;
return $this;
}
/**
* @return null
*/
public function getOutTradeNo()
{
return $this->out_trade_no;
}
/**
* @param null $out_trade_no
* @return Notify
*/
public function setOutTradeNo($out_trade_no)
{
$this->out_trade_no = $out_trade_no;
return $this;
}
/**
* @return null
*/
public function getAttach()
{
return $this->attach;
}
/**
* @param null $attach
* @return Notify
*/
public function setAttach($attach)
{
$this->attach = $attach;
return $this;
}
/**
* @return null
*/
public function getTimeEnd()
{
return $this->time_end;
}
/**
* @param null $time_end
* @return Notify
*/
public function setTimeEnd($time_end)
{
$this->time_end = $time_end;
return $this;
}
/**
* @return null
*/
public function getOpenid()
{
return $this->openid;
}
/**
* @param null $openid
* @return Notify
*/
public function setOpenid($openid)
{
$this->openid = $openid;
return $this;
}
}