| import "../shared/index.tsp"; |
| import "./capability.tsp"; |
| import "./app.tsp"; |
|
|
| namespace Apps; |
|
|
| |
| |
| |
| @friendlyName("BillingAppInstallMethods") |
| enum AppInstallMethods { |
| |
| |
| |
| WithOAuth2: "with_oauth2", |
|
|
| |
| |
| |
| WithAPIKey: "with_api_key", |
|
|
| |
| |
| |
| NoCredentialsRequired: "no_credentials_required", |
| } |
|
|
| |
| |
| |
| |
| |
| |
| @friendlyName("BillingAppCatalogItem") |
| @example(#{ |
| type: AppType.Stripe, |
| name: "Stripe", |
| description: "Stripe integration allows you to collect payments with Stripe.", |
| capabilities: #[ |
| #{ |
| type: AppCapabilityType.CalculateTax, |
| key: "stripe_calculate_tax", |
| name: "Calculate Tax", |
| description: "Stripe Tax calculates tax portion of the invoices.", |
| }, |
| #{ |
| type: AppCapabilityType.InvoiceCustomers, |
| key: "stripe_invoice_customers", |
| name: "Invoice Customers", |
| description: "Stripe invoices customers with due amount.", |
| }, |
| #{ |
| type: AppCapabilityType.CollectPayments, |
| key: "stripe_collect_payments", |
| name: "Collect Payments", |
| description: "Stripe payments collects outstanding revenue with Stripe customer's default payment method.", |
| } |
| ], |
| install_methods: #[ |
| AppInstallMethods.WithOAuth2, |
| AppInstallMethods.WithAPIKey |
| ], |
| }) |
| model AppCatalogItem { |
| |
| |
| |
| @visibility(Lifecycle.Read) |
| type: AppType; |
|
|
| |
| |
| |
| @visibility(Lifecycle.Read) |
| name: string; |
|
|
| |
| |
| |
| @visibility(Lifecycle.Read) |
| description: string; |
|
|
| |
| |
| |
| @visibility(Lifecycle.Read) |
| capabilities: AppCapability[]; |
|
|
| |
| |
| |
| @visibility(Lifecycle.Read) |
| install_methods: AppInstallMethods[]; |
| } |
|
|
| |
| |
| |
| @friendlyName("BillingInstallAppRequest") |
| @discriminated(#{ envelope: "none", discriminatorPropertyName: "type" }) |
| union InstallAppRequest { |
| @summary("Stripe") |
| stripe: InstallAppWithApiKey<AppType.Stripe>, |
|
|
| @summary("Sandbox") |
| sandbox: InstallAppBase<AppType.Sandbox>, |
|
|
| @summary("External Invoicing") |
| external_invoicing: InstallAppBase<AppType.ExternalInvoicing>, |
| } |
|
|
| |
| |
| |
| @friendlyName("BillingInstallApp{name}", T) |
| model InstallAppBase<T extends AppType> { |
| |
| |
| |
| type: T; |
|
|
| |
| |
| |
| name: string; |
|
|
| |
| |
| |
| |
| create_billing_profile: boolean; |
| } |
|
|
| |
| |
| |
| @friendlyName("BillingInstallApp{name}WithApiKey", T) |
| model InstallAppWithApiKey<T extends AppType> { |
| ...InstallAppBase<T>; |
|
|
| |
| |
| |
| api_key: string; |
| } |
|
|
| |
| |
| |
| @friendlyName("BillingInstallAppResponse") |
| model InstallAppResponse { |
| @visibility(Lifecycle.Read) |
| app: App; |
|
|
| @visibility(Lifecycle.Read) |
| default_for_capability_types: AppCapabilityType[]; |
| } |
|
|