Welcome to tothemoon.chat

Version 1.0.0

Created by: Bloberry Consulting

This is the landing page of the application. Navigate through the app to explore its features.

Loading information...

Loading information...

Description

This project is a web-based application designed to manage user information and API interactions. The 'ApiController' handles various API-related functionalities, including viewing, creating, and managing API keys, client profiles, and customer queries. The 'UserController' focuses on user-related operations, such as retrieving user information, selecting APIs for users, and assigning roles. Secure access is enforced through different roles, ensuring that each endpoint is accessed only by authorized users. The communication flow is designed to be straightforward, with clear endpoints for each specific task.

API Controller

The ApiController is designed to manage API interactions and user requests for transcription services, API key management, and more. It incorporates security with role-based access control, ensuring that only authorized users can execute specific operations.

Endpoints:

Security Roles:

ROLE_CUSTOMER, ROLE_SITE_ADMINISTRATOR, ROLE_CLIENT_ADMINISTRATOR

User Controller

The UserController focuses on operations related to user management, including information retrieval, API selection for users, and user-client association. It ensures secure access through authentication and authorization mechanisms.

Endpoints:

Security Roles:

ROLE_CUSTOMER, ROLE_SITE_ADMINISTRATOR, ROLE_CLIENT_ADMINISTRATOR

Stripe Payment Controller

This controller is responsible for creating Stripe Checkout Sessions. It initializes with the Stripe API key and sets up payment sessions with configurable amounts and success or cancellation URLs. The session creation endpoint takes payment details, creates a checkout session, and returns a session ID for frontend redirection to the Stripe payment page.

@PostMapping("/stripepayment/create-checkout-session")

The amount is dynamically mapped to price IDs configured in Stripe, allowing for flexible payment options. Successful payment sessions redirect users to a success page, and metadata including the user's ID is attached for tracking and confirmation purposes.

Stripe Webhook Controller

This controller handles webhook events from Stripe, particularly focusing on the completion of checkout sessions. It verifies the event signature to ensure legitimacy, then processes the event data to perform actions such as updating user credits based on the payment amount.

@PostMapping("/stripepayment/webhook")

Upon receiving a "checkout.session.completed" event, the controller extracts customer details and the payment amount from the session data. It then updates the corresponding user's credit in the system, based on the customer's email and the total payment amount. This automated process ensures that user credits are accurately and efficiently managed following successful transactions.