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>
51 lines
1.6 KiB
PHP
51 lines
1.6 KiB
PHP
<?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('واریز — افزایش موجودی'));
|
|
}
|
|
}
|