fix pargar mande

This commit is contained in:
2026-07-25 12:02:58 +03:30
parent 52ff3a088d
commit 22a5e566b4
5 changed files with 251 additions and 58 deletions
@@ -11,6 +11,7 @@ use App\Models\PargarSyncLog;
use App\Services\ConfigService;
use App\Services\PargarInboundWalletService;
use App\Services\PargarSyncService;
use App\Services\WalletBalanceService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Schema;
use Morilog\Jalali\Jalalian;
@@ -322,7 +323,9 @@ class PargarInboundController extends Controller
$walletInterface = new WalletInterface($customer->id, $ownerType);
$wallet = $walletInterface->wallet;
$appGold = (float) ($wallet->gold ?? 0);
// GoldInv پرگار فقط با طلای کیف اصلی مقایسه می‌شود — محصولات جدا سهمی ندارند
$appGold = app(WalletBalanceService::class)
->effectiveMainWalletGold((int) $customer->id, $ownerType);
$appCash = (float) ($wallet->cash ?? 0);
$goldDiff = $goldInv - $appGold;
$rialDiff = $rialInv - $appCash;
@@ -333,7 +336,7 @@ class PargarInboundController extends Controller
$desc = $pendingOutbound
? 'مانده دریافت شد — منتظر ثبت سند پنل در پرگار'
: ($hasDiff
? 'اختلاف مانده پرگار با اپ — در صف همگام‌سازی خودکار'
? 'اختلاف مانده پرگار با اپ — پس از تأیید پایداری اعمال می‌شود'
: 'دریافت مانده از پرگار — بدون اختلاف');
PargarSyncLog::create([