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

fix: send ahjo_version_series_id in update payload #2984

Merged
merged 1 commit into from
May 13, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 10 additions & 5 deletions backend/benefit/applications/services/ahjo_payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,19 @@ def prepare_update_application_payload(
) -> dict:
"""Prepare the payload that is sent to Ahjo when an application is updated, \
in this case it only contains a Records dict"""
if not pdf_summary.ahjo_version_series_id:
raise ValueError("Attachment must have an ahjo_version_series_id for update.")
return {
"records": [
_prepare_record(
_prepare_record_title(application, AhjoRecordType.APPLICATION),
AhjoRecordType.APPLICATION,
pdf_summary.created_at.isoformat("T", "seconds"),
[_prepare_record_document_dict(pdf_summary)],
application.calculation.handler,
record_title=_prepare_record_title(
application, AhjoRecordType.APPLICATION
),
record_type=AhjoRecordType.APPLICATION,
acquired=pdf_summary.created_at.isoformat("T", "seconds"),
documents=[_prepare_record_document_dict(pdf_summary)],
handler=application.calculation.handler,
ahjo_version_series_id=pdf_summary.ahjo_version_series_id,
)
]
}
Expand Down
5 changes: 4 additions & 1 deletion backend/benefit/applications/tests/test_ahjo_payload.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import uuid

from django.core.files.base import ContentFile
from django.urls import reverse

Expand Down Expand Up @@ -201,6 +203,7 @@ def test_prepare_update_application_payload(decided_application):
attachment_file=fake_file,
content_type="application/pdf",
attachment_type=AttachmentType.PDF_SUMMARY,
ahjo_version_series_id=str(uuid.uuid4()),
)

want = {
Expand All @@ -213,7 +216,7 @@ def test_prepare_update_application_payload(decided_application):
"SecurityReasons": ["JulkL (621/1999) 24.1 § 25 k"],
"Language": "fi",
"PersonalData": "Sisältää erityisiä henkilötietoja",
"MannerOfReceipt": "sähköinen asiointi",
"VersionSeriesId": str(fake_summary.ahjo_version_series_id),
"Documents": [_prepare_record_document_dict(fake_summary)],
"Agents": [
{
Expand Down