archetecture security fix
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ACCESS_MAP = exports.SUBSCRIPTION_POLICY = void 0;
|
||||
exports.getAccessLevel = getAccessLevel;
|
||||
exports.hasFullAccess = hasFullAccess;
|
||||
exports.hasAnyAccess = hasAnyAccess;
|
||||
exports.SUBSCRIPTION_POLICY = {
|
||||
trial: {
|
||||
durationDays: 14,
|
||||
requiresPaymentMethod: false, // set true when payment capture is mandatory
|
||||
oneTrialPerCompany: true,
|
||||
},
|
||||
payment: {
|
||||
paymentPendingTimeoutDays: 7,
|
||||
retryScheduleDays: [0, 3, 6, 10, 14],
|
||||
maxRetryAttempts: 5,
|
||||
},
|
||||
pastDue: {
|
||||
timeoutDays: 7,
|
||||
},
|
||||
suspension: {
|
||||
cancelAfterDays: 16,
|
||||
},
|
||||
notifications: {
|
||||
trialEndingDaysBefore: [7, 3, 1],
|
||||
paymentFailureDaysAfter: [0, 3, 6],
|
||||
pastDueDaysAfter: [7],
|
||||
suspensionDaysAfter: [14],
|
||||
cancellationDaysAfter: [30],
|
||||
},
|
||||
};
|
||||
exports.ACCESS_MAP = {
|
||||
TRIALING: 'full',
|
||||
ACTIVE: 'full',
|
||||
PAYMENT_PENDING: 'full',
|
||||
UNPAID: 'full',
|
||||
PAST_DUE: 'limited',
|
||||
SUSPENDED: 'read_only',
|
||||
CANCELLED: 'none',
|
||||
EXPIRED: 'none',
|
||||
PAUSED: 'read_only',
|
||||
};
|
||||
function getAccessLevel(status) {
|
||||
return exports.ACCESS_MAP[status] ?? 'none';
|
||||
}
|
||||
function hasFullAccess(status) {
|
||||
return getAccessLevel(status) === 'full';
|
||||
}
|
||||
function hasAnyAccess(status) {
|
||||
return getAccessLevel(status) !== 'none';
|
||||
}
|
||||
//# sourceMappingURL=subscription.policy.js.map
|
||||
Reference in New Issue
Block a user