mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 06:03:45 +01:00
Merge pull request #28505 from overleaf/jlm-fix-recurly-webhook-manual-charge
Handle manual charge in recurly webhook GitOrigin-RevId: 0e84725cc99433f3e6bebbd4fd424a47b233b966
This commit is contained in:
committed by
Copybot
parent
b3478ab26b
commit
9cbeaf53f8
@@ -831,8 +831,20 @@ function recurlyCallback(req, res, next) {
|
||||
return res.sendStatus(200)
|
||||
}
|
||||
|
||||
// A manual charge may have no subscription, in which case we get a
|
||||
// <subscription_id nil="true"/> element, which produces an object instead
|
||||
// of a string subscription_id.
|
||||
const subscriptionId = eventData.transaction?.subscription_id
|
||||
if (!subscriptionId || typeof subscriptionId !== 'string') {
|
||||
logger.info(
|
||||
{ transactionId: eventData.transaction?.id },
|
||||
'ignoring failed_payment_notification without subscription_id'
|
||||
)
|
||||
return res.sendStatus(200)
|
||||
}
|
||||
|
||||
SubscriptionHandler.getSubscriptionRestorePoint(
|
||||
eventData.transaction.subscription_id,
|
||||
subscriptionId,
|
||||
function (err, lastSubscription) {
|
||||
if (err) {
|
||||
return next(err)
|
||||
|
||||
Reference in New Issue
Block a user