doge 2 dni temu
rodzic
commit
e014d62b69

+ 4 - 0
app/Services/Payment/PaymentProviderCatalog.php

@@ -28,6 +28,10 @@ class PaymentProviderCatalog
             'zfbsm' => ['sanjin', '支付宝扫码'],
             'zfbsm' => ['sanjin', '支付宝扫码'],
             'zfbge' => ['sanjin', '支付宝固额'],
             'zfbge' => ['sanjin', '支付宝固额'],
             'zfbzk' => ['sanjin', '支付宝转卡'],
             'zfbzk' => ['sanjin', '支付宝转卡'],
+            'qq' => ['sanjin', 'QQ转账'],
+            'xeh5' => ['sanjin', '小额个人支付宝H5'],
+            'zfbqy' => ['sanjin', '企业支付宝H5'],
+            'zfbh5' => ['sanjin', '个人支付宝H5'],
             'sdjt' => ['sanjin', '手动金条'],
             'sdjt' => ['sanjin', '手动金条'],
             'JDpay' => ['jd', 'JD钱包'],
             'JDpay' => ['jd', 'JD钱包'],
             'NOpay12' => ['no', 'NO扫码支付'],
             'NOpay12' => ['no', 'NO扫码支付'],

+ 23 - 5
app/Services/PaymentOrderService.php

@@ -11,6 +11,8 @@ use App\Models\Agent\AgentWithdrawal;
 use App\Models\RechargeChannel;
 use App\Models\RechargeChannel;
 use App\Models\User;
 use App\Models\User;
 use App\Models\Wallet as WalletModel;
 use App\Models\Wallet as WalletModel;
+use Brick\Math\BigDecimal;
+use Brick\Math\Exception\MathException;
 use Exception;
 use Exception;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Log;
 use Illuminate\Support\Facades\Log;
@@ -261,6 +263,16 @@ class PaymentOrderService extends BaseService
         $result['chat_id'] = $memberId;
         $result['chat_id'] = $memberId;
         $result['code'] = 0;
         $result['code'] = 0;
         $result['url'] = '';
         $result['url'] = '';
+        $isDirectProvider = JdPayService::isChannel($paymentType)
+            || NoPayService::isRechargeChannel($paymentType)
+            || ZimuPayService::isRechargeChannel($paymentType);
+        if (!$isDirectProvider && is_float($amount)) {
+            // Accept only floating-point residue around a whole-cent amount, including at range boundaries.
+            $nearestCent = round($amount, 2);
+            if (abs($amount - $nearestCent) <= PHP_FLOAT_EPSILON * abs($amount)) {
+                $amount = $nearestCent;
+            }
+        }
         $channel = ''; // 支付的通道
         $channel = ''; // 支付的通道
         $product = SanJinService::product($groupId);
         $product = SanJinService::product($groupId);
         $max = (float)($channelConfig->max ?? 0);
         $max = (float)($channelConfig->max ?? 0);
@@ -313,9 +325,6 @@ class PaymentOrderService extends BaseService
             return $result;
             return $result;
         }
         }
 
 
-        $isDirectProvider = JdPayService::isChannel($paymentType)
-            || NoPayService::isRechargeChannel($paymentType)
-            || ZimuPayService::isRechargeChannel($paymentType);
         if ($isDirectProvider && ($amount < $min || ($max > 0 && $amount > $max))) {
         if ($isDirectProvider && ($amount < $min || ($max > 0 && $amount > $max))) {
             $result['text'] = "❌ 此充值通道充值金额{$min}-{$max}请务必输入区间金额!";
             $result['text'] = "❌ 此充值通道充值金额{$min}-{$max}请务必输入区间金额!";
             $result['code'] = 20001;
             $result['code'] = 20001;
@@ -323,7 +332,7 @@ class PaymentOrderService extends BaseService
         }
         }
 
 
         // 没有找到支付通道
         // 没有找到支付通道
