We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9890bba commit ef4eb97Copy full SHA for ef4eb97
payment/views.py
@@ -6,13 +6,19 @@
6
from payment.logic import generate_payment_key
7
from payment.models import Payment
8
9
+from django.conf import settings
10
+
11
12
class PortoneWebhookApi(APIView):
13
def post(self, request):
- # TODO: IP Filtering
- # 52.78.100.19
14
- # 52.78.48.223
15
- # 52.78.5.241 (Webhook Test Only)
+ portone_ips = [
+ "52.78.100.19",
16
+ "52.78.48.223",
17
+ "52.78.5.241" # (Webhook Test Only)
18
+ ]
19
20
+ if settings.DEBUG is False and request.META.get("REMOTE_ADDR") not in portone_ips:
21
+ raise ValueError("Not Allowed IP")
22
23
target_payment = Payment.objects.get(payment_key=request.data["merchant_uid"])
24
0 commit comments