@antelopejs/dms-saas 0.9.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -25
- package/dist/auth/subscription-access-gate.d.ts +4 -0
- package/dist/auth/subscription-access-gate.js +7 -2
- package/dist/auth/subscription-access-gate.js.map +1 -1
- package/dist/automation/index.d.ts +10 -10
- package/dist/automation/index.js +4 -1
- package/dist/automation/index.js.map +1 -1
- package/dist/data-api/platformOwner/admin-user-invoices.d.ts +3 -3
- package/dist/data-api/platformOwner/admin-user-workspaces.d.ts +3 -3
- package/dist/data-api/platformOwner/credit-note-rows.js +7 -7
- package/dist/data-api/platformOwner/credit-note-rows.js.map +1 -1
- package/dist/data-api/platformOwner/credit-notes.d.ts +4 -4
- package/dist/data-api/platformOwner/features.d.ts +32 -10
- package/dist/data-api/platformOwner/invitations.d.ts +2 -2
- package/dist/data-api/platformOwner/invoice-options.d.ts +1 -1
- package/dist/data-api/platformOwner/invoices.d.ts +6 -6
- package/dist/data-api/platformOwner/members.d.ts +4 -3
- package/dist/data-api/platformOwner/plan-migrations.d.ts +4 -4
- package/dist/data-api/platformOwner/plans.d.ts +7 -7
- package/dist/data-api/platformOwner/segments.d.ts +4 -3
- package/dist/data-api/platformOwner/segments.js.map +1 -1
- package/dist/data-api/platformOwner/table-scope.d.ts +1 -1
- package/dist/data-api/platformOwner/users.d.ts +4 -4
- package/dist/data-api/platformOwner/workspaces.d.ts +5 -5
- package/dist/data-api/tenant/tenant-invoices.d.ts +4 -4
- package/dist/data-api/tenant/tenant-invoices.js +2 -3
- package/dist/data-api/tenant/tenant-invoices.js.map +1 -1
- package/dist/hooks/register.js +2 -1
- package/dist/hooks/register.js.map +1 -1
- package/dist/hooks/tenant-export.d.ts +1 -1
- package/dist/hooks/tenant-export.js.map +1 -1
- package/dist/invoice-line-items/recovery/process.js +7 -8
- package/dist/invoice-line-items/recovery/process.js.map +1 -1
- package/dist/invoice-line-items/recovery/task.model.d.ts +7 -5
- package/dist/metrics/activity-sources.js.map +1 -1
- package/dist/metrics/activity.js +19 -15
- package/dist/metrics/activity.js.map +1 -1
- package/dist/metrics/revenue.js +8 -5
- package/dist/metrics/revenue.js.map +1 -1
- package/dist/notifications/recipients.js +2 -1
- package/dist/notifications/recipients.js.map +1 -1
- package/dist/operator-actions/db/lifecycle-delivery.model.d.ts +7 -5
- package/dist/operator-actions/db/operator-action.model.d.ts +7 -5
- package/dist/operator-actions/journal.js +12 -21
- package/dist/operator-actions/journal.js.map +1 -1
- package/dist/operator-billing/billing-rules.d.ts +4 -1
- package/dist/operator-billing/billing-rules.js +16 -6
- package/dist/operator-billing/billing-rules.js.map +1 -1
- package/dist/operator-billing/legal-documents-store.js +1 -1
- package/dist/operator-billing/legal-documents-store.js.map +1 -1
- package/dist/pages/platform/plans/index.js.map +1 -1
- package/dist/pages/tenant/general.d.ts +1 -0
- package/dist/pages/tenant/general.js +3 -3
- package/dist/pages/tenant/general.js.map +1 -1
- package/dist/plan-changes/deferred.js +1 -1
- package/dist/plan-changes/deferred.js.map +1 -1
- package/dist/plan-changes/pending-target.d.ts +1 -1
- package/dist/plan-changes/pending-target.js +2 -3
- package/dist/plan-changes/pending-target.js.map +1 -1
- package/dist/plans/migration-blocks.js +6 -5
- package/dist/plans/migration-blocks.js.map +1 -1
- package/dist/plans/plan-access-type.d.ts +20 -7
- package/dist/plans/plan-access-type.js +7 -1
- package/dist/plans/plan-access-type.js.map +1 -1
- package/dist/plans/plan-diff.js +19 -14
- package/dist/plans/plan-diff.js.map +1 -1
- package/dist/plans/plan-write.d.ts +7 -4
- package/dist/plans/plan-write.js +28 -5
- package/dist/plans/plan-write.js.map +1 -1
- package/dist/plans/stripe-sync.js +2 -0
- package/dist/plans/stripe-sync.js.map +1 -1
- package/dist/routes/platformOwner/billing-settings.d.ts +7 -3
- package/dist/routes/platformOwner/billing-settings.js +3 -4
- package/dist/routes/platformOwner/billing-settings.js.map +1 -1
- package/dist/routes/platformOwner/billing-stats.js.map +1 -1
- package/dist/routes/platformOwner/credit-notes-issue.js +3 -4
- package/dist/routes/platformOwner/credit-notes-issue.js.map +1 -1
- package/dist/routes/platformOwner/plan-migrations.js +3 -3
- package/dist/routes/platformOwner/plan-migrations.js.map +1 -1
- package/dist/routes/platformOwner/plans.d.ts +26 -0
- package/dist/routes/platformOwner/plans.js +6 -2
- package/dist/routes/platformOwner/plans.js.map +1 -1
- package/dist/routes/platformOwner/segments.d.ts +2 -1
- package/dist/routes/platformOwner/segments.js.map +1 -1
- package/dist/routes/platformOwner/workspace-operator-actions.d.ts +6 -5
- package/dist/routes/platformOwner/workspace-operator-actions.js.map +1 -1
- package/dist/routes/public/public-plan-catalog.d.ts +2 -1
- package/dist/routes/public/public-plan-catalog.js.map +1 -1
- package/dist/routes/public/register.js +3 -1
- package/dist/routes/public/register.js.map +1 -1
- package/dist/routes/tenant/billing-pay-invoice.d.ts +3 -4
- package/dist/routes/tenant/billing-pay-invoice.js +15 -17
- package/dist/routes/tenant/billing-pay-invoice.js.map +1 -1
- package/dist/routes/tenant/billing-portal.d.ts +3 -5
- package/dist/routes/tenant/billing-portal.js +13 -12
- package/dist/routes/tenant/billing-portal.js.map +1 -1
- package/dist/routes/tenant/billing-self-refund.d.ts +4 -3
- package/dist/routes/tenant/billing-self-refund.js +38 -33
- package/dist/routes/tenant/billing-self-refund.js.map +1 -1
- package/dist/routes/tenant/complimentary-banner.d.ts +3 -3
- package/dist/routes/tenant/complimentary-banner.js +4 -6
- package/dist/routes/tenant/complimentary-banner.js.map +1 -1
- package/dist/routes/tenant/tenant-billing.d.ts +3 -3
- package/dist/routes/tenant/tenant-billing.js +10 -11
- package/dist/routes/tenant/tenant-billing.js.map +1 -1
- package/dist/routes/tenant/tenant-plan-authentication.d.ts +1 -1
- package/dist/routes/tenant/tenant-plan-authentication.js +4 -4
- package/dist/routes/tenant/tenant-plan-authentication.js.map +1 -1
- package/dist/routes/tenant/tenant-plan-cancellation.d.ts +2 -3
- package/dist/routes/tenant/tenant-plan-cancellation.js +9 -7
- package/dist/routes/tenant/tenant-plan-cancellation.js.map +1 -1
- package/dist/routes/tenant/tenant-plan-checkout.js +18 -16
- package/dist/routes/tenant/tenant-plan-checkout.js.map +1 -1
- package/dist/routes/tenant/tenant-plan-ops.js +9 -8
- package/dist/routes/tenant/tenant-plan-ops.js.map +1 -1
- package/dist/routes/tenant/tenant-plan.d.ts +9 -8
- package/dist/routes/tenant/tenant-plan.js +25 -30
- package/dist/routes/tenant/tenant-plan.js.map +1 -1
- package/dist/routes/tenant/tenant-seats.d.ts +2 -3
- package/dist/routes/tenant/tenant-seats.js +4 -6
- package/dist/routes/tenant/tenant-seats.js.map +1 -1
- package/dist/routes/tenant/workspace-access.js +1 -1
- package/dist/routes/tenant/workspace-access.js.map +1 -1
- package/dist/stripe/availability.d.ts +0 -1
- package/dist/stripe/availability.js +2 -5
- package/dist/stripe/availability.js.map +1 -1
- package/dist/stripe/customer-billing.js +9 -9
- package/dist/stripe/customer-billing.js.map +1 -1
- package/dist/stripe/sync-plan.js +16 -7
- package/dist/stripe/sync-plan.js.map +1 -1
- package/dist/stripe/webhook-handlers.js +4 -1
- package/dist/stripe/webhook-handlers.js.map +1 -1
- package/dist/stripe/webhook-shared.d.ts +5 -1
- package/dist/stripe/webhook-shared.js +1 -1
- package/dist/stripe/webhook-shared.js.map +1 -1
- package/dist/stripe/workspace-checkout.d.ts +1 -1
- package/dist/stripe/workspace-checkout.js +6 -12
- package/dist/stripe/workspace-checkout.js.map +1 -1
- package/dist/upcoming-invoice/db/preview-cache.model.d.ts +7 -5
- package/dist/upcoming-invoice/invalidation.js +1 -1
- package/dist/upcoming-invoice/invalidation.js.map +1 -1
- package/dist/upcoming-invoice/pricing.js +2 -11
- package/dist/upcoming-invoice/pricing.js.map +1 -1
- package/dist/utils/parse-future-date.d.ts +2 -1
- package/dist/utils/parse-future-date.js.map +1 -1
- package/dist/utils/rejection-reasons.d.ts +1 -0
- package/dist/utils/rejection-reasons.js +12 -0
- package/dist/utils/rejection-reasons.js.map +1 -0
- package/dist/utils/row-instance.js +5 -1
- package/dist/utils/row-instance.js.map +1 -1
- package/dist/utils/segment-conditions-type.d.ts +8 -9
- package/dist/utils/segment-conditions-type.js +2 -1
- package/dist/utils/segment-conditions-type.js.map +1 -1
- package/dist/utils/segment-evaluator.d.ts +7 -3
- package/dist/utils/segment-evaluator.js +49 -33
- package/dist/utils/segment-evaluator.js.map +1 -1
- package/dist/utils/segment-explain.d.ts +2 -1
- package/dist/utils/segment-explain.js.map +1 -1
- package/dist/utils/segment-matching.d.ts +2 -2
- package/dist/utils/segment-preview.js.map +1 -1
- package/dist/utils/segment-validation.d.ts +5 -4
- package/dist/utils/segment-validation.js +57 -32
- package/dist/utils/segment-validation.js.map +1 -1
- package/dist/utils/status-vocabulary.js +2 -1
- package/dist/utils/status-vocabulary.js.map +1 -1
- package/dist/utils/zod-json.d.ts +3 -0
- package/dist/utils/zod-json.js +21 -0
- package/dist/utils/zod-json.js.map +1 -0
- package/dist/workers/plan-migration.js +6 -1
- package/dist/workers/plan-migration.js.map +1 -1
- package/dist/workspaces/billing-identity.d.ts +1 -1
- package/dist/workspaces/billing-identity.js +5 -3
- package/dist/workspaces/billing-identity.js.map +1 -1
- package/dist/workspaces/db/provisioning-attempt.model.d.ts +7 -5
- package/dist/workspaces/db/trial-identity.model.d.ts +7 -5
- package/dist/workspaces/default-member-role.js +14 -10
- package/dist/workspaces/default-member-role.js.map +1 -1
- package/dist/workspaces/operator-creation.d.ts +6 -5
- package/dist/workspaces/operator-creation.js.map +1 -1
- package/dist/workspaces/owner-invitation-email.js.map +1 -1
- package/dist/workspaces/registration-extras.d.ts +2 -1
- package/dist/workspaces/registration-extras.js.map +1 -1
- package/frontend-vue/package.json +1 -1
- package/package.json +15 -15
- package/skills/dms-saas/SKILL.md +2 -1
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type RequestContext } from "@antelopejs/interface-api";
|
|
2
2
|
import type { User } from "@antelopejs/interface-dms/auth/db";
|
|
3
|
-
import { type Invoice
|
|
3
|
+
import { type Invoice } from "../../db";
|
|
4
4
|
export interface PayInvoiceResult {
|
|
5
5
|
status: string | null;
|
|
6
6
|
}
|
|
7
7
|
export declare function isPayableInvoice(invoice: Invoice | undefined): boolean;
|
|
8
|
-
export declare function toPaymentFailure(error: unknown): HTTPResult;
|
|
9
8
|
declare const SaasBillingPayInvoiceController_base: import("@antelopejs/interface-api").ControllerClass<object>;
|
|
10
9
|
export declare class SaasBillingPayInvoiceController extends SaasBillingPayInvoiceController_base {
|
|
11
|
-
payInvoice(_user: User, invoiceId: string,
|
|
10
|
+
payInvoice(_user: User, invoiceId: string, ctx: RequestContext): Promise<PayInvoiceResult>;
|
|
12
11
|
}
|
|
13
12
|
export {};
|
|
@@ -17,12 +17,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.SaasBillingPayInvoiceController = void 0;
|
|
19
19
|
exports.isPayableInvoice = isPayableInvoice;
|
|
20
|
-
exports.toPaymentFailure = toPaymentFailure;
|
|
21
20
|
const interface_api_1 = require("@antelopejs/interface-api");
|
|
22
21
|
const interface_api_util_1 = require("@antelopejs/interface-api-util");
|
|
22
|
+
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
23
23
|
const logging_1 = require("@antelopejs/interface-core/logging");
|
|
24
|
+
const request_tenant_1 = require("@antelopejs/interface-dms/request-tenant");
|
|
24
25
|
const guards_1 = require("@antelopejs/interface-dms/guards");
|
|
25
|
-
const tenant_scoped_model_1 = require("@antelopejs/interface-dms/tenant-scoped-model");
|
|
26
26
|
const stripe_1 = __importDefault(require("stripe"));
|
|
27
27
|
const db_1 = require("../../db");
|
|
28
28
|
const client_1 = require("../../stripe/client");
|
|
@@ -43,17 +43,11 @@ function assertPayableSubscription(subscription) {
|
|
|
43
43
|
(0, interface_api_util_1.assert)(subscription?.stripeCustomerId &&
|
|
44
44
|
!(0, complimentary_1.isComplimentarySubscription)(subscription), HTTP_BAD_REQUEST, "saas.errors.workspace.no_stripe_customer");
|
|
45
45
|
}
|
|
46
|
-
function toPaymentFailure(error) {
|
|
47
|
-
if (error instanceof stripe_1.default.errors.StripeCardError) {
|
|
48
|
-
return new interface_api_1.HTTPResult(HTTP_PAYMENT_REQUIRED, "saas.errors.billing.payment_declined");
|
|
49
|
-
}
|
|
50
|
-
if (error instanceof stripe_1.default.errors.StripeInvalidRequestError) {
|
|
51
|
-
return new interface_api_1.HTTPResult(HTTP_CONFLICT, "saas.errors.invoice.not_payable");
|
|
52
|
-
}
|
|
53
|
-
return new interface_api_1.HTTPResult(HTTP_SERVICE_UNAVAILABLE, "saas.errors.billing.payment_unavailable");
|
|
54
|
-
}
|
|
55
46
|
class SaasBillingPayInvoiceController extends (0, interface_api_1.Controller)("/api/saas/billing") {
|
|
56
|
-
async payInvoice(_user, invoiceId,
|
|
47
|
+
async payInvoice(_user, invoiceId, ctx) {
|
|
48
|
+
const tenantId = (0, request_tenant_1.getRequestTenantId)(ctx);
|
|
49
|
+
const invoiceModel = (0, interface_database_decorators_1.GetModel)(db_1.InvoiceModel, tenantId);
|
|
50
|
+
const tenantSubscriptionModel = (0, interface_database_decorators_1.GetModel)(db_1.TenantSubscriptionModel, tenantId);
|
|
57
51
|
assertPayableSubscription(await tenantSubscriptionModel.findOne());
|
|
58
52
|
const invoice = await invoiceModel.get(invoiceId);
|
|
59
53
|
(0, interface_api_util_1.assert)(invoice && isPayableInvoice(invoice), HTTP_CONFLICT, "saas.errors.invoice.not_payable");
|
|
@@ -63,7 +57,13 @@ class SaasBillingPayInvoiceController extends (0, interface_api_1.Controller)("/
|
|
|
63
57
|
}
|
|
64
58
|
catch (error) {
|
|
65
59
|
logging_1.Logging.Warn(`${LOG_PREFIX} payment of ${invoice.stripeInvoiceId} failed`, error);
|
|
66
|
-
|
|
60
|
+
if (error instanceof stripe_1.default.errors.StripeCardError) {
|
|
61
|
+
throw new interface_api_1.HTTPResult(HTTP_PAYMENT_REQUIRED, "saas.errors.billing.payment_declined");
|
|
62
|
+
}
|
|
63
|
+
if (error instanceof stripe_1.default.errors.StripeInvalidRequestError) {
|
|
64
|
+
throw new interface_api_1.HTTPResult(HTTP_CONFLICT, "saas.errors.invoice.not_payable");
|
|
65
|
+
}
|
|
66
|
+
throw new interface_api_1.HTTPResult(HTTP_SERVICE_UNAVAILABLE, "saas.errors.billing.payment_unavailable");
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -72,11 +72,9 @@ __decorate([
|
|
|
72
72
|
(0, interface_api_1.Post)("/invoices/:invoiceId/pay"),
|
|
73
73
|
__param(0, (0, guards_1.AuthTenantOwner)({ bypassTenantAccessGate: true })),
|
|
74
74
|
__param(1, (0, interface_api_1.Parameter)("invoiceId")),
|
|
75
|
-
__param(2, (0,
|
|
76
|
-
__param(3, (0, tenant_scoped_model_1.TenantScopedModel)(db_1.TenantSubscriptionModel)),
|
|
75
|
+
__param(2, (0, interface_api_1.Context)()),
|
|
77
76
|
__metadata("design:type", Function),
|
|
78
|
-
__metadata("design:paramtypes", [Function, String,
|
|
79
|
-
db_1.TenantSubscriptionModel]),
|
|
77
|
+
__metadata("design:paramtypes", [Function, String, Object]),
|
|
80
78
|
__metadata("design:returntype", Promise)
|
|
81
79
|
], SaasBillingPayInvoiceController.prototype, "payInvoice", null);
|
|
82
80
|
//# sourceMappingURL=billing-pay-invoice.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing-pay-invoice.js","sourceRoot":"","sources":["../../../src/routes/tenant/billing-pay-invoice.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"billing-pay-invoice.js","sourceRoot":"","sources":["../../../src/routes/tenant/billing-pay-invoice.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAuCA,4CAMC;AA7CD,6DAOmC;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AAS,CAAC,CAAC;QAClD,IAAA,2BAAM,EACJ,OAAO,IAAI,gBAAgB,CAAC,OAAO,CAAC,EACpC,aAAa,EACb,iCAAiC,CAClC,CAAC;QACF,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,IAAA,wBAAe,GAAE,CAAC,QAAQ,CAAC,GAAG,CAC/C,OAAO,CAAC,eAAe,CACxB,CAAC;YACF,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC;QACzC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,iBAAO,CAAC,IAAI,CACV,GAAG,UAAU,eAAe,OAAO,CAAC,eAAe,SAAS,EAC5D,KAAK,CACN,CAAC;YACF,IAAI,KAAK,YAAY,gBAAM,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC;gBACnD,MAAM,IAAI,0BAAU,CAClB,qBAAqB,EACrB,sCAAsC,CACvC,CAAC;YACJ,CAAC;YACD,IAAI,KAAK,YAAY,gBAAM,CAAC,MAAM,CAAC,yBAAyB,EAAE,CAAC;gBAC7D,MAAM,IAAI,0BAAU,CAAC,aAAa,EAAE,iCAAiC,CAAC,CAAC;YACzE,CAAC;YACD,MAAM,IAAI,0BAAU,CAClB,wBAAwB,EACxB,yCAAyC,CAC1C,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAjDD,0EAiDC;AAxCO;IADL,IAAA,oBAAI,EAAC,0BAA0B,CAAC;IAE9B,WAAA,IAAA,wBAAe,EAAC,EAAE,sBAAsB,EAAE,IAAI,EAAE,CAAC,CAAA;IACjD,WAAA,IAAA,yBAAS,EAAC,WAAW,CAAC,CAAA;IACtB,WAAA,IAAA,uBAAO,GAAE,CAAA;;;;iEAoCX"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { type RequestContext } from "@antelopejs/interface-api";
|
|
2
|
-
import { TenantMemberModel } from "@antelopejs/interface-dms/db";
|
|
3
2
|
import type { User } from "@antelopejs/interface-dms/auth/db";
|
|
4
3
|
import { type PaymentMethodSummary, type UnpaidInvoiceRef, type UnpaidInvoiceSummary } from "../../billing-state";
|
|
5
4
|
import type { TenantSubscriptionStatus } from "../../db";
|
|
6
|
-
import { TenantSubscriptionModel } from "../../db";
|
|
7
5
|
import { type WorkspaceOwnerContact } from "../../workspaces/owner-contact";
|
|
8
6
|
interface PortalSessionBody {
|
|
9
7
|
returnUrl: string;
|
|
@@ -27,9 +25,9 @@ interface WorkspaceAccess {
|
|
|
27
25
|
}
|
|
28
26
|
declare const SaasBillingPortalController_base: import("@antelopejs/interface-api").ControllerClass<object>;
|
|
29
27
|
export declare class SaasBillingPortalController extends SaasBillingPortalController_base {
|
|
30
|
-
getWorkspaceAccess(ctx: RequestContext, user: User
|
|
31
|
-
getStatus(ctx: RequestContext, user: User
|
|
32
|
-
createPortalSession(_user: User, body: PortalSessionBody,
|
|
28
|
+
getWorkspaceAccess(ctx: RequestContext, user: User): Promise<WorkspaceAccess>;
|
|
29
|
+
getStatus(ctx: RequestContext, user: User): Promise<BillingStatus>;
|
|
30
|
+
createPortalSession(_user: User, body: PortalSessionBody, ctx: RequestContext): Promise<{
|
|
33
31
|
url: string;
|
|
34
32
|
}>;
|
|
35
33
|
}
|
|
@@ -15,10 +15,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.SaasBillingPortalController = void 0;
|
|
16
16
|
const interface_api_1 = require("@antelopejs/interface-api");
|
|
17
17
|
const interface_api_util_1 = require("@antelopejs/interface-api-util");
|
|
18
|
+
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
18
19
|
const db_1 = require("@antelopejs/interface-dms/db");
|
|
19
20
|
const guards_1 = require("@antelopejs/interface-dms/guards");
|
|
20
21
|
const request_tenant_1 = require("@antelopejs/interface-dms/request-tenant");
|
|
21
|
-
const tenant_scoped_model_1 = require("@antelopejs/interface-dms/tenant-scoped-model");
|
|
22
22
|
const auth_1 = require("../../auth");
|
|
23
23
|
const billing_state_1 = require("../../billing-state");
|
|
24
24
|
const config_1 = require("../../config");
|
|
@@ -54,8 +54,9 @@ async function loadOwnerDetails(tenantId, subscription) {
|
|
|
54
54
|
return { paymentMethod, unpaidInvoice, scheduledCancellationAt };
|
|
55
55
|
}
|
|
56
56
|
class SaasBillingPortalController extends (0, interface_api_1.Controller)("/api/saas/billing") {
|
|
57
|
-
async getWorkspaceAccess(ctx, user
|
|
57
|
+
async getWorkspaceAccess(ctx, user) {
|
|
58
58
|
const tenantId = (0, request_tenant_1.getRequestTenantId)(ctx);
|
|
59
|
+
const tenantMemberModel = (0, interface_database_decorators_1.GetModel)(db_1.TenantMemberModel, tenantId);
|
|
59
60
|
const { blocked, status } = await (0, auth_1.isTenantSubscriptionBlocked)(tenantId);
|
|
60
61
|
const membership = await tenantMemberModel.getByUser(user._id);
|
|
61
62
|
const isTenantOwner = !!membership?.isTenantOwner;
|
|
@@ -69,8 +70,10 @@ class SaasBillingPortalController extends (0, interface_api_1.Controller)("/api/
|
|
|
69
70
|
: null,
|
|
70
71
|
};
|
|
71
72
|
}
|
|
72
|
-
async getStatus(ctx, user
|
|
73
|
+
async getStatus(ctx, user) {
|
|
73
74
|
const tenantId = (0, request_tenant_1.getRequestTenantId)(ctx);
|
|
75
|
+
const tenantSubscriptionModel = (0, interface_database_decorators_1.GetModel)(db_2.TenantSubscriptionModel, tenantId);
|
|
76
|
+
const tenantMemberModel = (0, interface_database_decorators_1.GetModel)(db_1.TenantMemberModel, tenantId);
|
|
74
77
|
const [subscription, membership, workspaceOwner] = await Promise.all([
|
|
75
78
|
tenantSubscriptionModel.findOne(),
|
|
76
79
|
tenantMemberModel.getByUser(user._id),
|
|
@@ -89,7 +92,9 @@ class SaasBillingPortalController extends (0, interface_api_1.Controller)("/api/
|
|
|
89
92
|
}
|
|
90
93
|
return { ...base, ...(await loadOwnerDetails(tenantId, subscription)) };
|
|
91
94
|
}
|
|
92
|
-
async createPortalSession(_user, body,
|
|
95
|
+
async createPortalSession(_user, body, ctx) {
|
|
96
|
+
const tenantId = (0, request_tenant_1.getRequestTenantId)(ctx);
|
|
97
|
+
const tenantSubscriptionModel = (0, interface_database_decorators_1.GetModel)(db_2.TenantSubscriptionModel, tenantId);
|
|
93
98
|
(0, interface_api_util_1.assert)(await (0, config_1.isAllowedRedirectUrl)(body.returnUrl), HTTP_BAD_REQUEST, "saas.errors.billing.invalid_return_url");
|
|
94
99
|
const subscription = await tenantSubscriptionModel.findOne();
|
|
95
100
|
(0, interface_api_util_1.assert)(subscription?.stripeCustomerId &&
|
|
@@ -107,29 +112,25 @@ __decorate([
|
|
|
107
112
|
(0, interface_api_1.Get)("/access"),
|
|
108
113
|
__param(0, (0, interface_api_1.Context)()),
|
|
109
114
|
__param(1, (0, guards_1.AuthTenantMember)({ bypassTenantAccessGate: true })),
|
|
110
|
-
__param(2, (0, tenant_scoped_model_1.TenantScopedModel)(db_1.TenantMemberModel)),
|
|
111
115
|
__metadata("design:type", Function),
|
|
112
|
-
__metadata("design:paramtypes", [Object, Function
|
|
116
|
+
__metadata("design:paramtypes", [Object, Function]),
|
|
113
117
|
__metadata("design:returntype", Promise)
|
|
114
118
|
], SaasBillingPortalController.prototype, "getWorkspaceAccess", null);
|
|
115
119
|
__decorate([
|
|
116
120
|
(0, interface_api_1.Get)("/status"),
|
|
117
121
|
__param(0, (0, interface_api_1.Context)()),
|
|
118
122
|
__param(1, (0, guards_1.AuthTenantMember)({ bypassTenantAccessGate: true })),
|
|
119
|
-
__param(2, (0, tenant_scoped_model_1.TenantScopedModel)(db_2.TenantSubscriptionModel)),
|
|
120
|
-
__param(3, (0, tenant_scoped_model_1.TenantScopedModel)(db_1.TenantMemberModel)),
|
|
121
123
|
__metadata("design:type", Function),
|
|
122
|
-
__metadata("design:paramtypes", [Object, Function,
|
|
123
|
-
db_1.TenantMemberModel]),
|
|
124
|
+
__metadata("design:paramtypes", [Object, Function]),
|
|
124
125
|
__metadata("design:returntype", Promise)
|
|
125
126
|
], SaasBillingPortalController.prototype, "getStatus", null);
|
|
126
127
|
__decorate([
|
|
127
128
|
(0, interface_api_1.Post)("/portal-session"),
|
|
128
129
|
__param(0, (0, guards_1.AuthTenantOwner)({ bypassTenantAccessGate: true })),
|
|
129
130
|
__param(1, (0, interface_api_1.JSONBody)()),
|
|
130
|
-
__param(2, (0,
|
|
131
|
+
__param(2, (0, interface_api_1.Context)()),
|
|
131
132
|
__metadata("design:type", Function),
|
|
132
|
-
__metadata("design:paramtypes", [Function, Object,
|
|
133
|
+
__metadata("design:paramtypes", [Function, Object, Object]),
|
|
133
134
|
__metadata("design:returntype", Promise)
|
|
134
135
|
], SaasBillingPortalController.prototype, "createPortalSession", null);
|
|
135
136
|
//# sourceMappingURL=billing-portal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing-portal.js","sourceRoot":"","sources":["../../../src/routes/tenant/billing-portal.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAOmC;AACnC,uEAAwD;AACxD,qDAAiE;AACjE,6DAG0C;AAC1C,6EAA8E;
|
|
1
|
+
{"version":3,"file":"billing-portal.js","sourceRoot":"","sources":["../../../src/routes/tenant/billing-portal.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAOmC;AACnC,uEAAwD;AACxD,6FAAqE;AACrE,qDAAiE;AACjE,6DAG0C;AAC1C,6EAA8E;AAE9E,qCAAyD;AACzD,uDAO6B;AAC7B,yCAAoD;AAEpD,iCAAmD;AACnD,yCAA2E;AAC3E,kEAA0E;AAC1E,kEAA6E;AAC7E,kEAGwC;AAExC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAA2B;IAC7D,UAAU;IACV,WAAW;CACZ,CAAC,CAAC;AAqBH,MAAM,gBAAgB,GAAwB;IAC5C,aAAa,EAAE,IAAI;IACnB,aAAa,EAAE,IAAI;IACnB,uBAAuB,EAAE,IAAI;CAC9B,CAAC;AAOF,SAAS,iBA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EAkBpD;AAQK;IADL,IAAA,mBAAG,EAAC,SAAS,CAAC;IAEZ,WAAA,IAAA,uBAAO,GAAE,CAAA;IACT,WAAA,IAAA,yBAAgB,EAAC,EAAE,sBAAsB,EAAE,IAAI,EAAE,CAAC,CAAA;;;;4DAsBpD;AAGK;IADL,IAAA,oBAAI,EAAC,iBAAiB,CAAC;IAErB,WAAA,IAAA,wBAAe,EAAC,EAAE,sBAAsB,EAAE,IAAI,EAAE,CAAC,CAAA;IACjD,WAAA,IAAA,wBAAQ,GAAE,CAAA;IACV,WAAA,IAAA,uBAAO,GAAE,CAAA;;;;sEAwBX"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { type RequestContext } from "@antelopejs/interface-api";
|
|
1
2
|
import type { User } from "@antelopejs/interface-dms/auth/db";
|
|
2
3
|
import type Stripe from "stripe";
|
|
3
|
-
import { BillingSettingsModel
|
|
4
|
+
import { BillingSettingsModel } from "../../db";
|
|
4
5
|
export interface EligibleInvoice {
|
|
5
6
|
id: string;
|
|
6
7
|
amountPaid: number;
|
|
@@ -35,8 +36,8 @@ export declare function chargedInvoicesInWindow(invoices: Stripe.Invoice[], wind
|
|
|
35
36
|
export declare function toEligibilityResponse(eligibility: RefundEligibility, refundedAt: Date | null): RefundEligibilityResponse;
|
|
36
37
|
declare const SaasBillingSelfRefundController_base: import("@antelopejs/interface-api").ControllerClass<object>;
|
|
37
38
|
export declare class SaasBillingSelfRefundController extends SaasBillingSelfRefundController_base {
|
|
38
|
-
getRefundEligibility(_user: User, billingSettingsModel: BillingSettingsModel,
|
|
39
|
-
requestSelfRefund(_user: User, billingSettingsModel: BillingSettingsModel,
|
|
39
|
+
getRefundEligibility(_user: User, billingSettingsModel: BillingSettingsModel, ctx: RequestContext): Promise<RefundEligibilityResponse>;
|
|
40
|
+
requestSelfRefund(_user: User, billingSettingsModel: BillingSettingsModel, ctx: RequestContext): Promise<{
|
|
40
41
|
refunded: number;
|
|
41
42
|
}>;
|
|
42
43
|
}
|
|
@@ -19,8 +19,8 @@ exports.toEligibilityResponse = toEligibilityResponse;
|
|
|
19
19
|
const interface_api_1 = require("@antelopejs/interface-api");
|
|
20
20
|
const interface_api_util_1 = require("@antelopejs/interface-api-util");
|
|
21
21
|
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
22
|
+
const request_tenant_1 = require("@antelopejs/interface-dms/request-tenant");
|
|
22
23
|
const guards_1 = require("@antelopejs/interface-dms/guards");
|
|
23
|
-
const tenant_scoped_model_1 = require("@antelopejs/interface-dms/tenant-scoped-model");
|
|
24
24
|
const db_1 = require("../../db");
|
|
25
25
|
const stripe_1 = require("../../stripe");
|
|
26
26
|
const credit_note_request_1 = require("../../operator-billing/credit-note-request");
|
|
@@ -39,28 +39,31 @@ const REASON_NO_SUBSCRIPTION = "no_subscription";
|
|
|
39
39
|
const REASON_ALREADY_PROCESSED = "already_processed";
|
|
40
40
|
const REASON_NO_INVOICE = "no_invoice";
|
|
41
41
|
const REASON_WINDOW_EXPIRED = "window_expired";
|
|
42
|
-
const REASON_TO_ERROR =
|
|
43
|
-
[
|
|
44
|
-
|
|
45
|
-
message: "saas.errors.refund.not_enabled",
|
|
46
|
-
|
|
47
|
-
[
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
code:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
code:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
42
|
+
const REASON_TO_ERROR = new Map([
|
|
43
|
+
[
|
|
44
|
+
REASON_NOT_ENABLED,
|
|
45
|
+
{ code: HTTP_FORBIDDEN, message: "saas.errors.refund.not_enabled" },
|
|
46
|
+
],
|
|
47
|
+
[
|
|
48
|
+
REASON_NO_SUBSCRIPTION,
|
|
49
|
+
{
|
|
50
|
+
code: HTTP_BAD_REQUEST,
|
|
51
|
+
message: "saas.errors.workspace.no_active_subscription",
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
[
|
|
55
|
+
REASON_ALREADY_PROCESSED,
|
|
56
|
+
{ code: HTTP_CONFLICT, message: "saas.errors.refund.already_processed" },
|
|
57
|
+
],
|
|
58
|
+
[
|
|
59
|
+
REASON_NO_INVOICE,
|
|
60
|
+
{ code: HTTP_NOT_FOUND, message: "saas.errors.invoice.no_paid_found" },
|
|
61
|
+
],
|
|
62
|
+
[
|
|
63
|
+
REASON_WINDOW_EXPIRED,
|
|
64
|
+
{ code: HTTP_FORBIDDEN, message: "saas.errors.refund.window_expired" },
|
|
65
|
+
],
|
|
66
|
+
]);
|
|
64
67
|
function isCharged(invoice) {
|
|
65
68
|
return invoice.amount_paid > 0;
|
|
66
69
|
}
|
|
@@ -103,7 +106,7 @@ async function listPaidInvoices(stripeCustomerId) {
|
|
|
103
106
|
function toEligibleInvoice(invoice) {
|
|
104
107
|
const line = invoice.lines?.data?.[0];
|
|
105
108
|
return {
|
|
106
|
-
id: invoice
|
|
109
|
+
id: (0, stripe_1.requireInvoiceId)(invoice),
|
|
107
110
|
amountPaid: invoice.amount_paid,
|
|
108
111
|
refundable: Math.max(0, invoice.amount_paid - (invoice.post_payment_credit_notes_amount ?? 0)),
|
|
109
112
|
created: createdAt(invoice),
|
|
@@ -194,19 +197,23 @@ async function issueRefundAndCancel(subscriptionId, stripeSubscriptionId, refund
|
|
|
194
197
|
}
|
|
195
198
|
}
|
|
196
199
|
class SaasBillingSelfRefundController extends (0, interface_api_1.Controller)("/api/saas/billing") {
|
|
197
|
-
async getRefundEligibility(_user, billingSettingsModel,
|
|
200
|
+
async getRefundEligibility(_user, billingSettingsModel, ctx) {
|
|
201
|
+
const tenantId = (0, request_tenant_1.getRequestTenantId)(ctx);
|
|
202
|
+
const tenantSubscriptionModel = (0, interface_database_decorators_1.GetModel)(db_1.TenantSubscriptionModel, tenantId);
|
|
198
203
|
const settings = await (0, billing_settings_store_1.loadBillingSettings)(billingSettingsModel);
|
|
199
204
|
const subscription = await tenantSubscriptionModel.findOne();
|
|
200
205
|
const eligibility = await resolveRefundEligibility(settings, subscription);
|
|
201
206
|
return toEligibilityResponse(eligibility, subscription?.refundRequestedAt ?? null);
|
|
202
207
|
}
|
|
203
|
-
async requestSelfRefund(_user, billingSettingsModel,
|
|
208
|
+
async requestSelfRefund(_user, billingSettingsModel, ctx) {
|
|
209
|
+
const tenantId = (0, request_tenant_1.getRequestTenantId)(ctx);
|
|
210
|
+
const tenantSubscriptionModel = (0, interface_database_decorators_1.GetModel)(db_1.TenantSubscriptionModel, tenantId);
|
|
204
211
|
const settings = await (0, billing_settings_store_1.loadBillingSettings)(billingSettingsModel);
|
|
205
212
|
const subscription = await tenantSubscriptionModel.findOne();
|
|
206
213
|
const eligibility = await resolveRefundEligibility(settings, subscription);
|
|
207
214
|
const error = eligibility.eligible
|
|
208
215
|
? null
|
|
209
|
-
: REASON_TO_ERROR
|
|
216
|
+
: REASON_TO_ERROR.get(eligibility.reason ?? "");
|
|
210
217
|
(0, interface_api_util_1.assert)(eligibility.eligible, error?.code ?? HTTP_BAD_REQUEST, error?.message ?? "saas.errors.refund.not_eligible");
|
|
211
218
|
(0, interface_api_util_1.assert)(eligibility.invoice && subscription?.stripeSubscriptionId, HTTP_BAD_REQUEST, "saas.errors.workspace.no_active_subscription");
|
|
212
219
|
const claimed = await tenantSubscriptionModel.claimSelfRefund(subscription._id);
|
|
@@ -229,20 +236,18 @@ __decorate([
|
|
|
229
236
|
(0, interface_api_1.Get)("/refund-eligibility"),
|
|
230
237
|
__param(0, (0, guards_1.AuthTenantOwner)({ bypassTenantAccessGate: true })),
|
|
231
238
|
__param(1, (0, interface_database_decorators_1.Model)(db_1.BillingSettingsModel)),
|
|
232
|
-
__param(2, (0,
|
|
239
|
+
__param(2, (0, interface_api_1.Context)()),
|
|
233
240
|
__metadata("design:type", Function),
|
|
234
|
-
__metadata("design:paramtypes", [Function, db_1.BillingSettingsModel,
|
|
235
|
-
db_1.TenantSubscriptionModel]),
|
|
241
|
+
__metadata("design:paramtypes", [Function, db_1.BillingSettingsModel, Object]),
|
|
236
242
|
__metadata("design:returntype", Promise)
|
|
237
243
|
], SaasBillingSelfRefundController.prototype, "getRefundEligibility", null);
|
|
238
244
|
__decorate([
|
|
239
245
|
(0, interface_api_1.Post)("/refund-self"),
|
|
240
246
|
__param(0, (0, guards_1.AuthTenantOwner)()),
|
|
241
247
|
__param(1, (0, interface_database_decorators_1.Model)(db_1.BillingSettingsModel)),
|
|
242
|
-
__param(2, (0,
|
|
248
|
+
__param(2, (0, interface_api_1.Context)()),
|
|
243
249
|
__metadata("design:type", Function),
|
|
244
|
-
__metadata("design:paramtypes", [Function, db_1.BillingSettingsModel,
|
|
245
|
-
db_1.TenantSubscriptionModel]),
|
|
250
|
+
__metadata("design:paramtypes", [Function, db_1.BillingSettingsModel, Object]),
|
|
246
251
|
__metadata("design:returntype", Promise)
|
|
247
252
|
], SaasBillingSelfRefundController.prototype, "requestSelfRefund", null);
|
|
248
253
|
//# sourceMappingURL=billing-self-refund.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing-self-refund.js","sourceRoot":"","sources":["../../../src/routes/tenant/billing-self-refund.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"billing-self-refund.js","sourceRoot":"","sources":["../../../src/routes/tenant/billing-self-refund.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAsIA,kDAUC;AAUD,0DAaC;AAqHD,sDAkBC;AA9SD,6DAMmC;AACnC,uEAAwD;AACxD,6FAA4E;AAC5E,6EAA8E;AAC9E,6DAAmE;AAInE,iCAAyE;AACzE,yCAKsB;AACtB,oFAAkF;AAClF,2CAA8C;AAC9C,0FAAoF;AAEpF,MAAM,iBAAiB,GAAG,sBAAsB,CAAC;AACjD,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,MAAM,cAAc,G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BAAoB,CAAC,CAAA;IAC3B,WAAA,IAAA,uBAAO,GAAE,CAAA;;+CADyC,yBAAoB;;wEAyCxE"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { type RequestContext } from "@antelopejs/interface-api";
|
|
2
|
-
import {
|
|
2
|
+
import { TenantModel } from "@antelopejs/interface-dms/db";
|
|
3
3
|
import type { BannerContent } from "@antelopejs/interface-dms/base";
|
|
4
4
|
import type { User } from "@antelopejs/interface-dms/auth/db";
|
|
5
|
-
import { PlanModel
|
|
5
|
+
import { PlanModel } from "../../db";
|
|
6
6
|
declare const SaasTenantComplimentaryBannerController_base: import("@antelopejs/interface-api").ControllerClass<object>;
|
|
7
7
|
export declare class SaasTenantComplimentaryBannerController extends SaasTenantComplimentaryBannerController_base {
|
|
8
8
|
planModel: PlanModel;
|
|
9
9
|
tenantModel: TenantModel;
|
|
10
|
-
getBanner(ctx: RequestContext, user: User
|
|
10
|
+
getBanner(ctx: RequestContext, user: User): Promise<BannerContent | null>;
|
|
11
11
|
}
|
|
12
12
|
export {};
|
|
@@ -18,12 +18,13 @@ const interface_database_decorators_1 = require("@antelopejs/interface-database-
|
|
|
18
18
|
const db_1 = require("@antelopejs/interface-dms/db");
|
|
19
19
|
const guards_1 = require("@antelopejs/interface-dms/guards");
|
|
20
20
|
const request_tenant_1 = require("@antelopejs/interface-dms/request-tenant");
|
|
21
|
-
const tenant_scoped_model_1 = require("@antelopejs/interface-dms/tenant-scoped-model");
|
|
22
21
|
const db_2 = require("../../db");
|
|
23
22
|
const complimentary_banner_1 = require("../../workspaces/complimentary-banner");
|
|
24
23
|
class SaasTenantComplimentaryBannerController extends (0, interface_api_1.Controller)("/api/saas/tenant/complimentary-banner") {
|
|
25
|
-
async getBanner(ctx, user
|
|
24
|
+
async getBanner(ctx, user) {
|
|
26
25
|
const tenantId = (0, request_tenant_1.getRequestTenantId)(ctx);
|
|
26
|
+
const tenantSubscriptionModel = (0, interface_database_decorators_1.GetModel)(db_2.TenantSubscriptionModel, tenantId);
|
|
27
|
+
const tenantMemberModel = (0, interface_database_decorators_1.GetModel)(db_1.TenantMemberModel, tenantId);
|
|
27
28
|
const subscription = await tenantSubscriptionModel.findOne();
|
|
28
29
|
if (!subscription?.isComplimentary)
|
|
29
30
|
return null;
|
|
@@ -54,11 +55,8 @@ __decorate([
|
|
|
54
55
|
(0, interface_api_1.Get)("/"),
|
|
55
56
|
__param(0, (0, interface_api_1.Context)()),
|
|
56
57
|
__param(1, (0, guards_1.AuthTenantMember)({ bypassTenantAccessGate: true })),
|
|
57
|
-
__param(2, (0, tenant_scoped_model_1.TenantScopedModel)(db_2.TenantSubscriptionModel)),
|
|
58
|
-
__param(3, (0, tenant_scoped_model_1.TenantScopedModel)(db_1.TenantMemberModel)),
|
|
59
58
|
__metadata("design:type", Function),
|
|
60
|
-
__metadata("design:paramtypes", [Object, Function,
|
|
61
|
-
db_1.TenantMemberModel]),
|
|
59
|
+
__metadata("design:paramtypes", [Object, Function]),
|
|
62
60
|
__metadata("design:returntype", Promise)
|
|
63
61
|
], SaasTenantComplimentaryBannerController.prototype, "getBanner", null);
|
|
64
62
|
//# sourceMappingURL=complimentary-banner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"complimentary-banner.js","sourceRoot":"","sources":["../../../src/routes/tenant/complimentary-banner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAKmC;AACnC,
|
|
1
|
+
{"version":3,"file":"complimentary-banner.js","sourceRoot":"","sources":["../../../src/routes/tenant/complimentary-banner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAKmC;AACnC,6FAA4E;AAC5E,qDAA8E;AAC9E,6DAAoE;AACpE,6EAA8E;AAG9E,iCAA8D;AAC9D,gFAA4E;AAQ5E,MAAa,uCAAwC,SAAQ,IAAA,0BAAU,EACrE,uCAAuC,CACxC;IAQO,AAAN,KAAK,CAAC,SAAS,CACF,GAAmB,EACsB,IAAU;QAE9D,MAAM,Q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,CAAC,CAAA;;;;wEAmBpD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type RequestContext } from "@antelopejs/interface-api";
|
|
2
2
|
import type { User } from "@antelopejs/interface-dms/auth/db";
|
|
3
|
-
import { type TenantBillingAddress,
|
|
3
|
+
import { type TenantBillingAddress, type TenantCustomerType, type VatVerificationStatus } from "../../db";
|
|
4
4
|
import { type BillingIdentityField, type BillingIdentityInput } from "../../workspaces/billing-identity";
|
|
5
5
|
interface StoredBillingInfo {
|
|
6
6
|
customerType: TenantCustomerType | null;
|
|
@@ -17,8 +17,8 @@ interface BillingInfoResponse extends StoredBillingInfo {
|
|
|
17
17
|
declare const SaasTenantBillingController_base: import("@antelopejs/interface-api").ControllerClass<object>;
|
|
18
18
|
export declare class SaasTenantBillingController extends SaasTenantBillingController_base {
|
|
19
19
|
private refreshVatVerification;
|
|
20
|
-
getBillingInfo(_user: User,
|
|
20
|
+
getBillingInfo(_user: User, ctx: RequestContext): Promise<BillingInfoResponse>;
|
|
21
21
|
private syncStripe;
|
|
22
|
-
updateBillingInfo(ctx: RequestContext, user: User, body: BillingIdentityInput
|
|
22
|
+
updateBillingInfo(ctx: RequestContext, user: User, body: BillingIdentityInput): Promise<BillingInfoResponse>;
|
|
23
23
|
}
|
|
24
24
|
export {};
|
|
@@ -18,7 +18,6 @@ const interface_api_util_1 = require("@antelopejs/interface-api-util");
|
|
|
18
18
|
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
19
19
|
const guards_1 = require("@antelopejs/interface-dms/guards");
|
|
20
20
|
const request_tenant_1 = require("@antelopejs/interface-dms/request-tenant");
|
|
21
|
-
const tenant_scoped_model_1 = require("@antelopejs/interface-dms/tenant-scoped-model");
|
|
22
21
|
const db_1 = require("../../db");
|
|
23
22
|
const billing_identity_1 = require("../../workspaces/billing-identity");
|
|
24
23
|
const billing_identity_lock_1 = require("../../workspaces/billing-identity-lock");
|
|
@@ -96,7 +95,10 @@ class SaasTenantBillingController extends (0, interface_api_1.Controller)("/api/
|
|
|
96
95
|
await billingModel.update(info._id, { vatVerificationStatus: status });
|
|
97
96
|
return { ...info, vatVerificationStatus: status };
|
|
98
97
|
}
|
|
99
|
-
async getBillingInfo(_user,
|
|
98
|
+
async getBillingInfo(_user, ctx) {
|
|
99
|
+
const tenantId = (0, request_tenant_1.getRequestTenantId)(ctx);
|
|
100
|
+
const billingModel = (0, interface_database_decorators_1.GetModel)(db_1.TenantBillingInfoModel, tenantId);
|
|
101
|
+
const subscriptionModel = (0, interface_database_decorators_1.GetModel)(db_1.TenantSubscriptionModel, tenantId);
|
|
100
102
|
const info = await billingModel.findOne();
|
|
101
103
|
if (!info)
|
|
102
104
|
return toResponse(EMPTY_BILLING_INFO);
|
|
@@ -120,9 +122,11 @@ class SaasTenantBillingController extends (0, interface_api_1.Controller)("/api/
|
|
|
120
122
|
address: identity.address,
|
|
121
123
|
});
|
|
122
124
|
}
|
|
123
|
-
async updateBillingInfo(ctx, user, body
|
|
125
|
+
async updateBillingInfo(ctx, user, body) {
|
|
124
126
|
const identity = (0, billing_identity_1.parseBillingIdentity)(body);
|
|
125
127
|
const tenantId = (0, request_tenant_1.getRequestTenantId)(ctx);
|
|
128
|
+
const billingModel = (0, interface_database_decorators_1.GetModel)(db_1.TenantBillingInfoModel, tenantId);
|
|
129
|
+
const subscriptionModel = (0, interface_database_decorators_1.GetModel)(db_1.TenantSubscriptionModel, tenantId);
|
|
126
130
|
return (0, billing_identity_lock_1.withBillingIdentityLock)(tenantId, async () => {
|
|
127
131
|
const info = await billingModel.findOne();
|
|
128
132
|
const subscription = await subscriptionModel.findOne();
|
|
@@ -142,11 +146,9 @@ exports.SaasTenantBillingController = SaasTenantBillingController;
|
|
|
142
146
|
__decorate([
|
|
143
147
|
(0, interface_api_1.Get)("/billing-info"),
|
|
144
148
|
__param(0, (0, guards_1.AuthTenantMember)({ bypassTenantAccessGate: true })),
|
|
145
|
-
__param(1, (0,
|
|
146
|
-
__param(2, (0, tenant_scoped_model_1.TenantScopedModel)(db_1.TenantSubscriptionModel)),
|
|
149
|
+
__param(1, (0, interface_api_1.Context)()),
|
|
147
150
|
__metadata("design:type", Function),
|
|
148
|
-
__metadata("design:paramtypes", [Function,
|
|
149
|
-
db_1.TenantSubscriptionModel]),
|
|
151
|
+
__metadata("design:paramtypes", [Function, Object]),
|
|
150
152
|
__metadata("design:returntype", Promise)
|
|
151
153
|
], SaasTenantBillingController.prototype, "getBillingInfo", null);
|
|
152
154
|
__decorate([
|
|
@@ -154,11 +156,8 @@ __decorate([
|
|
|
154
156
|
__param(0, (0, interface_api_1.Context)()),
|
|
155
157
|
__param(1, (0, guards_1.AuthTenantOwner)({ bypassTenantAccessGate: true })),
|
|
156
158
|
__param(2, (0, interface_api_1.JSONBody)()),
|
|
157
|
-
__param(3, (0, tenant_scoped_model_1.TenantScopedModel)(db_1.TenantBillingInfoModel)),
|
|
158
|
-
__param(4, (0, tenant_scoped_model_1.TenantScopedModel)(db_1.TenantSubscriptionModel)),
|
|
159
159
|
__metadata("design:type", Function),
|
|
160
|
-
__metadata("design:paramtypes", [Object, Function, Object,
|
|
161
|
-
db_1.TenantSubscriptionModel]),
|
|
160
|
+
__metadata("design:paramtypes", [Object, Function, Object]),
|
|
162
161
|
__metadata("design:returntype", Promise)
|
|
163
162
|
], SaasTenantBillingController.prototype, "updateBillingInfo", null);
|
|
164
163
|
//# sourceMappingURL=tenant-billing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tenant-billing.js","sourceRoot":"","sources":["../../../src/routes/tenant/tenant-billing.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAOmC;AACnC,uEAAwD;AACxD,6FAAqE;AACrE,6DAG0C;AAC1C,6EAA8E;
|
|
1
|
+
{"version":3,"file":"tenant-billing.js","sourceRoot":"","sources":["../../../src/routes/tenant/tenant-billing.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAOmC;AACnC,uEAAwD;AACxD,6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,EAAE,qBAAqB,CAAC,CAAC;YACvE,MAAM,kBAAkB,CAAC,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;YAC/D,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,OAAO,EAAE,CAAC;YAC7C,OAAO,UAAU,CAAC,OAAO,IAAI,MAAM,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AApGD,kEAoGC;AApEO;IADL,IAAA,mBAAG,EAAC,eAAe,CAAC;IAElB,WAAA,IAAA,yBAAgB,EAAC,EAAE,sBAAsB,EAAE,IAAI,EAAE,CAAC,CAAA;IAClD,WAAA,IAAA,uBAAO,GAAE,CAAA;;;;iEAgBX;AAsBK;IADL,IAAA,mBAAG,EAAC,eAAe,CAAC;IAElB,WAAA,IAAA,uBAAO,GAAE,CAAA;IACT,WAAA,IAAA,wBAAe,EAAC,EAAE,sBAAsB,EAAE,IAAI,EAAE,CAAC,CAAA;IACjD,WAAA,IAAA,wBAAQ,GAAE,CAAA;;;;oEAwBZ"}
|
|
@@ -8,6 +8,6 @@ export interface ConfirmUpgradeBody {
|
|
|
8
8
|
export declare function confirmOwnerUpgrade(tenantId: string, subscription: TenantSubscription | undefined, plan: Plan, model: TenantSubscriptionModel): Promise<ChangePlanResult>;
|
|
9
9
|
declare const SaasTenantPlanAuthenticationController_base: import("@antelopejs/interface-api").ControllerClass<object>;
|
|
10
10
|
export declare class SaasTenantPlanAuthenticationController extends SaasTenantPlanAuthenticationController_base {
|
|
11
|
-
confirmUpgrade(_user: User, body: ConfirmUpgradeBody, ctx: RequestContext
|
|
11
|
+
confirmUpgrade(_user: User, body: ConfirmUpgradeBody, ctx: RequestContext): Promise<ChangePlanResult>;
|
|
12
12
|
}
|
|
13
13
|
export {};
|