Commit Graph

8 Commits

Author SHA1 Message Date
876501d94f Enhance webhook detection with explicit context tracking and database optimization
- Add database index on version field for optimistic locking performance
- Implement explicit webhook context tracking with symbols to avoid conflicts
- Replace fragile webhook detection logic with robust context-based approach
- Add request metadata support for enhanced debugging and audit trails
- Simplify version management in payment collection hooks
- Fix TypeScript compilation errors and improve type safety

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-17 20:07:02 +02:00
a5b6bb9bfd fix: Address type safety and error handling concerns
🔧 Type Safety Improvements:
- Add missing ProviderData import to fix compilation errors
- Create toPayloadId utility for safe ID type conversion
- Replace all 'as any' casts with typed utility function
- Improve type safety while maintaining PayloadCMS compatibility

🛡️ Error Handling Enhancements:
- Add try-catch for version check in payment hooks
- Handle missing documents gracefully with fallback to version 1
- Add detailed logging for debugging race conditions
- Prevent hook failures from blocking payment operations

 Version Logic Improvements:
- Distinguish between webhook updates and manual admin updates
- Only auto-increment version for manual updates, not webhook updates
- Check for webhook-specific fields to determine update source
- Reduce race condition risks with explicit update type detection

🔍 Code Quality:
- Centralized type casting in utility function
- Better error messages and logging context
- More explicit logic flow for version handling
- Improved maintainability and debugging capabilities

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-17 19:32:32 +02:00
d757c6942c fix: Implement true atomic optimistic locking and enhance type safety
🔒 Critical Race Condition Fixes:
- Add version field to payment schema for atomic updates
- Implement true optimistic locking using PayloadCMS updateMany with version checks
- Eliminate race condition window between conflict check and update
- Auto-increment version in beforeChange hooks

🛡️ Type Safety Improvements:
- Replace 'any' type with proper ProviderData<T> generic
- Maintain type safety throughout payment provider operations
- Enhanced intellisense and compile-time error detection

 Performance & Reliability:
- Atomic version-based locking prevents lost updates
- Proper conflict detection with detailed logging
- Graceful handling of concurrent modifications
- Version field hidden from admin UI but tracked internally

🔧 Configuration Validation:
- All critical validation moved to provider initialization
- Early failure detection prevents runtime issues
- Clear error messages for configuration problems

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-17 19:20:06 +02:00
50f1267941 security: Enhance production security and reliability
🔒 Security Enhancements:
- Add HTTPS validation for production URLs with comprehensive checks
- Implement type-safe Mollie status mapping to prevent type confusion
- Add robust request body handling with proper error boundaries

🚀 Reliability Improvements:
- Implement optimistic locking to prevent webhook race conditions
- Add providerId field indexing for efficient payment lookups
- Include webhook processing metadata for audit trails

📊 Performance Optimizations:
- Index providerId field for faster webhook payment queries
- Optimize concurrent webhook handling with version checking
- Add graceful degradation for update conflicts

🛡️ Production Readiness:
- Validate HTTPS protocol enforcement in production
- Prevent localhost URLs in production environments
- Enhanced error context and logging for debugging

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-17 18:50:30 +02:00
e3a58fe6bc feat: Add Mollie payment provider support
- Introduce `mollieProvider` for handling Mollie payments
- Add configurable payment hooks for initialization and processing
- Implement `initPayment` logic to create Mollie payments and update metadata
- Include types for Mollie integration in payments and refunds
- Update `package.json` to include `@mollie/api-client` dependency
- Refactor existing payment-related types into modular files for better maintainability
2025-09-16 22:10:47 +02:00
0308e30ebd refactor: Replace hardcoded billing data seeding with plugin-configurable collection overrides
- Remove `seedBillingData` function for sample data creation
- Update refunds, invoices, and payments collections to use pluginConfig for dynamic overrides
- Introduce utility functions like `extractSlug` for customizable collection slugs
- Streamline customer relation and data extractor logic across collections
2025-09-16 00:06:18 +02:00
f17b4c064e chore: Remove unused billing-related collections, types, and utility modules
- Drop `customers` collection and associated types (`types/index.ts`, `payload.ts`)
- Remove generated `payload-types.ts` file
- Clean up unused exports and dependencies across modules
- Streamline codebase by eliminating redundant billing logic
2025-09-15 23:14:25 +02:00
b995bdb505 Add PayloadCMS type definitions, Prettier config, and PNPM lockfile 2025-09-13 17:17:50 +02:00