File size: 2,092 Bytes
048b1e8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import "../shared/index.tsp";
import "./catalog.tsp";
import "./sandbox.tsp";
import "./stripe.tsp";
import "./external_invoicing.tsp";

namespace Apps;

/**
 * The type of the app.
 */
@friendlyName("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.
 */
@friendlyName("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.
 */
@friendlyName("BillingAppBase")
model AppBase<T extends AppType> {
  ...Shared.Resource;

  /**
   * The app type.
   */
  @visibility(Lifecycle.Read)
  type: T;

  /**
   * The app catalog definition that this installed app is based on.
   */
  @visibility(Lifecycle.Read)
  definition: AppCatalogItem;

  /**
   * Status of the app connection.
   */
  @visibility(Lifecycle.Read)
  status: AppStatus;
}

/**
 * Installed application.
 */
@friendlyName("BillingApp")
@discriminated(#{ envelope: "none", discriminatorPropertyName: "type" })
union App {
  @summary("Stripe")
  stripe: AppStripe,

  @summary("Sandbox")
  sandbox: AppSandbox,

  @summary("External Invoicing")
  external_invoicing: AppExternalInvoicing,
}

/**
 * App reference.
 */
@friendlyName("BillingAppReference")
model AppReference {
  /**
   * The ID of the app.
   */
  id: Shared.ULID;
}