mirror of
https://github.com/xtr-dev/payload-billing.git
synced 2025-12-11 11:23:23 +00:00
🔒 Security Fixes: - Make webhook signature validation required for production - Prevent information disclosure by returning 200 for all webhook responses - Sanitize external error messages while preserving internal logging 🔧 Code Quality Improvements: - Add URL validation to prevent localhost usage in production - Create currency utilities for proper handling of non-centesimal currencies - Replace unsafe 'any' types with type-safe ProviderData wrapper - Add comprehensive input validation for amounts, currencies, and descriptions - Set default Stripe API version for consistency 📦 New Features: - Currency conversion utilities supporting JPY, KRW, and other special cases - Type-safe provider data structure with metadata - Enhanced validation functions for payment data 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
22 lines
602 B
TypeScript
22 lines
602 B
TypeScript
import type { Payment } from '@/plugin/types/payments'
|
|
import type { Config, Payload } from 'payload'
|
|
import type { BillingPluginConfig } from '@/plugin/config'
|
|
|
|
export type InitPayment = (payload: Payload, payment: Partial<Payment>) => Promise<Partial<Payment>>
|
|
|
|
export type PaymentProvider = {
|
|
key: string
|
|
onConfig?: (config: Config, pluginConfig: BillingPluginConfig) => void
|
|
onInit?: (payload: Payload) => Promise<void> | void
|
|
initPayment: InitPayment
|
|
}
|
|
|
|
/**
|
|
* Type-safe provider data wrapper
|
|
*/
|
|
export type ProviderData<T = unknown> = {
|
|
raw: T
|
|
timestamp: string
|
|
provider: string
|
|
}
|