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:
@@ -4,6 +4,7 @@ namespace App\Services;
|
||||
|
||||
use App\Http\Controllers\Admin\ZarinController;
|
||||
use App\Models\Customer;
|
||||
use App\Models\Withdraw;
|
||||
use App\Models\Zarin;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@@ -567,6 +568,29 @@ class ZarinSyncService
|
||||
->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* درخواست برداشت مشتری cash را مثبت ذخیره میکند (type=2) — علامت مبلغ برای جهت سند کافی نیست.
|
||||
* 0 = واریز، 1 = برداشت
|
||||
*/
|
||||
public function rialWalletDirectionFromWithdraw(Withdraw $withdraw): int
|
||||
{
|
||||
if ((int) ($withdraw->type ?? 0) === 2) {
|
||||
return 1;
|
||||
}
|
||||
$note = (string) ($withdraw->note ?? '');
|
||||
if ($note !== '' && str_contains($note, 'برداشت')) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return ((float) ($withdraw->cash ?? 0)) >= 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
/** شرح محلی سند ریالی: «برداشت وجه» برداشت است؛ «واریز وجه» واریز. */
|
||||
public function rialWalletDirectionFromDesc(string $desc): int
|
||||
{
|
||||
return str_contains($desc, 'برداشت') ? 1 : 0;
|
||||
}
|
||||
|
||||
private function backfillWithdraw(ZarinController $controller, int $withdrawId): bool
|
||||
{
|
||||
$withdraw = \App\Models\Withdraw::query()->find($withdrawId);
|
||||
@@ -581,7 +605,7 @@ class ZarinSyncService
|
||||
$result = $controller->wallet([
|
||||
'customer_id' => (int) $withdraw->customer_id,
|
||||
'value' => abs($cash),
|
||||
'direction' => $cash >= 0 ? 0 : 1,
|
||||
'direction' => $this->rialWalletDirectionFromWithdraw($withdraw),
|
||||
'withdraw_id' => $withdrawId,
|
||||
'note' => $withdraw->note,
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user