

# **TUTORHUB**

**FRONTEND GUIDE FOR AI CODING AGENTS - PART 9 - EnrollmentManagement Service**

This document is a part of a REST API guide for the tutorhub project.
It is designed for AI agents that will generate frontend code to consume the project’s backend.

This document provides extensive instruction for the usage of enrollmentManagement

## Service Access

EnrollmentManagement service management is handled through service specific base urls.

EnrollmentManagement  service may be deployed to the preview server, staging server, or production server. Therefore,it has 3 access URLs.
The frontend application must support all deployment environments during development, and the user should be able to select the target API server on the login page (already handled in first part.).

For the enrollmentManagement service, the base URLs are:

* **Preview:** `https://tutorhub.prw.mindbricks.com/enrollmentmanagement-api`
* **Staging:** `https://tutorhub-stage.mindbricks.co/enrollmentmanagement-api`
* **Production:** `https://tutorhub.mindbricks.co/enrollmentmanagement-api`


## Scope

**EnrollmentManagement Service Description**

Handles enrollments (course booking, lesson/slot allocation, fulfillment/pre-check, and payment via Stripe) and refund workflow (strictly after first lesson only, auto approved, and Stripe-based). Exposes all enrollment/payment/refund status for admins, tutors, and students. All business state transitions are auditable for analytics and compliance.

EnrollmentManagement service provides apis and business logic for following data objects in tutorhub application. 
Each data object may be either a central domain of the application data structure or a related helper data object for a central concept.
Note that data object concept is equal to table concept in the database, in the service database each data object is represented as a db table scheme and the object instances as table rows.  


**`enrollment` Data Object**: Represents a student&#39;s enrollment in a structured course pack: includes booking transaction, lesson slots, pricing, full payment processing, refund eligibility status, and traceable transitions.

**`refundRequest` Data Object**: A request by a student (or in rare cases, admin) for a refund on a specific enrollment—limited to post-first lesson only, automatically approved and processed if eligible.

**`sys_enrollmentPayment` Data Object**: A payment storage object to store the payment life cyle of orders based on enrollment object. It is autocreated based on the source object&#39;s checkout config

**`sys_paymentCustomer` Data Object**: A payment storage object to store the customer values of the payment platform

**`sys_paymentMethod` Data Object**: A payment storage object to store the payment methods of the platform customers


## EnrollmentManagement Service Frontend Description By The Backend Architect

Students select a course pack along with desired lesson slots and submit for enrollment. Immediate payment is usually required, except when a preliminary screening meeting is enforced. Enrollment status (pending/active/canceled), payment status, and all associated lesson/slot statuses are visible to the student and tutor. Refund option is ONLY available after the very first lesson has been completed and cannot be requested after subsequent lessons—refunds are auto-processed. Admins view all transactions and refunds, but only students can initiate their own refund request (within policy limits). Tutors and students are both notified of key state changes via frontend mechanisms. No direct deletion of enrollments, only status transition is possible.

## API Structure

### Object Structure of a Successful Response

When the service processes requests successfully, it wraps the requested resource(s) within a JSON envelope. This envelope includes the data and essential metadata such as configuration details and pagination information, providing context to the client.

**HTTP Status Codes:**

* **200 OK**: Returned for successful GET, LIST, UPDATE, or DELETE operations, indicating that the request was processed successfully.
* **201 Created**: Returned for CREATE operations, indicating that the resource was created successfully.

**Success Response Format:**

For successful operations, the response includes a `"status": "OK"` property, signaling that the request executed successfully. The structure of a successful response is outlined below:

```json
{
  "status":"OK",
  "statusCode": 200,   
  "elapsedMs":126,
  "ssoTime":120,
  "source": "db",
  "cacheKey": "hexCode",
  "userId": "ID",
  "sessionId": "ID",
  "requestId": "ID",
  "dataName":"products",
  "method":"GET",
  "action":"list",
  "appVersion":"Version",
  "rowCount":3,
  "products":[{},{},{}],
  "paging": {
    "pageNumber":1, 
    "pageRowCount":25, 
    "totalRowCount":3,
    "pageCount":1
  },
  "filters": [],
  "uiPermissions": []
}
```
* **`products`**: In this example, this key contains the actual response content, which may be a single object or an array of objects depending on the operation.

### Additional Data

Each API may include additional data besides the main data object, depending on the business logic of the API. These will be provided in each API’s response signature.

### Error Response

If a request encounters an issue—whether due to a logical fault or a technical problem—the service responds with a standardized JSON error structure. The HTTP status code indicates the nature of the error, using commonly recognized codes for clarity:

* **400 Bad Request**: The request was improperly formatted or contained invalid parameters.
* **401 Unauthorized**: The request lacked a valid authentication token; login is required.
* **403 Forbidden**: The current token does not grant access to the requested resource.
* **404 Not Found**: The requested resource was not found on the server.
* **500 Internal Server Error**: The server encountered an unexpected condition.

Each error response is structured to provide meaningful insight into the problem, assisting in efficient diagnosis and resolution.

```js
{
  "result": "ERR",
  "status": 400,
  "message": "errMsg_organizationIdisNotAValidID",
  "errCode": 400,
  "date": "2024-03-19T12:13:54.124Z",
  "detail": "String"
}
```


## Enrollment Data Object

Represents a student&#39;s enrollment in a structured course pack: includes booking transaction, lesson slots, pricing, full payment processing, refund eligibility status, and traceable transitions.

### Enrollment  Data Object Frontend Description By The Backend Architect

Students enroll by selecting a course pack and one or more lesson slots; payment is processed online. Enrollment status and payment status are tracked. Refund eligibility only opens after student attends first lesson. All major state changes (enrollment, payment, refund) are exposed to the student, tutor, and admin for transparency.


### Enrollment Data Object Properties

Enrollment data object has got following properties that are represented as table fields in the database scheme. 
These properties don't stand just for data storage, but each may have different settings to manage the business logic. 

| Property | Type | IsArray | Required | Secret | Description |
|----------|------|---------|----------|--------|-------------|
| `coursePackId` | ID | false | Yes | No | FK to purchased course pack. |
| `studentId` | ID | false | Yes | No | FK to enrolling student (auth:user). |
| `tutorProfileId` | ID | false | Yes | No | FK to the course's tutorProfile for admin/analytics. |
| `lessonSlotIds` | ID | true | Yes | No | IDs for reserved lesson slots with this enrollment (must exist in courseScheduling:lessonSlot). |
| `totalAmount` | Double | false | Yes | No | Total amount paid for enrollment (for all slots/pack, pre-promotion/refund). |
| `currency` | String | false | Yes | No | 3-letter ISO currency code (e.g., 'USD', 'EUR'). |
| `paymentStatus` | Enum |  | Yes | No | Status of payment for enrollment: pending, paid, refunded (mapped by Stripe automation). |
| `refundStatus` | Enum | false | Yes | No | Tracks refund state: notRequested, eligible, processed, ineligible. Managed by workflow. |
| `enrollmentStatus` | Enum |  | Yes | No | Enrollment status: pending (not paid), active (paid and in-progress), completed (all lessons done), canceled (user or system initiated). |
| `enrolledAt` | Date | false | No | No | Datetime of completed enrollment (post-payment). |
| `paymentConfirmation` | Enum | false | Yes | No | An automatic property that is used to check the confirmed status of the payment set by webhooks. |
* Required properties are mandatory for creating objects and must be provided in the request body if no default value, formula or session bind is set.


### Array Properties 

`lessonSlotIds`

Array properties can hold multiple values. 
Array properties should be respected according to their multiple structure in the frontend in any user input for them.
Please use multiple input components for the array proeprties when needed.


### Enum Properties
Enum properties are defined with a set of allowed values, ensuring that only valid options can be assigned to them. 
The enum options value will be stored as strings in the database, 
but when a data object is created an additional property with the same name plus an idx suffix will be created, which will hold the index of the selected enum option.
You can use the {fieldName_idx} property to sort by the enum value or when your enum options represent a hiyerarchy of values.
In the frontend input components, enum type properties should only accept values from an option component that lists the enum options.

- **paymentStatus**: [pending, paid, refunded]

- **refundStatus**: [notRequested, eligible, processed, ineligible]

- **enrollmentStatus**: [pending, active, completed, canceled]

- **paymentConfirmation**: [pending, processing, paid, canceled]


### Relation Properties

`coursePackId` `studentId` `tutorProfileId` `lessonSlotIds`

Mindbricks supports relations between data objects, allowing you to define how objects are linked together.
The relations may reference to a data object either in this service or in another service. Id the reference is remote, backend handles the relations through service communication or elastic search.
These relations should be respected in the frontend so that instaead of showing the related objects id, the frontend should list human readable values from other data objects.
If the relation points to another service, frontend should use the referenced service api in case it needs related data.
The relation logic is montly handled in backend so the api responses feeds the frontend about the relational data. 
In mmost cases the api response will provide the relational data as well as the main one.

In frontend, please ensure that, 

1- instaead of these relational ids you show the main human readable field of the related target data (like name),
2- if this data object needs a user input of these relational ids, you should provide a combobox with the list of possible records or (a searchbox) to select with the realted target data object main human readable field.


- **coursePackId**: ID
Relation to `coursePack`.id

The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.

Required: Yes

- **studentId**: ID
Relation to `user`.id

The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.

Required: Yes

- **tutorProfileId**: ID
Relation to `tutorProfile`.id

The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.

Required: Yes

- **lessonSlotIds**: ID
Relation to `lessonSlot`.id

The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.

Required: Yes


### Filter Properties

