Add pm-backend deliverable: FastAPI app with provider-neutral billing + sandbox integration tests - #174
Merged
Merged
Conversation
…box integration tests
| requests.post( | ||
| f"{base}/customers/{cid}/delete", headers=headers, timeout=15 | ||
| ) | ||
| except requests.RequestException: |
| for cid in created: | ||
| try: | ||
| requests.delete(f"{base}/customers/{cid}", headers=headers, timeout=15) | ||
| except requests.RequestException: |
| for cid in created: | ||
| try: | ||
| stripe.Customer.delete(cid) | ||
| except Exception: |
| ) | ||
|
|
||
| _DEFAULT_BASE = "https://api.paddle.com" | ||
| _SANDBOX_BASE = "https://sandbox-api.paddle.com" |
|
|
||
| name: str | ||
|
|
||
| def create_customer(self, email: str, name: str = "") -> Customer: ... |
| name: str | ||
|
|
||
| def create_customer(self, email: str, name: str = "") -> Customer: ... | ||
| def get_customer(self, customer_id: str) -> Customer: ... |
| def create_invoice( | ||
| self, customer_id: str, amount: int, currency: str = "usd", | ||
| description: str = "", | ||
| ) -> Invoice: ... |
| ) -> Invoice: ... | ||
| def charge( | ||
| self, customer_id: str, amount: int, currency: str = "usd", | ||
| ) -> PaymentIntent: ... |
| def charge( | ||
| self, customer_id: str, amount: int, currency: str = "usd", | ||
| ) -> PaymentIntent: ... | ||
| def health(self) -> dict: ... |
|
|
||
|
|
||
| @pytest.fixture | ||
| def stripe_test_key(): |
fig-ai-agent Bot
added a commit
that referenced
this pull request
Sep 10, 2026
Co-authored-by: Fig Agent <agent@fig.local>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
deliverables/pm-backend/— a self-contained Program Management Backend, a single integrated FastAPI application with four equal-weight modules./api/csv/api/billing/api/tool/api/programsHighlights
BillingProviderinterface with four adapters. Swapping providers is a single env var (BILLING_PROVIDER) — no code changes elsewhere.ProviderAuthError→ 401,ProviderNotFoundError→ 404,ProviderError→ 502.stripe,requests), so an unused provider adds no hard dependency.ENCRYPT_AT_REST=true— plainStringcolumn by default, Fernet-encryptedTypeDecoratorwhen enabled.cryptographyis never imported when disabled.Tests
pytest --run-integration— they hit the real Stripe test API, Paddle sandbox, and Chargebee test site. Skipped by default; create-then-delete on teardown.Safety guards in
conftest.pyrefuse to run against production credentials — ask_live_*key, a non-sandbox Paddle host, or a Chargebee site without a-testsuffix fails fast rather than touching a real account.Pyflakes clean.
Notes
deliverables/per repo convention, with an index row added todeliverables/README.md..gitignoreexcludes runtime-generated files (pm_backend.db,tool_state.json)..github/workflows/changes in this PR.