Browse Source

refactor: 统一代码风格

runphp 2 weeks ago
parent
commit
cc72075db7

+ 1 - 0
config.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 return json_decode(<<<'JSON'

+ 2 - 2
database/migrations/20251031083213_wechatpay_transfer_bill.php

@@ -6,7 +6,7 @@ use Phinx\Migration\AbstractMigration;
 
 /**
  * 微信支付转账账单表
- * 
+ *
  * 用于存储微信支付转账账单信息
  */
 final class WechatpayTransferBill extends AbstractMigration
@@ -45,4 +45,4 @@ final class WechatpayTransferBill extends AbstractMigration
             ->addIndex(['out_bill_no'], ['unique' => true, 'name' => 'uniq_out_bill_no'])
             ->create();
     }
-}
+}

+ 1 - 0
info.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 return [

+ 1 - 1
route/admin.php

@@ -1,10 +1,10 @@
 <?php
+
 declare(strict_types=1);
 
 use think\facade\Route;
 use SixShop\WechatPay\Controller\TransferBillController;
 
-
 // API路由
 // 路由前缀: /admin/wechatpay
 //

+ 1 - 0
route/api.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 // API路由

+ 3 - 5
src/Config.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\WechatPay;
@@ -26,13 +27,10 @@ use WeChatPay\Crypto\Rsa;
  */
 class Config
 {
-
-
     public function __construct(
         private readonly ExtensionManager $extensionManager,
         private ?array                    $options = null
-    )
-    {
+    ) {
     }
 
     public function __get(string $name)
@@ -57,4 +55,4 @@ class Config
     {
         return 'file://' . public_path() . $name;
     }
-}
+}

+ 3 - 2
src/Controller/TransferBillController.php

@@ -1,12 +1,13 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\WechatPay\Controller;
 
 use SixShop\Core\Request;
 use SixShop\WechatPay\Entity\WechatpayTransferBillEntity;
-use SixShop\WechatPay\Enum\TransferBillStatusEnum;
 use think\Response;
+
 use function SixShop\Core\page_response;
 use function SixShop\Core\success_response;
 
@@ -40,4 +41,4 @@ class TransferBillController
     {
         return success_response($transferBillEntity->rejectTransferBill($id, $request->post('fail_reason/s')));
     }
-}
+}

+ 4 - 3
src/Entity/WechatpayTransferBillEntity.php

@@ -1,7 +1,8 @@
 <?php
+
 declare(strict_types=1);
-namespace SixShop\WechatPay\Entity;
 
+namespace SixShop\WechatPay\Entity;
 
 use SixShop\Core\Entity\BaseEntity;
 use SixShop\WechatPay\Enum\TransferBillStatusEnum;
@@ -11,8 +12,8 @@ use SixShop\WechatPay\Trait\ApiTrait;
 use think\db\Query;
 use think\facade\Db;
 use think\facade\Event;
-use think\Model;
 use think\Paginator;
+
 use function SixShop\Core\throw_logic_exception;
 
 /**
@@ -117,4 +118,4 @@ class WechatpayTransferBillEntity extends BaseEntity
 
         return $transferBill;
     }
-}
+}

+ 2 - 1
src/Enum/TransferBillStatusEnum.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\WechatPay\Enum;
@@ -32,4 +33,4 @@ enum TransferBillStatusEnum: string
             self::CANCELLED => '转账撤销完成',
         };
     }
-}
+}

+ 3 - 1
src/Event/TransferBillFailedEvent.php

@@ -1,5 +1,7 @@
 <?php
+
 declare(strict_types=1);
+
 namespace SixShop\WechatPay\Event;
 
 class TransferBillFailedEvent
@@ -12,4 +14,4 @@ class TransferBillFailedEvent
     {
         return $this->id;
     }
-}
+}

+ 3 - 1
src/Event/TransferSceneReportEvent.php

@@ -1,5 +1,7 @@
 <?php
+
 declare(strict_types=1);
+
 namespace SixShop\WechatPay\Event;
 
 use SixShop\WechatPay\Entity\WechatpayTransferBillEntity;
@@ -56,4 +58,4 @@ class TransferSceneReportEvent
         $this->transferSceneReportInfos = $transferSceneReportInfos;
         return $this;
     }
-}
+}

+ 2 - 1
src/Extension.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\WechatPay;
@@ -26,4 +27,4 @@ class Extension extends ExtensionAbstract implements PaymentExtensionInterface
     {
         return dirname(__DIR__);
     }
-}
+}

+ 2 - 1
src/Facade/WechatPayBuilder.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\WechatPay\Facade;
@@ -19,4 +20,4 @@ class WechatPayBuilder extends Facade
     {
         return \SixShop\WechatPay\WechatPayBuilder::class;
     }
-}
+}

+ 2 - 2
src/Hook/WechatpayHook.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\WechatPay\Hook;
@@ -9,7 +10,6 @@ use SixShop\Payment\PaymentInfo;
 
 class WechatpayHook
 {
-
     /**
      * 上报提供的支付服务信息
      */