`paymentConfirmation`

Filter properties are used to define parameters that can be used in query filters, allowing for dynamic data retrieval based on user input or predefined criteria.
These properties are automatically mapped as API parameters in the listing API's.

- **paymentConfirmation**: Enum  has a filter named `paymentConfirmation`


## RefundRequest Data Object

A request by a student (or in rare cases, admin) for a refund on a specific enrollment—limited to post-first lesson only, automatically approved and processed if eligible.

### RefundRequest  Data Object Frontend Description By The Backend Architect

A student may file a refund request ONLY after their first lesson, and only if no later lessons have been completed. The request is automatically approved and processed via Stripe. Only one refund is processed per enrollment. Admins and tutors are notified when refunds occur. Refund status is visible to students and staff for transparency and audit.


### RefundRequest Data Object Properties

RefundRequest data object has got following properties that are represented as table fields in the database scheme. 
These properties don't stand just for data storage, but each may have different settings to manage the business logic. 

| Property | Type | IsArray | Required | Secret | Description |
|----------|------|---------|----------|--------|-------------|
| `enrollmentId` | ID | false | Yes | No | FK to enrollment object for which refund is being requested (unique: one refund per enrollment). |
| `requestedBy` | ID | false | Yes | No | User (student) making the refund request (auth:user id). |
| `requestedAt` | Date | false | Yes | No | Datetime refund was requested. |
| `processedAt` | Date | false | No | No | When refund was processed by system (auto-approval). |
| `status` | Enum | false | Yes | No | Refund status: pending, approved, rejected, autoApproved (system processed/approved instantly). |
| `reason` | String | false | Yes | No | User-supplied reason for requesting refund. |
| `firstLessonCompleted` | Boolean | false | Yes | No | True if this refund is after first lesson (enforced by workflow); must be checked before approval. |
| `adminNote` | String | false | No | No | Admin note explaining the refund decision (approve/reject reason). |
* Required properties are mandatory for creating objects and must be provided in the request body if no default value, formula or session bind is set.



### Enum Properties
Enum properties are defined with a set of allowed values, ensuring that only valid options can be assigned to them. 
The enum options value will be stored as strings in the database, 
but when a data object is created an additional property with the same name plus an idx suffix will be created, which will hold the index of the selected enum option.
You can use the {fieldName_idx} property to sort by the enum value or when your enum options represent a hiyerarchy of values.
In the frontend input components, enum type properties should only accept values from an option component that lists the enum options.

- **status**: [pending, approved, rejected, autoApproved]


### Relation Properties

`enrollmentId` `requestedBy`

Mindbricks supports relations between data objects, allowing you to define how objects are linked together.
The relations may reference to a data object either in this service or in another service. Id the reference is remote, backend handles the relations through service communication or elastic search.
These relations should be respected in the frontend so that instaead of showing the related objects id, the frontend should list human readable values from other data objects.
If the relation points to another service, frontend should use the referenced service api in case it needs related data.
The relation logic is montly handled in backend so the api responses feeds the frontend about the relational data. 
In mmost cases the api response will provide the relational data as well as the main one.

In frontend, please ensure that, 

1- instaead of these relational ids you show the main human readable field of the related target data (like name),
2- if this data object needs a user input of these relational ids, you should provide a combobox with the list of possible records or (a searchbox) to select with the realted target data object main human readable field.


- **enrollmentId**: ID
Relation to `enrollment`.id

The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.

Required: Yes

- **requestedBy**: ID
Relation to `user`.id

The target object is a parent object, meaning that the relation is a one-to-many relationship from target to this object.

Required: Yes



## Sys_enrollmentPayment Data Object

A payment storage object to store the payment life cyle of orders based on enrollment object. It is autocreated based on the source object&#39;s checkout config



### Sys_enrollmentPayment Data Object Properties

Sys_enrollmentPayment data object has got following properties that are represented as table fields in the database scheme. 
These properties don't stand just for data storage, but each may have different settings to manage the business logic. 

| Property | Type | IsArray | Required | Secret | Description |
|----------|------|---------|----------|--------|-------------|
| `ownerId` | ID | false | No | No |  An ID value to represent owner user who created the order |
| `orderId` | ID | false | Yes | No | an ID value to represent the orderId which is the ID parameter of the source enrollment object |
| `paymentId` | String | false | Yes | No | A String value to represent the paymentId which is generated on the Stripe gateway. This id may represent different objects due to the payment gateway and the chosen flow type |
| `paymentStatus` | String | false | Yes | No | A string value to represent the payment status which belongs to the lifecyle of a Stripe payment. |
| `statusLiteral` | String | false | Yes | No | A string value to represent the logical payment status which belongs to the application lifecycle itself. |
| `redirectUrl` | String | false | No | No | A string value to represent return page of the frontend to show the result of the payment, this is used when the callback is made to server not the client. |
* Required properties are mandatory for creating objects and must be provided in the request body if no default value, formula or session bind is set.





### Filter Properties

`ownerId` `orderId` `paymentId` `paymentStatus` `statusLiteral` `redirectUrl`

Filter properties are used to define parameters that can be used in query filters, allowing for dynamic data retrieval based on user input or predefined criteria.
These properties are automatically mapped as API parameters in the listing API's.

- **ownerId**: ID  has a filter named `ownerId`

- **orderId**: ID  has a filter named `orderId`

- **paymentId**: String  has a filter named `paymentId`

- **paymentStatus**: String  has a filter named `paymentStatus`

- **statusLiteral**: String  has a filter named `statusLiteral`

- **redirectUrl**: String  has a filter named `redirectUrl`


## Sys_paymentCustomer Data Object

A payment storage object to store the customer values of the payment platform



### Sys_paymentCustomer Data Object Properties

Sys_paymentCustomer data object has got following properties that are represented as table fields in the database scheme. 
These properties don't stand just for data storage, but each may have different settings to manage the business logic. 

| Property | Type | IsArray | Required | Secret | Description |
|----------|------|---------|----------|--------|-------------|
| `userId` | ID | false | No | No |  An ID value to represent the user who is created as a stripe customer |
| `customerId` | String | false | Yes | No | A string value to represent the customer id which is generated on the Stripe gateway. This id is used to represent the customer in the Stripe gateway |
| `platform` | String | false | Yes | No | A String value to represent payment platform which is used to make the payment. It is stripe as default. It will be used to distinguesh the payment gateways in the future. |
* Required properties are mandatory for creating objects and must be provided in the request body if no default value, formula or session bind is set.





### Filter Properties

`userId` `customerId` `platform`

Filter properties are used to define parameters that can be used in query filters, allowing for dynamic data retrieval based on user input or predefined criteria.
These properties are automatically mapped as API parameters in the listing API's.

- **userId**: ID  has a filter named `userId`

- **customerId**: String  has a filter named `customerId`

- **platform**: String  has a filter named `platform`


## Sys_paymentMethod Data Object

A payment storage object to store the payment methods of the platform customers



### Sys_paymentMethod Data Object Properties

Sys_paymentMethod data object has got following properties that are represented as table fields in the database scheme. 
These properties don't stand just for data storage, but each may have different settings to manage the business logic. 

| Property | Type | IsArray | Required | Secret | Description |
|----------|------|---------|----------|--------|-------------|
| `paymentMethodId` | String | false | Yes | No | A string value to represent the id of the payment method on the payment platform. |
| `userId` | ID | false | Yes | No |  An ID value to represent the user who owns the payment method |
| `customerId` | String | false | Yes | No | A string value to represent the customer id which is generated on the payment gateway. |
| `cardHolderName` | String | false | No | No | A string value to represent the name of the card holder. It can be different than the registered customer. |
| `cardHolderZip` | String | false | No | No | A string value to represent the zip code of the card holder. It is used for address verification in specific countries. |
| `platform` | String | false | Yes | No | A String value to represent payment platform which teh paymentMethod belongs. It is stripe as default. It will be used to distinguesh the payment gateways in the future. |
| `cardInfo` | Object | false | Yes | No | A Json value to store the card details of the payment method. |
* Required properties are mandatory for creating objects and must be provided in the request body if no default value, formula or session bind is set.





### Filter Properties

`paymentMethodId` `userId` `customerId` `cardHolderName` `cardHolderZip` `platform` `cardInfo`

Filter properties are used to define parameters that can be used in query filters, allowing for dynamic data retrieval based on user input or predefined criteria.
These properties are automatically mapped as API parameters in the listing API's.

- **paymentMethodId**: String  has a filter named `paymentMethodId`

- **userId**: ID  has a filter named `userId`

- **customerId**: String  has a filter named `customerId`

- **cardHolderName**: String  has a filter named `cardHolderName`

- **cardHolderZip**: String  has a filter named `cardHolderZip`

- **platform**: String  has a filter named `platform`

- **cardInfo**: Object  has a filter named `cardInfo`



## Default CRUD APIs

For each data object, the backend architect may designate **default APIs** for standard operations (create, update, delete, get, list). These are the APIs that frontend CRUD forms and AI agents should use for basic record management. If no default is explicitly set (`isDefaultApi`), the frontend generator auto-discovers the most general API for each operation.

### Enrollment Default APIs

| Operation | API Name | Route | Explicitly Set |
|-----------|----------|-------|----------------|
| Create | `createEnrollment` | `/v1/enrollments` | Yes |
| Update | `cancelEnrollment` | `/v1/cancelenrollment/:enrollmentId` | Auto |
| Delete | _none_ | - | Auto |
| Get | `getEnrollment` | `/v1/enrollments/:enrollmentId` | Yes |
| List | `listEnrollments` | `/v1/enrollments` | Yes |
### RefundRequest Default APIs

| Operation | API Name | Route | Explicitly Set |
|-----------|----------|-------|----------------|
| Create | `createRefundRequest` | `/v1/refundrequests` | Yes |
| Update | `updateRefundRequest` | `/v1/refundrequests/:refundRequestId` | Yes |
| Delete | _none_ | - | Auto |
| Get | `getRefundRequest` | `/v1/refundrequests/:refundRequestId` | Yes |
| List | `listRefundRequests` | `/v1/refundrequests` | Yes |
### Sys_enrollmentPayment Default APIs

| Operation | API Name | Route | Explicitly Set |
|-----------|----------|-------|----------------|
| Create | `createEnrollmentPayment` | `/v1/enrollmentpayment` | Auto |
| Update | `updateEnrollmentPayment` | `/v1/enrollmentpayment/:sys_enrollmentPaymentId` | Auto |
| Delete | `deleteEnrollmentPayment` | `/v1/enrollmentpayment/:sys_enrollmentPaymentId` | Auto |
| Get | `getEnrollmentPayment` | `/v1/enrollmentpayment/:sys_enrollmentPaymentId` | Auto |
| List | `listEnrollmentPayments` | `/v1/enrollmentpayments` | Auto |
### Sys_paymentCustomer Default APIs

| Operation | API Name | Route | Explicitly Set |
|-----------|----------|-------|----------------|
| Create | _none_ | - | Auto |
| Update | _none_ | - | Auto |
| Delete | _none_ | - | Auto |
| Get | `getPaymentCustomerByUserId` | `/v1/paymentcustomers/:userId` | Auto |
| List | `listPaymentCustomers` | `/v1/paymentcustomers` | Auto |
### Sys_paymentMethod Default APIs

| Operation | API Name | Route | Explicitly Set |
|-----------|----------|-------|----------------|
| Create | _none_ | - | Auto |
| Update | _none_ | - | Auto |
| Delete | _none_ | - | Auto |
| Get | _none_ | - | Auto |
| List | `listPaymentCustomerMethods` | `/v1/paymentcustomermethods/:userId` | Auto |

When building CRUD forms for a data object, use the default create/update APIs listed above. The form fields should correspond to the API's body parameters. For relation fields, render a dropdown loaded from the related object's list API using the display label property.





## API Reference

### `Create Enrollment` API
**[Default create API]** — This is the designated default `create` API for the `enrollment` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Creates a new enrollment for a student in a selected course pack and selected lesson slots. Enforces booking prerequisites (availability, non-duplication, preliminary meeting if flagged in coursePack), and triggers Stripe payment. Updates all associated lesson slot statuses to booked. Enrollment remains pending until payment confirmed by Stripe webhook.

**API Frontend Description By The Backend Architect**

Student chooses course pack, selects lesson slots, triggers enrollment and Stripe payment. If the course requires preliminary screening, checks that it was passed before proceeding. If payment fails, booking is not confirmed. Successful booking sets lesson slots status to 'booked' and opens enrollment. Student, tutor, and admin can see details.

**Rest Route**

The `createEnrollment` API REST controller can be triggered via the following route:

`/v1/enrollments`


**Rest Request Parameters**


The `createEnrollment` api has got 7 regular request parameters  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| coursePackId  | ID  | true | request.body?.["coursePackId"] |
| tutorProfileId  | ID  | true | request.body?.["tutorProfileId"] |
| lessonSlotIds  | ID  | true | request.body?.["lessonSlotIds"] |
| totalAmount  | Double  | true | request.body?.["totalAmount"] |
| currency  | String  | true | request.body?.["currency"] |
| refundStatus  | Enum  | true | request.body?.["refundStatus"] |
| enrolledAt  | Date  | false | request.body?.["enrolledAt"] |
**coursePackId** : FK to purchased course pack.
**tutorProfileId** : FK to the course's tutorProfile for admin/analytics.
**lessonSlotIds** : IDs for reserved lesson slots with this enrollment (must exist in courseScheduling:lessonSlot).
**totalAmount** : Total amount paid for enrollment (for all slots/pack, pre-promotion/refund).
**currency** : 3-letter ISO currency code (e.g., 'USD', 'EUR').
**refundStatus** : Tracks refund state: notRequested, eligible, processed, ineligible. Managed by workflow.
**enrolledAt** : Datetime of completed enrollment (post-payment).



**REST Request**
To access the api you can use the **REST** controller with the path **POST  /v1/enrollments**
```js
  axios({
    method: 'POST',
    url: '/v1/enrollments',
    data: {
            coursePackId:"ID",  
            tutorProfileId:"ID",  
            lessonSlotIds:"ID",  
            totalAmount:"Double",  
            currency:"String",  
            refundStatus:"Enum",  
            enrolledAt:"Date",  
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "201",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "enrollment",
	"method": "POST",
	"action": "create",
	"appVersion": "Version",
	"rowCount": 1,
	"enrollment": {
		"id": "ID",
		"coursePackId": "ID",
		"studentId": "ID",
		"tutorProfileId": "ID",
		"lessonSlotIds": "ID",
		"totalAmount": "Double",
		"currency": "String",
		"paymentStatus": "Enum",
		"paymentStatus_idx": "Integer",
		"refundStatus": "Enum",
		"refundStatus_idx": "Integer",
		"enrollmentStatus": "Enum",
		"enrollmentStatus_idx": "Integer",
		"enrolledAt": "Date",
		"paymentConfirmation": "Enum",
		"paymentConfirmation_idx": "Integer",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Get Enrollment` API
**[Default get API]** — This is the designated default `get` API for the `enrollment` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Fetch a single enrollment, including all details and linked objects (student, coursePack, lessonSlots). Only the enrollment's student, tutor, or admin may view.

**API Frontend Description By The Backend Architect**

Enrollment owners (student), relevant tutor, and admin can see all details of an enrollment via this API. Contains lesson slot list, linked pack, payment/refund status, fulfillment states for transparency.

**Rest Route**

The `getEnrollment` API REST controller can be triggered via the following route:

`/v1/enrollments/:enrollmentId`


**Rest Request Parameters**


The `getEnrollment` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| enrollmentId  | ID  | true | request.params?.["enrollmentId"] |
**enrollmentId** : This id paremeter is used to query the required data object.



**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/enrollments/:enrollmentId**
```js
  axios({
    method: 'GET',
    url: `/v1/enrollments/${enrollmentId}`,
    data: {
    
    },
    params: {
    
        }
  });
```   
**REST Response**

This route's response is constrained to a select list of properties, and therefore does not encompass all attributes of the resource.

```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "enrollment",
	"method": "GET",
	"action": "get",
	"appVersion": "Version",
	"rowCount": 1,
	"enrollment": {
		"coursePack": {
			"tutorProfileId": "ID",
			"title": "String",
			"price": "Double",
			"category": "String",
			"schedulingType": "Enum",
			"schedulingType_idx": "Integer"
		},
		"lessonSlots": [
			{
				"scheduledDate": "Date",
				"scheduledTime": "String",
				"status": "Enum",
				"status_idx": "Integer",
				"locationType": "Enum",
				"locationType_idx": "Integer",
				"locationDetails": "String"
			},
			{},
			{}
		],
		"student": {
			"fullname": "String",
			"avatar": "String"
		},
		"tutorProfile": {
			"tutorId": "ID",
			"certifications": "String",
			"bio": "Text",
			"profilePhoto": "String"
		},
		"isActive": true
	}
}
```


### `List Enrollments` API
**[Default list API]** — This is the designated default `list` API for the `enrollment` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
List all enrollments. Admin sees all; students see their enrollments; tutors see enrollments where their tutorProfileId matches.

**API Frontend Description By The Backend Architect**

Admins see all enrollments; students see their own; tutors can filter enrollments to their packs by tutorProfileId. Response is enriched with embedded course, lesson, and user details as requested by the frontend.

**Rest Route**

The `listEnrollments` API REST controller can be triggered via the following route:

`/v1/enrollments`


**Rest Request Parameters**


The `listEnrollments` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| tutorProfileId  | ID  | false | request.query?.["tutorProfileId"] |
**tutorProfileId** : Optional tutor profile ID filter for tutors to see enrollments in their courses.


**Filter Parameters**

The `listEnrollments` api supports 1 optional filter parameter for filtering list results:

**paymentConfirmation** (`Enum`): An automatic property that is used to check the confirmed status of the payment set by webhooks.

- Single: `?paymentConfirmation=<value>` (case-insensitive)
- Multiple: `?paymentConfirmation=<value1>&paymentConfirmation=<value2>`
- Null: `?paymentConfirmation=null`



