diff --git a/src/Kernel/Events/EventHandlerInterface.php b/src/Kernel/Events/EventHandlerInterface.php deleted file mode 100644 index 3b063e2..0000000 --- a/src/Kernel/Events/EventHandlerInterface.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace EasyAlipay\Kernel\Contracts; - -/** - * Interface EventHandlerInterface. - * - * @author mingyoung - */ -interface EventHandlerInterface -{ - /** - * @param mixed $payload - */ - public function handle($payload = null); -} diff --git a/src/Kernel/Helpers.php b/src/Kernel/Helpers.php index f297b33..34c66b9 100644 --- a/src/Kernel/Helpers.php +++ b/src/Kernel/Helpers.php @@ -33,8 +33,7 @@ function decrypt($str, $screct_key) $screct_key = base64_decode($screct_key); $iv_size = openssl_cipher_iv_length('AES-128-CBC'); $iv = str_repeat("\0", $iv_size); - $decrypt_str = openssl_decrypt($str,"AES-128-CBC",$screct_key,OPENSSL_RAW_DATA,$iv); - return $decrypt_str; + return openssl_decrypt($str,"AES-128-CBC",$screct_key,OPENSSL_RAW_DATA,$iv); } /** diff --git a/src/Kernel/Traits/SingData.php b/src/Kernel/Traits/SingData.php index d9b57b6..6f30d40 100644 --- a/src/Kernel/Traits/SingData.php +++ b/src/Kernel/Traits/SingData.php @@ -179,42 +179,38 @@ trait SingData /** * 生成应用证书SN. - * @param $certPath + * @param $cert_path * @return string * @throws \Exception */ - public function getCertSN($certPath): string + public function getCertSN($cert_path): string { - if (!is_file($certPath)) { + if (!is_file($cert_path)) { throw new \Exception('unknown certPath -- [getCertSN]'); } - $x509data = file_get_contents($certPath); + $x509data = file_get_contents($cert_path); if (false === $x509data) { throw new \Exception('Alipay CertSN Error -- [getCertSN]'); } openssl_x509_read($x509data); - $certdata = openssl_x509_parse($x509data); - if (empty($certdata)) { + $cert_data = openssl_x509_parse($x509data); + if (empty($cert_data)) { throw new \Exception('Alipay openssl_x509_parse Error -- [getCertSN]'); } $issuer_arr = []; - foreach ($certdata['issuer'] as $key => $val) { + foreach ($cert_data['issuer'] as $key => $val) { $issuer_arr[] = $key.'='.$val; } $issuer = implode(',', array_reverse($issuer_arr)); - return md5($issuer.$certdata['serialNumber']); + return md5($issuer. $cert_data['serialNumber']); } /** * 生成支付宝根证书SN. * - * @author 大冰 https://sbing.vip/archives/2019-new-alipay-php-docking.html - * * @param $certPath - * * @return string - * * @throws /Exception */ public function getRootCertSN($certPath) @@ -255,10 +251,7 @@ trait SingData /** * 0x转高精度数字. * - * @author 大冰 https://sbing.vip/archives/2019-new-alipay-php-docking.html - * * @param $hex - * * @return int|string */ private static function bchexdec($hex) diff --git a/src/Payment/Notify/Handler.php b/src/Payment/Notify/Handler.php index ac02783..51e65d1 100644 --- a/src/Payment/Notify/Handler.php +++ b/src/Payment/Notify/Handler.php @@ -122,7 +122,7 @@ abstract class Handler } try { - $message = json_decode(strval($this->app['request']->getContent()), true); + parse_str($this->app['request']->getContent(), $message); } catch (\Throwable $e) { throw new Exception('Invalid request: ' . $e->getMessage(), 400); }