# Develop with saaster

To know which plan or which modules the customer has booked, you can query a struct. This gives you all the relevant information you need to develop your software.

There are two session structs in saaster with which you can get this data:

* session.currentPlan
* session.currentModules

### The session variable "currentPlan"

With the session variable *session.currentPlan* you get all the data for a booked plan. \
This is how it looks like:

<div align="left"><figure><img src="https://4165049393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUY7tl3j0xMLQbwSQOYv%2Fuploads%2FfmKwBEBalhEuSk12iPRt%2Fimage.png?alt=media&#x26;token=0375c94b-d3ec-4ece-b621-d716383a8504" alt=""><figcaption></figcaption></figure></div>

#### Explanation of the variables:

| **bookingID**       | The primary id from table *bookings*                              |
| ------------------- | ----------------------------------------------------------------- |
| **endDate**         | The end of the current subscription (*date*)                      |
| **invoiceID**       | The primary id from table *invoices,* which is joined to the plan |
| **maxUsers**        | The maximum number of users within this subscription              |
| **modulesIncluded** | An array with all modules included within this plan               |
| **nextPlan**        | A struct containing the data of the next plan if it’s another one |
| **planID**          | The primary id from table *plans*                                 |
| **planName**        | The name of the current plan                                      |
| **priceMonthly**    | The price paid monthly                                            |
| **recurring**       | <p>The current cycle of the plan; <br>ecurring and status</p>     |
| **startDate**       | The start of the current subscription (*date*)                    |
| **status**          | The status of the current subscription; Recurring and status      |

### The session variable "currentModules"

With the session variable *session.currentModules* you get all the data you need. \
This is how it looks like:

<div align="left"><figure><img src="https://4165049393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuUY7tl3j0xMLQbwSQOYv%2Fuploads%2FQrz1LEiMZKpch8d6u5AL%2Fimage.png?alt=media&#x26;token=0997a5ae-7f62-4a23-9ccd-a7115b150aad" alt=""><figcaption></figcaption></figure></div>

#### Explanation of the variables:

| **includedInCurrentPlan**                                 | Whether the module is included within the current plan              |
| --------------------------------------------------------- | ------------------------------------------------------------------- |
| **invoiceID**                                             | The primary id from table *invoices,* which is joined to the module |
| **moduleData**                                            | All data of the corresponding module as a struct                    |
| **moduleID**                                              | The primary id from table *modules*                                 |
|                                                           |                                                                     |
| <mark style="color:blue;">**Struct moduleStatus:**</mark> |                                                                     |
|                                                           |                                                                     |
| **bookingID**                                             | The primary id from table *bookings*                                |
| **endDate**                                               | The end of the current subscription (*date*)                        |
| **fontColor**                                             | The font color is used to display a text in that color              |
| **recurring**                                             | The current cycle of the plan; Recurring and status                 |
| **startDate**                                             | The start of the current subscription (*date*)                      |
| **status**                                                | The status of the current subscription; Recurring and status        |
| **statusText**                                            | The status description to display to the customer                   |
| **statusTitle**                                           | The status title to display to the customer                         |

### Recurring and status

We work in saaster with the term "recurring" to save the cycle of the plan or module. These values are used:

| **test**    | The plan is in test mode and will not be automatically renewed |
| ----------- | -------------------------------------------------------------- |
| **monthly** | The plan is in a monthly cycle                                 |
| **yearly**  | The plan is in a yearly cycle                                  |

Furthermore, many different statuses exist to define plans and modules. These values are used as statuses:

| **test**     | The plan is in test mode                   |
| ------------ | ------------------------------------------ |
| **free**     | There is a free plan running               |
| **active**   | There is a paid plan running               |
| **payment**  | Waiting for payment from the customer      |
| **waiting**  | Waiting to start the plan (next plan)      |
| **canceled** | The plan has been canceled by the customer |
| **expired**  | The plan has expired                       |