**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/enrollments**
```js
  axios({
    method: 'GET',
    url: '/v1/enrollments',
    data: {
    
    },
    params: {
             tutorProfileId:'"ID"',  
    
        // Filter parameters (see Filter Parameters section above)
        // paymentConfirmation: '<value>' // Filter by paymentConfirmation
            }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "enrollments",
	"method": "GET",
	"action": "list",
	"appVersion": "Version",
	"rowCount": "\"Number\"",
	"enrollments": [
		{
			"id": "ID",
			"coursePackId": "ID",
			"studentId": "ID",
			"tutorProfileId": "ID",
			"lessonSlotIds": "ID",
			"totalAmount": "Double",
			"currency": "String",
			"paymentStatus": "Enum",
			"paymentStatus_idx": "Integer",
			"refundStatus": "Enum",
			"refundStatus_idx": "Integer",
			"enrollmentStatus": "Enum",
			"enrollmentStatus_idx": "Integer",
			"enrolledAt": "Date",
			"paymentConfirmation": "Enum",
			"paymentConfirmation_idx": "Integer",
			"isActive": true,
			"recordVersion": "Integer",
			"createdAt": "Date",
			"updatedAt": "Date",
			"_owner": "ID",
			"coursePack": [
				{
					"title": "String",
					"category": "String",
					"schedulingType": "Enum",
					"schedulingType_idx": "Integer",
					"isActive": true
				},
				{},
				{}
			],
			"lessonSlots": [
				{
					"scheduledDate": "Date",
					"scheduledTime": "String",
					"status": "Enum",
					"status_idx": "Integer"
				},
				{},
				{}
			],
			"student": [
				{
					"email": "String",
					"fullname": "String",
					"avatar": "String"
				},
				{},
				{}
			],
			"tutorProfile": [
				{
					"tutorId": "ID",
					"bio": "Text"
				},
				{},
				{}
			]
		},
		{},
		{}
	],
	"paging": {
		"pageNumber": "Number",
		"pageRowCount": "NUmber",
		"totalRowCount": "Number",
		"pageCount": "Number"
	},
	"filters": [],
	"uiPermissions": []
}
```


### `Create Refundrequest` API
**[Default create API]** — This is the designated default `create` API for the `refundRequest` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Student files refund request for a completed enrollment only after first lesson and only if no additional lessons are complete. Auto-approves, updates enrollment statuses, and triggers Stripe refund if eligible.

**API Frontend Description By The Backend Architect**

Students can trigger a refund for their enrollment only after first lesson, provided no additional lessons have been completed. The refund is auto-approved and reflected in both user's and admin's views; tutor and admin are notified. No manual approval or asynchronous queue, strictly within narrow business criteria.

**Rest Route**

The `createRefundRequest` API REST controller can be triggered via the following route:

`/v1/refundrequests`


**Rest Request Parameters**


The `createRefundRequest` api has got 7 regular request parameters  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| enrollmentId  | ID  | true | request.body?.["enrollmentId"] |
| requestedAt  | Date  | true | request.body?.["requestedAt"] |
| processedAt  | Date  | false | request.body?.["processedAt"] |
| status  | Enum  | true | request.body?.["status"] |
| reason  | String  | true | request.body?.["reason"] |
| firstLessonCompleted  | Boolean  | true | request.body?.["firstLessonCompleted"] |
| adminNote  | String  | false | request.body?.["adminNote"] |
**enrollmentId** : FK to enrollment object for which refund is being requested (unique: one refund per enrollment).
**requestedAt** : Datetime refund was requested.
**processedAt** : When refund was processed by system (auto-approval).
**status** : Refund status: pending, approved, rejected, autoApproved (system processed/approved instantly).
**reason** : User-supplied reason for requesting refund.
**firstLessonCompleted** : True if this refund is after first lesson (enforced by workflow); must be checked before approval.
**adminNote** : Admin note explaining the refund decision (approve/reject reason).



**REST Request**
To access the api you can use the **REST** controller with the path **POST  /v1/refundrequests**
```js
  axios({
    method: 'POST',
    url: '/v1/refundrequests',
    data: {
            enrollmentId:"ID",  
            requestedAt:"Date",  
            processedAt:"Date",  
            status:"Enum",  
            reason:"String",  
            firstLessonCompleted:"Boolean",  
            adminNote:"String",  
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "201",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "refundRequest",
	"method": "POST",
	"action": "create",
	"appVersion": "Version",
	"rowCount": 1,
	"refundRequest": {
		"id": "ID",
		"enrollmentId": "ID",
		"requestedBy": "ID",
		"requestedAt": "Date",
		"processedAt": "Date",
		"status": "Enum",
		"status_idx": "Integer",
		"reason": "String",
		"firstLessonCompleted": "Boolean",
		"adminNote": "String",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Get Refundrequest` API
**[Default get API]** — This is the designated default `get` API for the `refundRequest` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Get refund request record for audit—visible to student (their own), tutor (if their course), or admin. Linked enrollment, user, and status are included.

**API Frontend Description By The Backend Architect**

Students check status of their refund request; tutors may audit if linked to their courses; admins can view all. Details include enrollment and state for auditing.

**Rest Route**

The `getRefundRequest` API REST controller can be triggered via the following route:

`/v1/refundrequests/:refundRequestId`


**Rest Request Parameters**


The `getRefundRequest` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| refundRequestId  | ID  | true | request.params?.["refundRequestId"] |
**refundRequestId** : This id paremeter is used to query the required data object.



**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/refundrequests/:refundRequestId**
```js
  axios({
    method: 'GET',
    url: `/v1/refundrequests/${refundRequestId}`,
    data: {
    
    },
    params: {
    
        }
  });
```   
**REST Response**

This route's response is constrained to a select list of properties, and therefore does not encompass all attributes of the resource.

```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "refundRequest",
	"method": "GET",
	"action": "get",
	"appVersion": "Version",
	"rowCount": 1,
	"refundRequest": {
		"enrollment": {
			"coursePackId": "ID",
			"studentId": "ID"
		},
		"isActive": true
	}
}
```


### `List Refundrequests` API
**[Default list API]** — This is the designated default `list` API for the `refundRequest` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
List all refund requests (students see their own, admins see all, tutors see linked to their courses via coursePack).

**API Frontend Description By The Backend Architect**

Admins list all refund requests; students see their submitted refunds; tutors see those linked to their courses for reporting and audit. Each item shows enrollment link and high-level audit fields.

**Rest Route**

The `listRefundRequests` API REST controller can be triggered via the following route:

`/v1/refundrequests`


**Rest Request Parameters**
The `listRefundRequests` api has got no request parameters.    




**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/refundrequests**
```js
  axios({
    method: 'GET',
    url: '/v1/refundrequests',
    data: {
    
    },
    params: {
    
        }
  });
```   
**REST Response**

This route's response is constrained to a select list of properties, and therefore does not encompass all attributes of the resource.

```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "refundRequests",
	"method": "GET",
	"action": "list",
	"appVersion": "Version",
	"rowCount": "\"Number\"",
	"refundRequests": [
		{
			"enrollment": [
				{
					"coursePackId": "ID",
					"studentId": "ID",
					"totalAmount": "Double",
					"currency": "String"
				},
				{},
				{}
			],
			"coursePack": {
				"title": "String"
			},
			"requester": [
				{
					"email": "String",
					"fullname": "String"
				},
				{},
				{}
			],
			"isActive": true
		},
		{},
		{}
	],
	"paging": {
		"pageNumber": "Number",
		"pageRowCount": "NUmber",
		"totalRowCount": "Number",
		"pageCount": "Number"
	},
	"filters": [],
	"uiPermissions": []
}
```


### `Update Refundrequest` API
**[Default update API]** — This is the designated default `update` API for the `refundRequest` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
Admin updates a refund request: approve or reject with an admin note. Only admins can update refund requests.

**API Frontend Description By The Backend Architect**

Admin-only endpoint for processing pending refund requests. Admin sets status to approved or rejected and optionally provides an adminNote explaining the decision. processedAt is set automatically on approval/rejection.

**Rest Route**

The `updateRefundRequest` API REST controller can be triggered via the following route:

`/v1/refundrequests/:refundRequestId`


**Rest Request Parameters**


The `updateRefundRequest` api has got 4 regular request parameters  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| refundRequestId  | ID  | true | request.params?.["refundRequestId"] |
| processedAt  | Date  | false | request.body?.["processedAt"] |
| status  | Enum  | false | request.body?.["status"] |
| adminNote  | String  | false | request.body?.["adminNote"] |
**refundRequestId** : This id paremeter is used to select the required data object that will be updated
**processedAt** : When refund was processed by system (auto-approval).
**status** : Refund status: pending, approved, rejected, autoApproved (system processed/approved instantly).
**adminNote** : Admin note explaining the refund decision (approve/reject reason).



**REST Request**
To access the api you can use the **REST** controller with the path **PATCH  /v1/refundrequests/:refundRequestId**
```js
  axios({
    method: 'PATCH',
    url: `/v1/refundrequests/${refundRequestId}`,
    data: {
            processedAt:"Date",  
            status:"Enum",  
            adminNote:"String",  
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "refundRequest",
	"method": "PATCH",
	"action": "update",
	"appVersion": "Version",
	"rowCount": 1,
	"refundRequest": {
		"id": "ID",
		"enrollmentId": "ID",
		"requestedBy": "ID",
		"requestedAt": "Date",
		"processedAt": "Date",
		"status": "Enum",
		"status_idx": "Integer",
		"reason": "String",
		"firstLessonCompleted": "Boolean",
		"adminNote": "String",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Cancel Enrollment` API
Admin force-cancels an enrollment. Sets enrollmentStatus to canceled, paymentStatus to refunded, refundStatus to processed. Used when a tutor is banned/suspended or a course is removed.

**API Frontend Description By The Backend Architect**

Admin-only action to force-cancel an enrollment. Used when tutor is banned, suspended, or course is removed.

**Rest Route**

The `cancelEnrollment` API REST controller can be triggered via the following route:

`/v1/cancelenrollment/:enrollmentId`


**Rest Request Parameters**


The `cancelEnrollment` api has got 2 regular request parameters  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| enrollmentId  | ID  | true | request.params?.["enrollmentId"] |
| cancelReason  | String  |  | request.body?.["cancelReason"] |
**enrollmentId** : This id paremeter is used to select the required data object that will be updated
**cancelReason** : Admin reason for canceling the enrollment



