Skip to content

feat: handle Stripe customer portal webhook events (#25)#26

Merged
fupelaqu merged 1 commit intomainfrom
feature/SP-25
May 4, 2026
Merged

feat: handle Stripe customer portal webhook events (#25)#26
fupelaqu merged 1 commit intomainfrom
feature/SP-25

Conversation

@fupelaqu
Copy link
Copy Markdown
Contributor

@fupelaqu fupelaqu commented May 4, 2026

Add webhook handlers for payment_method.attached, payment_method.detached, and customer.updated events. Fix command routing, add idempotency checks, and integration tests using Stripe CLI with fishForMessage probes.

  • DisablePaymentMethodFromWebhook routes via debitedAccount (customer ID from previous_attributes, since customer is null after detach)
  • RegisterPaymentMethodFromWebhook skips persistence if card already exists
  • UpdateCustomerFromWebhook extends PaymentAccountCommand (not PaymentMethodCommand), handler moved to PaymentBehavior
  • Add PaymentMethodNotFound error type for consistent error responses
  • Register webhook endpoint for customer.updated, payment_method.attached/detached
  • Integration tests for all 3 webhook events + recurring payment first invoice check

Add webhook handlers for payment_method.attached, payment_method.detached,
and customer.updated events. Fix command routing, add idempotency checks,
and integration tests using Stripe CLI with fishForMessage probes.

- DisablePaymentMethodFromWebhook routes via debitedAccount (customer ID
  from previous_attributes, since customer is null after detach)
- RegisterPaymentMethodFromWebhook skips persistence if card already exists
- UpdateCustomerFromWebhook extends PaymentAccountCommand (not PaymentMethodCommand),
  handler moved to PaymentBehavior
- Add PaymentMethodNotFound error type for consistent error responses
- Register webhook endpoint for customer.updated, payment_method.attached/detached
- Integration tests for all 3 webhook events + recurring payment first invoice check

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

❌ Patch coverage is 0% with 123 lines in your changes missing coverage. Please review.
✅ Project coverage is 40.76%. Comparing base (5cf45c0) to head (bed28f4).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...ersistence/typed/PaymentMethodCommandHandler.scala 0.00% 52 Missing ⚠️
...ftnetwork/payment/service/StripeEventHandler.scala 0.00% 51 Missing ⚠️
...rk/payment/persistence/typed/PaymentBehavior.scala 0.00% 17 Missing ⚠️
.../softnetwork/payment/message/PaymentMessages.scala 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #26      +/-   ##
==========================================
- Coverage   41.24%   40.76%   -0.49%     
==========================================
  Files         155      155              
  Lines       10405    10528     +123     
  Branches     1616     1589      -27     
==========================================
  Hits         4292     4292              
- Misses       6113     6236     +123     
Flag Coverage Δ
unittests 40.76% <0.00%> (-0.49%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fupelaqu fupelaqu merged commit 0a1805f into main May 4, 2026
2 of 5 checks passed
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.

1 participant