mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Don't let the server die when a sponsored subscription's sponsor can't be found.
This commit is contained in:
parent
bebe2dde21
commit
bb17621b47
1 changed files with 4 additions and 1 deletions
|
@ -161,7 +161,10 @@ module.exports.setup = (app) ->
|
|||
_.remove(stripeInfo.recipients, (s) -> s.userID is recipient.id)
|
||||
options =
|
||||
quantity: utils.getSponsoredSubsAmount(subscription.plan.amount, stripeInfo.recipients.length, stripeInfo.subscriptionID?)
|
||||
console.log 'Updating sponsored subscription', stripeInfo.customerID, stripeInfo.sponsorSubscriptionID, options, 'from stripeInfo', stripeInfo, 'and subscription', subscription, 'for user', recipient.id, 'with sponsor', sponsor.id
|
||||
unless stripeInfo.sponsorSubscriptionID
|
||||
# TODO: fix #2786 error for a particular customer which doesn't have this
|
||||
console.error "Couldn't find sponsorSubscriptionID from stripeInfo", stripeInfo, 'for customer', stripeInfo.customerID, 'with options', options, 'and subscription', subscription, 'for user', recipient.id, 'with sponsor', sponsor.id
|
||||
return res.send(500, '')
|
||||
stripe.customers.updateSubscription stripeInfo.customerID, stripeInfo.sponsorSubscriptionID, options, (err, subscription) =>
|
||||
if err
|
||||
logStripeWebhookError(err)
|
||||
|
|
Loading…
Reference in a new issue