@opencxh/domain 1.56.0 → 1.59.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.
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Billing domain types for the organization app. Provider-agnostic by design:
|
|
3
|
+
* we never store raw card data (PCI) — only a provider name and the provider's
|
|
4
|
+
* external token/id, plus a few display-only fields. A real payment provider
|
|
5
|
+
* (Stripe, Mollie, …) gets wired in later behind these fields.
|
|
6
|
+
*/
|
|
7
|
+
export type PaymentMethodType = "card" | "sepa_direct_debit" | "paypal" | "other";
|
|
8
|
+
export interface PaymentMethod {
|
|
9
|
+
id: string;
|
|
10
|
+
organizationId: string;
|
|
11
|
+
/** Provider key, e.g. "stripe" | "mollie". Free-form until a provider is wired in. */
|
|
12
|
+
provider: string;
|
|
13
|
+
/** The provider's payment-method token/id (never raw card data). */
|
|
14
|
+
externalId?: string;
|
|
15
|
+
type: PaymentMethodType;
|
|
16
|
+
/** Display-only card metadata. */
|
|
17
|
+
brand?: string;
|
|
18
|
+
last4?: string;
|
|
19
|
+
expiryMonth?: number;
|
|
20
|
+
expiryYear?: number;
|
|
21
|
+
holderName?: string;
|
|
22
|
+
/** Whether this is the default method for the organization. */
|
|
23
|
+
isDefault: boolean;
|
|
24
|
+
}
|
|
25
|
+
export type PlanInterval = "month" | "year";
|
|
26
|
+
export interface Plan {
|
|
27
|
+
id: string;
|
|
28
|
+
organizationId: string;
|
|
29
|
+
name: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
/** Amount in the major currency unit (e.g. 49.99). */
|
|
32
|
+
price: number;
|
|
33
|
+
/** ISO 4217 currency code, e.g. "EUR". */
|
|
34
|
+
currency: string;
|
|
35
|
+
interval: PlanInterval;
|
|
36
|
+
features: string[];
|
|
37
|
+
/** Whether the plan can be subscribed to. */
|
|
38
|
+
active: boolean;
|
|
39
|
+
}
|
|
40
|
+
export type SubscriptionStatus = "active" | "trialing" | "past_due" | "canceled" | "incomplete";
|
|
41
|
+
export interface Subscription {
|
|
42
|
+
id: string;
|
|
43
|
+
organizationId: string;
|
|
44
|
+
planId?: string;
|
|
45
|
+
status: SubscriptionStatus;
|
|
46
|
+
/** Payment method used to bill this subscription. */
|
|
47
|
+
paymentMethodId?: string;
|
|
48
|
+
/** ISO date strings for the current billing period. */
|
|
49
|
+
currentPeriodStart?: string;
|
|
50
|
+
currentPeriodEnd?: string;
|
|
51
|
+
cancelAtPeriodEnd?: boolean;
|
|
52
|
+
}
|
|
@@ -3,4 +3,13 @@ export interface User {
|
|
|
3
3
|
name: string;
|
|
4
4
|
email: string;
|
|
5
5
|
availableOrganizations: string[];
|
|
6
|
+
/** Mirrored from system.users. */
|
|
7
|
+
firstName?: string;
|
|
8
|
+
lastName?: string;
|
|
9
|
+
/** Roles for the current tenant, sourced from system.rbac (not our DB). */
|
|
10
|
+
roles?: string[];
|
|
11
|
+
displayName?: string;
|
|
12
|
+
avatarUrl?: string;
|
|
13
|
+
locale?: string;
|
|
14
|
+
timezone?: string;
|
|
6
15
|
}
|
|
@@ -3,10 +3,12 @@ import { User } from '../entities/user/types';
|
|
|
3
3
|
export interface PlatformContext {
|
|
4
4
|
user: User | null;
|
|
5
5
|
activeOrg: Organization | null;
|
|
6
|
+
availableOrganizations: Organization[];
|
|
6
7
|
env: 'production' | 'staging' | 'dev';
|
|
7
8
|
locale: string;
|
|
8
9
|
isAuthenticated: boolean;
|
|
9
10
|
isOrgSelected: boolean;
|
|
11
|
+
hasMultipleOrgs: boolean;
|
|
10
12
|
}
|
|
11
13
|
export interface PlatformConfig {
|
|
12
14
|
httpUrl: string;
|