From 9e114462c0793caf8af9995eafd43601ae6900da Mon Sep 17 00:00:00 2001 From: rgaudin Date: Fri, 15 Nov 2024 16:29:57 +0000 Subject: [PATCH] apple-only additional verif? --- donation-api/src/donation_api/constants.py | 3 +++ donation-api/src/donation_api/entrypoint.py | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/donation-api/src/donation_api/constants.py b/donation-api/src/donation_api/constants.py index d608b563..fc96d6b2 100644 --- a/donation-api/src/donation_api/constants.py +++ b/donation-api/src/donation_api/constants.py @@ -22,6 +22,9 @@ class Constants: merchantid_domain_association: str = ( os.getenv("MERCHANTID_DOMAIN_ASSOCIATION") or "" ) + merchantid_domain_association_txt: str = ( + os.getenv("MERCHANTID_DOMAIN_ASSOCIATION_TXT") or "" + ) stripe_minimal_amount: int = int(os.getenv("STRIPE_MINIMAL_AMOUNT") or "5") stripe_maximum_amount: int = int(os.getenv("STRIPE_MAXIMUM_AMOUNT") or "999999") diff --git a/donation-api/src/donation_api/entrypoint.py b/donation-api/src/donation_api/entrypoint.py index 073eac3d..60b08cca 100644 --- a/donation-api/src/donation_api/entrypoint.py +++ b/donation-api/src/donation_api/entrypoint.py @@ -33,6 +33,15 @@ async def _(): conf.merchantid_domain_association, status_code=HTTPStatus.OK ) + if conf.merchantid_domain_association_txt: + + @app.get("/.well-known/apple-developer-merchantid-domain-association.txt") + async def _(): + """Used to validate domain ownership with apple""" + return PlainTextResponse( + conf.merchantid_domain_association_txt, status_code=HTTPStatus.OK + ) + api = FastAPI( title=__title__, description=__description__,