SubscriptionController.js 20 KB

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