Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
mhieta committed Feb 2, 2024
2 parents 3944322 + 57745e3 commit 7473011
Show file tree
Hide file tree
Showing 27 changed files with 737 additions and 54 deletions.
39 changes: 31 additions & 8 deletions locale/fi/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-12-02 15:09+0200\n"
"POT-Creation-Date: 2024-01-31 23:25+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -60,14 +60,14 @@ msgstr "Pysäköintialuetta ei löytynyt tälle sijainnille"
msgid "Multiple parking zones found for the location"
msgstr "Useita pysäköintialueita löytyi tälle sijainnille"

msgid "Person not found"
msgstr "Henkilöä ei löytynyt"
msgid "Customer not found"
msgstr "Asiakasta ei löytynyt"

msgid "Customer search error"
msgstr "Asiakkaan hakuvirhe"

msgid "Owner/holder data of a vehicle could not be verified. Please check with Traficom for data transfer restrictions."
msgstr "Omistajuutta/haltijuutta ei pystytty todentamaan. Tarkistathan Traficomilta tiedonluovutuskiellot."
msgid "Owner/holder data of a vehicle could not be verified"
msgstr "Omistajuutta/haltijuutta ei pystytty todentamaan"

msgid "Customer does not have a valid driving licence for this vehicle"
msgstr "Puutteelliset ajokorttitiedot tälle ajoneuvolle"
Expand Down Expand Up @@ -182,6 +182,13 @@ msgstr ""
msgid "Permit for a given vehicle already exist."
msgstr "Kyseisellä ajoneuvolla on jo pysäköintitunnus."

msgid ""
"Owner/holder data of a vehicle could not be verified. Please check with "
"Traficom for data transfer restrictions."
msgstr ""
"Omistajuutta/haltijuutta ei pystytty todentamaan. Tarkistathan Traficomilta "
"tiedonluovutuskiellot."

msgid "Customer does not have a valid driving licence"
msgstr "Puutteelliset ajokorttitiedot"

Expand Down Expand Up @@ -318,9 +325,6 @@ msgstr "Helsingin kaupunki"
msgid "Personal data - Digital and population data services agency"
msgstr "Henkilötiedot - Digi- ja väestötietovirasto"

msgid "Source: Transport register, Traficom"
msgstr "Lähde: Liikenneasioidenrekisteri, Traficom"

msgid "Permit ID"
msgstr "Tunniste"

Expand Down Expand Up @@ -772,15 +776,24 @@ msgstr "Väliaikaiset ajoneuvot"
msgid "M1"
msgstr "M1"

msgid "M1G"
msgstr "M1G"

msgid "M2"
msgstr "M2"

msgid "N1"
msgstr "N1"

msgid "N1G"
msgstr "N1G"

msgid "N2"
msgstr "N2"

msgid "N2G"
msgstr "N2G"

msgid "L3e-A1"
msgstr "L3e-A1"

Expand Down Expand Up @@ -910,6 +923,9 @@ msgstr "Asiakkaalla ei ole aktiivisia tunnuksia"
msgid "Conflict parking zones for active permits"
msgstr "Pysäköintialueiden ja aktiivisten tunnusten konfliktitilanne"

msgid "Person not found"
msgstr "Henkilöä ei löytynyt"

msgid "New parking permit has been created for you"
msgstr "Sinulle on luotu pysäköintitunnus"

Expand Down Expand Up @@ -954,6 +970,10 @@ msgstr ""
msgid "Vehicle %(registration_number)s is decommissioned"
msgstr "Ajoneuvo %(registration_number)s on liikennekäytöstäpoistettu"

#, python-format
msgid "Vehicle's %(registration_number)s weight exceeds maximum allowed limit"
msgstr "Ajoneuvon %(registration_number)s paino ylittää sallitun maksimirajan"

msgid "The person has no driving licence"
msgstr "Henkilölle ei löydy ajokorttia"

Expand Down Expand Up @@ -986,6 +1006,9 @@ msgstr ""
"* Tunnus on voimassa valitsemastasi alkamispäivästä lähtien, kun "
"maksusuoritus on hyväksytty"

msgid "Source: Transport register, Traficom"
msgstr "Lähde: Liikenneasioidenrekisteri, Traficom"

msgid "Parking permit expiration date"
msgstr "Pysäköintitunnuksen päättymispäivä"

Expand Down
37 changes: 30 additions & 7 deletions locale/sv/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-12-02 15:09+0200\n"
"POT-Creation-Date: 2024-01-31 23:25+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -60,14 +60,14 @@ msgstr "Det finns inte parkering zon för det plats"
msgid "Multiple parking zones found for the location"
msgstr "Flera parkerings zon till denna plats"

