"""Blueprint for Reference Tax Withholding API.""" from http import HTTPStatus import typing from common_apispec import doc, marshal_with, use_kwargs from flask import Blueprint, Response from payment.logic import reference_tax_withholding as logic from payment.schemas.reference_tax_withholding import ( ReferenceTaxWithholdingListFilterParamsSchema, ReferenceTaxWithholdingListSchema, ) from payment.utils.authorization import check_access reference_tax_withholding_api = Blueprint('reference_tax_withholding_api', __name__) @reference_tax_withholding_api.route('/reference-tax-withholding', methods=['GET']) @doc( tags=['tax withholding'], description='List endpoint for reference_tax_withholding.' ) @check_access @use_kwargs(ReferenceTaxWithholdingListFilterParamsSchema, location='query') @marshal_with( ReferenceTaxWithholdingListSchema, code=HTTPStatus.OK, description=HTTPStatus.OK.phrase, ) def get_reference_tax_withholding( country_of_withholding: typing.Optional[str] = None, country_of_tax_residence: typing.Optional[str] = None, ) -> typing.Tuple[dict, int] | Response: """Endpoint to GET reference tax withholding.""" return logic.get_reference_tax_withholding( country_of_withholding=country_of_withholding, country_of_tax_residence=country_of_tax_residence, ), HTTPStatus.OK