-        if (empty($channel) && !JdPayService::isChannel($paymentType) && !NoPayService::isRechargeChannel($paymentType) && !ZimuPayService::isRechargeChannel($paymentType)) {
+        if (empty($channel) && !$isDirectProvider) {
             // $text = "发起充值失败 \n";
             // $text = "发起充值失败 \n";
             // $text .= "最低充值:" . $min . " \n";
             // $text .= "最低充值:" . $min . " \n";
             // $text .= "最高充值:" . $max . " \n";
             // $text .= "最高充值:" . $max . " \n";
@@ -480,6 +489,15 @@ class PaymentOrderService extends BaseService
             return $result;
             return $result;
         }
         }
 
 
+        try {
+            $decimalAmount = is_float($amount) ? BigDecimal::fromFloatShortest($amount) : BigDecimal::of($amount);
+            $amountInCents = $decimalAmount->multipliedBy(100)->toInt();
+        } catch (MathException) {
+            $result['code'] = 20001;
+            $result['text'] = '充值金额必须精确到分';
+            return $result;
+        }
+
         $data = [];
         $data = [];
         $data['type'] = self::TYPE_PAY;
         $data['type'] = self::TYPE_PAY;
         $data['member_id'] = $memberId;
         $data['member_id'] = $memberId;
@@ -492,7 +510,7 @@ class PaymentOrderService extends BaseService
         $data['callback_url'] = SanJinService::getNotifyUrl();
         $data['callback_url'] = SanJinService::getNotifyUrl();
         $data['remark'] = '充值手续费:' . RechargeChannel::feeDisplay($rate, $feeFixed)['fee_text'];
         $data['remark'] = '充值手续费:' . RechargeChannel::feeDisplay($rate, $feeFixed)['fee_text'];
         $data['status'] = self::STATUS_STAY;
         $data['status'] = self::STATUS_STAY;
