Skip to content

fix(stripe): upgrade SDK to 2.0.0, add ConnectedAccountHandler, full test suite for all 36 actions#273

Merged
NinosMan merged 18 commits into
masterfrom
fix/stripe-connected-account-handler
May 12, 2026
Merged

fix(stripe): upgrade SDK to 2.0.0, add ConnectedAccountHandler, full test suite for all 36 actions#273
NinosMan merged 18 commits into
masterfrom
fix/stripe-connected-account-handler

Conversation

@Shubhank-Jonnada
Copy link
Copy Markdown
Contributor

@Shubhank-Jonnada Shubhank-Jonnada commented Apr 27, 2026

Summary

Fixes a missing ConnectedAccountHandler error, upgrades the Stripe integration to SDK 2.0.0, and adds a complete test suite with end-to-end coverage for all 36 actions.

Changes

Core fixes

  • Added ConnectedAccountHandler to resolve the missing handler error
  • Bumped SDK from 1.0.2 to ~=2.0.0
  • Switched all error returns from ActionResult(data={..., result: False}) to ActionError(message=...)
  • Fixed response.get() calls to response.data.get() throughout (20 occurrences)
  • Fixed unit_amount_decimal field mapping for invoice items (Stripe preview API requires string)
  • Fixed create_price config schema: removed unit_amount from required since unit_amount_decimal is also accepted
  • Resolved all validator warnings (optional fields, unused list params)
  • Bumped integration version to 3.0.0

Tests

  • Replaced old script-style test_stripe.py and context.py with proper pytest
  • tests/conftest.py provides stripe_context fixture (real aiohttp) and mock_context for units
  • tests/test_stripe_unit.py covers all 36 actions including ConnectedAccountHandler (48 unit tests)
  • tests/test_stripe_integration.py covers all 36 actions via end-to-end lifecycle tests (13 live tests)

Validation

  • validate_integration.py — 0 errors, 0 warnings
  • check_code.py — 0 errors, 0 warnings

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 27, 2026

🔍 Integration Validation Results

Commit: d9f45cb626f990a1cf04f8249bf4452ed4f5a70d · fix(stripe): remove ruff.toml, tooling handles formatting config
Updated: 2026-05-12T02:00:16Z

Changed directories: stripe

Check Result
Structure ✅ Passed
Code ✅ Passed
Tests ✅ Passed
README ✅ Passed
Version ✅ Passed
✅ Structure Check output
Validating 1 integration(s)...

============================================================
Integration: stripe
============================================================
✅ All checks passed!

============================================================
SUMMARY
============================================================
Integrations validated: 1
Total errors: 0
Total warnings: 0

✅ All validations passed!
✅ Code Check output

[notice] A new release of pip is available: 26.0.1 -> 26.1.1
[notice] To update, run: pip install --upgrade pip
----------------------------------------
Checking: stripe
----------------------------------------

📦 Installing dependencies...

🐍 Checking Python syntax...
   ✅ Syntax OK

📥 Checking imports...
   ✅ Imports OK

📄 Checking JSON files...
   ✅ JSON files OK

🔍 Linting with ruff...
   ✅ Lint OK

🎨 Checking formatting with ruff...
   ✅ Formatting OK

🔒 Scanning for security issues with bandit...
   ✅ Security OK

🛡️ Checking dependencies for vulnerabilities with pip-audit...
   ✅ Dependencies OK

🔗 Checking config-code sync...
   ✅ Config-code sync OK

🔄 Checking fetch patterns...
   ✅ Fetch patterns OK

========================================
✅ CODE CHECK PASSED
========================================
✅ Tests Check output

Integration   Tests  Coverage        Status
-------------------------------------------
stripe     49/49       57%      ✅ Passed
-------------------------------------------
Total      49/49            ✅ All passed

✅ Tests passed: stripe
✅ README Check output
========================================
✅ README CHECK PASSED
========================================
✅ Version Check output
✅ stripe: 2.0.0 → 3.0.0 (major bump)

========================================
✅ VERSION CHECK PASSED
========================================

@TheRealAgentK
Copy link
Copy Markdown
Collaborator

Would it hurt or be a huge issue to add useful tests to this PR, @Shubhank-Jonnada ?

Comment thread stripe/stripe.py
@Shubhank-Jonnada Shubhank-Jonnada changed the title fix(stripe): add ConnectedAccountHandler to resolve missing handler error fix(stripe): upgrade SDK to 2.0.0, add ConnectedAccountHandler, full test suite May 12, 2026
@Shubhank-Jonnada Shubhank-Jonnada changed the title fix(stripe): upgrade SDK to 2.0.0, add ConnectedAccountHandler, full test suite fix(stripe): upgrade SDK to 2.0.0, add ConnectedAccountHandler, full test suite for all 36 actions May 12, 2026
…chema

- Expanded integration tests from 10 to 13 covering all 36 actions
- Added TestDeleteInvoice, TestInvoiceItemStandaloneLifecycle, TestPaymentMethodLifecycle
- TestPaymentMethodLifecycle covers attach, list, get, pay_invoice, detach end-to-end
- TestProductAndPriceLifecycle now covers update_product and update_price
- TestInvoiceLifecycle now covers send_invoice and update_invoice_item
- Removed unit_amount from create_price required fields since unit_amount_decimal is also valid
@Shubhank-Jonnada
Copy link
Copy Markdown
Contributor Author

Shubhank-Jonnada commented May 12, 2026

Would it hurt or be a huge issue to add useful tests to this PR, @Shubhank-Jonnada ?

Done

- Remove unused build_list_params helper
- Fix business_profile null crash in ConnectedAccountHandler (use or {} guard)
- Add comment explaining preview API version requirement for unit_amount_decimal
- Add inline comments explaining unit_amount -> unit_amount_decimal coercion
- Add _fetch() wrapper that surfaces Stripe error messages on 4xx/5xx responses
- Add unit test for business_profile: null case
Copy link
Copy Markdown
Collaborator

@TheRealAgentK TheRealAgentK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@NinosMan NinosMan merged commit 05547e4 into master May 12, 2026
3 checks passed
@NinosMan NinosMan deleted the fix/stripe-connected-account-handler branch May 12, 2026 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants