feat: landing settings, instant withdraw deduct, and OTP site URL
Add has_landing plus landing_* deploy keys, deduct balance on withdraw request, keep app_url for SMS login links, and clarify Zarin rial wallet document titles. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -60,6 +60,16 @@ class ConfigServiceOtpHostTest extends TestCase
|
||||
$this->assertSame('https://my.goldarvin.ir', $cfg->resolvePublicSiteUrl($request));
|
||||
}
|
||||
|
||||
public function test_does_not_fall_back_to_laravel_api_host(): void
|
||||
{
|
||||
config(['app.url' => 'https://goldarvin.gholaktala.ir/server']);
|
||||
$request = Request::create('https://goldarvin.gholaktala.ir/server/admin/customer', 'POST');
|
||||
$this->app->instance('request', $request);
|
||||
|
||||
$this->assertSame('', $this->cfgWithAppUrl(null)->resolvePublicSiteUrl($request));
|
||||
$this->assertSame('', $this->cfgWithAppUrl(null)->resolvePublicHost($request));
|
||||
}
|
||||
|
||||
public function test_app_url_without_scheme_gets_https(): void
|
||||
{
|
||||
$request = Request::create('https://goldarvin.gholaktala.ir/server/auth/login', 'POST');
|
||||
|
||||
@@ -19,6 +19,7 @@ class SuperAdminProgramSettingsOverlayTest extends TestCase
|
||||
'enable_gold_credit',
|
||||
'enable_product_funds',
|
||||
'group_sms',
|
||||
'has_landing',
|
||||
'has_page_earn_money',
|
||||
'has_page_gift_card',
|
||||
'has_page_notification',
|
||||
@@ -29,7 +30,7 @@ class SuperAdminProgramSettingsOverlayTest extends TestCase
|
||||
];
|
||||
|
||||
$this->assertSame($expected, SuperAdminProgramSettingsOverlay::SUPERADMIN_OWNED_KEYS);
|
||||
$this->assertCount(15, SuperAdminProgramSettingsOverlay::SUPERADMIN_OWNED_KEYS);
|
||||
$this->assertCount(16, SuperAdminProgramSettingsOverlay::SUPERADMIN_OWNED_KEYS);
|
||||
}
|
||||
|
||||
public function test_overlay_keeps_only_access_keys(): void
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use App\Models\Withdraw;
|
||||
use App\Services\ZarinSyncService;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ZarinRialWalletDirectionTest extends TestCase
|
||||
{
|
||||
public function test_customer_rial_withdraw_is_direction_one_even_if_cash_positive(): void
|
||||
{
|
||||
$withdraw = new Withdraw([
|
||||
'type' => 2,
|
||||
'cash' => 200000000,
|
||||
'note' => 'برداشت ریالی',
|
||||
]);
|
||||
|
||||
$this->assertSame(1, app(ZarinSyncService::class)->rialWalletDirectionFromWithdraw($withdraw));
|
||||
}
|
||||
|
||||
public function test_admin_deposit_with_positive_cash_is_direction_zero(): void
|
||||
{
|
||||
$withdraw = new Withdraw([
|
||||
'type' => null,
|
||||
'cash' => 200000000,
|
||||
'note' => 'افزایش موجودی',
|
||||
]);
|
||||
|
||||
$this->assertSame(0, app(ZarinSyncService::class)->rialWalletDirectionFromWithdraw($withdraw));
|
||||
}
|
||||
|
||||
public function test_admin_deduction_with_negative_cash_is_direction_one(): void
|
||||
{
|
||||
$withdraw = new Withdraw([
|
||||
'cash' => -50000000,
|
||||
'note' => 'کسر',
|
||||
]);
|
||||
|
||||
$this->assertSame(1, app(ZarinSyncService::class)->rialWalletDirectionFromWithdraw($withdraw));
|
||||
}
|
||||
|
||||
public function test_desc_bardasht_is_withdraw_and_variz_is_deposit(): void
|
||||
{
|
||||
$svc = app(ZarinSyncService::class);
|
||||
$this->assertSame(1, $svc->rialWalletDirectionFromDesc('برداشت وجه'));
|
||||
$this->assertSame(0, $svc->rialWalletDirectionFromDesc('واریز وجه'));
|
||||
$this->assertSame(0, $svc->rialWalletDirectionFromDesc('واریز — افزایش موجودی'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user