**REST Request**
To access the api you can use the **REST** controller with the path **PATCH  /v1/cancelenrollment/:enrollmentId**
```js
  axios({
    method: 'PATCH',
    url: `/v1/cancelenrollment/${enrollmentId}`,
    data: {
            cancelReason:"String",  
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "enrollment",
	"method": "PATCH",
	"action": "update",
	"appVersion": "Version",
	"rowCount": 1,
	"enrollment": {
		"id": "ID",
		"coursePackId": "ID",
		"studentId": "ID",
		"tutorProfileId": "ID",
		"lessonSlotIds": "ID",
		"totalAmount": "Double",
		"currency": "String",
		"paymentStatus": "Enum",
		"paymentStatus_idx": "Integer",
		"refundStatus": "Enum",
		"refundStatus_idx": "Integer",
		"enrollmentStatus": "Enum",
		"enrollmentStatus_idx": "Integer",
		"enrolledAt": "Date",
		"paymentConfirmation": "Enum",
		"paymentConfirmation_idx": "Integer",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Admin Refundenrollment` API
Admin-initiated refund for an enrollment. Creates a refundRequest with autoApproved status, cancels the enrollment, and triggers Stripe refund. No student eligibility checks — admin override.

**API Frontend Description By The Backend Architect**

Admin-only action to refund an enrollment on behalf of a student. Used when tutor is banned/suspended, course removed, or admin decides a refund is warranted. The enrollment is immediately canceled and a refund request record is created for audit.

**Rest Route**

The `adminRefundEnrollment` API REST controller can be triggered via the following route:

`/v1/adminrefundenrollment`


**Rest Request Parameters**


The `adminRefundEnrollment` api has got 2 regular request parameters  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| enrollmentId  | ID  |  | request.body?.["enrollmentId"] |
| reason  | String  |  | request.body?.["reason"] |
**enrollmentId** : The enrollment to refund
**reason** : Admin reason for issuing the refund



**REST Request**
To access the api you can use the **REST** controller with the path **POST  /v1/adminrefundenrollment**
```js
  axios({
    method: 'POST',
    url: '/v1/adminrefundenrollment',
    data: {
            enrollmentId:"ID",  
            reason:"String",  
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "201",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "refundRequest",
	"method": "POST",
	"action": "create",
	"appVersion": "Version",
	"rowCount": 1,
	"refundRequest": {
		"id": "ID",
		"enrollmentId": "ID",
		"requestedBy": "ID",
		"requestedAt": "Date",
		"processedAt": "Date",
		"status": "Enum",
		"status_idx": "Integer",
		"reason": "String",
		"firstLessonCompleted": "Boolean",
		"adminNote": "String",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Cascade Tutorban` API
Admin cascade: cancel all active enrollments for a banned/suspended tutor.

**API Frontend Description By The Backend Architect**

Called after admin bans or suspends a tutor. Cancels all active enrollments and frees slots.

**Rest Route**

The `cascadeTutorBan` API REST controller can be triggered via the following route:

`/v1/cascadetutorban`


**Rest Request Parameters**


The `cascadeTutorBan` api has got 2 regular request parameters  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| tutorProfileId  | ID  |  | request.body?.["tutorProfileId"] |
| reason  | String  |  | request.body?.["reason"] |
**tutorProfileId** : The tutor profile whose enrollments should be canceled
**reason** : Reason for cascade cancellation


**Filter Parameters**

The `cascadeTutorBan` api supports 1 optional filter parameter for filtering list results:

**paymentConfirmation** (`Enum`): An automatic property that is used to check the confirmed status of the payment set by webhooks.

- Single: `?paymentConfirmation=<value>` (case-insensitive)
- Multiple: `?paymentConfirmation=<value1>&paymentConfirmation=<value2>`
- Null: `?paymentConfirmation=null`



**REST Request**
To access the api you can use the **REST** controller with the path **POST  /v1/cascadetutorban**
```js
  axios({
    method: 'POST',
    url: '/v1/cascadetutorban',
    data: {
            tutorProfileId:"ID",  
            reason:"String",  
    
    },
    params: {
    
        // Filter parameters (see Filter Parameters section above)
        // paymentConfirmation: '<value>' // Filter by paymentConfirmation
            }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "enrollments",
	"method": "POST",
	"action": "list",
	"appVersion": "Version",
	"rowCount": "\"Number\"",
	"enrollments": [
		{
			"id": "ID",
			"coursePackId": "ID",
			"studentId": "ID",
			"tutorProfileId": "ID",
			"lessonSlotIds": "ID",
			"totalAmount": "Double",
			"currency": "String",
			"paymentStatus": "Enum",
			"paymentStatus_idx": "Integer",
			"refundStatus": "Enum",
			"refundStatus_idx": "Integer",
			"enrollmentStatus": "Enum",
			"enrollmentStatus_idx": "Integer",
			"enrolledAt": "Date",
			"paymentConfirmation": "Enum",
			"paymentConfirmation_idx": "Integer",
			"isActive": true,
			"recordVersion": "Integer",
			"createdAt": "Date",
			"updatedAt": "Date",
			"_owner": "ID"
		},
		{},
		{}
	],
	"paging": {
		"pageNumber": "Number",
		"pageRowCount": "NUmber",
		"totalRowCount": "Number",
		"pageCount": "Number"
	},
	"filters": [],
	"uiPermissions": []
}
```


### `Cascade Courseremoval` API
Admin cascade: cancel all active enrollments for a removed course pack.

**API Frontend Description By The Backend Architect**

Called after admin removes a course. Cancels all active enrollments and frees slots.

**Rest Route**

The `cascadeCourseRemoval` API REST controller can be triggered via the following route:

`/v1/cascadecourseremoval`


**Rest Request Parameters**


The `cascadeCourseRemoval` api has got 2 regular request parameters  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| coursePackId  | ID  |  | request.body?.["coursePackId"] |
| reason  | String  |  | request.body?.["reason"] |
**coursePackId** : The course pack whose enrollments should be canceled
**reason** : Reason for cascade cancellation


**Filter Parameters**

The `cascadeCourseRemoval` api supports 1 optional filter parameter for filtering list results:

**paymentConfirmation** (`Enum`): An automatic property that is used to check the confirmed status of the payment set by webhooks.

- Single: `?paymentConfirmation=<value>` (case-insensitive)
- Multiple: `?paymentConfirmation=<value1>&paymentConfirmation=<value2>`
- Null: `?paymentConfirmation=null`



**REST Request**
To access the api you can use the **REST** controller with the path **POST  /v1/cascadecourseremoval**
```js
  axios({
    method: 'POST',
    url: '/v1/cascadecourseremoval',
    data: {
            coursePackId:"ID",  
            reason:"String",  
    
    },
    params: {
    
        // Filter parameters (see Filter Parameters section above)
        // paymentConfirmation: '<value>' // Filter by paymentConfirmation
            }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "enrollments",
	"method": "POST",
	"action": "list",
	"appVersion": "Version",
	"rowCount": "\"Number\"",
	"enrollments": [
		{
			"id": "ID",
			"coursePackId": "ID",
			"studentId": "ID",
			"tutorProfileId": "ID",
			"lessonSlotIds": "ID",
			"totalAmount": "Double",
			"currency": "String",
			"paymentStatus": "Enum",
			"paymentStatus_idx": "Integer",
			"refundStatus": "Enum",
			"refundStatus_idx": "Integer",
			"enrollmentStatus": "Enum",
			"enrollmentStatus_idx": "Integer",
			"enrolledAt": "Date",
			"paymentConfirmation": "Enum",
			"paymentConfirmation_idx": "Integer",
			"isActive": true,
			"recordVersion": "Integer",
			"createdAt": "Date",
			"updatedAt": "Date",
			"_owner": "ID"
		},
		{},
		{}
	],
	"paging": {
		"pageNumber": "Number",
		"pageRowCount": "NUmber",
		"totalRowCount": "Number",
		"pageCount": "Number"
	},
	"filters": [],
	"uiPermissions": []
}
```


### `Cleanup Pendingenrollments` API
Cleanup stale pending enrollments that were never paid. Cancels them and frees lesson slots. Default timeout: 60 minutes.

**API Frontend Description By The Backend Architect**

Admin or system cron calls this to clean up abandoned enrollments. Can also be triggered from frontend as a housekeeping action.

**Rest Route**

The `cleanupPendingEnrollments` API REST controller can be triggered via the following route:

`/v1/cleanuppendingenrollments`


**Rest Request Parameters**


The `cleanupPendingEnrollments` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| maxAgeMinutes  | Integer  |  | request.body?.["maxAgeMinutes"] |
**maxAgeMinutes** : How old (in minutes) a pending enrollment must be to get cleaned up. Default: 60


**Filter Parameters**

The `cleanupPendingEnrollments` api supports 1 optional filter parameter for filtering list results:

**paymentConfirmation** (`Enum`): An automatic property that is used to check the confirmed status of the payment set by webhooks.

- Single: `?paymentConfirmation=<value>` (case-insensitive)
- Multiple: `?paymentConfirmation=<value1>&paymentConfirmation=<value2>`
- Null: `?paymentConfirmation=null`



