Skip to content

Commit

Permalink
Merge pull request #101 from websideproject/dev
Browse files Browse the repository at this point in the history
Add PADDLE_IP_REQUEST_HEADER settings
  • Loading branch information
bgervan authored Aug 14, 2024
2 parents 3b6a2a7 + 2dd70d0 commit b5c49ee
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at bgervan@webstormit.com. All
reported by contacting the project team at benjamin@websideproject.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Expand Down
19 changes: 10 additions & 9 deletions src/django_paddle_billing/migrations/0003_discount.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
# Generated by Django 5.0.4 on 2024-06-01 08:46

import django_paddle_billing.encoders
from django.db import migrations, models

import django_paddle_billing.encoders


class Migration(migrations.Migration):

dependencies = [
('django_paddle_billing', '0002_alter_subscription_status'),
("django_paddle_billing", "0002_alter_subscription_status"),
]

operations = [
migrations.CreateModel(
name='Discount',
name="Discount",
fields=[
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('occurred_at', models.DateTimeField(blank=True, null=True)),
('id', models.CharField(max_length=50, primary_key=True, serialize=False)),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
("occurred_at", models.DateTimeField(blank=True, null=True)),
("id", models.CharField(max_length=50, primary_key=True, serialize=False)),
(
'data',
"data",
models.JSONField(blank=True, encoder=django_paddle_billing.encoders.PrettyJSONEncoder, null=True),
),
(
'custom_data',
"custom_data",
models.JSONField(blank=True, encoder=django_paddle_billing.encoders.PrettyJSONEncoder, null=True),
),
],
Expand Down
1 change: 1 addition & 0 deletions src/django_paddle_billing/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"PADDLE_CLIENT_TOKEN": "",
"PADDLE_SECRET_KEY": "",
"PADDLE_API_URL": "https://sandbox-api.paddle.com",
"PADDLE_IP_REQUEST_HEADER": "HTTP_X_FORWARDED_FOR",
"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"],
"PADDLE_SANDBOX_IPS": [
"34.194.127.46",
Expand Down
2 changes: 1 addition & 1 deletion src/django_paddle_billing/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def post(self, request, *args, **kwargs):
- sending a django signal for each of the SUPPORTED_WEBHOOKS
"""
payload = request.body.decode("utf-8")
paddle_ip = request.META.get("HTTP_X_FORWARDED_FOR", "").split(", ")[0]
paddle_ip = request.META.get(app_settings.PADDLE_IP_REQUEST_HEADER, "").split(", ")[0]
if app_settings.PADDLE_SANDBOX and paddle_ip not in app_settings.PADDLE_SANDBOX_IPS:
return HttpResponseBadRequest("IP not allowed")
elif not app_settings.PADDLE_SANDBOX and paddle_ip not in app_settings.PADDLE_IPS:
Expand Down

0 comments on commit b5c49ee

Please sign in to comment.