mirror of
https://github.com/xtr-dev/payload-billing.git
synced 2025-12-09 18:33:24 +00:00
Merge pull request #23 from xtr-dev/claude/issue-22-20250919-1107
Claude/issue 22 20250919 1107
This commit is contained in:
@@ -11,6 +11,7 @@ export type {
|
||||
StripeProviderConfig,
|
||||
MollieProviderConfig,
|
||||
TestProviderConfig,
|
||||
TestProviderConfigResponse,
|
||||
PaymentOutcome,
|
||||
PaymentMethod,
|
||||
PaymentScenario
|
||||
|
||||
@@ -7,4 +7,4 @@ export * from './currency'
|
||||
// Re-export provider configurations and types
|
||||
export type { StripeProviderConfig } from './stripe'
|
||||
export type { MollieProviderConfig } from './mollie'
|
||||
export type { TestProviderConfig, PaymentOutcome, PaymentMethod, PaymentScenario } from './test'
|
||||
export type { TestProviderConfig, TestProviderConfigResponse, PaymentOutcome, PaymentMethod, PaymentScenario } from './test'
|
||||
|
||||
@@ -31,6 +31,23 @@ export interface TestProviderConfig {
|
||||
baseUrl?: string
|
||||
}
|
||||
|
||||
export interface TestProviderConfigResponse {
|
||||
enabled: boolean
|
||||
scenarios: PaymentScenario[]
|
||||
methods: Array<{
|
||||
id: string
|
||||
name: string
|
||||
icon: string
|
||||
}>
|
||||
testModeIndicators: {
|
||||
showWarningBanners: boolean
|
||||
showTestBadges: boolean
|
||||
consoleWarnings: boolean
|
||||
}
|
||||
defaultDelay: number
|
||||
customUiRoute: string
|
||||
}
|
||||
|
||||
// Properly typed session interface
|
||||
export interface TestPaymentSession {
|
||||
id: string
|
||||
@@ -144,6 +161,31 @@ export const testProvider = (testConfig: TestProviderConfig) => {
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/payload-billing/test/config',
|
||||
method: 'get',
|
||||
handler: async (req) => {
|
||||
const response: TestProviderConfigResponse = {
|
||||
enabled: testConfig.enabled,
|
||||
scenarios: scenarios,
|
||||
methods: Object.entries(PAYMENT_METHODS).map(([id, method]) => ({
|
||||
id,
|
||||
name: method.name,
|
||||
icon: method.icon
|
||||
})),
|
||||
testModeIndicators: testConfig.testModeIndicators || {
|
||||
showWarningBanners: true,
|
||||
showTestBadges: true,
|
||||
consoleWarnings: true
|
||||
},
|
||||
defaultDelay: testConfig.defaultDelay || 1000,
|
||||
customUiRoute: uiRoute
|
||||
}
|
||||
return new Response(JSON.stringify(response), {
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/payload-billing/test/process',
|
||||
method: 'post',
|
||||
|
||||
Reference in New Issue
Block a user