mirror of
https://github.com/xtr-dev/payload-billing.git
synced 2025-12-10 19:03:23 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
50ab001e94 | ||
| 29db6635b8 |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@xtr-dev/payload-billing",
|
||||
"version": "0.1.4",
|
||||
"version": "0.1.5",
|
||||
"description": "PayloadCMS plugin for billing and payment provider integrations with tracking and local testing",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
@@ -106,7 +106,7 @@
|
||||
"vitest": "^3.1.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@mollie/api-client": "^3.7.0",
|
||||
"@mollie/api-client": "^3.7.0 || ^4.0.0",
|
||||
"payload": "^3.37.0",
|
||||
"stripe": "^18.5.0"
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Payment } from '@/plugin/types'
|
||||
import type { Payment } from '../plugin/types/index.js'
|
||||
import type { Payload } from 'payload'
|
||||
import { useBillingPlugin } from '@/plugin'
|
||||
import { useBillingPlugin } from '../plugin/index.js'
|
||||
|
||||
export const initProviderPayment = (payload: Payload, payment: Partial<Payment>) => {
|
||||
const billing = useBillingPlugin(payload)
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export { createInvoicesCollection } from './invoices'
|
||||
export { createPaymentsCollection } from './payments'
|
||||
export { createRefundsCollection } from './refunds'
|
||||
export { createInvoicesCollection } from './invoices.js'
|
||||
export { createPaymentsCollection } from './payments.js'
|
||||
export { createRefundsCollection } from './refunds.js'
|
||||
|
||||
@@ -5,10 +5,10 @@ import {
|
||||
CollectionBeforeValidateHook,
|
||||
CollectionConfig, Field,
|
||||
} from 'payload'
|
||||
import type { BillingPluginConfig} from '@/plugin/config';
|
||||
import { defaults } from '@/plugin/config'
|
||||
import { extractSlug } from '@/plugin/utils'
|
||||
import type { Invoice } from '@/plugin/types/invoices'
|
||||
import type { BillingPluginConfig} from '../plugin/config.js';
|
||||
import { defaults } from '../plugin/config.js'
|
||||
import { extractSlug } from '../plugin/utils.js'
|
||||
import type { Invoice } from '../plugin/types/invoices.js'
|
||||
|
||||
export function createInvoicesCollection(pluginConfig: BillingPluginConfig): CollectionConfig {
|
||||
const {customerRelationSlug, customerInfoExtractor} = pluginConfig
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { AccessArgs, CollectionBeforeChangeHook, CollectionConfig, Field } from 'payload'
|
||||
import type { BillingPluginConfig} from '@/plugin/config';
|
||||
import { defaults } from '@/plugin/config'
|
||||
import { extractSlug } from '@/plugin/utils'
|
||||
import type { Payment } from '@/plugin/types/payments'
|
||||
import { initProviderPayment } from '@/collections/hooks'
|
||||
import type { BillingPluginConfig} from '../plugin/config.js';
|
||||
import { defaults } from '../plugin/config.js'
|
||||
import { extractSlug } from '../plugin/utils.js'
|
||||
import type { Payment } from '../plugin/types/payments.js'
|
||||
import { initProviderPayment } from './hooks.js'
|
||||
|
||||
export function createPaymentsCollection(pluginConfig: BillingPluginConfig): CollectionConfig {
|
||||
const overrides = typeof pluginConfig.collections?.payments === 'object' ? pluginConfig.collections?.payments : {}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { AccessArgs, CollectionConfig } from 'payload'
|
||||
import { BillingPluginConfig, defaults } from '@/plugin/config'
|
||||
import { extractSlug } from '@/plugin/utils'
|
||||
import { Payment } from '@/plugin/types'
|
||||
import { BillingPluginConfig, defaults } from '../plugin/config.js'
|
||||
import { extractSlug } from '../plugin/utils.js'
|
||||
import { Payment } from '../plugin/types/index.js'
|
||||
|
||||
export function createRefundsCollection(pluginConfig: BillingPluginConfig): CollectionConfig {
|
||||
// TODO: finish collection overrides
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
export { billingPlugin } from './plugin'
|
||||
export type { BillingPluginConfig, CustomerInfoExtractor } from './plugin/config'
|
||||
export type { Invoice, Payment, Refund } from './plugin/types'
|
||||
export { billingPlugin } from './plugin/index.js'
|
||||
export type { BillingPluginConfig, CustomerInfoExtractor } from './plugin/config.js'
|
||||
export type { Invoice, Payment, Refund } from './plugin/types/index.js'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CollectionConfig } from 'payload'
|
||||
import { FieldsOverride } from '@/plugin/utils'
|
||||
import { PaymentProvider } from '@/plugin/types'
|
||||
import { FieldsOverride } from './utils.js'
|
||||
import { PaymentProvider } from './types/index.js'
|
||||
|
||||
export const defaults = {
|
||||
paymentsCollection: 'payments',
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { createInvoicesCollection, createPaymentsCollection, createRefundsCollection } from '@/collections'
|
||||
import type { BillingPluginConfig } from '@/plugin/config'
|
||||
import { createInvoicesCollection, createPaymentsCollection, createRefundsCollection } from '../collections/index.js'
|
||||
import type { BillingPluginConfig } from './config.js'
|
||||
import type { Config, Payload } from 'payload'
|
||||
import { createSingleton } from '@/plugin/singleton'
|
||||
import type { PaymentProvider } from '@/providers'
|
||||
import { createSingleton } from './singleton.js'
|
||||
import type { PaymentProvider } from '../providers/index.js'
|
||||
|
||||
const singleton = createSingleton(Symbol('billingPlugin'))
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export * from './id'
|
||||
export * from './invoices'
|
||||
export * from './payments'
|
||||
export * from './refunds'
|
||||
export * from '../../providers/types'
|
||||
export * from './id.js'
|
||||
export * from './invoices.js'
|
||||
export * from './payments.js'
|
||||
export * from './refunds.js'
|
||||
export * from '../../providers/types.js'
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Payment } from '@/plugin/types/payments'
|
||||
|
||||
import { Id } from '@/plugin/types/id'
|
||||
import { Payment } from './payments.js'
|
||||
import { Id } from './id.js'
|
||||
|
||||
export interface Invoice<TCustomer = unknown> {
|
||||
id: Id;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Refund } from '@/plugin/types/refunds'
|
||||
import { Invoice } from '@/plugin/types/invoices'
|
||||
import { Id } from '@/plugin/types/id'
|
||||
import { Refund } from './refunds.js'
|
||||
import { Invoice } from './invoices.js'
|
||||
import { Id } from './id.js'
|
||||
|
||||
export interface Payment {
|
||||
id: Id;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Payment } from '@/plugin/types/payments'
|
||||
import { Payment } from './payments.js'
|
||||
|
||||
export interface Refund {
|
||||
id: number;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { CollectionConfig, CollectionSlug, Field } from 'payload'
|
||||
import type { Id } from '@/plugin/types'
|
||||
import type { Id } from './types/index.js'
|
||||
|
||||
export type FieldsOverride = (args: { defaultFields: Field[] }) => Field[]
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export * from './mollie'
|
||||
export * from './stripe'
|
||||
export * from './types'
|
||||
export * from './currency'
|
||||
export * from './mollie.js'
|
||||
export * from './stripe.js'
|
||||
export * from './types.js'
|
||||
export * from './currency.js'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Payment } from '@/plugin/types/payments'
|
||||
import type { PaymentProvider } from '@/plugin/types'
|
||||
import type { Payment } from '../plugin/types/payments.js'
|
||||
import type { PaymentProvider } from '../plugin/types/index.js'
|
||||
import type { Payload } from 'payload'
|
||||
import { createSingleton } from '@/plugin/singleton'
|
||||
import { createSingleton } from '../plugin/singleton.js'
|
||||
import type { createMollieClient, MollieClient } from '@mollie/api-client'
|
||||
import {
|
||||
webhookResponses,
|
||||
@@ -10,8 +10,8 @@ import {
|
||||
updateInvoiceOnPaymentSuccess,
|
||||
handleWebhookError,
|
||||
validateProductionUrl
|
||||
} from './utils'
|
||||
import { formatAmountForProvider, isValidAmount, isValidCurrencyCode } from './currency'
|
||||
} from './utils.js'
|
||||
import { formatAmountForProvider, isValidAmount, isValidCurrencyCode } from './currency.js'
|
||||
|
||||
const symbol = Symbol('mollie')
|
||||
export type MollieProviderConfig = Parameters<typeof createMollieClient>[0]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Payment } from '@/plugin/types/payments'
|
||||
import type { PaymentProvider, ProviderData } from '@/plugin/types'
|
||||
import type { Payment } from '../plugin/types/payments.js'
|
||||
import type { PaymentProvider, ProviderData } from '../plugin/types/index.js'
|
||||
import type { Payload } from 'payload'
|
||||
import { createSingleton } from '@/plugin/singleton'
|
||||
import { createSingleton } from '../plugin/singleton.js'
|
||||
import type Stripe from 'stripe'
|
||||
import {
|
||||
webhookResponses,
|
||||
@@ -10,8 +10,8 @@ import {
|
||||
updateInvoiceOnPaymentSuccess,
|
||||
handleWebhookError,
|
||||
logWebhookEvent
|
||||
} from './utils'
|
||||
import { isValidAmount, isValidCurrencyCode } from './currency'
|
||||
} from './utils.js'
|
||||
import { isValidAmount, isValidCurrencyCode } from './currency.js'
|
||||
|
||||
const symbol = Symbol('stripe')
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Payment } from '@/plugin/types/payments'
|
||||
import type { Payment } from '../plugin/types/payments.js'
|
||||
import type { Config, Payload } from 'payload'
|
||||
import type { BillingPluginConfig } from '@/plugin/config'
|
||||
import type { BillingPluginConfig } from '../plugin/config.js'
|
||||
|
||||
export type InitPayment = (payload: Payload, payment: Partial<Payment>) => Promise<Partial<Payment>>
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { Payload } from 'payload'
|
||||
import type { Payment } from '@/plugin/types/payments'
|
||||
import type { BillingPluginConfig } from '@/plugin/config'
|
||||
import type { ProviderData } from './types'
|
||||
import { defaults } from '@/plugin/config'
|
||||
import { extractSlug, toPayloadId } from '@/plugin/utils'
|
||||
import type { Payment } from '../plugin/types/payments.js'
|
||||
import type { BillingPluginConfig } from '../plugin/config.js'
|
||||
import type { ProviderData } from './types.js'
|
||||
import { defaults } from '../plugin/config.js'
|
||||
import { extractSlug, toPayloadId } from '../plugin/utils.js'
|
||||
|
||||
/**
|
||||
* Common webhook response utilities
|
||||
|
||||
Reference in New Issue
Block a user