123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- <?php
- class WxPayNotify extends WxPayNotifyReply
- {
- private $config = null;
-
- final public function Handle($config, $needSign = true)
- {
- $this->config = $config;
- $msg = "OK";
-
- $result = WxpayApi::notify($config, array($this, 'NotifyCallBack'), $msg);
- if($result == false){
- $this->SetReturn_code("FAIL");
- $this->SetReturn_msg($msg);
- $this->ReplyNotify(false);
- return;
- } else {
-
- $this->SetReturn_code("SUCCESS");
- $this->SetReturn_msg("OK");
- }
- $this->ReplyNotify($needSign);
- }
-
-
- public function NotifyProcess($objData, $config, &$msg)
- {
-
- return false;
- }
-
- public function LogAfterProcess($xmlData)
- {
- return;
- }
-
-
- final public function NotifyCallBack($data)
- {
- $msg = "OK";
- $result = $this->NotifyProcess($data, $this->config, $msg);
-
- if($result == true){
- $this->SetReturn_code("SUCCESS");
- $this->SetReturn_msg("OK");
- } else {
- $this->SetReturn_code("FAIL");
- $this->SetReturn_msg($msg);
- }
- return $result;
- }
-
-
- final private function ReplyNotify($needSign = true)
- {
-
- if($needSign == true &&
- $this->GetReturn_code() == "SUCCESS")
- {
- $this->SetSign($this->config);
- }
- $xml = $this->ToXml();
- $this->LogAfterProcess($xml);
- WxpayApi::replyNotify($xml);
- }
- }
|