Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.3] Migrate merchants models to the new app #1343

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -46,7 +46,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