mirror of
https://github.com/xtr-dev/payload-billing.git
synced 2025-12-10 02:43:24 +00:00
- Updated InitPayment type to return Promise<Partial<Payment>> | Partial<Payment> - Modified initProviderPayment hook to handle both async and sync returns using Promise.resolve() - Enables payment providers to use either async or synchronous initPayment implementations 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
22 lines
623 B
TypeScript
22 lines
623 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>> | 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
|
|
}
|