Skip to content

Billing enhancements#56

Open
Blue25GD wants to merge 3 commits intoPteroCA-Org:mainfrom
Blue25GD:billing-enhancements
Open

Billing enhancements#56
Blue25GD wants to merge 3 commits intoPteroCA-Org:mainfrom
Blue25GD:billing-enhancements

Conversation

@Blue25GD
Copy link
Copy Markdown

@Blue25GD Blue25GD commented Aug 2, 2025

This pull request introduces multiple changes to the database schema and application logic, focusing on adding support for free trials, enhancing payment settings, and improving server management. Below is a summary of the most important changes grouped by theme:

Database Schema Changes

  • Added a new user_payment table to track user payments, including fields for session ID, status, amount, currency, and related foreign keys (used_voucher and user_id) (migrations/Version20250731202312.php).
  • Introduced a new is_on_free_trial field in the server table to track servers created with a free trial (migrations/Version20250801080659.php).
  • Modified product and server_product tables to change the type of eggs_configuration from VARCHAR(255) to LONGTEXT (migrations/Version20250801084437.php). This allows longer and more complex configurations.
  • Added settings for minimum and maximum recharge amounts in the setting table (migrations/Version20250802175001.php). Stripe requires transactions to be at least 50 cents and so a minimum threshold is required.

Free Trial Support

  • Added methods to the ProductPriceInterface to handle free trial information, including hasFreeTrial, getFreeTrialValue, and getFreeTrialUnit (src/Core/Contract/ProductPriceInterface.php).
  • Implemented logic in the CartController to check user eligibility for free trials (e.g., first-time customers) and pass this information to the view (src/Core/Controller/CartController.php).

Payment Enhancements

  • Integrated minimum and maximum recharge amount settings into the BalanceController and CartController, ensuring user-entered amounts adhere to these constraints (src/Core/Controller/BalanceController.php).

Server Management Improvements

  • Added routes and logic to enable or disable auto-renewal for servers, including a new ServerAutoRenewalService dependency in the CartController (src/Core/Controller/CartController.php). This makes the application compliant towards EU Consumer Rights and canceling a server is as clear as possible.
  • Updated the ServerCrudController to display the isOnFreeTrial field in server details, ensuring it is non-editable (src/Core/Controller/Panel/ServerCrudController.php).

Miscellaneous

  • Enhanced the ServerController to use a repository method that fetches servers along with their associated products (src/Core/Controller/ServerController.php).

- Introduced 'is_on_free_trial' field in the server entity to track free trial status.
- Added minimum and maximum recharge amount settings in the payment configuration.
- Updated various services and controllers to handle free trial eligibility and recharge limits.
- Enhanced UI to reflect changes in server management and payment processes.
Prevented errors from being thrown if the user doesn't configure email
@pteroca-com
Copy link
Copy Markdown
Collaborator

Thanks for the PR and clear summary - looks like a solid set of changes :) I’ll go through the code and test it in the next days. If I notice anything that needs adjusting or polishing, I’ll leave comments.

Also, if you haven’t joined yet, feel free to hop into our Discord - it’s a good place to discuss things more directly or get quick feedback :)

@Blue25GD
Copy link
Copy Markdown
Author

Blue25GD commented Aug 3, 2025

Thanks for this swift reply. I have joined the Discord and hope this contribution is well appreciated. If you have any problems or questions feel free to ask me.

{
public function getDescription(): string
{
return '';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty description

{
public function getDescription(): string
{
return '';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty description

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty migration file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty migration file

private Server $server;

#[ORM\OneToOne(targetEntity: Product::class)]
#[ORM\ManyToOne(targetEntity: Product::class)]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why changed to ManyToOne?

{
public function getDescription(): string
{
return '';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! I see this migration was generated via doctrine:migrations:diff on a different local setup. It contains a lot of noise (index renames, default/colllation/type changes) that aren’t part of the feature and may break existing data (e.g. new UNIQUE constraints on server_product).

Could you please:

  • Rebase on current main and regenerate a clean migration that includes only the intentional changes from this PR (e.g. the free-trial columns)?
  • Drop unrelated index renames and type/default flips (unless there’s a mapping change that explicitly requires them and we agree on it).
  • Confirm whether the new UNIQUE constraints are intended; if not, please revert them.

I try to keep migrations minimal and deterministic so different environments don’t fight over names/collations. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants