Skip to content

Commit

Permalink
feat: add talpa status and decision date to apps which are "in paymen…
Browse files Browse the repository at this point in the history
…t" state (#3444)
  • Loading branch information
sirtawast authored Oct 16, 2024
1 parent 6882559 commit 3fd9088
Show file tree
Hide file tree
Showing 10 changed files with 220 additions and 105 deletions.
19 changes: 15 additions & 4 deletions backend/benefit/applications/api/v1/serializers/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
ApplicationBatchStatus,
ApplicationOrigin,
ApplicationStatus,
ApplicationTalpaStatus,
AttachmentRequirement,
AttachmentType,
BenefitType,
Expand Down Expand Up @@ -1904,6 +1905,7 @@ class Meta:
"ahjo_case_id",
"batch",
"ahjo_error",
"talpa_status",
]

read_only_fields = [
Expand All @@ -1927,6 +1929,7 @@ class Meta:
"ahjo_case_id",
"batch",
"ahjo_error",
"talpa_status",
]

archived = serializers.BooleanField()
Expand Down Expand Up @@ -1971,18 +1974,26 @@ def get_latest_ahjo_error(self, obj) -> Union[Dict, None]:
),
)

batch = serializers.SerializerMethodField("get_batch_status")
batch = serializers.SerializerMethodField("get_batch_info")

def get_batch_status(self, obj):
return {"status": getattr(obj.batch, "status", None)}
def get_batch_info(self, obj):
return {
"status": getattr(obj.batch, "status", None),
"decision_date": getattr(obj.batch, "decision_date", None),
}

ahjo_case_id = serializers.CharField()
application_number = serializers.IntegerField()

status = serializers.ChoiceField(
choices=ApplicationStatus.choices,
validators=[ApplicantApplicationStatusValidator()],
help_text="Status of the application, visible to the applicant",
help_text="Status of the application",
)

talpa_status = serializers.ChoiceField(
choices=ApplicationTalpaStatus.choices,
help_text="Talpa status of the application",
)

application_origin = serializers.CharField()
Expand Down
14 changes: 12 additions & 2 deletions backend/benefit/calculator/api/v1/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,18 @@ class Meta:
class CalculationSearchSerializer(serializers.ModelSerializer):
class Meta:
model = Calculation
fields = ["start_date", "end_date", "handler_details"]
read_only_fields = ["start_date", "end_date", "handler_details"]
fields = [
"start_date",
"end_date",
"handler_details",
"calculated_benefit_amount",
]
read_only_fields = [
"start_date",
"end_date",
"handler_details",
"calculated_benefit_amount",
]

handler_details = UserSerializer(
help_text=(
Expand Down
11 changes: 9 additions & 2 deletions frontend/benefit/handler/public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@
"statusArchive": "Päätös",
"ahjoStatus": "Päätös",
"talpaStatus": "Maksun tila",
"decisionDate": "Päätöspäivä",
"benefitAmount": "Tuen määrä",
"statuses": {
"cancelled": "Peruutettu",
Expand All @@ -213,7 +214,13 @@
"rejected": "Kielteinen",
"archival": "Myönteinen"
},
"calculationEndDate": "Viim. tukipäivä"
"talpaStatuses": {
"not_sent_to_talpa": "Odottaa maksua",
"rejected_by_talpa": "Virhe maksussa",
"successfully_sent_to_talpa": "Lähetetty maksuun"
},
"calculationEndDate": "Viim. tukipäivä",
"calculatedBenefitAmount": "Tukisumma"
},
"messages": {
"empty": {
Expand Down Expand Up @@ -1144,7 +1151,7 @@
"cancelled": "Hakemus peruttiin",
"decisionMakerName": "Päättäjä",
"decisionMakerTitle": "Päättäjän titteli",
"decisionDate": "Päätöspäivämäärä",
"decisionDate": "Päätöspäivä",
"sectionOfTheLaw": "Pykälä",
"p2pTitle": "P2P-tarkastuksen tiedot",
"p2pInspector": "Tarkastaja, P2P",
Expand Down
11 changes: 9 additions & 2 deletions frontend/benefit/handler/public/locales/fi/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@
"statusArchive": "Päätös tai tila",
"ahjoStatus": "Päätös",
"talpaStatus": "Maksun tila",
"decisionDate": "Päätöspäivä",
"benefitAmount": "Tuen määrä",
"statuses": {
"cancelled": "Peruutettu",
Expand All @@ -213,7 +214,13 @@
"rejected": "Kielteinen",
"archival": "Myönteinen"
},
"calculationEndDate": "Viim. tukipäivä"
"talpaStatuses": {
"not_sent_to_talpa": "Odottaa maksua",
"rejected_by_talpa": "Virhe maksussa",
"successfully_sent_to_talpa": "Lähetetty maksuun"
},
"calculationEndDate": "Viim. tukipäivä",
"calculatedBenefitAmount": "Tukisumma"
},
"messages": {
"empty": {
Expand Down Expand Up @@ -1144,7 +1151,7 @@
"cancelled": "Hakemus peruttiin",
"decisionMakerName": "Päättäjä",
"decisionMakerTitle": "Päättäjän titteli",
"decisionDate": "Päätöspäivämäärä",
"decisionDate": "Päätöspäivä",
"sectionOfTheLaw": "Pykälä",
"p2pTitle": "P2P-tarkastuksen tiedot",
"p2pInspector": "Tarkastaja, P2P",
Expand Down
11 changes: 9 additions & 2 deletions frontend/benefit/handler/public/locales/sv/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@
"statusArchive": "Päätös",
"ahjoStatus": "Päätös",
"talpaStatus": "Maksun tila",
"decisionDate": "Päätöspäivä",
"benefitAmount": "Tuen määrä",
"statuses": {
"cancelled": "Peruutettu",
Expand All @@ -213,7 +214,13 @@
"rejected": "Kielteinen",
"archival": "Myönteinen"
},
"calculationEndDate": "Viim. tukipäivä"
"talpaStatuses": {
"not_sent_to_talpa": "Odottaa maksua",
"rejected_by_talpa": "Virhe maksussa",
"successfully_sent_to_talpa": "Lähetetty maksuun"
},
"calculationEndDate": "Viim. tukipäivä",
"calculatedBenefitAmount": "Tukisumma"
},
"messages": {
"empty": {
Expand Down Expand Up @@ -1144,7 +1151,7 @@
"cancelled": "Hakemus peruttiin",
"decisionMakerName": "Päättäjä",
"decisionMakerTitle": "Päättäjän titteli",
"decisionDate": "Päätöspäivämäärä",
"decisionDate": "Päätöspäivä",
"sectionOfTheLaw": "Pykälä",
"p2pTitle": "P2P-tarkastuksen tiedot",
"p2pInspector": "Tarkastaja, P2P",
Expand Down
Loading

0 comments on commit 3fd9088

Please sign in to comment.