Skip to content

Commit

Permalink
Migrate merchants models to the new app
Browse files Browse the repository at this point in the history
  • Loading branch information
matti-lamppu committed Sep 27, 2024
1 parent f082e26 commit 2b945ef
Show file tree
Hide file tree
Showing 126 changed files with 1,877 additions and 1,299 deletions.
3 changes: 1 addition & 2 deletions common/management/commands/data_creation/create_caisa.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from datetime import date, timedelta

from merchants.models import PaymentAccounting, PaymentMerchant, PaymentProduct
from opening_hours.models import OriginHaukiResource
from reservation_units.enums import (
AuthenticationType,
Expand All @@ -24,7 +23,7 @@
from reservations.models import ReservationMetadataSet
from spaces.models import Space, Unit
from tilavarauspalvelu.enums import TermsOfUseTypeChoices
from tilavarauspalvelu.models import TermsOfUse
from tilavarauspalvelu.models import PaymentAccounting, PaymentMerchant, PaymentProduct, TermsOfUse

from .utils import SetName, with_logs

Expand Down
18 changes: 12 additions & 6 deletions common/utils.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
from __future__ import annotations

import datetime
import hashlib
import hmac
import operator
import urllib.parse
from collections.abc import Generator, Iterable, Sequence
from typing import Any, Generic, Literal, TypeVar
from typing import TYPE_CHECKING, Any, Generic, Literal, TypeVar

from django.conf import settings
from django.core.cache import cache
from django.db import models
from django.http import HttpRequest
from django.utils import translation
from django.utils.functional import Promise
from django.utils.translation import get_language_from_request
from modeltranslation.manager import get_translatable_fields_for_model

from common.date_utils import local_datetime
from common.typing import Lang
from tilavarauspalvelu.models import User

if TYPE_CHECKING:
from collections.abc import Generator, Iterable, Sequence

from django.http import HttpRequest
from django.utils.functional import Promise

from common.typing import Lang
from tilavarauspalvelu.models import User

__all__ = [
"comma_sep_str",
Expand Down
2 changes: 1 addition & 1 deletion config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
]

if settings.MOCK_VERKKOKAUPPA_API_ENABLED:
urlpatterns.append(path("mock_verkkokauppa/", include("merchants.mock_verkkokauppa_api.urls")))
urlpatterns.append(path("mock_verkkokauppa/", include("tilavarauspalvelu.api.mock_verkkokauppa_api.urls")))

if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Expand Down
3 changes: 2 additions & 1 deletion email_notification/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from reservations.models import Reservation
from spaces.models import Unit
from tilavarauspalvelu.enums import ReservationNotification
from tilavarauspalvelu.models import User
from utils.sentry import SentryLogger

###############
Expand Down Expand Up @@ -61,6 +60,8 @@ def _get_reservation_staff_notification_recipients(
Get users with unit roles and notifications enabled, collect the ones that can manage relevant units,
have matching notification setting are not the reservation creator
"""
from tilavarauspalvelu.models import User

notification_recipients: list[str] = []
reservation_units = reservation.reservation_unit.all()
units = Unit.objects.filter(reservationunit__in=reservation_units).prefetch_related("unit_groups").distinct()
Expand Down
Loading

0 comments on commit 2b945ef

Please sign in to comment.