mirror of
https://github.com/xtr-dev/payload-billing.git
synced 2025-12-10 10:53:23 +00:00
- Replace all @/ path aliases with proper relative imports and .js extensions - Update @mollie/api-client peer dependency to support v4.x (^3.7.0 || ^4.0.0) - Bump version to 0.1.5 - Ensure ESM compatibility for plugin distribution Fixes module resolution error: "Cannot find package '@/collections'" when using the plugin in external PayloadCMS projects. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
58 lines
1.4 KiB
TypeScript
58 lines
1.4 KiB
TypeScript
import { CollectionConfig } from 'payload'
|
|
import { FieldsOverride } from './utils.js'
|
|
import { PaymentProvider } from './types/index.js'
|
|
|
|
export const defaults = {
|
|
paymentsCollection: 'payments',
|
|
invoicesCollection: 'invoices',
|
|
refundsCollection: 'refunds',
|
|
customerRelationSlug: 'customer'
|
|
}
|
|
|
|
// Provider configurations
|
|
|
|
export interface TestProviderConfig {
|
|
autoComplete?: boolean
|
|
defaultDelay?: number
|
|
enabled: boolean
|
|
failureRate?: number
|
|
simulateFailures?: boolean
|
|
}
|
|
|
|
// Customer info extractor callback type
|
|
export interface CustomerInfoExtractor {
|
|
(customer: any): {
|
|
name: string
|
|
email: string
|
|
phone?: string
|
|
company?: string
|
|
taxId?: string
|
|
billingAddress?: {
|
|
line1: string
|
|
line2?: string
|
|
city: string
|
|
state?: string
|
|
postalCode: string
|
|
country: string
|
|
}
|
|
}
|
|
}
|
|
|
|
// Plugin configuration
|
|
export interface BillingPluginConfig {
|
|
admin?: {
|
|
customComponents?: boolean
|
|
dashboard?: boolean
|
|
}
|
|
collections?: {
|
|
invoices?: string | (Partial<CollectionConfig> & {fields?: FieldsOverride})
|
|
payments?: string | (Partial<CollectionConfig> & {fields?: FieldsOverride})
|
|
refunds?: string | (Partial<CollectionConfig> & {fields?: FieldsOverride})
|
|
}
|
|
customerInfoExtractor?: CustomerInfoExtractor // Callback to extract customer info from relationship
|
|
customerRelationSlug?: string // Customer collection slug for relationship
|
|
disabled?: boolean
|
|
providers?: PaymentProvider[]
|
|
}
|
|
|