feat: add comprehensive demo application with custom payment UI

- Custom test payment UI with modern Tailwind CSS design
- Payment method selection (iDEAL, Credit Card, PayPal, Apple Pay, Bank Transfer)
- Test scenario selection (6 scenarios: success, delayed, cancelled, declined, expired, pending)
- Real-time payment status polling
- Success and failure result pages with payment details
- Interactive demo homepage at root path
- Sample data seeding (customers, invoices)
- Customers collection with auto-sync to invoices
- Comprehensive documentation (README.md, DEMO_GUIDE.md)
- Proper cursor styles for all interactive elements

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-08 14:03:28 +01:00
parent fa22900db5
commit 3508418698
18 changed files with 2505 additions and 459 deletions

View File

@@ -0,0 +1,56 @@
import configPromise from '@payload-config'
import { getPayload } from 'payload'
export async function POST(request: Request) {
try {
const payload = await getPayload({
config: configPromise,
})
const body = await request.json()
const { amount, currency, description } = body
if (!amount || !currency) {
return Response.json(
{ success: false, error: 'Amount and currency are required' },
{ status: 400 }
)
}
// Create a payment using the test provider
const payment = await payload.create({
collection: 'payments',
data: {
provider: 'test',
amount,
currency,
description: description || 'Demo payment',
status: 'pending',
metadata: {
source: 'demo-ui',
createdAt: new Date().toISOString(),
},
},
})
return Response.json({
success: true,
payment: {
id: payment.providerId, // Use the test provider ID for the UI
paymentId: payment.id,
amount: payment.amount,
currency: payment.currency,
description: payment.description,
},
})
} catch (error) {
console.error('Failed to create payment:', error)
return Response.json(
{
success: false,
error: error instanceof Error ? error.message : 'Failed to create payment',
},
{ status: 500 }
)
}
}