Skip to content

Commit

Permalink
Initial Nekku code changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tahtee committed Feb 7, 2025
1 parent c44c724 commit 76ba308
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,30 @@ export default React.memo(function GroupUpdateModal({ group }: Props) {
/>
</>
)}
{featureFlags.nekkuIntegration && (
<>
<Gap size="s" />
<div className="bold">
{i18n.unit.groups.updateModal.jamixTitle}
</div>
<InputField
value={data.jamixCustomerNumber?.toString() ?? ''}
onChange={(value) => {
if (/^\d*$/.exec(value)) {
const parsedNumber = parseInt(value)
setData((state) => ({
...state,
jamixCustomerNumber: isNaN(parsedNumber)
? null
: parsedNumber
}))
}
}}
data-qa="jamix-customer-id-input"
placeholder={i18n.unit.groups.updateModal.nekkuPlaceholder}
/>
</>
)}
</section>
<InfoBox message={i18n.unit.groups.updateModal.info} thin />
</FixedSpaceColumn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2491,6 +2491,7 @@ export const fi = {
endDate: 'Viimeinen toimintapäivä',
info: 'Ryhmän aikaisempia tietoja ei säilytetä',
jamixPlaceholder: 'Jamix customerNumber',
nekkuPlaceholder: 'Nekku asiakasnumero',
jamixTitle: 'Ruokatilausten asiakasnumero'
},
startDate: 'Perustettu',
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/lib-customizations/espoo/featureFlags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ const features: Features = {
intermittentShiftCare: false,
noAbsenceType: false,
discussionReservations: true,
jamixIntegration: true,
jamixIntegration: false,
nekkuIntegration: true,
forceUnpublishDocumentTemplate: true,
invoiceDisplayAccountNumber: true,
serviceApplications: true,
Expand Down Expand Up @@ -77,7 +78,8 @@ const features: Features = {
intermittentShiftCare: false,
noAbsenceType: false,
discussionReservations: true,
jamixIntegration: true,
jamixIntegration: false,
nekkuIntegration: true,
forceUnpublishDocumentTemplate: true,
invoiceDisplayAccountNumber: true,
serviceApplications: true,
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/lib-customizations/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,11 @@ interface BaseFeatureFlags {
*/
aromiIntegration?: boolean

/**
* Display Nekku food ordering service related functions
*/
nekkuIntegration?: boolean

/**
* Allow admin to force unpublish document templates.
* Do not set in production.
Expand Down
14 changes: 14 additions & 0 deletions service/src/main/kotlin/fi/espoo/evaka/EvakaEnv.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ data class EvakaEnv(
val vtjEnabled: Boolean,
val webPushEnabled: Boolean,
val jamixEnabled: Boolean,
val nekkuEnabled: Boolean,
val forceUnpublishDocumentTemplateEnabled: Boolean,
val asyncJobRunnerDisabled: Boolean,
val frontendBaseUrlFi: String,
Expand All @@ -51,6 +52,7 @@ data class EvakaEnv(
vtjEnabled = env.lookup("evaka.integration.vtj.enabled") ?: false,
webPushEnabled = env.lookup("evaka.web_push.enabled") ?: false,
jamixEnabled = env.lookup("evaka.integration.jamix.enabled") ?: false,
nekkuEnabled = env.lookup("evaka.integration.nekku.enabled") ?: false,
forceUnpublishDocumentTemplateEnabled =
env.lookup("evaka.not_for_prod.force_unpublish_document_template_enabled")
?: false,
Expand Down Expand Up @@ -627,6 +629,18 @@ data class JamixEnv(val url: URI, val user: String, val password: Sensitive<Stri
}
}

data class NekkuEnv(val url: URI, val apikey: Sensitive<String>) {
companion object {
fun fromEnvironment(env: Environment): NekkuEnv {
return NekkuEnv(
// URL up to the operation name/
url = URI.create(env.lookup("evaka.integration.nekku.url")),
apikey = Sensitive(env.lookup("evaka.integration.nekku.apikey")),
)
}
}
}

data class Sensitive<T>(@JsonValue val value: T) {
override fun toString(): String = "**REDACTED**"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import fi.espoo.evaka.EvakaEnv
import fi.espoo.evaka.JamixEnv
import fi.espoo.evaka.JwtEnv
import fi.espoo.evaka.KoskiEnv
import fi.espoo.evaka.NekkuEnv
import fi.espoo.evaka.OphEnv
import fi.espoo.evaka.ScheduledJobsEnv
import fi.espoo.evaka.SfiEnv
Expand Down Expand Up @@ -92,4 +93,10 @@ class EnvConfig {
true -> JamixEnv.fromEnvironment(env)
false -> null
}

fun nekkuEnv(evakaEnv: EvakaEnv, env: Environment): NekkuEnv? =
when (evakaEnv.nekkuEnabled) {
true -> NekkuEnv.fromEnvironment(env)
false -> null
}
}

0 comments on commit 76ba308

Please sign in to comment.