fix pargar bugs 2
This commit is contained in:
@@ -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 === '') {
|
||||
|
||||
Reference in New Issue
Block a user