test: add tests for PaymentMethodService #25

Open
Charon wants to merge 2 commits from feat/test-payment-method-service into dev
Member

Summary

  • Add comprehensive Pest test suite for PaymentMethodService (51 test cases)
  • Cover CRUD operations, default method selection logic, Stripe gateway mocking
  • Test validation: ownership checks, last-method guard with active subscriptions
  • Test expiry detection, gateway data updates, setup sessions, billing portal
  • Include PaymentMethod model tests: type helpers, scopes, display names, expiry

Fixes #4

Test plan

  • vendor/bin/pest --filter=PaymentMethodServiceTest passes (requires lthn/php dependency)
  • No lint issues (vendor/bin/pint --test)

🤖 Generated with Claude Code

## Summary - Add comprehensive Pest test suite for `PaymentMethodService` (51 test cases) - Cover CRUD operations, default method selection logic, Stripe gateway mocking - Test validation: ownership checks, last-method guard with active subscriptions - Test expiry detection, gateway data updates, setup sessions, billing portal - Include `PaymentMethod` model tests: type helpers, scopes, display names, expiry Fixes #4 ## Test plan - [ ] `vendor/bin/pest --filter=PaymentMethodServiceTest` passes (requires `lthn/php` dependency) - [ ] No lint issues (`vendor/bin/pint --test`) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Charon added 2 commits 2026-03-24 16:24:12 +00:00
- Add `verified` middleware to billing route group so only
  email-verified users can access billing endpoints
- Separate read-only GET routes from state-changing POST routes
- Add `throttle:6,1` rate limiting to state-changing endpoints
  (cancel, resume, upgrade/preview, upgrade) — 6 requests per minute
- Reorganise route group with clear section comments

Fixes #13

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Cover CRUD operations, default method selection logic, Stripe
gateway mocking, validation (ownership, last-method guard),
expiry detection, gateway data updates, setup sessions, billing
portal, and PaymentMethod model helpers/scopes.

Fixes #4

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feat/test-payment-method-service:feat/test-payment-method-service
git checkout feat/test-payment-method-service

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git checkout dev
git merge --no-ff feat/test-payment-method-service
git checkout feat/test-payment-method-service
git rebase dev
git checkout dev
git merge --ff-only feat/test-payment-method-service
git checkout feat/test-payment-method-service
git rebase dev
git checkout dev
git merge --no-ff feat/test-payment-method-service
git checkout dev
git merge --squash feat/test-payment-method-service
git checkout dev
git merge --ff-only feat/test-payment-method-service
git checkout dev
git merge feat/test-payment-method-service
git push origin dev
Sign in to join this conversation.
No description provided.