@@ -22,4 +22,4 @@ class WechatpayHook
             '微信支付',
         );
     }
-}
+}

+ 3 - 3
src/Job/QueryRefundJob.php

@@ -1,11 +1,11 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\WechatPay\Job;
 
 use SixShop\Core\Job\BaseJob;
 use SixShop\WechatPay\PaymentProvider;
-use think\facade\Log;
 
 class QueryRefundJob extends BaseJob
 {
@@ -13,8 +13,8 @@ class QueryRefundJob extends BaseJob
     {
     }
 
-    public function execute(int $refundID):void
+    public function execute(int $refundID): void
     {
         $this->paymentProvider->refundQuery($refundID);
     }
-}
+}

+ 3 - 1
src/Model/WechatpayTransferBillModel.php

@@ -1,5 +1,7 @@
 <?php
+
 declare(strict_types=1);
+
 namespace SixShop\WechatPay\Model;
 
 use app\model\UserModel;
@@ -52,4 +54,4 @@ class WechatpayTransferBillModel extends Model
     {
         return $this->belongsTo(UserModel::class, 'user_id');
     }
-}
+}

+ 19 - 19
src/PaymentProvider.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\WechatPay;
@@ -8,7 +9,6 @@ use SixShop\Core\Exception\NotFoundException;
 use SixShop\Payment\Contracts\PaymentNotifyResult;
 use SixShop\Payment\Contracts\PaymentProviderInterface;
 use SixShop\Payment\Contracts\PaymentQueryResult;
-use SixShop\Payment\Contracts\PaymentRefundQueryResult;
 use SixShop\Payment\Contracts\PaymentRefundRequest;
 use SixShop\Payment\Contracts\PaymentRefundResult;
 use SixShop\Payment\Contracts\PaymentResponse;
@@ -30,25 +30,25 @@ use SixShop\WechatPay\Trait\PaymentParamsTrait;
 use think\facade\Db;
 use think\facade\Event;
 use think\facade\Log;
