laravel-cashier-mollie
laravel-cashier-mollie copied to clipboard
Wrong date for next subscription cycle.
We have switched from cashier_plans.php
to our own database plan table. Since then the cycle date calculation is very strange.
Before we had monthly (1 month) cycles that looked like this in the subscription and order_items table:
2022-01-11 08:00:00 -> 2022-02-11 08:00:00
2022-02-11 08:00:00 -> 2022-03-11 08:00:00
2022-03-11 08:00:00 -> 2022-04-11 08:00:00
Right now we have something like this:
2022-08-11 08:00:00 -> 2022-09-21 08:00:00
or
2022-08-11 08:00:00 -> 2022-09-06 08:00:00
This is our Plan-Model with the interval attribute method.
PHP: 8.1 Cashier-Mollie: v2.4.3
I think this should be very good handled by the DefaultIntervalGenerator class. I don´t get it why this is happening.
Did we something wrong? Thanks again!
Is it possible that it is the trial_ends_at
timestamp? As far as i can see uses the startOfTheSubscription
the end date of trial to calculate the next possible cycle end date.
For this specific real customer the trial has ended 2020-12-06
, what looks logical for the next cycle_ends_at 2022-09-06
. Does this column should be null
after trial expired?
Hi @tobischulz ,
Thanks for the extensive report. @ciungulete can you figure out what happened here?
Hello, any updates on this?
@ciungulete can you reproduce this issue?
As far as i can see it is the trial_ends_at or the created_at timestamps that will be used on every new cycle. But it ignores the cycle_started_at and cycle_ends_at timestamps which are important cause on a 14 day trial there are not the same day.
We have 14 day trials and monthly subscriptions. On any point, or update of the package the new cycle_ends_at is a totally different day which leads to a monthly payed subscription for a cycle that is less days as the month should have.
After manually changing the trials_ends_at timestamp to the same day as the cycle has, see above screenshot 2020-12-06 changed into 2020-12-11, the new cycle is correct and everything works as expected.
Should be easy to reproduce, just take an active subscription, change the day of the trial_ends_at and start the next cycle. cycle_ends_at should now have the day same as trial_ends_at but not as the plan interval "1 month".
At the moment im not able to reproduce this anymore. It just happens on production as there was a bug that has switched every subscription to yearly that has to be monthly. Maybe its just that bug that leads to this behaviour. So i will close this issue. I will come back to this if this ever happens again. Thanks for your time @sandervanhooft @ciungulete