feat(payment): add test mode check for payment callback IP validation

This commit is contained in:
hamed
2026-06-15 13:17:28 +03:30
parent 5fd45b429e
commit 68dfe613a2
3 changed files with 212 additions and 120 deletions
+3 -2
View File
@@ -237,8 +237,9 @@ class PaymentController extends BaseController
#[Route('/api/v1/payment/callback/{gateway}', methods: ['POST', 'GET'])]
public function callback(string $gateway, Request $request): \Symfony\Component\HttpFoundation\Response
{
$clientIp = $request->getClientIp() ?? '';
if (!$this->isAllowedCallbackIp($clientIp)) {
$clientIp = $request->getClientIp() ?? '';
$isTestMode = $this->configRepo->get('payment_test_mode') === '1';
if (!$isTestMode && !$this->isAllowedCallbackIp($clientIp)) {
return new JsonResponse(['success' => false, 'message' => 'دسترسی ممنوع'], 403);
}