fix: webhooks issues

This commit is contained in:
swve 2024-11-10 15:42:55 +01:00
parent a8ba053447
commit 93c0838fab
12 changed files with 323 additions and 182 deletions

View file

@ -74,6 +74,7 @@ class RedisConfig(BaseModel):
class InternalStripeConfig(BaseModel):
stripe_secret_key: str | None
stripe_publishable_key: str | None
stripe_webhook_secret: str | None
class InternalPaymentsConfig(BaseModel):
@ -274,6 +275,7 @@ def get_learnhouse_config() -> LearnHouseConfig:
# Payments config
env_stripe_secret_key = os.environ.get("LEARNHOUSE_STRIPE_SECRET_KEY")
env_stripe_publishable_key = os.environ.get("LEARNHOUSE_STRIPE_PUBLISHABLE_KEY")
env_stripe_webhook_secret = os.environ.get("LEARNHOUSE_STRIPE_WEBHOOK_SECRET")
stripe_secret_key = env_stripe_secret_key or yaml_config.get("payments_config", {}).get(
"stripe", {}
@ -283,6 +285,10 @@ def get_learnhouse_config() -> LearnHouseConfig:
"stripe", {}
).get("stripe_publishable_key")
stripe_webhook_secret = env_stripe_webhook_secret or yaml_config.get("payments_config", {}).get(
"stripe", {}
).get("stripe_webhook_secret")
# Create HostingConfig and DatabaseConfig objects
hosting_config = HostingConfig(
domain=domain,
@ -328,7 +334,8 @@ def get_learnhouse_config() -> LearnHouseConfig:
payments_config=InternalPaymentsConfig(
stripe=InternalStripeConfig(
stripe_secret_key=stripe_secret_key,
stripe_publishable_key=stripe_publishable_key
stripe_publishable_key=stripe_publishable_key,
stripe_webhook_secret=stripe_webhook_secret
)
)
)

View file

@ -41,6 +41,7 @@ payments_config:
stripe:
stripe_secret_key: ""
stripe_publishable_key: ""
stripe_webhook_secret: ""
ai_config:
chromadb_config: