mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-06 23:59:01 +02:00
Merge pull request #23203 from overleaf/ii-flexible-group-licensing-no-billing-details
[web] FL handle subscriptions with missing billing info GitOrigin-RevId: 34209299c039992a80da5739e086beb5d0ede7b0
This commit is contained in:
@@ -16,6 +16,7 @@ const {
|
||||
RecurlyPlan,
|
||||
RecurlyImmediateCharge,
|
||||
} = require('./RecurlyEntities')
|
||||
const { MissingBillingInfoError } = require('./Errors')
|
||||
|
||||
/**
|
||||
* @import { RecurlySubscriptionChangeRequest } from './RecurlyEntities'
|
||||
@@ -193,7 +194,19 @@ async function resumeSubscriptionByUuid(subscriptionUuid) {
|
||||
* @return {Promise<PaymentMethod>}
|
||||
*/
|
||||
async function getPaymentMethod(userId) {
|
||||
const billingInfo = await client.getBillingInfo(`code-${userId}`)
|
||||
let billingInfo
|
||||
|
||||
try {
|
||||
billingInfo = await client.getBillingInfo(`code-${userId}`)
|
||||
} catch (error) {
|
||||
if (error instanceof recurly.errors.NotFoundError) {
|
||||
throw new MissingBillingInfoError('This account has no billing info', {
|
||||
userId,
|
||||
})
|
||||
}
|
||||
throw error
|
||||
}
|
||||
|
||||
return paymentMethodFromApi(billingInfo)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user