Vereinfacht API: filter-based contact lookup, no extra required fields, country sync, and docs #459

Merged
moritz merged 5 commits from feat/vereinfacht_api into main 2026-03-04 21:15:07 +01:00
3 changed files with 5 additions and 3 deletions
Showing only changes of commit 9f169b9835 - Show all commits

View file

@ -25,7 +25,7 @@ When creating an external finance contact, the API only requires:
- **Attributes:** `contactType` (e.g. `"person"`), `isExternal: true`
- **Relationship:** `club` (club ID from config)
Additional attributes (firstName, lastName, email, address, zipCode, city) are optional and are sent when present on the member so the contact is filled in. The app does **not** enforce extra required member fields for Vereinfacht; only Settings-based required fields and email apply.
Additional attributes (firstName, lastName, email, address, zipCode, city, country) are optional and are sent when present on the member so the contact is filled in. The app does **not** enforce extra required member fields for Vereinfacht; only Settings-based required fields and email apply.
- **Client:** `Mv.Vereinfacht.Client.create_contact/1` builds the JSON:API body from the member; `Mv.Constants.vereinfacht_required_member_fields/0` is an empty list.

View file

@ -9,7 +9,7 @@ defmodule Mv.Vereinfacht.Changes.SyncContact do
(Mv.Config.vereinfacht_configured?/0).
Only runs when relevant data changed: on create always; on update only when
first_name, last_name, email, street, house_number, postal_code, or city changed,
first_name, last_name, email, street, house_number, postal_code, city, or country changed,
or when the member has no vereinfacht_contact_id yet (to avoid unnecessary API calls).
"""
use Ash.Resource.Change
@ -26,7 +26,8 @@ defmodule Mv.Vereinfacht.Changes.SyncContact do
:street,
:house_number,
:postal_code,
:city
:city,
:country
]
@impl true

View file

@ -345,6 +345,7 @@ defmodule Mv.Vereinfacht.Client do
|> put_attr("address", address)
|> put_attr("zipCode", member |> Map.get(:postal_code))
|> put_attr("city", member |> Map.get(:city))
|> put_attr("country", member |> Map.get(:country))
|> Map.put("contactType", "person")
|> Map.put("isExternal", true)
|> Enum.reject(fn {_k, v} -> is_nil(v) end)