Files
Verso/services/web/app/src/Features/Subscription/Errors.mjs
T
Kristina 4c5cdecffa [web] fix bug where pending downgrades are removed when subscriptions change (#30420)
* preserve pending changes when generating change requests
* re-apply pending term_end changes after immediate updates
* block changes when Stripe subscription has multiple phases
* handle MultiplePendingChangesError & rm PendingChangeError

GitOrigin-RevId: 0af11044766ff48e683d684ad6d62b732d17290c
2026-02-03 09:05:55 +00:00

87 lines
2.1 KiB
JavaScript

// @ts-check
import Errors from '../Errors/Errors.js'
import OError from '@overleaf/o-error'
export class RecurlyTransactionError extends Errors.BackwardCompatibleError {
constructor(options) {
super({
message: 'Unknown transaction error',
...options,
})
}
}
export class DuplicateAddOnError extends OError {}
export class AddOnNotPresentError extends OError {}
export class MissingBillingInfoError extends OError {}
export class ManuallyCollectedError extends OError {}
export class MultiplePendingChangesError extends OError {}
export class InactiveError extends OError {}
export class SubtotalLimitExceededError extends OError {}
export class HasPastDueInvoiceError extends OError {}
export class HasNoAdditionalLicenseWhenManuallyCollectedError extends OError {}
export class InvalidTaxIdError extends OError {}
export class StripeClientIdempotencyKeyInUseError extends OError {
constructor() {
super('Stripe idempotency key was already in use')
}
}
/**
* @typedef {Object} PaymentActionRequiredInfo
* @property {string} PaymentActionRequiredInfo.clientSecret
* @property {string} PaymentActionRequiredInfo.publicKey
*/
export class PaymentActionRequiredError extends OError {
/**
* @param {PaymentActionRequiredInfo} info
*/
constructor(info) {
super('Payment action required', info)
}
}
/**
* @typedef {Object} PaymentFailedInfo
* @property {string} PaymentFailedInfo.subscriptionId
* @property {string} PaymentFailedInfo.reason
* @property {string} PaymentFailedInfo.adviceCode
*/
export class PaymentFailedError extends OError {
/**
* @param {PaymentFailedInfo} info
*/
constructor(info) {
super('Failed to process payment', info)
}
}
export default {
RecurlyTransactionError,
DuplicateAddOnError,
AddOnNotPresentError,
PaymentActionRequiredError,
PaymentFailedError,
MissingBillingInfoError,
ManuallyCollectedError,
MultiplePendingChangesError,
InactiveError,
SubtotalLimitExceededError,
HasPastDueInvoiceError,
HasNoAdditionalLicenseWhenManuallyCollectedError,
InvalidTaxIdError,
StripeClientIdempotencyKeyInUseError,
}