mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
feat: log error for support to investigate, and return 200 to recurly to prevent retries (#26317)
GitOrigin-RevId: 6f71fd4451e950a7bdbe1140a86a78bf8a04b039
This commit is contained in:
committed by
Copybot
parent
b0c5d6fc5a
commit
a1591e8b0c
@@ -36,6 +36,7 @@ const PermissionsManager = require('../Authorization/PermissionsManager')
|
||||
const {
|
||||
sanitizeSessionUserForFrontEnd,
|
||||
} = require('../../infrastructure/FrontEndUser')
|
||||
const { IndeterminateInvoiceError } = require('../Errors/Errors')
|
||||
|
||||
/**
|
||||
* @import { SubscriptionChangeDescription } from '../../../../types/subscription/subscription-change-preview'
|
||||
@@ -622,6 +623,13 @@ function recurlyCallback(req, res, next) {
|
||||
eventData.transaction.subscription_id,
|
||||
lastSubscription,
|
||||
function (err) {
|
||||
if (err instanceof IndeterminateInvoiceError) {
|
||||
logger.warn(
|
||||
{ recurlySubscriptionId: err.info.recurlySubscriptionId },
|
||||
'could not determine invoice to fail for subscription'
|
||||
)
|
||||
return res.sendStatus(200)
|
||||
}
|
||||
if (err) {
|
||||
return next(err)
|
||||
}
|
||||
|
||||
@@ -384,7 +384,7 @@ async function revertPlanChange(
|
||||
throw new IndeterminateInvoiceError(
|
||||
'cant determine invoice to fail for plan revert',
|
||||
{
|
||||
info: { recurlySubscriptionId },
|
||||
recurlySubscriptionId,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -522,7 +522,7 @@ async function setRestorePoint(subscriptionId, planCode, addOns, consumed) {
|
||||
}
|
||||
|
||||
if (consumed) {
|
||||
update.$inc = { revertedDueToFailedPayment: 1 }
|
||||
update.$inc = { timesRevertedDueToFailedPayment: 1 }
|
||||
}
|
||||
|
||||
await Subscription.updateOne({ _id: subscriptionId }, update).exec()
|
||||
|
||||
Reference in New Issue
Block a user