Skip to content

Commit

Permalink
Merge branch 'OK-745-kk-payment-translations-and-fixes' into MERGE__O…
Browse files Browse the repository at this point in the history
…Y-5020_finalizer_retry__OY-4826__OK-770__OK-719__OK-745
  • Loading branch information
vaeinoe committed Dec 19, 2024
2 parents 28140e2 + a1be28d commit 047dd7c
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 29 deletions.
2 changes: 2 additions & 0 deletions resources/less/virkailija-application.less
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,8 @@ i.arkistoitu {
.application-handling__review-header--eligibility-state,
.application-handling__review-header--payment-obligation {
.light;
max-width: 145px;
word-wrap: break-word;
}

.application-handling__review-header--points {
Expand Down
10 changes: 3 additions & 7 deletions spec/ataru/virkailija/virkailija_routes_spec.clj
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@
(after-all
(db/nuke-kk-payment-data))

(it "should return payment information and history for an application"
(it "should return payment information for an application"
(let [application-id (db/init-db-fixture fixtures/payment-exemption-test-form
application-fixtures/application-without-hakemusmaksu-exemption
nil)
Expand All @@ -763,14 +763,10 @@
status (:status resp)
body (:body resp)
payment-data (:kk-payment body)
state (get-in payment-data [:payment :state])
history (sort-by :modified-at (:history payment-data))]
state (get-in payment-data [:payment :state])]
(should= 200 status)
(should-not-be-nil payment-data)
(should= (:paid payment/all-states) state)
(should= 2 (count history))
(should= [(:not-required payment/all-states) (:awaiting payment/all-states)]
(map :state history)))))
(should= (:paid payment/all-states) state))))

(defn- init-and-get-kk-fixtures []
(let [person-oid "1.2.3.4.5.303"
Expand Down
2 changes: 1 addition & 1 deletion src/clj/ataru/applications/application_service.clj
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@
hakukohde-reviews (future (parse-application-hakukohde-reviews application-key))
attachment-reviews (future (parse-application-attachment-reviews application-key))
events (future (get-application-events organization-service application-key))
kk-payment-state (future (kk-application-payment/get-kk-payment-state application true))
kk-payment-state (future (kk-application-payment/get-kk-payment-state application false))
review (future (application-store/get-application-review application-key))
review-notes (future (map (partial enrich-virkailija-organizations organization-service)
(application-store/get-application-review-notes application-key)))
Expand Down
2 changes: 1 addition & 1 deletion src/clj/ataru/hakija/hakija_application_service.clj
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@
(application-store/application-exists-with-secret? secret))
application-in-processing? (util/application-in-processing? (:application-hakukohde-reviews application))
inactivated? (is-inactivated? application)
kk-payment (future (kk-application-payment/get-kk-payment-state application true))
kk-payment (future (kk-application-payment/get-kk-payment-state application false))
lang-override (when (or secret-expired? inactivated?) (application-store/get-application-language-by-secret secret))
field-deadlines (or (some->> application
:key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
payments))
; TODO: the amount of open payments may be quite large at a given moment, should we partition the API queries here?
maksut (maksut-protocol/list-lasku-statuses maksut-service (keys keys-states))]
(log/debug "Received statuses for" (count maksut) "kk payment invoices")
(log/info "Received statuses for" (count maksut) "kk payment invoices")
(let [terminal (filter #(some #{(:status %)} '(:paid :overdue)) maksut)
raw (map (fn [{:keys [reference status origin]}]
(when-let [key-match (get keys-states reference)]
Expand All @@ -30,7 +30,7 @@
:origin origin}))
terminal)
items (filter some? raw)]
(log/debug "Out of which in terminal-state are" (count terminal) "invoices")
(log/info "Out of which in terminal-state are" (count terminal) "invoices")
(log/debug (pr-str "Invoices" items))
(doseq [item items]
(let [{:keys [origin ataru-status maksut-status ataru-data]} item
Expand Down Expand Up @@ -61,9 +61,9 @@
; TODO: we should probably also handle awaiting payments without maksut information (in case something has gone wrong)
(if-let [payments (seq (store/get-awaiting-kk-application-payments))]
(do
(log/debug "Found " (count payments) " open kk application payments, checking maksut status")
(log/info "Found " (count payments) " open kk application payments, checking maksut status")
(poll-payments job-runner maksut-service payments))
(log/debug "No kk application payments in need of maksut polling found"))
(log/info "No kk application payments in need of maksut polling found"))
(catch Exception e
(log/error e "Maksut polling failed")))))

Expand Down
2 changes: 1 addition & 1 deletion src/cljc/ataru/application/review_states.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
["ok-by-proxy" (:ok-by-proxy state-translations)]
["paid" (:paid state-translations)]
["overdue" (:overdue state-translations)]
["not-checked" (:not-checked state-translations)]])
["not-checked" (:kk-payment-not-checked state-translations)]])

(def hakukohde-review-types
[[:processing-state (:processing-state state-translations) application-hakukohde-processing-states]
Expand Down
2 changes: 1 addition & 1 deletion src/cljc/ataru/schema/form_schema.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@

(s/defschema KkPaymentState
{(s/optional-key :payment) PaymentStatus
(s/optional-key :history) [PaymentStatus]})
(s/optional-key :history) (s/maybe [PaymentStatus])})

