| import "../shared/index.tsp"; | |
| import "./catalog.tsp"; | |
| import "./sandbox.tsp"; | |
| import "./stripe.tsp"; | |
| import "./external_invoicing.tsp"; | |
| namespace Apps; | |
| /** | |
| * The type of the app. | |
| */ | |
| ("BillingAppType") | |
| enum AppType { | |
| /** | |
| * Built-in sandbox integration for testing and development. | |
| */ | |
| Sandbox: "sandbox", | |
| /** | |
| * The Stripe app synchronizes invoices to Stripe Invoicing, enabling automated revenue collection with Stripe Payments and Stripe Tax. | |
| */ | |
| Stripe: "stripe", | |
| /** | |
| * The external invoicing app enables synchronizing invoices with finance systems that are not natively supported, such as ERPs, in-house invoicing solutions, or local e-invoicing and payment providers. | |
| */ | |
| ExternalInvoicing: "external_invoicing", | |
| } | |
| /** | |
| * Connection status of an installed app. | |
| */ | |
| ("BillingAppStatus") | |
| enum AppStatus { | |
| /** | |
| * The app is ready to be used. | |
| */ | |
| Ready: "ready", | |
| /** | |
| * The app is unauthorized. | |
| * This usually happens when the app's credentials are revoked or expired. | |
| * To resolve this, the user must re-authorize the app. | |
| */ | |
| Unauthorized: "unauthorized", | |
| } | |
| /** | |
| * Base model for installed apps, with its own configuration and credentials. | |
| */ | |
| ("BillingAppBase") | |
| model AppBase<T extends AppType> { | |
| ...Shared.Resource; | |
| /** | |
| * The app type. | |
| */ | |
| (Lifecycle.Read) | |
| type: T; | |
| /** | |
| * The app catalog definition that this installed app is based on. | |
| */ | |
| (Lifecycle.Read) | |
| definition: AppCatalogItem; | |
| /** | |
| * Status of the app connection. | |
| */ | |
| (Lifecycle.Read) | |
| status: AppStatus; | |
| } | |
| /** | |
| * Installed application. | |
| */ | |
| ("BillingApp") | |
| (#{ envelope: "none", discriminatorPropertyName: "type" }) | |
| union App { | |
| ("Stripe") | |
| stripe: AppStripe, | |
| ("Sandbox") | |
| sandbox: AppSandbox, | |
| ("External Invoicing") | |
| external_invoicing: AppExternalInvoicing, | |
| } | |
| /** | |
| * App reference. | |
| */ | |
| ("BillingAppReference") | |
| model AppReference { | |
| /** | |
| * The ID of the app. | |
| */ | |
| id: Shared.ULID; | |
| } | |