msgid "Person not found"
msgid "Customer not found"
msgstr "Ingen kund hittas"

msgid "Customer search error"
msgstr "Kundsökningsfel"

msgid "Owner/holder data of a vehicle could not be verified. Please check with Traficom for data transfer restrictions."
msgstr "Ägar/innehavaruppgifter av fordon kunde inte verifieras. Kontrollera med Traficom för dataöverföringsförbud."
msgid "Owner/holder data of a vehicle could not be verified"
msgstr "Ägar/innehavaruppgifter av fordon kunde inte verifieras"

msgid "Customer does not have a valid driving licence for this vehicle"
msgstr "Kunden har inte ett giltigt körkort för detta fordon"
Expand Down Expand Up @@ -178,6 +178,13 @@ msgstr ""
msgid "Permit for a given vehicle already exist."
msgstr "Tillstånd för ett givet fordon finns redan."

msgid ""
"Owner/holder data of a vehicle could not be verified. Please check with "
"Traficom for data transfer restrictions."
msgstr ""
"Ägar/innehavaruppgifter av fordon kunde inte verifieras. Kontrollera med "
"Traficom för dataöverföringsförbud."

msgid "Customer does not have a valid driving licence"
msgstr "Kunden har inte giltigt körkort"

Expand Down Expand Up @@ -313,9 +320,6 @@ msgstr "Helsingfors stad"
msgid "Personal data - Digital and population data services agency"
msgstr "Personuppgifter - Digital- och befolkningsdatatjänstbyrå"

msgid "Source: Transport register, Traficom"
msgstr "Källä: Trafik- och transportregistret, Traficom"

msgid "Permit ID"
msgstr "Permit ID"

Expand Down Expand Up @@ -769,15 +773,24 @@ msgstr "Tillfälliga fordon"
msgid "M1"
msgstr "M1"

msgid "M1G"
msgstr "M1G"

msgid "M2"
msgstr "M2"

msgid "N1"
msgstr "N1"

msgid "N1G"
msgstr "N1G"

msgid "N2"
msgstr "N2"

msgid "N2G"
msgstr "N2G"

msgid "L3e-A1"
msgstr "L3e-A1"

Expand Down Expand Up @@ -907,6 +920,9 @@ msgstr "Inga aktiva tillstånd för kunden"
msgid "Conflict parking zones for active permits"
msgstr "Konflict för parkering zoner och aktiva tillståndet"

msgid "Person not found"
msgstr "Ingen kund hittas"

msgid "New parking permit has been created for you"
msgstr "Nytt parkeringstillstånd har skapats åt dig"

Expand Down Expand Up @@ -952,6 +968,10 @@ msgstr ""
msgid "Vehicle %(registration_number)s is decommissioned"
msgstr "Fordonet %(registration_number)s är avställd"

#, python-format
msgid "Vehicle's %(registration_number)s weight exceeds maximum allowed limit"
msgstr "Fordonets %(registration_number)s vikt överstiger den högsta tillåtna gränsen"

msgid "The person has no driving licence"
msgstr "Personen har inget körkort"

Expand Down Expand Up @@ -984,6 +1004,9 @@ msgstr ""
"* Parkeringpermit är i kraft från den valda startdatum, när betalningen är "
"godkännt"

msgid "Source: Transport register, Traficom"
msgstr "Källä: Trafik- och transportregistret, Traficom"

msgid "Parking permit expiration date"
msgstr "Tillståndet upphör att gälla"

Expand Down
4 changes: 4 additions & 0 deletions parking_permits/admin_resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ def resolve_create_resident_permit(obj, info, permit, audit_msg: AuditMsg = None
address_apartment=permit.get("address_apartment"),
address_apartment_sv=permit.get("address_apartment"),
primary_vehicle=primary_vehicle,
bypass_traficom_validation=permit.get("bypass_traficom_validation", False),
)

audit_msg.target = parking_permit
Expand Down Expand Up @@ -814,10 +815,13 @@ def resolve_update_resident_permit(
)
send_refund_email(RefundEmailType.CREATED, customer, refund)

bypass_traficom_validation = permit_info.get("bypass_traficom_validation", False)

# Update permit address and zone for all active permits
for permit in active_permits:
permit.parking_zone = new_zone
permit.address = permit_address if not security_ban else None
permit.bypass_traficom_validation = bypass_traficom_validation
permit.save()