(s/defschema ApplicationWithPerson
(-> Application
Expand Down
17 changes: 10 additions & 7 deletions src/cljc/ataru/translations/texts.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -1598,7 +1598,7 @@
:guardian-contact-information {:fi "Huoltajan yhteystiedot"
:sv "Vårdnadshavarens kontaktuppgifter"
:en "Guardians contact information"}
:payment-obligation {:fi "Maksuvelvollisuus"
:payment-obligation {:fi "Lukuvuosimaksuvelvollisuus"
:sv "Betalningsskyldighet"
:en "Obligated to pay"}
:payment-obligation-set-automatically {:fi "Maksuvelvollisuus asetettu automaattisesti"
Expand Down Expand Up @@ -2463,7 +2463,7 @@
:maksupyynto-due-label {:fi "Eräpäivä"
:sv ""
:en ""}
:maksupyynto-header {:fi "Maksupyyntö"
:maksupyynto-header {:fi "Hakemusmaksupyyntö"
:sv ""
:en ""}
:maksupyynto-processing-header {:fi "Käsittelymaksu:"
Expand Down Expand Up @@ -2584,7 +2584,7 @@
:sv "valda"
:en "selected"}
:payment-not-checked {:fi "Hakijan maksuvelvollisuuden tila ei ole vielä tiedossa"
:sv "SV: Hakijan maksuvelvollisuuden tila ei ole vielä tiedossa"
:sv "Sökandens betalningsskyldighet är ännu okänd"
:en "Applicant payment liability unknown"}
:payment-not-obligated {:fi "Hakija ei ole maksuvelvollinen"
:sv "SV: Hakija ei ole maksuvelvollinen"
Expand Down Expand Up @@ -2777,14 +2777,17 @@
:kk-application-payment {:fi "Hakemusmaksu"
:sv "Ansökningsavgift"
:en "Application fee"}
:kk-payment-not-checked {:fi "Hakijan maksuvelvollisuuden tila ei ole vielä tiedossa"
:sv "Sökandens betalningsskyldighet är ännu okänd"
:en "Applicant payment liability unknown"}
:not-required {:fi "Ei vaadittu"
:sv "SV: Ei vaadittu"
:sv "Krävs ej"
:en "Not required"}
:awaiting {:fi "Odottaa maksua"
:sv "SV: Odottaa maksua"
:sv "Väntar på betalning"
:en "Awaiting payment"}
:ok-by-proxy {:fi "Maksettu toisessa haussa"
:sv "SV: Maksettu toisessa haussa"
:sv "Betald i en annan ansökan"
:en "Paid in another application round"}
:paid {:fi "Maksettu"
:sv "Betalt"
Expand Down Expand Up @@ -2910,7 +2913,7 @@
:en "EN: Hakukelpoisuus"}
:maksuvelvollisuus {:fi "Maksuvelvollisuus"
:sv "Betalningsskyldighet"
:en "EN: Maksuvelvollisuus"}
:en "Obligated to pay"}
:valinnan-tila {:fi "Valinnan tila"
:sv "Antagningens status"
:en "EN: Valinnan tila"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
(re-frame/reg-event-fx
:payment/handle-fetch-payments
(fn [{db :db} [_ body {:keys [application-key]}]]
(let [oid-suffix-matcher #(first (filter (fn [x] (ends-with? (:order_id x) %)) body))
payments {:processing (oid-suffix-matcher "-1")
(let [oid-suffix-matcher #(first (filter (fn [x] (ends-with? (:order_id x) %)) body))
payments {:processing (or (oid-suffix-matcher "-1")
(first (filter #(= (:origin %) "kkhakemusmaksu") body)))
:decision (or (oid-suffix-matcher "-2")
(first (filter #(= (:origin %) "astu") body)))}]

Expand Down Expand Up @@ -138,7 +139,6 @@
(re-frame/reg-fx
:payment/fetch-payments
(fn [{:keys [application-key]}]
(prn "Ladataan hakemukseen liittyviä maksuja")
(ajax/http :get
(str "/lomake-editori/api/maksut/list/" application-key)
:payment/handle-fetch-payments
Expand Down
10 changes: 6 additions & 4 deletions src/cljs/ataru/virkailija/application/payment/payment_view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@
([header payment status]
(let [icon (case (keyword status)
:active icons/tutu-payment-outstanding
:paid icons/tutu-payment-paid
:overdue icons/tutu-payment-overdue
nil)
:paid icons/tutu-payment-paid
:overdue icons/tutu-payment-overdue
nil)
label (if (or (empty? payment) (nil? status))
@(subscribe [:editor/virkailija-translation :maksupyynto-invoice-notfound])
(case (keyword status)
Expand Down Expand Up @@ -312,7 +312,9 @@
nil)
due-label (when (= :awaiting kk-payment-state)
@(subscribe [:editor/virkailija-translation :maksupyynto-due-label]))
due-value (format/unparse fi-formatter (:due-date kk-payment))]
due-value (if (:due-date kk-payment)
(format/unparse fi-formatter (:due-date kk-payment))
"")]
[:<>
[single-payment-status-row @(subscribe [:editor/virkailija-translation :maksupyynto-processing-header])
(:processing payments) state-for-status-row]
Expand Down

0 comments on commit 047dd7c

Please sign in to comment.