Remove outdated BillingController implementation, resolve conflicting bean definitions across modules, and retain the updated BillingController for consistency with frontend API logic.

This commit is contained in:
2026-04-12 21:51:33 +02:00
parent 9754f3e36b
commit 5eb2dd6904
28 changed files with 912 additions and 776 deletions
@@ -1,65 +0,0 @@
@file:OptIn(ExperimentalUuidApi::class)
package at.mocode.billing.service.api
import at.mocode.billing.domain.model.Buchung
import at.mocode.billing.domain.model.BuchungsTyp
import at.mocode.billing.domain.model.TeilnehmerKonto
import at.mocode.billing.service.TeilnehmerKontoService
import org.springframework.web.bind.annotation.*
import kotlin.uuid.ExperimentalUuidApi
import kotlin.uuid.Uuid
@RestController
@RequestMapping("/api/v1/billing")
class BillingController(
private val kontoService: TeilnehmerKontoService
) {
@GetMapping("/konten/{kontoId}")
fun getKonto(@PathVariable kontoId: String): TeilnehmerKonto? {
return kontoService.getKontoById(Uuid.parse(kontoId))
}
@GetMapping("/veranstaltungen/{veranstaltungId}/personen/{personId}")
fun getOrCreateKonto(
@PathVariable veranstaltungId: String,
@PathVariable personId: String,
@RequestParam(required = false) personName: String?
): TeilnehmerKonto {
return kontoService.getOrCreateKonto(
Uuid.parse(veranstaltungId),
Uuid.parse(personId),
personName ?: "Unbekannter Teilnehmer"
)
}
@GetMapping("/konten/{kontoId}/historie")
fun getHistorie(@PathVariable kontoId: String): List<Buchung> {
return kontoService.getBuchungsHistorie(Uuid.parse(kontoId))
}
@GetMapping("/veranstaltungen/{veranstaltungId}/konten")
fun getKonten(@PathVariable veranstaltungId: String): List<TeilnehmerKonto> {
return kontoService.getKontenFuerVeranstaltung(Uuid.parse(veranstaltungId))
}
@PostMapping("/konten/{kontoId}/buche")
fun buche(
@PathVariable kontoId: String,
@RequestBody request: BuchungRequest
): TeilnehmerKonto {
return kontoService.buche(
Uuid.parse(kontoId),
request.betragCent,
request.typ,
request.verwendungszweck
)
}
}
data class BuchungRequest(
val betragCent: Long,
val typ: BuchungsTyp,
val verwendungszweck: String
)