Skip to content

Conversation

@hdiniz
Copy link
Contributor

@hdiniz hdiniz commented Nov 5, 2025

@hdiniz hdiniz self-assigned this Nov 5, 2025
@hdiniz hdiniz marked this pull request as ready for review November 6, 2025 10:05
@hdiniz hdiniz requested a review from Betree November 6, 2025 10:05
Comment on lines 153 to 163
if (order.Subscription.chargeNumber !== null) {
order.Subscription.chargeNumber += 1;
}

order.status = status.ACTIVE;
}

if (orderProcessedStatus === 'success' || orderProcessedStatus === 'processing') {
// TODO: we should consolidate on error and remove latestError
order.data = omit(order.data, ['error', 'latestError']);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The status.PROCESSING constant is undefined, causing exclusion logic to fail and order.status not to be set during processing.
Severity: CRITICAL | Confidence: 1.00

🔍 Detailed Analysis

The query at line 34 attempts to exclude orders with status.PROCESSING, but this constant is undefined. Consequently, when an order's payment is in a processing state (lines 152-165), its order.status is not explicitly updated to a processing status. This allows the order to be repeatedly fetched by subsequent cron runs, as the intended exclusion based on a processing status is ineffective.

💡 Suggested Fix

Define the status.PROCESSING constant. Ensure order.status is explicitly set to status.PROCESSING when payment is in a processing state.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: server/lib/recurring-contributions.js#L153-L163

Potential issue: The query at line 34 attempts to exclude orders with
`status.PROCESSING`, but this constant is undefined. Consequently, when an order's
payment is in a processing state (lines 152-165), its `order.status` is not explicitly
updated to a processing status. This allows the order to be repeatedly fetched by
subsequent cron runs, as the intended exclusion based on a processing status is
ineffective.

Did we get this right? 👍 / 👎 to inform future reviews.

interval,
monthlyInterval: interval === 'month',
firstPayment: true,
firstPayment,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This default value has been removed and passed as an optional argument, yet I don't see all the references to sendEmailNotifications being updated, only one of them. Aren't we going to miss it with other payment methods, when called from executeOrder?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I kept the existing default now.

@hdiniz hdiniz requested a review from Betree December 2, 2025 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stripe ACH recurring contributions issues

3 participants