fix pargar bug

This commit is contained in:
2026-07-20 15:52:42 +03:30
parent 160d6bd923
commit a809a843b8
7 changed files with 586 additions and 62 deletions
@@ -25,6 +25,7 @@ use App\Models\TransactionsAdmin;
use App\Services\AssetSummaryService;
use App\Services\BalanceReportService;
use App\Services\ConfigService;
use App\Services\PargarSyncService;
use App\Services\WalletBalanceService;
use App\Services\WalletBroadcastService;
use Hekmatinasser\Verta\Verta;
@@ -83,6 +84,20 @@ class WalletController extends Controller
'active' => true
], 3, false, true, $gold_block);
try {
app(PargarSyncService::class)->queueWalletDocument(
$customer,
'cash',
(float) $data['value'],
[
'withdraw_id' => $Withdraw->id,
'source' => 'admin_charge2',
]
);
} catch (\Throwable $e) {
report($e);
}
$message = 'کیف پول شما به مبلغ ' . self::formatSmsRialAmount($data['value']) . " ریال در تاریخ " . verta()->format('Y/n/j H:i:s') . " شارژ شد " . "\n"
. $this->Config('name_fa');
$this->Send($customer->mobile, $message);
@@ -140,6 +155,21 @@ class WalletController extends Controller
}
}
try {
app(PargarSyncService::class)->queueWalletDocument(
$customer,
'cash',
(float) $data['value'],
[
'withdraw_id' => $Withdraw->id,
'note' => $data['note'] ?? null,
'source' => 'admin_cash',
]
);
} catch (\Throwable $e) {
report($e);
}
//send sms to users and customer
$status = $data['value'] > 0 ?" شارژ شد ": " کسر شد ";
if (self::isSmsNotifEnabled('charge_notif')) {
@@ -212,6 +242,23 @@ class WalletController extends Controller
report($e);
}
}
try {
app(PargarSyncService::class)->queueWalletDocument(
$customer,
'gold',
(float) $data['value'],
[
'withdraw_id' => $Withdraw->id,
'note' => $data['note'] ?? null,
'product_id' => $representative?->id,
'source' => 'admin_gold',
]
);
} catch (\Throwable $e) {
report($e);
}
//send sms to users and customer
$status = $data['value'] > 0 ?" شارژ شد ": " کسر شد ";
$weightUnit = self::tradeWeightUnit();
@@ -361,6 +408,23 @@ class WalletController extends Controller
}
}
try {
// فقط محصول متصل به کیف اصلی → سند طلای پرگار
app(PargarSyncService::class)->queueWalletDocument(
$customer,
'gold',
(float) $data['value'],
[
'withdraw_id' => $Withdraw->id,
'note' => $data['note'] ?? null,
'product_id' => $productId,
'source' => 'admin_product',
]
);
} catch (\Throwable $e) {
report($e);
}
$status = $deposit ? ' شارژ شد ' : ' کسر شد ';
$formatted = self::formatSmsGoldWeight($data['value']);