[web] mv PaymentService to modules

GitOrigin-RevId: 73d739f53d96ff9e9d51a535907dbdc878aa6624
This commit is contained in:
Kristina Hjertberg
2025-04-17 08:05:58 +00:00
committed by Copybot
parent 04d36122bd
commit f8f2585164
4 changed files with 32 additions and 219 deletions
@@ -23,8 +23,8 @@ const {
V1ConnectionError,
} = require('../Errors/Errors')
const FeaturesHelper = require('./FeaturesHelper')
const PaymentService = require('./PaymentService')
const { formatCurrency } = require('../../util/currency')
const Modules = require('../../infrastructure/Modules')
/**
* @import { Subscription } from "../../../../types/project/dashboard/subscription"
@@ -82,16 +82,16 @@ async function buildUsersSubscriptionViewModel(user, locale = 'en') {
currentInstitutionsWithLicence,
managedInstitutions,
managedPublishers,
paymentRecord,
fetchedPaymentRecord,
plan,
} = await async.auto({
personalSubscription(cb) {
SubscriptionLocator.getUsersSubscription(user, cb)
},
paymentRecord: [
fetchedPaymentRecord: [
'personalSubscription',
({ personalSubscription }, cb) => {
PaymentService.getPaymentFromRecord(personalSubscription, cb)
Modules.hooks.fire('getPaymentFromRecord', personalSubscription, cb)
},
],
plan: [
@@ -138,6 +138,8 @@ async function buildUsersSubscriptionViewModel(user, locale = 'en') {
},
})
const paymentRecord = fetchedPaymentRecord && fetchedPaymentRecord[0]
if (memberGroupSubscriptions == null) {
memberGroupSubscriptions = []
} else {