diff --git a/pycroft/lib/finance/repayment/fields.py b/pycroft/lib/finance/repayment/fields.py index 4761dcc77..eca3ed324 100644 --- a/pycroft/lib/finance/repayment/fields.py +++ b/pycroft/lib/finance/repayment/fields.py @@ -9,7 +9,9 @@ class IBANField(fields.Field): to a string. """ - def _deserialize(self, value: Any, attr: str | None, data: Mapping[str, Any], **kwargs) -> IBAN: + def _deserialize( + self, value: Any, attr: str | None, data: Mapping[str, Any], **kwargs + ) -> IBAN: try: return IBAN(value, validate_bban=True) except ValueError as error: diff --git a/pycroft/model/repayment.py b/pycroft/model/repayment.py new file mode 100644 index 000000000..59b4a3deb --- /dev/null +++ b/pycroft/model/repayment.py @@ -0,0 +1,16 @@ +from sqlalchemy import String, ForeignKey +from sqlalchemy.orm import relationship, Mapped, mapped_column + +from pycroft.model.base import IntegerIdModel + + +class RepaymentRequest(IntegerIdModel): + """A request for transferring back excess membership contributions""" + + id: Mapped[int] = mapped_column(primary_key=True) + user_id: Mapped[int] = mapped_column( + ForeignKey("user.id", ondelete="CASCADE", onupdate="CASCADE") + ) + beneficiary: Mapped[str] = mapped_column(nullable=False) + iban: Mapped[str] = mapped_column(String, nullable=False) + amount: Mapped[Decimal] = mapped_column(Decimal, nullable=False) diff --git a/web/blueprints/finance/__init__.py b/web/blueprints/finance/__init__.py index c6a52b960..860d756ce 100644 --- a/web/blueprints/finance/__init__.py +++ b/web/blueprints/finance/__init__.py @@ -1556,3 +1556,8 @@ def payment_reminder_mail() -> ResponseReturnValue: page_title="Zahlungserinnerungen per E-Mail versenden", form_args=form_args, form=form) + +@bp.route("/repayment_requests", methods=("GET", "POST")) +@access.require("finance_change") +def handle_repayment_requests() -> ResponseReturnValue: + return render_template()