Skip to content

Commit b5c49ee

Browse files
authored
Merge pull request #101 from websideproject/dev
Add PADDLE_IP_REQUEST_HEADER settings
2 parents 3b6a2a7 + 2dd70d0 commit b5c49ee

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
5555
## Enforcement
5656

5757
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58-
reported by contacting the project team at bgervan@webstormit.com. All
58+
reported by contacting the project team at benjamin@websideproject.com. All
5959
complaints will be reviewed and investigated and will result in a response that
6060
is deemed necessary and appropriate to the circumstances. The project team is
6161
obligated to maintain confidentiality with regard to the reporter of an incident.

src/django_paddle_billing/migrations/0003_discount.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,30 @@
11
# Generated by Django 5.0.4 on 2024-06-01 08:46
22

3-
import django_paddle_billing.encoders
43
from django.db import migrations, models
54

5+
import django_paddle_billing.encoders
6+
67

78
class Migration(migrations.Migration):
89

910
dependencies = [
10-
('django_paddle_billing', '0002_alter_subscription_status'),
11+
("django_paddle_billing", "0002_alter_subscription_status"),
1112
]
1213

1314
operations = [
1415
migrations.CreateModel(
15-
name='Discount',
16+
name="Discount",
1617
fields=[
17-
('created_at', models.DateTimeField(auto_now_add=True)),
18-
('updated_at', models.DateTimeField(auto_now=True)),
19-
('occurred_at', models.DateTimeField(blank=True, null=True)),
20-
('id', models.CharField(max_length=50, primary_key=True, serialize=False)),
18+
("created_at", models.DateTimeField(auto_now_add=True)),
19+
("updated_at", models.DateTimeField(auto_now=True)),
20+
("occurred_at", models.DateTimeField(blank=True, null=True)),
21+
("id", models.CharField(max_length=50, primary_key=True, serialize=False)),
2122
(
22-
'data',
23+
"data",
2324
models.JSONField(blank=True, encoder=django_paddle_billing.encoders.PrettyJSONEncoder, null=True),
2425
),
2526
(
26-
'custom_data',
27+
"custom_data",
2728
models.JSONField(blank=True, encoder=django_paddle_billing.encoders.PrettyJSONEncoder, null=True),
2829
),
2930
],

src/django_paddle_billing/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"PADDLE_CLIENT_TOKEN": "",
77
"PADDLE_SECRET_KEY": "",
88
"PADDLE_API_URL": "https://sandbox-api.paddle.com",
9+
"PADDLE_IP_REQUEST_HEADER": "HTTP_X_FORWARDED_FOR",
910
"PADDLE_IPS": ["34.232.58.13", "34.195.105.136", "34.237.3.244", "35.155.119.135", "52.11.166.252", "34.212.5.7"],
1011
"PADDLE_SANDBOX_IPS": [
1112
"34.194.127.46",

src/django_paddle_billing/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def post(self, request, *args, **kwargs):
7777
- sending a django signal for each of the SUPPORTED_WEBHOOKS
7878
"""
7979
payload = request.body.decode("utf-8")
80-
paddle_ip = request.META.get("HTTP_X_FORWARDED_FOR", "").split(", ")[0]
80+
paddle_ip = request.META.get(app_settings.PADDLE_IP_REQUEST_HEADER, "").split(", ")[0]
8181
if app_settings.PADDLE_SANDBOX and paddle_ip not in app_settings.PADDLE_SANDBOX_IPS:
8282
return HttpResponseBadRequest("IP not allowed")
8383
elif not app_settings.PADDLE_SANDBOX and paddle_ip not in app_settings.PADDLE_IPS:

0 commit comments

Comments
 (0)