SubscriptionController.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670
  1. const SessionManager = require('../Authentication/SessionManager')
  2. const SubscriptionHandler = require('./SubscriptionHandler')
  3. const SubscriptionViewModelBuilder = require('./SubscriptionViewModelBuilder')
  4. const LimitationsManager = require('./LimitationsManager')
  5. const RecurlyWrapper = require('./RecurlyWrapper')
  6. const Settings = require('@overleaf/settings')
  7. const logger = require('@overleaf/logger')
  8. const GeoIpLookup = require('../../infrastructure/GeoIpLookup')
  9. const FeaturesUpdater = require('./FeaturesUpdater')
  10. const planFeatures = require('./planFeatures')
  11. const plansConfig = require('./plansConfig')
  12. const interstitialPaymentConfig = require('./interstitialPaymentConfig')
  13. const GroupPlansData = require('./GroupPlansData')
  14. const V1SubscriptionManager = require('./V1SubscriptionManager')
  15. const AnalyticsManager = require('../Analytics/AnalyticsManager')
  16. const RecurlyEventHandler = require('./RecurlyEventHandler')
  17. const { expressify } = require('@overleaf/promise-utils')
  18. const OError = require('@overleaf/o-error')
  19. const SplitTestHandler = require('../SplitTests/SplitTestHandler')
  20. const SubscriptionHelper = require('./SubscriptionHelper')
  21. const AuthorizationManager = require('../Authorization/AuthorizationManager')
  22. const Modules = require('../../infrastructure/Modules')
  23. const async = require('async')
  24. const groupPlanModalOptions = Settings.groupPlanModalOptions
  25. const validGroupPlanModalOptions = {
  26. plan_code: groupPlanModalOptions.plan_codes.map(item => item.code),
  27. currency: groupPlanModalOptions.currencies.map(item => item.code),
  28. size: groupPlanModalOptions.sizes,
  29. usage: groupPlanModalOptions.usages.map(item => item.code),
  30. }
  31. async function plansPage(req, res) {
  32. const plans = SubscriptionViewModelBuilder.buildPlansList()
  33. let currency = null
  34. const queryCurrency = req.query.currency?.toUpperCase()
  35. if (GeoIpLookup.isValidCurrencyParam(queryCurrency)) {
  36. currency = queryCurrency
  37. }
  38. const { recommendedCurrency, countryCode, geoPricingINRTestVariant } =
  39. await _getRecommendedCurrency(req, res)
  40. if (recommendedCurrency && currency == null) {
  41. currency = recommendedCurrency
  42. }
  43. function getDefault(param, category, defaultValue) {
  44. const v = req.query && req.query[param]
  45. if (v && validGroupPlanModalOptions[category].includes(v)) {
  46. return v
  47. }
  48. return defaultValue
  49. }
  50. const currentView = 'annual'
  51. let defaultGroupPlanModalCurrency = 'USD'
  52. if (validGroupPlanModalOptions.currency.includes(currency)) {
  53. defaultGroupPlanModalCurrency = currency
  54. }
  55. const groupPlanModalDefaults = {
  56. plan_code: getDefault('plan', 'plan_code', 'collaborator'),
  57. size: getDefault('number', 'size', '2'),
  58. currency: getDefault('currency', 'currency', defaultGroupPlanModalCurrency),
  59. usage: getDefault('usage', 'usage', 'enterprise'),
  60. }
  61. let showInrGeoBanner, inrGeoBannerSplitTestName
  62. let inrGeoBannerVariant = 'default'
  63. if (countryCode === 'IN') {
  64. inrGeoBannerSplitTestName =
  65. geoPricingINRTestVariant === 'inr'
  66. ? 'geo-banners-inr-2'
  67. : 'geo-banners-inr-1'
  68. const geoBannerAssignment = await SplitTestHandler.promises.getAssignment(
  69. req,
  70. res,
  71. inrGeoBannerSplitTestName
  72. )
  73. inrGeoBannerVariant = geoBannerAssignment.variant
  74. if (inrGeoBannerVariant !== 'default') {
  75. showInrGeoBanner = true
  76. }
  77. }
  78. // annual plans with the free trial option split test - nudge variant
  79. const annualTrialsAssignment = await SplitTestHandler.promises.getAssignment(
  80. req,
  81. res,
  82. 'annual-trials'
  83. )
  84. const websiteRedesignVariant =
  85. res.locals.splitTestVariants?.['website-redesign']
  86. const plansPageViewSegmentation = {
  87. currency: recommendedCurrency,
  88. countryCode,
  89. 'geo-pricing-inr-group': geoPricingINRTestVariant,
  90. 'geo-pricing-inr-page': currency === 'INR' ? 'inr' : 'default',
  91. 'annual-trials': annualTrialsAssignment.variant,
  92. 'website-redesign': websiteRedesignVariant,
  93. }
  94. if (inrGeoBannerSplitTestName) {
  95. plansPageViewSegmentation[inrGeoBannerSplitTestName] = inrGeoBannerVariant
  96. }
  97. AnalyticsManager.recordEventForSession(
  98. req.session,
  99. 'plans-page-view',
  100. plansPageViewSegmentation
  101. )
  102. res.render('subscriptions/plans', {
  103. title: 'plans_and_pricing',
  104. currentView,
  105. plans,
  106. itm_content: req.query?.itm_content,
  107. itm_referrer: req.query?.itm_referrer,
  108. itm_campaign: 'plans',
  109. recommendedCurrency: currency,
  110. planFeatures,
  111. plansConfig,
  112. groupPlans: GroupPlansData,
  113. groupPlanModalOptions,
  114. groupPlanModalDefaults,
  115. initialLocalizedGroupPrice:
  116. SubscriptionHelper.generateInitialLocalizedGroupPrice(currency),
  117. showInrGeoBanner,
  118. annualTrialsAssignment: annualTrialsAssignment?.variant,
  119. })
  120. }
  121. function formatGroupPlansDataForDash() {
  122. return {
  123. plans: [...groupPlanModalOptions.plan_codes],
  124. sizes: [...groupPlanModalOptions.sizes],
  125. usages: [...groupPlanModalOptions.usages],
  126. priceByUsageTypeAndSize: JSON.parse(JSON.stringify(GroupPlansData)),
  127. }
  128. }
  129. /**
  130. * @param {import('express').Request} req
  131. * @param {import('express').Response} res
  132. * @returns {Promise<void>}
  133. */
  134. async function userSubscriptionPage(req, res) {
  135. const user = SessionManager.getSessionUser(req.session)
  136. const results =
  137. await SubscriptionViewModelBuilder.promises.buildUsersSubscriptionViewModel(
  138. user
  139. )
  140. const {
  141. personalSubscription,
  142. memberGroupSubscriptions,
  143. managedGroupSubscriptions,
  144. currentInstitutionsWithLicence,
  145. managedInstitutions,
  146. managedPublishers,
  147. } = results
  148. const hasSubscription =
  149. await LimitationsManager.promises.userHasV1OrV2Subscription(user)
  150. const fromPlansPage = req.query.hasSubscription
  151. const plansData =
  152. SubscriptionViewModelBuilder.buildPlansListForSubscriptionDash(
  153. personalSubscription?.plan
  154. )
  155. AnalyticsManager.recordEventForSession(req.session, 'subscription-page-view')
  156. const cancelButtonAssignment = await SplitTestHandler.promises.getAssignment(
  157. req,
  158. res,
  159. 'subscription-cancel-button'
  160. )
  161. const cancelButtonNewCopy = cancelButtonAssignment?.variant === 'new-copy'
  162. const groupPlansDataForDash = formatGroupPlansDataForDash()
  163. // display the Group Settings button only to admins of group subscriptions with either/or the Managed Users or Group SSO feature available
  164. let groupSettingsEnabledFor
  165. try {
  166. const managedGroups = await async.filter(
  167. managedGroupSubscriptions || [],
  168. async subscription => {
  169. const managedUsersResults = await Modules.promises.hooks.fire(
  170. 'hasManagedUsersFeature',
  171. subscription
  172. )
  173. const groupSSOResults = await Modules.promises.hooks.fire(
  174. 'hasGroupSSOFeature',
  175. subscription
  176. )
  177. const isGroupAdmin =
  178. (subscription.admin_id._id || subscription.admin_id).toString() ===
  179. user._id.toString()
  180. return (
  181. (managedUsersResults?.[0] === true ||
  182. groupSSOResults?.[0] === true) &&
  183. isGroupAdmin
  184. )
  185. }
  186. )
  187. groupSettingsEnabledFor = managedGroups.map(subscription =>
  188. subscription._id.toString()
  189. )
  190. } catch (error) {
  191. logger.error(
  192. { err: error },
  193. 'Failed to list groups with group settings enabled'
  194. )
  195. }
  196. const data = {
  197. title: 'your_subscription',
  198. plans: plansData?.plans,
  199. planCodesChangingAtTermEnd: plansData?.planCodesChangingAtTermEnd,
  200. user,
  201. hasSubscription,
  202. fromPlansPage,
  203. personalSubscription,
  204. memberGroupSubscriptions,
  205. managedGroupSubscriptions,
  206. managedInstitutions,
  207. managedPublishers,
  208. currentInstitutionsWithLicence,
  209. cancelButtonNewCopy,
  210. groupPlans: groupPlansDataForDash,
  211. groupSettingsEnabledFor,
  212. isManagedAccount: !!req.managedBy,
  213. userRestrictions: Array.from(req.userRestrictions || []),
  214. }
  215. res.render('subscriptions/dashboard-react', data)
  216. }
  217. async function interstitialPaymentPage(req, res) {
  218. const user = SessionManager.getSessionUser(req.session)
  219. const { recommendedCurrency, countryCode, geoPricingINRTestVariant } =
  220. await _getRecommendedCurrency(req, res)
  221. const hasSubscription =
  222. await LimitationsManager.promises.userHasV1OrV2Subscription(user)
  223. const showSkipLink = req.query?.skipLink === 'true'
  224. if (hasSubscription) {
  225. res.redirect('/user/subscription?hasSubscription=true')
  226. } else {
  227. let showInrGeoBanner, inrGeoBannerSplitTestName
  228. let inrGeoBannerVariant = 'default'
  229. if (countryCode === 'IN') {
  230. inrGeoBannerSplitTestName =
  231. geoPricingINRTestVariant === 'inr'
  232. ? 'geo-banners-inr-2'
  233. : 'geo-banners-inr-1'
  234. const geoBannerAssignment = await SplitTestHandler.promises.getAssignment(
  235. req,
  236. res,
  237. inrGeoBannerSplitTestName
  238. )
  239. inrGeoBannerVariant = geoBannerAssignment.variant
  240. if (inrGeoBannerVariant !== 'default') {
  241. showInrGeoBanner = true
  242. }
  243. }
  244. // annual plans with the free trial option split test - nudge variant
  245. const annualTrialsAssignment =
  246. await SplitTestHandler.promises.getAssignment(req, res, 'annual-trials')
  247. const paywallPlansPageViewSegmentation = {
  248. currency: recommendedCurrency,
  249. countryCode,
  250. 'geo-pricing-inr-group': geoPricingINRTestVariant,
  251. 'geo-pricing-inr-page': recommendedCurrency === 'INR' ? 'inr' : 'default',
  252. 'annual-trials': annualTrialsAssignment.variant,
  253. }
  254. if (inrGeoBannerSplitTestName) {
  255. paywallPlansPageViewSegmentation[inrGeoBannerSplitTestName] =
  256. inrGeoBannerVariant
  257. }
  258. AnalyticsManager.recordEventForSession(
  259. req.session,
  260. 'paywall-plans-page-view',
  261. paywallPlansPageViewSegmentation
  262. )
  263. let templatePath
  264. switch (annualTrialsAssignment?.variant) {
  265. case 'nudge':
  266. templatePath = 'subscriptions/interstitial-payment_nudge_annual'
  267. break
  268. case 'no-nudge':
  269. templatePath = 'subscriptions/interstitial-payment_no_nudge_monthly'
  270. break
  271. default:
  272. templatePath = 'subscriptions/interstitial-payment'
  273. }
  274. res.render(templatePath, {
  275. title: 'subscribe',
  276. itm_content: req.query?.itm_content,
  277. itm_campaign: req.query?.itm_campaign,
  278. itm_referrer: req.query?.itm_referrer,
  279. recommendedCurrency,
  280. interstitialPaymentConfig,
  281. showSkipLink,
  282. showInrGeoBanner,
  283. })
  284. }
  285. }
  286. /**
  287. * @param {import('express').Request} req
  288. * @param {import('express').Response} res
  289. * @returns {Promise<void>}
  290. */
  291. async function successfulSubscription(req, res) {
  292. const user = SessionManager.getSessionUser(req.session)
  293. const { personalSubscription } =
  294. await SubscriptionViewModelBuilder.promises.buildUsersSubscriptionViewModel(
  295. user
  296. )
  297. const postCheckoutRedirect = req.session?.postCheckoutRedirect
  298. if (!personalSubscription) {
  299. res.redirect('/user/subscription/plans')
  300. } else {
  301. res.render('subscriptions/successful-subscription-react', {
  302. title: 'thank_you',
  303. personalSubscription,
  304. postCheckoutRedirect,
  305. })
  306. }
  307. }
  308. function cancelSubscription(req, res, next) {
  309. const user = SessionManager.getSessionUser(req.session)
  310. logger.debug({ userId: user._id }, 'canceling subscription')
  311. SubscriptionHandler.cancelSubscription(user, function (err) {
  312. if (err) {
  313. OError.tag(err, 'something went wrong canceling subscription', {
  314. user_id: user._id,
  315. })
  316. return next(err)
  317. }
  318. // Note: this redirect isn't used in the main flow as the redirection is
  319. // handled by Angular
  320. res.redirect('/user/subscription/canceled')
  321. })
  322. }
  323. /**
  324. * @param {import('express').Request} req
  325. * @param {import('express').Response} res
  326. * @param {import('express').NextFunction} next
  327. * @returns {Promise<void>}
  328. */
  329. function canceledSubscription(req, res, next) {
  330. return res.render('subscriptions/canceled-subscription-react', {
  331. title: 'subscription_canceled',
  332. })
  333. }
  334. function cancelV1Subscription(req, res, next) {
  335. const userId = SessionManager.getLoggedInUserId(req.session)
  336. logger.debug({ userId }, 'canceling v1 subscription')
  337. V1SubscriptionManager.cancelV1Subscription(userId, function (err) {
  338. if (err) {
  339. OError.tag(err, 'something went wrong canceling v1 subscription', {
  340. userId,
  341. })
  342. return next(err)
  343. }
  344. res.redirect('/user/subscription')
  345. })
  346. }
  347. function updateSubscription(req, res, next) {
  348. const origin = req && req.query ? req.query.origin : null
  349. const user = SessionManager.getSessionUser(req.session)
  350. const planCode = req.body.plan_code
  351. if (planCode == null) {
  352. const err = new Error('plan_code is not defined')
  353. logger.warn(
  354. { userId: user._id, err, planCode, origin, body: req.body },
  355. '[Subscription] error in updateSubscription form'
  356. )
  357. return next(err)
  358. }
  359. logger.debug({ planCode, userId: user._id }, 'updating subscription')
  360. SubscriptionHandler.updateSubscription(user, planCode, null, function (err) {
  361. if (err) {
  362. OError.tag(err, 'something went wrong updating subscription', {
  363. user_id: user._id,
  364. })
  365. return next(err)
  366. }
  367. res.redirect('/user/subscription')
  368. })
  369. }
  370. function cancelPendingSubscriptionChange(req, res, next) {
  371. const user = SessionManager.getSessionUser(req.session)
  372. logger.debug({ userId: user._id }, 'canceling pending subscription change')
  373. SubscriptionHandler.cancelPendingSubscriptionChange(user, function (err) {
  374. if (err) {
  375. OError.tag(
  376. err,
  377. 'something went wrong canceling pending subscription change',
  378. {
  379. user_id: user._id,
  380. }
  381. )
  382. return next(err)
  383. }
  384. res.redirect('/user/subscription')
  385. })
  386. }
  387. function updateAccountEmailAddress(req, res, next) {
  388. const user = SessionManager.getSessionUser(req.session)
  389. RecurlyWrapper.updateAccountEmailAddress(
  390. user._id,
  391. user.email,
  392. function (error) {
  393. if (error) {
  394. return next(error)
  395. }
  396. res.sendStatus(200)
  397. }
  398. )
  399. }
  400. function reactivateSubscription(req, res, next) {
  401. const user = SessionManager.getSessionUser(req.session)
  402. logger.debug({ userId: user._id }, 'reactivating subscription')
  403. try {
  404. if (req.isManagedGroupAdmin) {
  405. // allow admins to reactivate subscriptions
  406. } else {
  407. // otherwise require the user to have the reactivate-subscription permission
  408. req.assertPermission('reactivate-subscription')
  409. }
  410. } catch (error) {
  411. return next(error)
  412. }
  413. SubscriptionHandler.reactivateSubscription(user, function (err) {
  414. if (err) {
  415. OError.tag(err, 'something went wrong reactivating subscription', {
  416. user_id: user._id,
  417. })
  418. return next(err)
  419. }
  420. res.redirect('/user/subscription')
  421. })
  422. }
  423. function recurlyCallback(req, res, next) {
  424. logger.debug({ data: req.body }, 'received recurly callback')
  425. const event = Object.keys(req.body)[0]
  426. const eventData = req.body[event]
  427. RecurlyEventHandler.sendRecurlyAnalyticsEvent(event, eventData).catch(error =>
  428. logger.error(
  429. { err: error },
  430. 'Failed to process analytics event on Recurly webhook'
  431. )
  432. )
  433. if (
  434. [
  435. 'new_subscription_notification',
  436. 'updated_subscription_notification',
  437. 'expired_subscription_notification',
  438. ].includes(event)
  439. ) {
  440. const recurlySubscription = eventData.subscription
  441. SubscriptionHandler.syncSubscription(
  442. recurlySubscription,
  443. { ip: req.ip },
  444. function (err) {
  445. if (err) {
  446. return next(err)
  447. }
  448. res.sendStatus(200)
  449. }
  450. )
  451. } else if (event === 'billing_info_updated_notification') {
  452. const recurlyAccountCode = eventData.account.account_code
  453. SubscriptionHandler.attemptPaypalInvoiceCollection(
  454. recurlyAccountCode,
  455. function (err) {
  456. if (err) {
  457. return next(err)
  458. }
  459. res.sendStatus(200)
  460. }
  461. )
  462. } else {
  463. res.sendStatus(200)
  464. }
  465. }
  466. function renderUpgradeToAnnualPlanPage(req, res, next) {
  467. const user = SessionManager.getSessionUser(req.session)
  468. LimitationsManager.userHasV2Subscription(
  469. user,
  470. function (err, hasSubscription, subscription) {
  471. let planName
  472. if (err) {
  473. return next(err)
  474. }
  475. const planCode = subscription
  476. ? subscription.planCode.toLowerCase()
  477. : undefined
  478. if ((planCode ? planCode.indexOf('annual') : undefined) !== -1) {
  479. planName = 'annual'
  480. } else if ((planCode ? planCode.indexOf('student') : undefined) !== -1) {
  481. planName = 'student'
  482. } else if (
  483. (planCode ? planCode.indexOf('collaborator') : undefined) !== -1
  484. ) {
  485. planName = 'collaborator'
  486. }
  487. if (hasSubscription) {
  488. res.render('subscriptions/upgradeToAnnual', {
  489. title: 'Upgrade to annual',
  490. planName,
  491. })
  492. } else {
  493. res.redirect('/user/subscription/plans')
  494. }
  495. }
  496. )
  497. }
  498. function processUpgradeToAnnualPlan(req, res, next) {
  499. const user = SessionManager.getSessionUser(req.session)
  500. const { planName } = req.body
  501. const couponCode = Settings.coupon_codes.upgradeToAnnualPromo[planName]
  502. const annualPlanName = `${planName}-annual`
  503. logger.debug(
  504. { userId: user._id, planName: annualPlanName },
  505. 'user is upgrading to annual billing with discount'
  506. )
  507. return SubscriptionHandler.updateSubscription(
  508. user,
  509. annualPlanName,
  510. couponCode,
  511. function (err) {
  512. if (err) {
  513. OError.tag(err, 'error updating subscription', {
  514. user_id: user._id,
  515. })
  516. return next(err)
  517. }
  518. res.sendStatus(200)
  519. }
  520. )
  521. }
  522. async function extendTrial(req, res) {
  523. const user = SessionManager.getSessionUser(req.session)
  524. const { subscription } =
  525. await LimitationsManager.promises.userHasV2Subscription(user)
  526. try {
  527. await SubscriptionHandler.promises.extendTrial(subscription, 14)
  528. AnalyticsManager.recordEventForSession(
  529. req.session,
  530. 'subscription-trial-extended'
  531. )
  532. } catch (error) {
  533. return res.sendStatus(500)
  534. }
  535. res.sendStatus(200)
  536. }
  537. function recurlyNotificationParser(req, res, next) {
  538. let xml = ''
  539. req.on('data', chunk => (xml += chunk))
  540. req.on('end', () =>
  541. RecurlyWrapper._parseXml(xml, function (error, body) {
  542. if (error) {
  543. return next(error)
  544. }
  545. req.body = body
  546. next()
  547. })
  548. )
  549. }
  550. async function refreshUserFeatures(req, res) {
  551. const { user_id: userId } = req.params
  552. await FeaturesUpdater.promises.refreshFeatures(userId, 'acceptance-test')
  553. res.sendStatus(200)
  554. }
  555. async function redirectToHostedPage(req, res) {
  556. const userId = SessionManager.getLoggedInUserId(req.session)
  557. const { pageType } = req.params
  558. const url =
  559. await SubscriptionViewModelBuilder.promises.getRedirectToHostedPage(
  560. userId,
  561. pageType
  562. )
  563. logger.warn({ userId, pageType }, 'redirecting to recurly hosted page')
  564. res.redirect(url)
  565. }
  566. async function _getRecommendedCurrency(req, res) {
  567. const userId = SessionManager.getLoggedInUserId(req.session)
  568. let ip = req.ip
  569. if (
  570. req.query?.ip &&
  571. (await AuthorizationManager.promises.isUserSiteAdmin(userId))
  572. ) {
  573. ip = req.query.ip
  574. }
  575. const currencyLookup = await GeoIpLookup.promises.getCurrencyCode(ip)
  576. const countryCode = currencyLookup.countryCode
  577. let recommendedCurrency = currencyLookup.currencyCode
  578. // for #12703
  579. // Split test is kept active, but all users geolocated in India can
  580. // now use the INR currency (See #13507)
  581. const assignmentINR = await SplitTestHandler.promises.getAssignment(
  582. req,
  583. res,
  584. 'geo-pricing-inr'
  585. )
  586. if (['BRL', 'MXN', 'COP', 'CLP', 'PEN'].includes(recommendedCurrency)) {
  587. recommendedCurrency = GeoIpLookup.DEFAULT_CURRENCY_CODE
  588. }
  589. return {
  590. recommendedCurrency,
  591. countryCode,
  592. geoPricingINRTestVariant: assignmentINR?.variant,
  593. }
  594. }
  595. module.exports = {
  596. plansPage: expressify(plansPage),
  597. userSubscriptionPage: expressify(userSubscriptionPage),
  598. interstitialPaymentPage: expressify(interstitialPaymentPage),
  599. successfulSubscription: expressify(successfulSubscription),
  600. cancelSubscription,
  601. canceledSubscription,
  602. cancelV1Subscription,
  603. updateSubscription,
  604. cancelPendingSubscriptionChange,
  605. updateAccountEmailAddress,
  606. reactivateSubscription,
  607. recurlyCallback,
  608. renderUpgradeToAnnualPlanPage,
  609. processUpgradeToAnnualPlan,
  610. extendTrial: expressify(extendTrial),
  611. recurlyNotificationParser,
  612. refreshUserFeatures: expressify(refreshUserFeatures),
  613. redirectToHostedPage: expressify(redirectToHostedPage),
  614. promises: {
  615. getRecommendedCurrency: _getRecommendedCurrency,
  616. },
  617. }