Files
JiriUhlir 0e05fef335 first
2026-07-16 11:56:15 +02:00

36 lines
1.4 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Zákaznická data: bankovní účty (měny pro dobírku), adresy, číselné řady."""
from fastapi import APIRouter, Body, Depends
from ..cpl_client import cpl_request, relay_json
from ..credentials import Credentials, get_credentials
router = APIRouter(prefix="/customer", tags=["customer"])
@router.get("", summary="Informace k zákazníkovi (účty, měny pro dobírku)")
async def customer_info(creds: Credentials = Depends(get_credentials)):
"""`GET customer` — registrované bankovní účty vč. měny, země a SWIFT."""
resp = await cpl_request(creds, "GET", "/customer")
return relay_json(resp)
@router.get("/addresses", summary="Registrované adresy zákazníka")
async def customer_addresses(creds: Credentials = Depends(get_credentials)):
"""`GET customer/address` — adresy registrované u PPL (kód, adresa, default)."""
resp = await cpl_request(creds, "GET", "/customer/address")
return relay_json(resp)
@router.post("/number-range", summary="Založení číselné řady zásilek")
async def create_number_range(
body: dict = Body(
...,
examples=[{"productType": "BUSS", "quantity": 100}],
),
creds: Credentials = Depends(get_credentials),
):
"""`POST customer/numberRange` — přidělí rozsah čísel zásilek
(packNumberFrompackNumberTo) pro daný productType."""
resp = await cpl_request(creds, "POST", "/customer/numberRange", json_body=body)
return relay_json(resp)