+
 use function SixShop\Core\throw_logic_exception;
 
 class PaymentProvider implements PaymentProviderInterface
 {
-    private const string PAYMENT_TYPE = 'wechatpay';
     use ApiTrait;
     use MiniAppTrait {
         uploadShippingInfo as private uploadShippingInfoAPI;
         waybillToken as private waybillTokenAPI;
     }
     use PaymentParamsTrait;
+    private const string PAYMENT_TYPE = 'wechatpay';
 
     public function __construct(
         private readonly ExtensionPaymentEntity $extensionPaymentEntity,
         private readonly ExtensionRefundEntity  $extensionRefundEntity,
         private readonly WechatpayTransferBillEntity $wechatpayTransferBillEntity,
         private readonly NotifyService $notifyService,
-    )
-    {
+    ) {
     }
 
     public function create(array $order, PaymentBizEnum $bizType): PaymentResponse
@@ -68,7 +68,7 @@ class PaymentProvider implements PaymentProviderInterface
             //订单已撤销请重新下单
             // 订单支付中请稍后再试
             // 订单支付失败请重新下单
-            throw new  \RuntimeException('开发测试中,请稍后再试');
+            throw new \RuntimeException('开发测试中,请稍后再试');
         }
         $payment->transaction(function () use ($bizType, $order, $payment) {
             $payment->save([
@@ -117,8 +117,8 @@ class PaymentProvider implements PaymentProviderInterface
                 'out_trade_no' => $data['out_trade_no'],
             ])->findOrEmpty();
             if ($payment->isEmpty()) {
-                Log::warning(__METHOD__ . '订单不存在{out_trade_no}', ['out_trade_no' => $data['out_trade_no']] );
-                throw_logic_exception('订单不存在或已结束',httpCode: 404);
+                Log::warning(__METHOD__ . '订单不存在{out_trade_no}', ['out_trade_no' => $data['out_trade_no']]);
+                throw_logic_exception('订单不存在或已结束', httpCode: 404);
             }
             $queryResult = $this->query($payment['id']);
             return new PaymentNotifyResult(
@@ -128,11 +128,11 @@ class PaymentProvider implements PaymentProviderInterface
                 status: $queryResult->status,
                 raw: $data
             );
-        } else if ($inBody['event_type'] == 'MCHTRANSFER.BILL.FINISHED') {
+        } elseif ($inBody['event_type'] == 'MCHTRANSFER.BILL.FINISHED') {
             // 转账完成
             $transferBill = $this->wechatpayTransferBillEntity->where('out_bill_no', $data['out_bill_no'])->findOrEmpty();
             if ($transferBill->isEmpty()) {
-                Log::warning(__METHOD__ . '订单不存在{out_trade_no}', ['out_trade_no' => $data['out_trade_no']] );
+                Log::warning(__METHOD__ . '订单不存在{out_trade_no}', ['out_trade_no' => $data['out_trade_no']]);
                 throw_logic_exception('转账单不存在', httpCode: 404);
             }
             $this->wechatpayTransferBillEntity->refreshTransferBill($transferBill->id);
@@ -185,7 +185,7 @@ class PaymentProvider implements PaymentProviderInterface
         $payment = $this->extensionPaymentEntity->find($recordID);
         // todo 订单分多次退款未实现
         $refund = ExtensionRefundModel::where(
-            ['order_sn' => $payment->out_trade_no, 'status' =>RefundStatusEnum::SUCCESS]
+            ['order_sn' => $payment->out_trade_no, 'status' => RefundStatusEnum::SUCCESS]
         )->findOrEmpty();
         if (!$refund->isEmpty()) {
             return new PaymentRefundResult($refund);
@@ -234,12 +234,14 @@ class PaymentProvider implements PaymentProviderInterface
                 $refund->status = RefundStatusEnum::SUCCESS;
                 $refund->status_desc = '成功退款到' . $result->user_received_account;
                 $refund->success_time = strtotime($result->success_time);
-                Event::trigger(new RefundSuccessEvent(
+                Event::trigger(
+                    new RefundSuccessEvent(
                         $refund->model(),
                         $refund->payment,
-                        new PaymentRefundRequest($refund->amount, $refund->reason, $refund->refund_param))
+                        new PaymentRefundRequest($refund->amount, $refund->reason, $refund->refund_param)
+                    )
                 );
-            } else if ($result->status === 'PROCESSING') {
+            } elseif ($result->status === 'PROCESSING') {
                 QueryRefundJob::dispatch($refund->id)->delay(10);
             }
             $refund->save();
@@ -251,7 +253,7 @@ class PaymentProvider implements PaymentProviderInterface
     /**
      * 发货信息录入
      * @param int $orderID 订单ID
-     * @param int $bizType 业务类型 
+     * @param int $bizType 业务类型
      * @param string $itemDesc 商品描述
      * @param string $trackingNo 运单号
      * @param string $expressCompany 快递公司ID
@@ -268,8 +270,7 @@ class PaymentProvider implements PaymentProviderInterface
         string $receiverContact = '',
         int $logisticsType = 1,
         bool   $failException = true,
-    ): array
-    {
+    ): array {
         $order = $this->extensionPaymentEntity->where([
             'order_id' => $orderID,
             'biz_type' => $bizType,
@@ -293,8 +294,7 @@ class PaymentProvider implements PaymentProviderInterface
         string $deliveryID,
         array $detailList,
         bool   $failException = true
-    ): array
-    {
+    ): array {
         $order = $this->extensionPaymentEntity->where([
             'order_id' => $orderID,
             'biz_type' => 1,
@@ -306,4 +306,4 @@ class PaymentProvider implements PaymentProviderInterface
         }
         return $this->waybillTokenAPI($order->user_id, $receiverPhone, $waybillID, $deliveryID, $detailList, $failException);
     }
-}
+}

+ 4 - 2
src/Service/NotifyService.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\WechatPay\Service;
@@ -8,6 +9,7 @@ use think\facade\Log;
 use WeChatPay\Crypto\AesGcm;
 use WeChatPay\Crypto\Rsa;
 use WeChatPay\Formatter;
+
 use function SixShop\Core\throw_logic_exception;
 
 class NotifyService
@@ -43,7 +45,7 @@ class NotifyService
         if (!$verifiedStatus) {
             // 签名值中的 WECHATPAY/SIGNTEST/ 前缀快速判断是否为探测流量
             if (str_starts_with($signature, 'WECHATPAY/SIGNTEST/')) {
-                throw_logic_exception(msg:'The signature is a probe traffic.',httpCode: 400);
+                throw_logic_exception(msg:'The signature is a probe traffic.', httpCode: 400);
             } else {
                 Log::warning('The signature is invalid. timestamp={timestamp} nonce={nonce} inBody={inBody} signature={signature} serial={serial}', [
                     'timestamp' => $timestamp,
@@ -67,4 +69,4 @@ class NotifyService
         $inBodyResource = AesGcm::decrypt($ciphertext, $apiV3Key, $nonce, $aad);
         return json_decode($inBodyResource, true);
     }
-}
+}

+ 3 - 5
src/Service/WechatpayTransferBillService.php

@@ -1,15 +1,13 @@
 <?php
+
 declare(strict_types=1);
+
 namespace SixShop\WechatPay\Service;
 
-use GuzzleHttp\Promise\PromiseInterface;
 use SixShop\Wechat\Facade\WechatUser;
 use SixShop\WechatPay\Config;
 use SixShop\WechatPay\Enum\TransferBillStatusEnum;
 use SixShop\WechatPay\Model\WechatpayTransferBillModel;
-use SixShop\WechatPay\Trait\HandleAsyncRequestTrait;
-use WeChatPay\BuilderChainable;
-use WeChatPay\Crypto\Rsa;
 
 class WechatpayTransferBillService
 {
@@ -31,4 +29,4 @@ class WechatpayTransferBillService
             'transfer_remark' => '提现',
         ])->id;
     }
-}
+}

+ 14 - 5
src/Trait/ApiTrait.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\WechatPay\Trait;
@@ -7,6 +8,7 @@ use GuzzleHttp\Promise\PromiseInterface;
 use SixShop\WechatPay\Config;
 use WeChatPay\BuilderChainable;
 use WeChatPay\Crypto\Rsa;
+
 use function SixShop\Core\throw_logic_exception;
 
 trait ApiTrait
@@ -32,7 +34,13 @@ trait ApiTrait
         // https://pay.weixin.qq.com/doc/v3/merchant/4012791856
         // 【POST】/v3/pay/transactions/jsapi
         return $this->handleAsyncRequest(function (
-            BuilderChainable $builder, Config $config, string $openid, string $outTradeNo, int $total, string $description, int $expireTime
+            BuilderChainable $builder,
+            Config $config,
+            string $openid,
+            string $outTradeNo,
+            int $total,
+            string $description,
+            int $expireTime
         ): PromiseInterface {
             return $builder->v3->pay->transactions->jsapi->postAsync([
                 'json' => [
@@ -163,8 +171,7 @@ trait ApiTrait
         array $transferSceneReportInfos,
         string $userName = '',
         string $userRecvPerception = ''
-    ): object
-    {
+    ): object {
         // https://pay.weixin.qq.com/doc/v3/merchant/4012716434
         // 支持商户:【普通商户】
         // 请求方式:【POST】/v3/fund-app/mch-transfer/transfer-bills
@@ -179,7 +186,7 @@ trait ApiTrait
             'transfer_scene_report_infos' => $transferSceneReportInfos,
         ];
         if ($userName) {
-            $encryptor = static function(string $msg): string {
+            $encryptor = static function (string $msg): string {
                 return Rsa::encrypt($msg, $this->config->public_key);
             };
             $data['user_name'] = $encryptor($userName);
@@ -188,7 +195,9 @@ trait ApiTrait
             $data['user_recv_perception'] = $userRecvPerception;
         }
         return $this->handleAsyncRequest(function (
-            BuilderChainable $builder, Config $config, $data
+            BuilderChainable $builder,
+            Config $config,
+            $data
         ): PromiseInterface {
             $data['appid'] = $config->appid;
             $data['notify_url'] = $config->notify_url;

+ 2 - 1
src/Trait/HandleAsyncRequestTrait.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\WechatPay\Trait;
@@ -40,4 +41,4 @@ trait HandleAsyncRequestTrait
             })
             ->wait();
     }
-}
+}

+ 6 - 8
src/Trait/MiniAppTrait.php

@@ -5,11 +5,11 @@ namespace SixShop\WechatPay\Trait;
 use SixShop\Wechat\Facade\WechatUser;
 use SixShop\WechatPay\Facade\WechatPayBuilder;
 use think\facade\Log;
+
 use function SixShop\Core\throw_logic_exception;
 
 trait MiniAppTrait
 {
-
     /**
      * 特殊发货报备
      * @see https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html#%E5%8D%81%E3%80%81%E7%89%B9%E6%AE%8A%E5%8F%91%E8%B4%A7%E6%8A%A5%E5%A4%87
@@ -27,7 +27,7 @@ trait MiniAppTrait
         ]);
         $result = json_decode($response->getContent());
         if ($result->errcode != 0) {
-            throw new  \InvalidArgumentException($result->errmsg, $result->errcode);
+            throw new \InvalidArgumentException($result->errmsg, $result->errcode);
         }
         return true;
     }
@@ -56,8 +56,7 @@ trait MiniAppTrait
         string $receiverContact = '',
         int    $logisticsType = 1,
         bool   $failException = true,
-    ): array
-    {
+    ): array {
         $data = [
             'order_key' => [
                 'order_number_type' => 1, // 枚举值1,使用下单商户号和商户侧单号;枚举值2,使用微信支付单号
@@ -111,8 +110,7 @@ trait MiniAppTrait
         string $deliveryID,
         array  $detailList,
         bool   $failException = true
-    ): array
-    {
+    ): array {
         // POST https://api.weixin.qq.com/cgi-bin/express/delivery/open_msg/trace_waybill?access_token=XXX
         $data = [
             'openid' => WechatUser::openid($userID),
@@ -129,10 +127,10 @@ trait MiniAppTrait
         $result = json_decode($result, true);
         if ($result['errcode'] == 931023) {
             throw_logic_exception("运单不存在:".$waybillID);
-        } else if ($result['errcode'] !== 0) {
+        } elseif ($result['errcode'] !== 0) {
             Log::error('获取运单token失败{errcode}:{errmsg}:' . json_encode($data), $result);
             $failException && throw new \RuntimeException($result['errmsg'], $result['errcode']);
         }
         return $result;
     }
-}
+}

+ 2 - 1
src/Trait/PaymentParamsTrait.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\WechatPay\Trait;
@@ -24,4 +25,4 @@ trait PaymentParamsTrait
         ), 'signType' => 'RSA'];
         return $params;
     }
-}
+}

+ 3 - 3
src/WechatPayBuilder.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\WechatPay;
@@ -17,8 +18,7 @@ class WechatPayBuilder extends Facade
         private readonly Config   $config,
         private ?BuilderChainable $builderChainable = null,
         private ?MiniApp          $miniApp = null
-    )
-    {
+    ) {
     }
 
     protected static function getFacadeAccessor(): string
@@ -60,4 +60,4 @@ class WechatPayBuilder extends Facade
         }
         return $this->miniApp;
     }
-}
+}

+ 5 - 3
tests/PaymentProviderTest.php

@@ -1,5 +1,7 @@
 <?php
+
 declare(strict_types=1);
+
 namespace SixShop\WechatPay;
 
 use app\admin\listener\RefundSuccessListener;
@@ -15,7 +17,7 @@ class PaymentProviderTest extends TestCase
         $this->provider = app()->make(PaymentProvider::class);
     }
 
-    public function testRefundQuery():void
+    public function testRefundQuery(): void
     {
         app()->event->listen(RefundSuccessEvent::class, RefundSuccessListener::class);
         $result = $this->provider->refundQuery(15);
@@ -23,10 +25,10 @@ class PaymentProviderTest extends TestCase
     }
 
 
-    public function testNotify():void
+    public function testNotify(): void
     {
         $request = '{"headers":{"Wechatpay-Timestamp":"1761788693","Pragma":"no-cache","Wechatpay-Signature-Type":"WECHATPAY2-SHA256-RSA2048","Wechatpay-Signature":"Bgbneutr3QJLh2MPGIkMbcfVf2c7Qvuc6K36J9bjeIUyzrGqAxX+FLQihUvc1Kql\/+CsfZ56KiSgvX2EAKXSfrS8MfiYBmZmod5MJ+z0okJCKs2zs+u02T9Rdq1dQel5obDBFz8\/ml3+\/iMpCHWXIgZKhZ\/m5\/Y5WEzi4rtLRi2a85DIB+94FTKzgocHBQEerl3MIAFja670bO1yl9x3Oh0Tm8pABKFG9a4AJRR7C2s8knWF\/G\/U6ACzxcb8F72gdnR12hOemKW9SK3ZmlPU0sGg2OtwQRbcrpEnfknoDwlPmvbF1EqGWsaAX0V\/PhmoFnF18uvsSOdq8v9FTgc8Qw==","Wechatpay-Serial":"7427F0AF01B742B517F5F332D9F420A5522F42C8","Content-Type":"application\/json","Wechatpay-Nonce":"lxYrTLcexvLKGiQLcpx6mp1f9ZHr8AYd","Accept":"*\/*","User-Agent":"Mozilla\/4.0","Connection":"Keep-Alive","Content-Length":"919","Host":"api.xxdj86.com"},"inBody":{"id":"166aae75-5279-5561-b870-af8d3335d503","create_time":"2025-10-30T09:43:50+08:00","resource_type":"encrypt-resource","event_type":"TRANSACTION.SUCCESS","summary":"\u652f\u4ed8\u6210\u529f","resource":{"original_type":"transaction","algorithm":"AEAD_AES_256_GCM","ciphertext":"1Wiv+WCmB1lRFtKgwfdVpxMOndDb\/oKfCSJHKSoBdD7Ayaj05U\/0BDQA0TogttWd7TzE0dtFF8ykyoO8TCMUA9lH1qL0fmXWeUPZEJM5Sm9jyhmtDzPGpRxynY0LSrJyFpQO7FT7KlA17Ndj9Vl\/c6B32mB0sKU0ccLTGkqYEMDADhQbO+BTlf8G57c5iDJCqZ5B5auvT3yjSC0yyTBAmuGbyYnHt1+Bcv86ni7UWodFo0PuTaOCdUqi2WS4CLjqxXV+pNPDDD8w3sfg90oKFziEpbMDQHhY2qSzqThP\/fxel5XwMA8ezwCm4BWRM5aIL8HXmp6FyyltdqSpjUecBgLxkBAkziZ1w1adKJDPIBVwgDJ2arEJidEUwnB2ivngfn50ze3tNpwxsjBI5wifLZLUOrmPUlaev+tYfdrJ+ioC54jaPq4xqMbLebycfci89iB3dDR0go71X5hXkjt6+4KaDOcsCHKEqREhOL6qz2TIe7M+dg8ZDnXvq\/PuWjjSthCpH1tO2RdkhxK1dayYPx7AzK6PFWDiOc9fSPPrSkX1zdJQazIfz8qVsW14zSXZtv4YddUy\/\/6Kk8Ag","associated_data":"transaction","nonce":"PXZ7RYOm2vTI"}}}';
         $request = json_decode($request, true);
         $this->provider->notify($request);
     }
-}
+}

+ 4 - 2
tests/Service/NotifyServiceTest.php

@@ -1,5 +1,7 @@
 <?php
+
 declare(strict_types=1);
+
 namespace SixShop\WechatPay\Service;
 
 use PHPUnit\Framework\Attributes\Test;
@@ -18,7 +20,7 @@ class NotifyServiceTest extends TestCase
     {
         $header = '{"Wechatpay-Timestamp":"1766164013","Wechatpay-Signature":"J+PdOHvlcocaZMig0oaLrQluQ2Rn176+VDKsjqS8C8E+v\/lEH2UhowO1IyasGvb934LBeXyDWtsbDlY7W8JuztdXKtmJi\/0yhhW1L3raqbjISvNEAQiW\/a1O3w8YLsB3\/znlYATFkTR6Pi1GwF8jmlHs7vvadIlkPrtA8OXT189PBu3mMDZWPhUXkoCy\/6gKcL35BHOI0MAU79cdO6C4fqRL+YoMo+ETHkhnTm4R5kFLQIh9qrtmv2bBCNcgk5yBqPKzDMNnLYZnT6tO0W9KbXG038Zd7cAAECkAgDnlixbLeTfeVzeft4HeStCl0klB1aD\/9sLbsEU7JwOAQpwDlA==","Wechatpay-Serial":"PUB_KEY_ID_0117289218142025100700211947000800","Content-Type":"application\/json","Wechatpay-Nonce":"7H8olXNudQOnwtMhZDbEaXXWZe13CSp1"}';
         $inBody = '{"id":"25279e63-c260-5eaa-b55d-2141f4454dce","create_time":"2025-12-19T19:32:27+08:00","resource_type":"encrypt-resource","event_type":"TRANSACTION.SUCCESS","summary":"支付成功","resource":{"original_type":"transaction","algorithm":"AEAD_AES_256_GCM","ciphertext":"zNt4q12Jw2kF/8yb9JwggYtHBNLtCZaFmGMQpRHCAc73rnp90ygZSoghgxCffYoMGgqgAt7QXanINMDIFkk8EfGbKaAZn0QGrtUdcdbjlhWcRpgKylRITjsq9slvTPR/S5Wk+eup1QDp/MMRBHPSncuv2kV7Vp4PVSj/jdn3KKutk8so0VzQQMIMa08GPlPasu2A5sngsXlernPGxYfyNdwVqPeL5Yi1QiNuzZqPqXSbMeNqed5fE8wIBHOzyh4i4i57Zg5Gsf9sPL/nqHy8nY7mqmlr90leTA8wunbKVPoDvU/Rk0lC8lunzkrMiL+X0PtZZKe7lO1BLzcbJxC4GGYaxbhkcP7iTRlJwUmjPxvV0ZgMHV2I+dDccMWG6MKq1Onp00lzUMB/VUHtJVNcSTSHid4I5Wc7RkFZFJzYXseqhKqbGSs8EkIRcI4H2VoF4njDnlrBOb1hlzmtDJd7DhaxHjBsD84enVAZ0V3OQVvFnC3VqErki/mJhU60Q5QoAhr1ap3RZ6xMWEgDXMTIr/9FtM8jYKHUBu8FURY8Kxf9P1/xuUTDcds74ktWeGHXrhVcJdduHOzVvGJPyXYjhQ==","associated_data":"transaction","nonce":"Tp6yg5SshjL3"}}';
-        $result = $this->notifyService->transactionSuccess(json_decode($header,true), inBody: $inBody);
+        $result = $this->notifyService->transactionSuccess(json_decode($header, true), inBody: $inBody);
         dump(json_decode($inBody));
     }
-}
+}

+ 2 - 1
tests/WechatPayBuilderTest.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\WechatPay;
@@ -51,4 +52,4 @@ class WechatPayBuilderTest extends TestCase
         $result = $this->queryTransferBill('20251105151948049869');
         dump($result);
     }
-}
+}