**REST Request**
To access the api you can use the **REST** controller with the path **POST  /v1/cleanuppendingenrollments**
```js
  axios({
    method: 'POST',
    url: '/v1/cleanuppendingenrollments',
    data: {
            maxAgeMinutes:"Integer",  
    
    },
    params: {
    
        // Filter parameters (see Filter Parameters section above)
        // paymentConfirmation: '<value>' // Filter by paymentConfirmation
            }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "enrollments",
	"method": "POST",
	"action": "list",
	"appVersion": "Version",
	"rowCount": "\"Number\"",
	"enrollments": [
		{
			"id": "ID",
			"coursePackId": "ID",
			"studentId": "ID",
			"tutorProfileId": "ID",
			"lessonSlotIds": "ID",
			"totalAmount": "Double",
			"currency": "String",
			"paymentStatus": "Enum",
			"paymentStatus_idx": "Integer",
			"refundStatus": "Enum",
			"refundStatus_idx": "Integer",
			"enrollmentStatus": "Enum",
			"enrollmentStatus_idx": "Integer",
			"enrolledAt": "Date",
			"paymentConfirmation": "Enum",
			"paymentConfirmation_idx": "Integer",
			"isActive": true,
			"recordVersion": "Integer",
			"createdAt": "Date",
			"updatedAt": "Date",
			"_owner": "ID"
		},
		{},
		{}
	],
	"paging": {
		"pageNumber": "Number",
		"pageRowCount": "NUmber",
		"totalRowCount": "Number",
		"pageCount": "Number"
	},
	"filters": [],
	"uiPermissions": []
}
```


### `Check Enrollmentcompletion` API
Check if all lesson slots in an enrollment are completed and mark enrollment as completed if so.

**API Frontend Description By The Backend Architect**

Called after a lesson is marked completed. Checks if all lessons are done and auto-completes the enrollment.

**Rest Route**

The `checkEnrollmentCompletion` API REST controller can be triggered via the following route:

`/v1/checkenrollmentcompletion`


**Rest Request Parameters**


The `checkEnrollmentCompletion` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| enrollmentId  | ID  |  | request.body?.["enrollmentId"] |
**enrollmentId** : The enrollment to check for completion


**Filter Parameters**

The `checkEnrollmentCompletion` api supports 1 optional filter parameter for filtering list results:

**paymentConfirmation** (`Enum`): An automatic property that is used to check the confirmed status of the payment set by webhooks.

- Single: `?paymentConfirmation=<value>` (case-insensitive)
- Multiple: `?paymentConfirmation=<value1>&paymentConfirmation=<value2>`
- Null: `?paymentConfirmation=null`



**REST Request**
To access the api you can use the **REST** controller with the path **POST  /v1/checkenrollmentcompletion**
```js
  axios({
    method: 'POST',
    url: '/v1/checkenrollmentcompletion',
    data: {
            enrollmentId:"ID",  
    
    },
    params: {
    
        // Filter parameters (see Filter Parameters section above)
        // paymentConfirmation: '<value>' // Filter by paymentConfirmation
            }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "enrollments",
	"method": "POST",
	"action": "list",
	"appVersion": "Version",
	"rowCount": "\"Number\"",
	"enrollments": [
		{
			"id": "ID",
			"coursePackId": "ID",
			"studentId": "ID",
			"tutorProfileId": "ID",
			"lessonSlotIds": "ID",
			"totalAmount": "Double",
			"currency": "String",
			"paymentStatus": "Enum",
			"paymentStatus_idx": "Integer",
			"refundStatus": "Enum",
			"refundStatus_idx": "Integer",
			"enrollmentStatus": "Enum",
			"enrollmentStatus_idx": "Integer",
			"enrolledAt": "Date",
			"paymentConfirmation": "Enum",
			"paymentConfirmation_idx": "Integer",
			"isActive": true,
			"recordVersion": "Integer",
			"createdAt": "Date",
			"updatedAt": "Date",
			"_owner": "ID"
		},
		{},
		{}
	],
	"paging": {
		"pageNumber": "Number",
		"pageRowCount": "NUmber",
		"totalRowCount": "Number",
		"pageCount": "Number"
	},
	"filters": [],
	"uiPermissions": []
}
```


### `Get Enrollmentpayment` API
This route is used to get the payment information by ID.


**Rest Route**

The `getEnrollmentPayment` API REST controller can be triggered via the following route:

`/v1/enrollmentpayment/:sys_enrollmentPaymentId`


**Rest Request Parameters**


The `getEnrollmentPayment` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| sys_enrollmentPaymentId  | ID  | true | request.params?.["sys_enrollmentPaymentId"] |
**sys_enrollmentPaymentId** : This id paremeter is used to query the required data object.



