This commit is contained in:
xl
2023-11-14 14:10:36 +08:00
parent f263014948
commit 70222819b9
13 changed files with 133 additions and 129 deletions
+14 -14
View File
@@ -30,12 +30,12 @@ class WxV3PaymentNotify extends SmallProgram
* @param array $resource
*/
public function __construct(
public string $id = "EV-2018022511223320873",
public string $create_time = "2015-05-20T13:29:35+08:00",
public string $resource_type = "encrypt-resource",
public string $event_type = "TRANSACTION.SUCCESS",
public string $summary = "支付成功",
public array $resource = []
public string $id = "EV-2018022511223320873",
public string $create_time = "2015-05-20T13:29:35+08:00",
public string $resource_type = "encrypt-resource",
public string $event_type = "TRANSACTION.SUCCESS",
public string $summary = "支付成功",
public array $resource = []
)
{
}
@@ -93,10 +93,10 @@ class WxV3PaymentNotify extends SmallProgram
/**
* @param string $message
* @param string $signature
* @param $publicKey
* @param OpenSSLAsymmetricKey $publicKey
* @return bool
*/
protected function notifyVerify(string $message, string $signature, $publicKey): bool
protected function notifyVerify(string $message, string $signature, OpenSSLAsymmetricKey $publicKey): bool
{
if (($result = openssl_verify($message, base64_decode($signature), $publicKey, OPENSSL_ALGO_SHA256)) === false) {
throw new \UnexpectedValueException('Verified the input $message failed, please checking your $publicKey whether or nor correct.');
@@ -106,11 +106,11 @@ class WxV3PaymentNotify extends SmallProgram
/**
* @param $thing
* @param string $thing
* @param string $type
* @return OpenSSLAsymmetricKey
*/
protected function rsaFrom($thing, string $type = KEY_TYPE_PRIVATE): OpenSSLAsymmetricKey
protected function rsaFrom(string $thing, string $type = KEY_TYPE_PRIVATE): OpenSSLAsymmetricKey
{
$pkey = (($isPublic = $type === KEY_TYPE_PUBLIC) ? openssl_pkey_get_public(file_get_contents($thing)) : openssl_pkey_get_private(file_get_contents($thing)));
if (false === $pkey) {
@@ -120,12 +120,12 @@ class WxV3PaymentNotify extends SmallProgram
}
/**
* @param $ciphertext
* @param $nonce
* @param $associated_data
* @param string $ciphertext
* @param string $nonce
* @param string $associated_data
* @return bool
*/
public function decode($ciphertext, $nonce, $associated_data): bool
public function decode(string $ciphertext, string $nonce, string $associated_data): bool
{
$data = $this->decrypt($ciphertext, $this->payConfig->pay->wx->secret, $nonce, $associated_data);
$this->notifyModel = new NotifyModel();