diff --git a/services/web/app/src/Features/Subscription/SubscriptionController.js b/services/web/app/src/Features/Subscription/SubscriptionController.js index 685e5e621b..3d70fd1d3f 100644 --- a/services/web/app/src/Features/Subscription/SubscriptionController.js +++ b/services/web/app/src/Features/Subscription/SubscriptionController.js @@ -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) } diff --git a/services/web/app/src/Features/Subscription/SubscriptionHandler.js b/services/web/app/src/Features/Subscription/SubscriptionHandler.js index b83b52c852..104acd8783 100644 --- a/services/web/app/src/Features/Subscription/SubscriptionHandler.js +++ b/services/web/app/src/Features/Subscription/SubscriptionHandler.js @@ -384,7 +384,7 @@ async function revertPlanChange( throw new IndeterminateInvoiceError( 'cant determine invoice to fail for plan revert', { - info: { recurlySubscriptionId }, + recurlySubscriptionId, } ) } diff --git a/services/web/app/src/Features/Subscription/SubscriptionUpdater.js b/services/web/app/src/Features/Subscription/SubscriptionUpdater.js index 70fa1a6403..9de194f262 100644 --- a/services/web/app/src/Features/Subscription/SubscriptionUpdater.js +++ b/services/web/app/src/Features/Subscription/SubscriptionUpdater.js @@ -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()