Completely remove all race condition and optimistic locking logic

- Remove webhook context tracking system (context.ts file)
- Eliminate updatePaymentFromWebhook wrapper function
- Simplify payment providers to use updatePaymentStatus directly
- Remove all version-based optimistic locking references
- Clean up webhook context parameters and metadata
- Streamline codebase assuming providers don't send duplicate webhooks

The payment system now operates with simple, direct updates without any
race condition handling, as payment providers typically don't send
duplicate webhook requests for the same event.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-18 18:51:23 +02:00
parent b6c27ff3a3
commit a25111444a
4 changed files with 9 additions and 89 deletions

View File

@@ -6,7 +6,7 @@ import type { createMollieClient, MollieClient } from '@mollie/api-client'
import {
webhookResponses,
findPaymentByProviderId,
updatePaymentFromWebhook,
updatePaymentStatus,
updateInvoiceOnPaymentSuccess,
handleWebhookError,
validateProductionUrl
@@ -83,15 +83,13 @@ export const mollieProvider = (mollieConfig: MollieProviderConfig & {
// Map Mollie status to our status using proper type-safe mapping
const status = mapMollieStatusToPaymentStatus(molliePayment.status)
// Update the payment status and provider data with webhook context
const updateSuccess = await updatePaymentFromWebhook(
// Update the payment status and provider data
const updateSuccess = await updatePaymentStatus(
payload,
payment.id,
status,
molliePayment.toPlainObject(),
pluginConfig,
'mollie',
`payment.${molliePayment.status}`
pluginConfig
)
// If payment is successful and update succeeded, update the invoice