Skip to content

Commit

Permalink
Remove duplicate slashes and add user-header
Browse files Browse the repository at this point in the history
Fixes #PV-617
  • Loading branch information
mhieta committed Aug 31, 2023
1 parent 8535bb0 commit 1bd5aa0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
13 changes: 10 additions & 3 deletions parking_permits/models/order.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
from urllib.parse import urljoin

import requests
from dateutil.relativedelta import relativedelta
Expand Down Expand Up @@ -39,7 +40,7 @@ def validate_order(order_id, user_id):
"Content-Type": "application/json",
}
response = requests.get(
f"{settings.TALPA_ORDER_EXPERIENCE_API}/admin/{order_id}",
urljoin(settings.TALPA_ORDER_EXPERIENCE_API, f"admin/{order_id}"),
headers=headers,
)
if response.status_code == 200:
Expand Down Expand Up @@ -369,10 +370,13 @@ def _cancel_talpa_order(self):
headers = {
"api-key": settings.TALPA_API_KEY,
"namespace": settings.NAMESPACE,
"user": str(self.customer.user.uuid),
"Content-Type": "application/json",
}
response = requests.post(
f"{settings.TALPA_ORDER_EXPERIENCE_API}/{self.talpa_order_id}/cancel",
urljoin(
settings.TALPA_ORDER_EXPERIENCE_API, f"{self.talpa_order_id}/cancel"
),
headers=headers,
)
if response.status_code == 200:
Expand Down Expand Up @@ -452,7 +456,10 @@ def _cancel_talpa_subcription(self):
"Content-Type": "application/json",
}
response = requests.post(
f"{settings.TALPA_ORDER_EXPERIENCE_API}/subcription/{self.talpa_subscription_id}/cancel",
urljoin(
settings.TALPA_ORDER_EXPERIENCE_API,
f"subcription/{self.talpa_subscription_id}/cancel",
),
headers=headers,
)
if response.status_code == 200:
Expand Down
6 changes: 5 additions & 1 deletion parking_permits/models/product.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import logging
from decimal import Decimal
from urllib.parse import urljoin

import requests
from dateutil.relativedelta import relativedelta
Expand Down Expand Up @@ -180,7 +181,10 @@ def get_merchant_id(self):
"Content-Type": "application/json",
}
response = requests.get(
f"{settings.TALPA_MERCHANT_EXPERIENCE_API}/list/merchants/{settings.NAMESPACE}/",
urljoin(
settings.TALPA_MERCHANT_EXPERIENCE_API,
f"list/merchants/{settings.NAMESPACE}/",
),
headers=headers,
)
if response.status_code == 200:
Expand Down

0 comments on commit 1bd5aa0

Please sign in to comment.