fix pargar bugs 2

This commit is contained in:
2026-07-21 13:25:18 +03:30
parent d43c5e1f25
commit 49e80a1b97
17 changed files with 228 additions and 106 deletions
@@ -172,6 +172,13 @@ class PargarInboundWalletService
*/
public function applyLatestMandeDifference(Customer $customer): array
{
if ($this->hasPendingOutboundWalletSync((int) $customer->id)) {
return [
'applied' => false,
'message' => 'سند ارسالی از پنل به پرگار هنوز تأیید نشده — برای جلوگیری از برگشت شارژ، ماندهٔ پرگار اعمال نشد',
];
}
$log = PargarSyncLog::query()
->where('customer_id', $customer->id)
->where('type', PargarSyncService::TYPE_MANDE)
@@ -393,6 +400,15 @@ class PargarInboundWalletService
]);
}
private function hasPendingOutboundWalletSync(int $customerId): bool
{
return PargarSyncLog::query()
->where('customer_id', $customerId)
->whereIn('type', [PargarSyncService::TYPE_WALLET_CASH, PargarSyncService::TYPE_WALLET_GOLD])
->where('sync_status', PargarSyncService::STATUS_PENDING)
->exists();
}
private function parseNumber(mixed $value): float
{
if ($value === null || $value === '') {