-        $ret = SanJinService::pay(($amount * 100), $order_no, $channel);
+        $ret = SanJinService::pay($amountInCents, $order_no, $channel);
         Log::error('三斤支付发起:', $ret);
         Log::error('三斤支付发起:', $ret);
         if ($ret['code'] == 0) {
         if ($ret['code'] == 0) {
 
 

+ 61 - 0
database/migrations/2026_11_14_120000_add_sanjin_recharge_channels.php

@@ -0,0 +1,61 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Support\Facades\DB;
+
+return new class extends Migration {
+    public function up(): void
+    {
+        DB::transaction(function () {
+            $channels = [
+                'QQ' => ['qq', 'QQ转账', 10, 1000, '0.0100'],
+                'XEH5' => ['xeh5', '小额个人支付宝H5', 100, 199, '0.1500'],
+                'ZFBQY' => ['zfbqy', '企业支付宝H5', 200, 5000, '0.1300'],
+                'ZFBH5' => ['zfbh5', '个人支付宝H5', 200, 5000, '0.1250'],
+            ];
+            $now = now();
+            foreach ($channels as $key => [$type, $name, $min, $max, $rate]) {
+                $existing = DB::table('recharge_channel')->where('data_type', 1)->where('key', $key)
+                    ->orderBy('id')->lockForUpdate()->get(['id', 'key', 'from', 'type', 'deleted_at']);
+                if ($existing->isNotEmpty()) {
+                    $live = $existing->whereNull('deleted_at');
+                    $channel = $live->first();
+                    if ($live->count() !== 1 || $channel->key !== $key || (int) $channel->from !== 1 || $channel->type !== $type) {
+                        $ids = $existing->pluck('id')->implode(', ');
+                        throw new RuntimeException("充值通道 Key {$key} 已被占用(通道 ID {$ids}),需要未删除的三斤通道 type={$type}");
+                    }
+                    continue;
+                }
+                DB::table('recharge_channel')->insert([
+                    'data_type' => 1, 'from' => 1, 'key' => $key, 'type' => $type, 'name' => $name,
+                    'min' => $min, 'max' => $max, 'rate' => $rate, 'fee_fixed' => 0,
+                    'fixed' => null, 'status' => 1, 'sort' => 46,
+                    'created_at' => $now, 'updated_at' => $now,
+                ]);
+            }
+
+            $registeredTypes = array_column($channels, 0);
+            DB::table('recharge_channel_group')->whereNull('deleted_at')->lockForUpdate()
+                ->select('id', 'recharge_type')->chunkById(100, function ($groups) use ($registeredTypes, $now) {
+                    foreach ($groups as $group) {
+                        $types = explode(',', (string) $group->recharge_type);
+                        if (!in_array('zfbzk', $types, true)) {
+                            continue;
+                        }
+                        $missing = array_diff($registeredTypes, $types);
+                        if ($missing !== []) {
+                            DB::table('recharge_channel_group')->where('id', $group->id)->update([
+                                'recharge_type' => implode(',', array_merge($types, $missing)),
+                                'updated_at' => $now,
+                            ]);
+                        }
+                    }
+                });
+        });
+    }
+
+    public function down(): void
+    {
+        throw new RuntimeException('这四个充值通道可能已有订单或后台配置,请在后台管理通道启停');
+    }
+};

+ 4 - 0
lang/en/messages.php

@@ -149,6 +149,10 @@ return [
     "支付宝扫码" => "Alipay QR Code",
     "支付宝扫码" => "Alipay QR Code",
     "支付宝固额" => "Alipay Fixed Amount",
     "支付宝固额" => "Alipay Fixed Amount",
     "支付宝转卡" => "Alipay Transfer to Card",
     "支付宝转卡" => "Alipay Transfer to Card",
+    "QQ转账" => "QQ Transfer",
+    "小额个人支付宝H5" => "Personal Alipay H5 (Small Amounts)",
+    "企业支付宝H5" => "Business Alipay H5",
+    "个人支付宝H5" => "Personal Alipay H5",
     "银联扫码" => "UnionPay QR Code",
     "银联扫码" => "UnionPay QR Code",
     "手动金条" => "Manual Gold Bar",
     "手动金条" => "Manual Gold Bar",
     "无效的支付通道!" => "Invalid payment channel!",
     "无效的支付通道!" => "Invalid payment channel!",

+ 4 - 0
lang/vi/messages.php

@@ -149,6 +149,10 @@ return [
     "支付宝扫码" => "Quét mã Alipay",
     "支付宝扫码" => "Quét mã Alipay",
     "支付宝固额" => "Số tiền cố định Alipay",
     "支付宝固额" => "Số tiền cố định Alipay",
     "支付宝转卡" => "Chuyển thẻ Alipay",
     "支付宝转卡" => "Chuyển thẻ Alipay",
+    "QQ转账" => "Chuyển khoản QQ",
+    "小额个人支付宝H5" => "Alipay H5 cá nhân (số tiền nhỏ)",
+    "企业支付宝H5" => "Alipay H5 doanh nghiệp",
+    "个人支付宝H5" => "Alipay H5 cá nhân",
     "银联扫码" => "Quét mã UnionPay",
     "银联扫码" => "Quét mã UnionPay",
     "手动金条" => "Vàng thỏi thủ công",
     "手动金条" => "Vàng thỏi thủ công",
     "无效的支付通道!" => "Kênh thanh toán không hợp lệ!",
     "无效的支付通道!" => "Kênh thanh toán không hợp lệ!",

+ 4 - 0
lang/zh/messages.php

@@ -149,6 +149,10 @@ return [
     "支付宝扫码" => "支付宝扫码",
     "支付宝扫码" => "支付宝扫码",
     "支付宝固额" => "支付宝固额",
     "支付宝固额" => "支付宝固额",
     "支付宝转卡" => "支付宝转卡",
     "支付宝转卡" => "支付宝转卡",
+    "QQ转账" => "QQ转账",
+    "小额个人支付宝H5" => "小额个人支付宝H5",
+    "企业支付宝H5" => "企业支付宝H5",
+    "个人支付宝H5" => "个人支付宝H5",
     "银联扫码" => "银联扫码",
     "银联扫码" => "银联扫码",
     "手动金条" => "手动金条",
     "手动金条" => "手动金条",
     "无效的支付通道!" => "无效的支付通道!",
     "无效的支付通道!" => "无效的支付通道!",

+ 120 - 4
tests/Integration/PaymentChannelOptionsTest.php

@@ -22,7 +22,11 @@ use Illuminate\Support\Facades\Facade;
 use Illuminate\Translation\ArrayLoader;
 use Illuminate\Translation\ArrayLoader;
 use Illuminate\Translation\Translator;
 use Illuminate\Translation\Translator;
 use Illuminate\Validation\Factory;
 use Illuminate\Validation\Factory;
+use PHPUnit\Framework\Attributes\PreserveGlobalState;
+use PHPUnit\Framework\Attributes\RunInSeparateProcess;
 use PHPUnit\Framework\TestCase;
 use PHPUnit\Framework\TestCase;
+use Psr\Log\NullLogger;
+use Tests\Support\RecordingProviderClient;
 
 
 class PaymentChannelOptionsTest extends TestCase
 class PaymentChannelOptionsTest extends TestCase
 {
 {
@@ -136,21 +140,21 @@ class PaymentChannelOptionsTest extends TestCase
         DB::table('recharge_channel')->where('data_type', 1)->update(['status' => 0]);
         DB::table('recharge_channel')->where('data_type', 1)->update(['status' => 0]);
         DB::table('payment_providers')->update(['status' => 0]);
         DB::table('payment_providers')->update(['status' => 0]);
         $options = $service->options();
         $options = $service->options();
-        $this->assertSame(13, $options['total']);
+        $this->assertSame(17, $options['total']);
         $rows = array_column($options['data'], null, 'channel_type');
         $rows = array_column($options['data'], null, 'channel_type');
-        foreach (['wxsm','ylsm','szrmb','zfbsm','zfbge','zfbzk','sdjt','JDpay','NOpay12','NOpay13','ZIMUpay','usdt','rgcz'] as $type) {
+        foreach (['wxsm','ylsm','szrmb','zfbsm','zfbge','zfbzk','qq','xeh5','zfbqy','zfbh5','sdjt','JDpay','NOpay12','NOpay13','ZIMUpay','usdt','rgcz'] as $type) {
             $this->assertArrayHasKey($type, $rows);
             $this->assertArrayHasKey($type, $rows);
         }
         }
         $this->assertSame('三斤支付 / 微信扫码', $rows['wxsm']['channel_name']);
         $this->assertSame('三斤支付 / 微信扫码', $rows['wxsm']['channel_name']);
         DB::table('recharge_channel')->delete(); DB::table('recharge_channel_group')->delete();
         DB::table('recharge_channel')->delete(); DB::table('recharge_channel_group')->delete();
-        $this->assertSame(13, $service->options()['total']);
+        $this->assertSame(17, $service->options()['total']);
         $result = $service->save(['channel_type' => 'wxsm', 'logo' => 'https://cdn.example.test/wx.png']);
         $result = $service->save(['channel_type' => 'wxsm', 'logo' => 'https://cdn.example.test/wx.png']);
         $this->assertSame('https://cdn.example.test/wx.png', $result['logo']);
         $this->assertSame('https://cdn.example.test/wx.png', $result['logo']);
         $this->assertSame(0, DB::table('recharge_channel')->count());
         $this->assertSame(0, DB::table('recharge_channel')->count());
         $this->assertSame('https://cdn.example.test/wx.png', array_column($service->options()['data'], null, 'channel_type')['wxsm']['logo']);
         $this->assertSame('https://cdn.example.test/wx.png', array_column($service->options()['data'], null, 'channel_type')['wxsm']['logo']);
         $this->assertSame('', $service->save(['channel_type' => 'wxsm', 'logo' => null])['logo']);
         $this->assertSame('', $service->save(['channel_type' => 'wxsm', 'logo' => null])['logo']);
         $this->request('/admin/rechargeChannel/logoOptions', []);
         $this->request('/admin/rechargeChannel/logoOptions', []);
-        $this->assertSame(13, (new RechargeChannel())->logoOptions($service)->getData(true)['data']['total']);
+        $this->assertSame(17, (new RechargeChannel())->logoOptions($service)->getData(true)['data']['total']);
         $router = new \Illuminate\Routing\Router(new \Illuminate\Events\Dispatcher($this->app), $this->app);
         $router = new \Illuminate\Routing\Router(new \Illuminate\Events\Dispatcher($this->app), $this->app);
         $this->app->instance('router', $router);
         $this->app->instance('router', $router);
         $router->group(['prefix' => 'admin'], function () { require dirname(__DIR__, 2) . '/routes/admin.php'; });
         $router->group(['prefix' => 'admin'], function () { require dirname(__DIR__, 2) . '/routes/admin.php'; });
@@ -284,6 +288,118 @@ class PaymentChannelOptionsTest extends TestCase
         $this->assertSame('wxsm', DB::table('recharge_channel_group')->value('recharge_type'));
         $this->assertSame('wxsm', DB::table('recharge_channel_group')->value('recharge_type'));
     }
     }
 
 
+    #[RunInSeparateProcess]
+    #[PreserveGlobalState(false)]
+    public function test_new_sanjin_channels_use_their_own_limits_and_product_codes(): void
+    {
+        $this->app->instance('log', new NullLogger());
+        $migration = require dirname(__DIR__, 2) . '/database/migrations/2026_11_14_120000_add_sanjin_recharge_channels.php';
+        $migration->up();
+        $migration->up();
+        $expected = [
+            'qq' => ['QQ', 10, 1000, '0.0100'],
+            'xeh5' => ['XEH5', 100, 199, '0.1500'],
+            'zfbqy' => ['ZFBQY', 200, 5000, '0.1300'],
+            'zfbh5' => ['ZFBH5', 200, 5000, '0.1250'],
+        ];
+        $this->assertSame(4, ChannelModel::whereIn('type', array_keys($expected))->count());
+        $this->request('/admin/rechargeChannel/getChannel', ['data_type' => 1]);
+        $groupOptions = (new RechargeChannel())->getChannel()->getData(true)['data']['data'];
+        $this->assertSame(array_keys($expected), array_values(array_intersect(
+            array_keys($expected), array_column($groupOptions, 'type')
+        )));
+        (require dirname(__DIR__, 2) . '/database/migrations/2026_11_01_120000_add_config_to_payment_providers.php')->up();
+        config(['app.tree_pay_mch_id' => 'test-sanjin', 'app.tree_pay_key' => 'test-secret', 'app.url' => 'https://example.test']);
+        $this->assertFalse(class_exists(\GuzzleHttp\Client::class, false));
+        class_alias(RecordingProviderClient::class, \GuzzleHttp\Client::class);
+        RecordingProviderClient::$responseBody = '{"code":88,"message":"mock gateway rejected"}';
+        $channels = array_column(ChannelModel::getFormatChannel(1, 1), null, 'value');
+
+        foreach ($expected as $type => [$key, $min, $max, $rate]) {
+            $channel = ChannelModel::checkRechargeChannel($type, 1);
+            $this->assertSame($key, $channel->key);
+            $this->assertSame([$min, $max], [(int) $channel->min, (int) $channel->max]);
+            $this->assertSame($rate, bcadd((string) $channel->rate, '0', 4));
+            $this->assertArrayHasKey($type, $channels);
+            $this->assertFalse(ChannelModel::checkRechargeChannel($type, 2));
+
+            $rejected = PaymentOrderService::createPayOrder(\App\Models\PaymentOrder::class, 'member', $max + 1, $type, 1, $channel);
+            $this->assertSame(20001, $rejected['code']);
+            $this->assertSame([], RecordingProviderClient::$requests);
+            $fractionalCent = PaymentOrderService::createPayOrder(\App\Models\PaymentOrder::class, 'member', $min . '.001', $type, 1, $channel);
+            $this->assertSame(20001, $fractionalCent['code']);
+            $this->assertSame([], RecordingProviderClient::$requests);
+
+            // The transport captures the request and rejects it before QR generation or order creation.
+            $result = PaymentOrderService::createPayOrder(\App\Models\PaymentOrder::class, 'member', $min + 0.20, $type, 1, $channel);
+            $this->assertSame(20002, $result['code']);
+            $request = array_pop(RecordingProviderClient::$requests);
+            $this->assertSame('api/v1/pay/unifiedOrder', $request['url']);
+            $this->assertSame($key, $request['options']['json']['productId']);
+            $this->assertSame($min * 100 + 20, $request['options']['json']['amount']);
+        }
+
+        $channel = ChannelModel::findOrFail(6);
+        $model = \App\Models\PaymentOrder::class;
+        $result = PaymentOrderService::createPayOrder($model, 'member', 100.01 + 0.20, 'zfbsm', 1, $channel, channelId: 6);
+        $this->assertSame(20002, $result['code']);
+        $request = array_pop(RecordingProviderClient::$requests);
+        $this->assertSame(10021, $request['options']['json']['amount']);
+        foreach ([100.211, '100.21000000000001'] as $amount) {
+            $result = PaymentOrderService::createPayOrder($model, 'member', $amount, 'zfbsm', 1, $channel, channelId: 6);
+            $this->assertSame(20001, $result['code']);
+            $this->assertSame([], RecordingProviderClient::$requests);
+        }
+        $channel = ChannelModel::checkRechargeChannel('xeh5', 1);
+        $result = PaymentOrderService::createPayOrder($model, 'member', 199.00000000000003, 'xeh5', 1, $channel);
+        $this->assertSame(20002, $result['code']);
+        $request = array_pop(RecordingProviderClient::$requests);
+        $this->assertSame(19900, $request['options']['json']['amount']);
+
+        DB::table('recharge_channel')->where('key', 'QQ')->update(['status' => 0, 'min' => 20]);
+        $migration->up();
+        $this->assertSame(20, (int) DB::table('recharge_channel')->where('key', 'QQ')->value('min'));
+        $this->assertFalse(ChannelModel::checkRechargeChannel('qq', 1));
+    }
+
+    public function test_sanjin_channel_migration_preserves_matching_live_channel_after_deleted_record(): void
+    {
+        $channels = DB::table('recharge_channel');
+        $row = ['data_type' => 1, 'from' => 1, 'key' => 'QQ', 'type' => 'qq', 'name' => 'QQ transfer',
+            'rate' => '0.02', 'min' => 30, 'max' => 1000, 'status' => 1, 'sort' => 46];
+        $deleted = $channels->insertGetId($row + ['deleted_at' => now()]);
+        $live = $channels->insertGetId($row);
+        $migration = require dirname(__DIR__, 2) . '/database/migrations/2026_11_14_120000_add_sanjin_recharge_channels.php';
+
+        $migration->up();
+
+        $channel = ChannelModel::checkRechargeChannel('qq', 1);
+        $this->assertSame($live, $channel->id);
+        $this->assertSame(30, (int) $channel->min);
+        $this->assertNotNull(ChannelModel::withTrashed()->findOrFail($deleted)->deleted_at);
+    }
+
+    public function test_sanjin_channel_migration_rolls_back_when_a_key_conflicts(): void
+    {
+        $channels = DB::table('recharge_channel');
+        $conflict = $channels->insertGetId(['data_type' => 1, 'from' => 1, 'key' => 'XEH5', 'type' => 'zfbsm',
+            'name' => 'Existing Alipay channel', 'rate' => '0.10', 'min' => 100, 'max' => 199, 'status' => 1, 'sort' => 46]);
+        $groupTypes = DB::table('recharge_channel_group')->where('id', 1)->value('recharge_type');
+        $migration = require dirname(__DIR__, 2) . '/database/migrations/2026_11_14_120000_add_sanjin_recharge_channels.php';
+
+        try {
+            $migration->up();
+            $this->fail('Expected migration to report the occupied XEH5 Key');
+        } catch (\RuntimeException $exception) {
+            $this->assertStringContainsString('Key XEH5', $exception->getMessage());
+            $this->assertStringContainsString("通道 ID {$conflict}", $exception->getMessage());
+        }
+
+        $this->assertFalse($channels->where('key', 'QQ')->exists());
+        $this->assertSame('zfbsm', ChannelModel::findOrFail($conflict)->type);
+        $this->assertSame($groupTypes, DB::table('recharge_channel_group')->where('id', 1)->value('recharge_type'));
+    }
+
     private function formOptions(int $dataType = 1, ?int $id = null): array
     private function formOptions(int $dataType = 1, ?int $id = null): array
     {
     {
         $this->request('/admin/rechargeChannel/options', ['data_type' => $dataType] + ($id ? ['id' => $id] : []));
         $this->request('/admin/rechargeChannel/options', ['data_type' => $dataType] + ($id ? ['id' => $id] : []));

+ 3 - 3
tests/Regression/payment_provider_catalog.php

@@ -1,7 +1,7 @@
 <?php
 <?php
 
 
-// 无需 Laravel 或数据库:php tests/Regression/payment_provider_catalog.php
-require_once __DIR__ . '/../../app/Services/Payment/PaymentProviderCatalog.php';
+// 无需启动 Laravel 或连接数据库:php tests/Regression/payment_provider_catalog.php
+require_once __DIR__ . '/../../vendor/autoload.php';
 
 
 use App\Services\Payment\PaymentProviderCatalog;
 use App\Services\Payment\PaymentProviderCatalog;
 
 
@@ -45,7 +45,7 @@ $check(['945', '988', '990'], $allChannels[10]['fixed_amounts'], '固额金额
 
 
 $filtered = $options(['kind' => 'deposit', 'payment_company' => 'sanjin', 'payment_method' => 'zfbsm']);
 $filtered = $options(['kind' => 'deposit', 'payment_company' => 'sanjin', 'payment_method' => 'zfbsm']);
 $check([6, 7, 8, 9], array_column($filtered['recharge_channels'], 'id'), '支付宝扫码保留全部四个额度通道');
 $check([6, 7, 8, 9], array_column($filtered['recharge_channels'], 'id'), '支付宝扫码保留全部四个额度通道');
-$check(7, count($filtered['payment_methods']), '选方式不截断公司方式下拉');
+$check(11, count($filtered['payment_methods']), '选方式不截断公司方式下拉');
 $no = $options(['kind' => 'collection_scan', 'provider_name' => 'no']);
 $no = $options(['kind' => 'collection_scan', 'provider_name' => 'no']);
 $check(['NOpay12', 'NOpay13'], array_column($no['collection_methods'], 'value'), '代收NO方式联动');
 $check(['NOpay12', 'NOpay13'], array_column($no['collection_methods'], 'value'), '代收NO方式联动');
 $check([26, 27], array_column($no['recharge_channels'], 'id'), '代收NO通道联动');
 $check([26, 27], array_column($no['recharge_channels'], 'id'), '代收NO通道联动');

+ 2 - 1
tests/Support/RecordingProviderClient.php

@@ -6,10 +6,11 @@ namespace Tests\Support;
 class RecordingProviderClient
 class RecordingProviderClient
 {
 {
     public static array $requests = [];
     public static array $requests = [];
+    public static string $responseBody = '{}';
     public function __construct(private array $config = []) {}
     public function __construct(private array $config = []) {}
     public function post(string $url, array $options): \GuzzleHttp\Psr7\Response
     public function post(string $url, array $options): \GuzzleHttp\Psr7\Response
     {
     {
         self::$requests[] = ['url' => $url, 'options' => $options] + $this->config;
         self::$requests[] = ['url' => $url, 'options' => $options] + $this->config;
-        return new \GuzzleHttp\Psr7\Response(200, [], '{}');
+        return new \GuzzleHttp\Psr7\Response(200, [], self::$responseBody);
     }
     }
 }
 }