mirror of
https://github.com/xtr-dev/payload-billing.git
synced 2025-12-10 10:53:23 +00:00
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:
@@ -6,7 +6,7 @@ import type Stripe from 'stripe'
|
||||
import {
|
||||
webhookResponses,
|
||||
findPaymentByProviderId,
|
||||
updatePaymentFromWebhook,
|
||||
updatePaymentStatus,
|
||||
updateInvoiceOnPaymentSuccess,
|
||||
handleWebhookError,
|
||||
logWebhookEvent
|
||||
@@ -117,14 +117,12 @@ export const stripeProvider = (stripeConfig: StripeProviderConfig) => {
|
||||
timestamp: new Date().toISOString(),
|
||||
provider: 'stripe'
|
||||
}
|
||||
const updateSuccess = await updatePaymentFromWebhook(
|
||||
const updateSuccess = await updatePaymentStatus(
|
||||
payload,
|
||||
payment.id,
|
||||
status,
|
||||
providerData,
|
||||
pluginConfig,
|
||||
'stripe',
|
||||
event.type
|
||||
pluginConfig
|
||||
)
|
||||
|
||||
// If payment is successful and update succeeded, update the invoice
|
||||
@@ -165,14 +163,12 @@ export const stripeProvider = (stripeConfig: StripeProviderConfig) => {
|
||||
timestamp: new Date().toISOString(),
|
||||
provider: 'stripe'
|
||||
}
|
||||
const updateSuccess = await updatePaymentFromWebhook(
|
||||
const updateSuccess = await updatePaymentStatus(
|
||||
payload,
|
||||
payment.id,
|
||||
isFullyRefunded ? 'refunded' : 'partially_refunded',
|
||||
providerData,
|
||||
pluginConfig,
|
||||
'stripe',
|
||||
event.type
|
||||
pluginConfig
|
||||
)
|
||||
|
||||
if (!updateSuccess) {
|
||||
|
||||
Reference in New Issue
Block a user