|
|
@@ -200,6 +200,30 @@ class PaymentChannelOptionsTest extends TestCase
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public function test_withdraw_logos_upload_save_share_by_method_and_list_returns_logo(): void
|
|
|
+ {
|
|
|
+ $this->app['config']->set('app.url', 'https://admin.example.test');
|
|
|
+ $this->assertSame(0, $this->saveChannel(['id' => 25, 'data_type' => 2, 'payment_company' => 'jd', 'type' => 'JDpay', 'rate' => '0.01', 'logo' => '/storage/images/jd-withdraw.png'])['code']);
|
|
|
+ $row = \App\Models\RechargeChannel::find(25);
|
|
|
+ $this->assertSame('https://admin.example.test/storage/images/jd-withdraw.png', $row->logo);
|
|
|
+ $deposit = \App\Models\RechargeChannel::find(24);
|
|
|
+ $this->assertSame('', $deposit->logo);
|
|
|
+ $this->assertSame(0, $this->saveChannel($this->newChannel(['data_type' => 2, 'payment_company' => 'jd', 'type' => 'JDpay', 'rate' => '0.02', 'key' => 'withdraw-peer']))['code']);
|
|
|
+ foreach (\App\Models\RechargeChannel::where('data_type', 2)->where('type', 'JDpay')->get() as $peer) {
|
|
|
+ $this->assertSame($row->logo, $peer->logo);
|
|
|
+ }
|
|
|
+ $listRow = $this->channelList(['data_type' => '2', 'payment_company' => 'jd'])['data'][0];
|
|
|
+ $this->assertArrayHasKey('logo', $listRow);
|
|
|
+ $this->assertSame('https://admin.example.test/storage/images/jd-withdraw.png', $listRow['logo']);
|
|
|
+ $formatted = array_column(\App\Models\RechargeChannel::getFormatChannel(2, 1), null, 'value');
|
|
|
+ $this->assertSame('https://admin.example.test/storage/images/jd-withdraw.png', $formatted['JDpay']['logo'] ?? '');
|
|
|
+ $this->assertSame('', array_column(\App\Models\RechargeChannel::getFormatChannel(1, 1), null, 'value')['JDpay']['logo'] ?? 'x');
|
|
|
+ $this->assertSame(0, $this->saveChannel(['id' => 25, 'data_type' => 2, 'payment_company' => 'jd', 'type' => 'JDpay', 'rate' => '0.01', 'logo' => null])['code']);
|
|
|
+ foreach (\App\Models\RechargeChannel::where('data_type', 2)->where('type', 'JDpay')->get() as $peer) {
|
|
|
+ $this->assertSame('', $peer->logo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public function test_company_options_use_all_rows_not_first_page(): void
|
|
|
{
|
|
|
$page1 = $this->channelList(['data_type' => '1']);
|