feat(payments): build payment method management with fallback chains - #1035
Open
retkatmun wants to merge 1 commit into
Open
feat(payments): build payment method management with fallback chains#1035retkatmun wants to merge 1 commit into
retkatmun wants to merge 1 commit into
Conversation
…martdevs17#951) - Add PaymentMethodService with full CRUD, chain validation, expiry tracking, analytics, and sharing (paymentMethodService.ts) - Add FallbackChainEngine with 6 pluggable strategies: priority, weighted, sticky, priority-burst, geo-aware, round-robin - Add PaymentMethodManager with circuit breaker (open after 3 consecutive failures), health scoring (0-100), and rate limiting - Add useWalletStore actions: addPaymentMethod, removePaymentMethod, updatePaymentMethod, verifyPaymentMethod, setPaymentMethodPriority, processPayment, processPaymentWithChain, createFallbackChain, updateFallbackChain, deleteFallbackChain, reorderFallbackChain, validateFallbackChain, expiryAlerts, deactivateExpiredMethods, paymentAnalytics, sharePaymentMethod, revokePaymentMethodShare - Add PaymentMethodManager.tsx UI component with 4 tabs: Methods, Chains, Analytics, Alerts — fully accessible (ARIA) - Add dedicated src/types/paymentMethod.ts re-export module - Remove duplicate PaymentMethodService/Error class from walletService.ts; re-export from paymentMethodService.ts - Fix walletStore.ts imports to use single source (paymentMethodService) - Add unit tests (paymentMethodService, walletStore) and integration tests (11 critical fallback-chain scenarios) - Add docs/payment-method-management.md Closes Smartdevs17#951
|
@retkatmun Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
7 tasks
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
Closes #951
Implements production-ready payment method management with ordered fallback chains for SubTrackr, as specified in issue #951.
What changed
New files
src/services/paymentMethodService.tssrc/services/PaymentMethodManager.tssrc/services/FallbackChainEngine.tssrc/types/paymentMethod.tssrc/components/payment/PaymentMethodManager.tsxsrc/services/__tests__/paymentMethodService.test.tssrc/store/__tests__/walletStore.test.tssrc/services/__tests__/paymentFallbackChain.integration.test.tsdocs/payment-method-management.mdModified files
src/services/walletService.tsPaymentMethodServiceclass; re-export frompaymentMethodService.tssrc/store/walletStore.tsFeatures
Payment method CRUD
primary→backup→fallbackmaxSpendPerInterval)Fallback chains
stopOnHardDecline— halt on expired/deactivated methodmaxAttempts— cap on methods tried per chargebuildDefaultChain— auto-generated from priority orderCircuit breaker (PaymentMethodManager)
Fallback strategies (FallbackChainEngine)
Expiry management
warning(≤30 d),critical(≤7 d),expiredinActiveChainflag when expired method still in a live chaindeactivateExpiredMethods()actionPayment method sharing
viewer/chargerroles; optionalspendLimitandexpiresAtrevokedAttimestampAnalytics
UI — PaymentMethodManager.tsx
accessibilityRole,accessibilityLabel,accessibilityStateTesting
paymentMethodService.test.ts): 40+ tests covering every public methodwalletStore.test.ts): 35+ tests covering every store actionpaymentFallbackChain.integration.test.ts): 11 suitesstopOnHardDecline— chain halts on expired methodmaxAttemptscapAcceptance criteria
docs/payment-method-management.md)