# get updated permit info
Expand Down
1 change: 1 addition & 0 deletions parking_permits/cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def automatic_expiration_of_permits():
active_permit = active_permits.first()
active_permit.primary_vehicle = True
active_permit.save()
logger.info(f"Permit {permit.pk} ended")

logger.info("Automatically ending permits completed.")

Expand Down
8 changes: 6 additions & 2 deletions parking_permits/customer_permit.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,13 @@ def get(self):
)
vehicle = permit.vehicle
# Update vehicle detail from traficom if it wasn't updated today
if permit.vehicle.updated_from_traficom_on < tz.localdate(tz.now()):
if (
not permit.vehicle.updated_from_traficom_on
or permit.vehicle.updated_from_traficom_on < tz.localdate(tz.now())
):
vehicle = self.customer.fetch_vehicle_detail(
vehicle.registration_number
vehicle.registration_number,
permit=permit,
)

user_of_vehicle = self.customer.is_user_of_vehicle(vehicle)
Expand Down
19 changes: 19 additions & 0 deletions parking_permits/migrations/0046_add_bypass_traficom_validation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 4.2.1 on 2024-01-26 08:34

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("parking_permits", "0045_alter_product_low_emission_discount"),
]

operations = [
migrations.AddField(
model_name="parkingpermit",
name="bypass_traficom_validation",
field=models.BooleanField(
default=False, verbose_name="Bypass Traficom validation"
),
),
]
46 changes: 46 additions & 0 deletions parking_permits/migrations/0046_alter_vehicle_vehicle_class.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Generated by Django 4.2.1 on 2024-02-01 09:18

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("parking_permits", "0045_alter_product_low_emission_discount"),
]

operations = [
migrations.AlterField(
model_name="vehicle",
name="vehicle_class",
field=models.CharField(
blank=True,
choices=[
("M1", "M1"),
("M1G", "M1G"),
("M2", "M2"),
("N1", "N1"),
("N1G", "N1G"),
("N2", "N2"),
("N2G", "N2G"),
("L3e-A1", "L3e-A1"),
("L3e-A2", "L3e-A2"),
("L3e-A3", "L3e-A3"),
("L3e-A1E", "L3e-A1E"),
("L3e-A2E", "L3e-A2E"),
("L3e-A3E", "L3e-A3E"),
("L3e-A1T", "L3e-A1T"),
("L3e-A2T", "L3e-A2T"),
("L3e-A3T", "L3e-A3T"),
("L4e", "L4e"),
("L5e-A", "L5e-A"),
("L5e-B", "L5e-B"),
("L6e-A", "L6e-A"),
("L6e-B", "L6e-B"),
("L6e-BP", "L6e-BP"),
("L6e-BU", "L6e-BU"),
],
max_length=16,
verbose_name="VehicleClass",
),
),
]
19 changes: 19 additions & 0 deletions parking_permits/migrations/0047_set_updated_from_traficom_null.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 4.2.1 on 2024-01-29 11:45

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("parking_permits", "0046_add_bypass_traficom_validation"),
]

operations = [
migrations.AlterField(
model_name="vehicle",
name="updated_from_traficom_on",
field=models.DateField(
blank=True, null=True, verbose_name="Update from traficom on"
),
),
]
12 changes: 12 additions & 0 deletions parking_permits/migrations/0048_merge_20240202_0838.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Generated by Django 4.2.1 on 2024-02-02 06:38

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("parking_permits", "0046_alter_vehicle_vehicle_class"),
("parking_permits", "0047_set_updated_from_traficom_null"),
]

operations = []
9 changes: 5 additions & 4 deletions parking_permits/models/customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,19 @@ def age(self):
)
return relativedelta(datetime.today(), date_of_birth).years

def fetch_vehicle_detail(self, registration_number):
return Traficom().fetch_vehicle_details(registration_number)
def fetch_vehicle_detail(self, registration_number, permit=None):
return Traficom().fetch_vehicle_details(registration_number, permit=permit)

def is_user_of_vehicle(self, vehicle):
if not settings.TRAFICOM_CHECK:
return True
users_nin = [user.national_id_number for user in vehicle.users.all()]
return self.national_id_number in users_nin

def fetch_driving_licence_detail(self):
def fetch_driving_licence_detail(self, permit=None):
licence_details = Traficom().fetch_driving_licence_details(
self.national_id_number
self.national_id_number,
permit=permit,
)
driving_licence = DrivingLicence.objects.update_or_create(
customer=self,
Expand Down
Loading

0 comments on commit 7473011

Please sign in to comment.