mirror of
https://github.com/xtr-dev/payload-billing.git
synced 2025-12-10 02:43: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,
|
StripeProviderConfig,
|
||||||
MollieProviderConfig,
|
MollieProviderConfig,
|
||||||
TestProviderConfig,
|
TestProviderConfig,
|
||||||
|
TestProviderConfigResponse,
|
||||||
PaymentOutcome,
|
PaymentOutcome,
|
||||||
PaymentMethod,
|
PaymentMethod,
|
||||||
PaymentScenario
|
PaymentScenario
|
||||||
|
|||||||
@@ -7,4 +7,4 @@ export * from './currency'
|
|||||||
// Re-export provider configurations and types
|
// Re-export provider configurations and types
|
||||||
export type { StripeProviderConfig } from './stripe'
|
export type { StripeProviderConfig } from './stripe'
|
||||||
export type { MollieProviderConfig } from './mollie'
|
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
|
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
|
// Properly typed session interface
|
||||||
export interface TestPaymentSession {
|
export interface TestPaymentSession {
|
||||||
id: string
|
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',
|
path: '/payload-billing/test/process',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
|||||||
Reference in New Issue
Block a user