Payment provider interface: Yoco behind it, Site settings → Payments
- src/payments: provider registry and PaymentProvider interface (createCheckout, verifyWebhook/parseWebhook, getTransaction, refund, listTransactions as capabilities), Yoco as the first provider. All four direct Yoco checkout calls go through payments.createCheckout. - Webhook split into the provider part (signature, parsing) and shared processing; same URL (/api/webhooks/yoco), same behaviour. - YocoTransaction renamed in place to ProviderTransaction (+ provider, unique per provider + externalId); Payment.provider added and backfilled to "yoco". Payment.method stays the wallet type so cashups are unchanged. - Site settings → Payments: Enabled toggle and order per provider; Yoco's settings shown while it's enabled. R15 minimum for all online payments. - New endpoint names (/api/payments/checkout, /api/provider-transactions); the old /yoco-checkout and /yoco-transactions paths still work. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1365,20 +1365,20 @@ const createManualRegistration = async (req, res) => {
|
||||
await generateTicketsForRegistration(registration.id);
|
||||
} catch {}
|
||||
|
||||
// For paid registrations, generate a Yoco checkout link to include in the email
|
||||
// For paid registrations, generate a checkout link to include in the email
|
||||
let yocoPaymentUrl = null;
|
||||
if (registration.status !== 'paid') {
|
||||
try {
|
||||
const { createRegistrationCheckoutInternal } = require('./paymentController');
|
||||
const { createRegistrationCheckout } = require('../payments/checkouts');
|
||||
const baseUrl = process.env.FRONTEND_URL || process.env.APP_BASE_URL || 'http://localhost:3001';
|
||||
const checkout = await createRegistrationCheckoutInternal(registrationId, userId, {
|
||||
const checkout = await createRegistrationCheckout(registrationId, userId, {
|
||||
successUrl: `${baseUrl}/payment/success`,
|
||||
cancelUrl: `${baseUrl}/payment/cancel`,
|
||||
failureUrl: `${baseUrl}/payment/failure`,
|
||||
});
|
||||
yocoPaymentUrl = checkout.redirectUrl || null;
|
||||
} catch (e) {
|
||||
console.warn('Could not create Yoco checkout for self-service email:', e?.message || e);
|
||||
console.warn('Could not create a checkout for the self-service email:', e?.message || e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user