**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/enrollmentpayment/:sys_enrollmentPaymentId**
```js
  axios({
    method: 'GET',
    url: `/v1/enrollmentpayment/${sys_enrollmentPaymentId}`,
    data: {
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "sys_enrollmentPayment",
	"method": "GET",
	"action": "get",
	"appVersion": "Version",
	"rowCount": 1,
	"sys_enrollmentPayment": {
		"id": "ID",
		"ownerId": "ID",
		"orderId": "ID",
		"paymentId": "String",
		"paymentStatus": "String",
		"statusLiteral": "String",
		"redirectUrl": "String",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `List Enrollmentpayments` API
This route is used to list all payments.


**Rest Route**

The `listEnrollmentPayments` API REST controller can be triggered via the following route:

`/v1/enrollmentpayments`


**Rest Request Parameters**



**Filter Parameters**

The `listEnrollmentPayments` api supports 6 optional filter parameters for filtering list results:

**ownerId** (`ID`):  An ID value to represent owner user who created the order

- Single: `?ownerId=<value>`
- Multiple: `?ownerId=<value1>&ownerId=<value2>`
- Null: `?ownerId=null`


**orderId** (`ID`): an ID value to represent the orderId which is the ID parameter of the source enrollment object

- Single: `?orderId=<value>`
- Multiple: `?orderId=<value1>&orderId=<value2>`
- Null: `?orderId=null`


**paymentId** (`String`): A String value to represent the paymentId which is generated on the Stripe gateway. This id may represent different objects due to the payment gateway and the chosen flow type

- Single (partial match, case-insensitive): `?paymentId=<value>`
- Multiple: `?paymentId=<value1>&paymentId=<value2>`
- Null: `?paymentId=null`


**paymentStatus** (`String`): A string value to represent the payment status which belongs to the lifecyle of a Stripe payment.

- Single (partial match, case-insensitive): `?paymentStatus=<value>`
- Multiple: `?paymentStatus=<value1>&paymentStatus=<value2>`
- Null: `?paymentStatus=null`


**statusLiteral** (`String`): A string value to represent the logical payment status which belongs to the application lifecycle itself.

- Single (partial match, case-insensitive): `?statusLiteral=<value>`
- Multiple: `?statusLiteral=<value1>&statusLiteral=<value2>`
- Null: `?statusLiteral=null`


**redirectUrl** (`String`): A string value to represent return page of the frontend to show the result of the payment, this is used when the callback is made to server not the client.

- Single (partial match, case-insensitive): `?redirectUrl=<value>`
- Multiple: `?redirectUrl=<value1>&redirectUrl=<value2>`
- Null: `?redirectUrl=null`



**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/enrollmentpayments**
```js
  axios({
    method: 'GET',
    url: '/v1/enrollmentpayments',
    data: {
    
    },
    params: {
    
        // Filter parameters (see Filter Parameters section above)
        // ownerId: '<value>' // Filter by ownerId
        // orderId: '<value>' // Filter by orderId
        // paymentId: '<value>' // Filter by paymentId
        // paymentStatus: '<value>' // Filter by paymentStatus
        // statusLiteral: '<value>' // Filter by statusLiteral
        // redirectUrl: '<value>' // Filter by redirectUrl
            }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "sys_enrollmentPayments",
	"method": "GET",
	"action": "list",
	"appVersion": "Version",
	"rowCount": "\"Number\"",
	"sys_enrollmentPayments": [
		{
			"id": "ID",
			"ownerId": "ID",
			"orderId": "ID",
			"paymentId": "String",
			"paymentStatus": "String",
			"statusLiteral": "String",
			"redirectUrl": "String",
			"isActive": true,
			"recordVersion": "Integer",
			"createdAt": "Date",
			"updatedAt": "Date",
			"_owner": "ID"
		},
		{},
		{}
	],
	"paging": {
		"pageNumber": "Number",
		"pageRowCount": "NUmber",
		"totalRowCount": "Number",
		"pageCount": "Number"
	},
	"filters": [],
	"uiPermissions": []
}
```


### `Create Enrollmentpayment` API
This route is used to create a new payment.


**Rest Route**

The `createEnrollmentPayment` API REST controller can be triggered via the following route:

`/v1/enrollmentpayment`


**Rest Request Parameters**


The `createEnrollmentPayment` api has got 5 regular request parameters  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| orderId  | ID  | true | request.body?.["orderId"] |
| paymentId  | String  | true | request.body?.["paymentId"] |
| paymentStatus  | String  | true | request.body?.["paymentStatus"] |
| statusLiteral  | String  | true | request.body?.["statusLiteral"] |
| redirectUrl  | String  | false | request.body?.["redirectUrl"] |
**orderId** : an ID value to represent the orderId which is the ID parameter of the source enrollment object
**paymentId** : A String value to represent the paymentId which is generated on the Stripe gateway. This id may represent different objects due to the payment gateway and the chosen flow type
**paymentStatus** : A string value to represent the payment status which belongs to the lifecyle of a Stripe payment.
**statusLiteral** : A string value to represent the logical payment status which belongs to the application lifecycle itself.
**redirectUrl** : A string value to represent return page of the frontend to show the result of the payment, this is used when the callback is made to server not the client.



**REST Request**
To access the api you can use the **REST** controller with the path **POST  /v1/enrollmentpayment**
```js
  axios({
    method: 'POST',
    url: '/v1/enrollmentpayment',
    data: {
            orderId:"ID",  
            paymentId:"String",  
            paymentStatus:"String",  
            statusLiteral:"String",  
            redirectUrl:"String",  
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "201",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "sys_enrollmentPayment",
	"method": "POST",
	"action": "create",
	"appVersion": "Version",
	"rowCount": 1,
	"sys_enrollmentPayment": {
		"id": "ID",
		"ownerId": "ID",
		"orderId": "ID",
		"paymentId": "String",
		"paymentStatus": "String",
		"statusLiteral": "String",
		"redirectUrl": "String",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Update Enrollmentpayment` API
This route is used to update an existing payment.


**Rest Route**

The `updateEnrollmentPayment` API REST controller can be triggered via the following route:

`/v1/enrollmentpayment/:sys_enrollmentPaymentId`


**Rest Request Parameters**


The `updateEnrollmentPayment` api has got 5 regular request parameters  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| sys_enrollmentPaymentId  | ID  | true | request.params?.["sys_enrollmentPaymentId"] |
| paymentId  | String  | false | request.body?.["paymentId"] |
| paymentStatus  | String  | false | request.body?.["paymentStatus"] |
| statusLiteral  | String  | false | request.body?.["statusLiteral"] |
| redirectUrl  | String  | false | request.body?.["redirectUrl"] |
**sys_enrollmentPaymentId** : This id paremeter is used to select the required data object that will be updated
**paymentId** : A String value to represent the paymentId which is generated on the Stripe gateway. This id may represent different objects due to the payment gateway and the chosen flow type
**paymentStatus** : A string value to represent the payment status which belongs to the lifecyle of a Stripe payment.
**statusLiteral** : A string value to represent the logical payment status which belongs to the application lifecycle itself.
**redirectUrl** : A string value to represent return page of the frontend to show the result of the payment, this is used when the callback is made to server not the client.



**REST Request**
To access the api you can use the **REST** controller with the path **PATCH  /v1/enrollmentpayment/:sys_enrollmentPaymentId**
```js
  axios({
    method: 'PATCH',
    url: `/v1/enrollmentpayment/${sys_enrollmentPaymentId}`,
    data: {
            paymentId:"String",  
            paymentStatus:"String",  
            statusLiteral:"String",  
            redirectUrl:"String",  
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "sys_enrollmentPayment",
	"method": "PATCH",
	"action": "update",
	"appVersion": "Version",
	"rowCount": 1,
	"sys_enrollmentPayment": {
		"id": "ID",
		"ownerId": "ID",
		"orderId": "ID",
		"paymentId": "String",
		"paymentStatus": "String",
		"statusLiteral": "String",
		"redirectUrl": "String",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Delete Enrollmentpayment` API
This route is used to delete a payment.


**Rest Route**

The `deleteEnrollmentPayment` API REST controller can be triggered via the following route:

`/v1/enrollmentpayment/:sys_enrollmentPaymentId`


**Rest Request Parameters**


The `deleteEnrollmentPayment` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| sys_enrollmentPaymentId  | ID  | true | request.params?.["sys_enrollmentPaymentId"] |
**sys_enrollmentPaymentId** : This id paremeter is used to select the required data object that will be deleted



**REST Request**
To access the api you can use the **REST** controller with the path **DELETE  /v1/enrollmentpayment/:sys_enrollmentPaymentId**
```js
  axios({
    method: 'DELETE',
    url: `/v1/enrollmentpayment/${sys_enrollmentPaymentId}`,
    data: {
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "sys_enrollmentPayment",
	"method": "DELETE",
	"action": "delete",
	"appVersion": "Version",
	"rowCount": 1,
	"sys_enrollmentPayment": {
		"id": "ID",
		"ownerId": "ID",
		"orderId": "ID",
		"paymentId": "String",
		"paymentStatus": "String",
		"statusLiteral": "String",
		"redirectUrl": "String",
		"isActive": false,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Get Enrollmentpaymentbyorderid` API
This route is used to get the payment information by order id.


**Rest Route**

The `getEnrollmentPaymentByOrderId` API REST controller can be triggered via the following route:

`/v1/enrollmentpaymentbyorderid/:orderId`


**Rest Request Parameters**


The `getEnrollmentPaymentByOrderId` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| orderId  | ID  | true | request.params?.["orderId"] |
**orderId** : an ID value to represent the orderId which is the ID parameter of the source enrollment object. The parameter is used to query data.



**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/enrollmentpaymentbyorderid/:orderId**
```js
  axios({
    method: 'GET',
    url: `/v1/enrollmentpaymentbyorderid/${orderId}`,
    data: {
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "sys_enrollmentPayment",
	"method": "GET",
	"action": "get",
	"appVersion": "Version",
	"rowCount": 1,
	"sys_enrollmentPayment": {
		"id": "ID",
		"ownerId": "ID",
		"orderId": "ID",
		"paymentId": "String",
		"paymentStatus": "String",
		"statusLiteral": "String",
		"redirectUrl": "String",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Get Enrollmentpaymentbypaymentid` API
This route is used to get the payment information by payment id.


**Rest Route**

The `getEnrollmentPaymentByPaymentId` API REST controller can be triggered via the following route:

`/v1/enrollmentpaymentbypaymentid/:paymentId`


**Rest Request Parameters**


The `getEnrollmentPaymentByPaymentId` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| paymentId  | String  | true | request.params?.["paymentId"] |
**paymentId** : A String value to represent the paymentId which is generated on the Stripe gateway. This id may represent different objects due to the payment gateway and the chosen flow type. The parameter is used to query data.



**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/enrollmentpaymentbypaymentid/:paymentId**
```js
  axios({
    method: 'GET',
    url: `/v1/enrollmentpaymentbypaymentid/${paymentId}`,
    data: {
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "sys_enrollmentPayment",
	"method": "GET",
	"action": "get",
	"appVersion": "Version",
	"rowCount": 1,
	"sys_enrollmentPayment": {
		"id": "ID",
		"ownerId": "ID",
		"orderId": "ID",
		"paymentId": "String",
		"paymentStatus": "String",
		"statusLiteral": "String",
		"redirectUrl": "String",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `Start Enrollmentpayment` API
Start payment for enrollment


**Rest Route**

The `startEnrollmentPayment` API REST controller can be triggered via the following route:

`/v1/startenrollmentpayment/:enrollmentId`


**Rest Request Parameters**


The `startEnrollmentPayment` api has got 2 regular request parameters  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| enrollmentId  | ID  | true | request.params?.["enrollmentId"] |
| paymentUserParams  | Object  | true | request.body?.["paymentUserParams"] |
**enrollmentId** : This id paremeter is used to select the required data object that will be updated
**paymentUserParams** : The user parameters that should be defined to start a stripe payment process. Must include paymentMethodId.



**REST Request**
To access the api you can use the **REST** controller with the path **PATCH  /v1/startenrollmentpayment/:enrollmentId**
```js
  axios({
    method: 'PATCH',
    url: `/v1/startenrollmentpayment/${enrollmentId}`,
    data: {
            paymentUserParams:"Object",  
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "enrollment",
	"method": "PATCH",
	"action": "update",
	"appVersion": "Version",
	"rowCount": 1,
	"enrollment": {
		"id": "ID",
		"coursePackId": "ID",
		"studentId": "ID",
		"tutorProfileId": "ID",
		"lessonSlotIds": "ID",
		"totalAmount": "Double",
		"currency": "String",
		"paymentStatus": "Enum",
		"paymentStatus_idx": "Integer",
		"refundStatus": "Enum",
		"refundStatus_idx": "Integer",
		"enrollmentStatus": "Enum",
		"enrollmentStatus_idx": "Integer",
		"enrolledAt": "Date",
		"paymentConfirmation": "Enum",
		"paymentConfirmation_idx": "Integer",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	},
	"paymentResult": {
		"paymentTicketId": "ID",
		"orderId": "ID",
		"paymentId": "String",
		"paymentStatus": "Enum",
		"paymentIntentInfo": "Object",
		"statusLiteral": "String",
		"amount": "Double",
		"currency": "String",
		"success": true,
		"description": "String",
		"metadata": "Object",
		"paymentUserParams": "Object"
	}
}
```


### `Refresh Enrollmentpayment` API
Refresh payment info for enrollment from Stripe


**Rest Route**

The `refreshEnrollmentPayment` API REST controller can be triggered via the following route:

`/v1/refreshenrollmentpayment/:enrollmentId`


**Rest Request Parameters**


The `refreshEnrollmentPayment` api has got 2 regular request parameters  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| enrollmentId  | ID  | true | request.params?.["enrollmentId"] |
| paymentUserParams  | Object  | false | request.body?.["paymentUserParams"] |
**enrollmentId** : This id paremeter is used to select the required data object that will be updated
**paymentUserParams** : The user parameters that should be defined to refresh a stripe payment process



**REST Request**
To access the api you can use the **REST** controller with the path **PATCH  /v1/refreshenrollmentpayment/:enrollmentId**
```js
  axios({
    method: 'PATCH',
    url: `/v1/refreshenrollmentpayment/${enrollmentId}`,
    data: {
            paymentUserParams:"Object",  
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "enrollment",
	"method": "PATCH",
	"action": "update",
	"appVersion": "Version",
	"rowCount": 1,
	"enrollment": {
		"id": "ID",
		"coursePackId": "ID",
		"studentId": "ID",
		"tutorProfileId": "ID",
		"lessonSlotIds": "ID",
		"totalAmount": "Double",
		"currency": "String",
		"paymentStatus": "Enum",
		"paymentStatus_idx": "Integer",
		"refundStatus": "Enum",
		"refundStatus_idx": "Integer",
		"enrollmentStatus": "Enum",
		"enrollmentStatus_idx": "Integer",
		"enrolledAt": "Date",
		"paymentConfirmation": "Enum",
		"paymentConfirmation_idx": "Integer",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	},
	"paymentResult": {
		"paymentTicketId": "ID",
		"orderId": "ID",
		"paymentId": "String",
		"paymentStatus": "Enum",
		"paymentIntentInfo": "Object",
		"statusLiteral": "String",
		"amount": "Double",
		"currency": "String",
		"success": true,
		"description": "String",
		"metadata": "Object",
		"paymentUserParams": "Object"
	}
}
```


### `Callback Enrollmentpayment` API
Refresh payment values by gateway webhook call for enrollment


**Rest Route**

The `callbackEnrollmentPayment` API REST controller can be triggered via the following route:

`/v1/callbackenrollmentpayment`


**Rest Request Parameters**


The `callbackEnrollmentPayment` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| enrollmentId  | ID  | false | request.body?.["enrollmentId"] |
**enrollmentId** : The order id parameter that will be read from webhook callback params



**REST Request**
To access the api you can use the **REST** controller with the path **POST  /v1/callbackenrollmentpayment**
```js
  axios({
    method: 'POST',
    url: '/v1/callbackenrollmentpayment',
    data: {
            enrollmentId:"ID",  
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "enrollment",
	"method": "POST",
	"action": "update",
	"appVersion": "Version",
	"rowCount": 1,
	"enrollment": {
		"id": "ID",
		"coursePackId": "ID",
		"studentId": "ID",
		"tutorProfileId": "ID",
		"lessonSlotIds": "ID",
		"totalAmount": "Double",
		"currency": "String",
		"paymentStatus": "Enum",
		"paymentStatus_idx": "Integer",
		"refundStatus": "Enum",
		"refundStatus_idx": "Integer",
		"enrollmentStatus": "Enum",
		"enrollmentStatus_idx": "Integer",
		"enrolledAt": "Date",
		"paymentConfirmation": "Enum",
		"paymentConfirmation_idx": "Integer",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	},
	"paymentResult": {
		"paymentTicketId": "ID",
		"orderId": "ID",
		"paymentId": "String",
		"paymentStatus": "Enum",
		"paymentIntentInfo": "Object",
		"statusLiteral": "String",
		"amount": "Double",
		"currency": "String",
		"success": true,
		"description": "String",
		"metadata": "Object",
		"paymentUserParams": "Object"
	}
}
```


### `Get Paymentcustomerbyuserid` API
This route is used to get the payment customer information by user id.


**Rest Route**

The `getPaymentCustomerByUserId` API REST controller can be triggered via the following route:

`/v1/paymentcustomers/:userId`


**Rest Request Parameters**


The `getPaymentCustomerByUserId` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userId  | ID  | true | request.params?.["userId"] |
**userId** :  An ID value to represent the user who is created as a stripe customer. The parameter is used to query data.



**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/paymentcustomers/:userId**
```js
  axios({
    method: 'GET',
    url: `/v1/paymentcustomers/${userId}`,
    data: {
    
    },
    params: {
    
        }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "sys_paymentCustomer",
	"method": "GET",
	"action": "get",
	"appVersion": "Version",
	"rowCount": 1,
	"sys_paymentCustomer": {
		"id": "ID",
		"userId": "ID",
		"customerId": "String",
		"platform": "String",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}
```


### `List Paymentcustomers` API
This route is used to list all payment customers.


**Rest Route**

The `listPaymentCustomers` API REST controller can be triggered via the following route:

`/v1/paymentcustomers`


**Rest Request Parameters**



**Filter Parameters**

The `listPaymentCustomers` api supports 3 optional filter parameters for filtering list results:

**userId** (`ID`):  An ID value to represent the user who is created as a stripe customer

- Single: `?userId=<value>`
- Multiple: `?userId=<value1>&userId=<value2>`
- Null: `?userId=null`


**customerId** (`String`): A string value to represent the customer id which is generated on the Stripe gateway. This id is used to represent the customer in the Stripe gateway

- Single (partial match, case-insensitive): `?customerId=<value>`
- Multiple: `?customerId=<value1>&customerId=<value2>`
- Null: `?customerId=null`


**platform** (`String`): A String value to represent payment platform which is used to make the payment. It is stripe as default. It will be used to distinguesh the payment gateways in the future.

- Single (partial match, case-insensitive): `?platform=<value>`
- Multiple: `?platform=<value1>&platform=<value2>`
- Null: `?platform=null`



**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/paymentcustomers**
```js
  axios({
    method: 'GET',
    url: '/v1/paymentcustomers',
    data: {
    
    },
    params: {
    
        // Filter parameters (see Filter Parameters section above)
        // userId: '<value>' // Filter by userId
        // customerId: '<value>' // Filter by customerId
        // platform: '<value>' // Filter by platform
            }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "sys_paymentCustomers",
	"method": "GET",
	"action": "list",
	"appVersion": "Version",
	"rowCount": "\"Number\"",
	"sys_paymentCustomers": [
		{
			"id": "ID",
			"userId": "ID",
			"customerId": "String",
			"platform": "String",
			"isActive": true,
			"recordVersion": "Integer",
			"createdAt": "Date",
			"updatedAt": "Date",
			"_owner": "ID"
		},
		{},
		{}
	],
	"paging": {
		"pageNumber": "Number",
		"pageRowCount": "NUmber",
		"totalRowCount": "Number",
		"pageCount": "Number"
	},
	"filters": [],
	"uiPermissions": []
}
```


### `List Paymentcustomermethods` API
This route is used to list all payment customer methods.


**Rest Route**

The `listPaymentCustomerMethods` API REST controller can be triggered via the following route:

`/v1/paymentcustomermethods/:userId`


**Rest Request Parameters**


The `listPaymentCustomerMethods` api has got 1 regular request parameter  

| Parameter              | Type                   | Required | Population                   |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userId  | ID  | true | request.params?.["userId"] |
**userId** :  An ID value to represent the user who owns the payment method. The parameter is used to query data.


**Filter Parameters**

The `listPaymentCustomerMethods` api supports 6 optional filter parameters for filtering list results:

**paymentMethodId** (`String`): A string value to represent the id of the payment method on the payment platform.

- Single (partial match, case-insensitive): `?paymentMethodId=<value>`
- Multiple: `?paymentMethodId=<value1>&paymentMethodId=<value2>`
- Null: `?paymentMethodId=null`


**customerId** (`String`): A string value to represent the customer id which is generated on the payment gateway.

- Single (partial match, case-insensitive): `?customerId=<value>`
- Multiple: `?customerId=<value1>&customerId=<value2>`
- Null: `?customerId=null`


**cardHolderName** (`String`): A string value to represent the name of the card holder. It can be different than the registered customer.

- Single (partial match, case-insensitive): `?cardHolderName=<value>`
- Multiple: `?cardHolderName=<value1>&cardHolderName=<value2>`
- Null: `?cardHolderName=null`


**cardHolderZip** (`String`): A string value to represent the zip code of the card holder. It is used for address verification in specific countries.

- Single (partial match, case-insensitive): `?cardHolderZip=<value>`
- Multiple: `?cardHolderZip=<value1>&cardHolderZip=<value2>`
- Null: `?cardHolderZip=null`


**platform** (`String`): A String value to represent payment platform which teh paymentMethod belongs. It is stripe as default. It will be used to distinguesh the payment gateways in the future.

- Single (partial match, case-insensitive): `?platform=<value>`
- Multiple: `?platform=<value1>&platform=<value2>`
- Null: `?platform=null`


**cardInfo** (`Object`): A Json value to store the card details of the payment method.

- Single: `?cardInfo=<value>`
- Multiple: `?cardInfo=<value1>&cardInfo=<value2>`
- Null: `?cardInfo=null`


**REST Request**
To access the api you can use the **REST** controller with the path **GET  /v1/paymentcustomermethods/:userId**
```js
  axios({
    method: 'GET',
    url: `/v1/paymentcustomermethods/${userId}`,
    data: {
    
    },
    params: {
    
        // Filter parameters (see Filter Parameters section above)
        // paymentMethodId: '<value>' // Filter by paymentMethodId
        // customerId: '<value>' // Filter by customerId
        // cardHolderName: '<value>' // Filter by cardHolderName
        // cardHolderZip: '<value>' // Filter by cardHolderZip
        // platform: '<value>' // Filter by platform
        // cardInfo: '<value>' // Filter by cardInfo
            }
  });
```   
**REST Response**


```json
{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "sys_paymentMethods",
	"method": "GET",
	"action": "list",
	"appVersion": "Version",
	"rowCount": "\"Number\"",
	"sys_paymentMethods": [
		{
			"id": "ID",
			"paymentMethodId": "String",
			"userId": "ID",
			"customerId": "String",
			"cardHolderName": "String",
			"cardHolderZip": "String",
			"platform": "String",
			"cardInfo": "Object",
			"isActive": true,
			"recordVersion": "Integer",
			"createdAt": "Date",
			"updatedAt": "Date",
			"_owner": "ID"
		},
		{},
		{}
	],
	"paging": {
		"pageNumber": "Number",
		"pageRowCount": "NUmber",
		"totalRowCount": "Number",
		"pageCount": "Number"
	},
	"filters": [],
	"uiPermissions": []
}
```



**After this prompt, the user may give you new instructions to update the output of this prompt or provide subsequent prompts about the project.**


