By Weeblr on Wednesday, 14 October 2020
Posted in General Issues
Replies 5
Likes 0
Views 468
Votes 0
Hi

I have debugged an issue in Payplans 4.2.2 that causes me some trouble with users renewal of their subscription. I have reproduced this independantly on my live site, so you can too.

It goes as like this:

- User purchased a sub in November 2018
- They renew in November 2019 (Paypal) but there's a problem somewhere and they pay twice
- We refund one of the invoice. User now has one Active sub and 3 invoices: 2018, 2019 paid and 2019 refunded
- Now they want to renew in 2020: go to dashboard, hit the Renew button and they get a Fatal error:



Error: 0 call to undefined method stdClass::refresh()


I have tracked that down to /administrator/components/com_payplans/includes/renewal/renewal.php at line 71: the $invoice object is a stdClass instead of being an invoice object.
I have tracked that down then to: /administrator/components/com_payplans/includes/order/order.php at line 413.
Payplans gets the 2 invoices for that user: the oldes is active and the more recent has been redunded. Therefore at line 413


$invoice = $this->createChildInvoice($invoiceCount);


fails to create a child invoice and eventually a fatal error is triggered later on.

So there are 3 problems:

1 - This situation is not taken into account: createChildInvoice should not try to create a childInvoice from the last subscription but from the last active subscription.
2. If not possible, this should not trigger a fatal error but simply some kind of error message.

Please have a look and try fix that.

The 3rd problem is how I fix that manually until the problem is really fixed. I have tried re-creating a separate subscription expiring in a month, but when I go to the user dashboard, the "Renew" button is not displayed.

Right now, I have:

- deleted all the invoices, orders and subscriptions of that user in the database as there's no UI to delete those items
- Created a new subscription
- Set the expiration date of that subscription to November 8, 2020 (the original expiration date)

BUT: when going to the dashboard, the Renew button is not displayed. What's going on?

Please provide me for a temporary solution to allow user to renew. Why is the renew button not showing on an active subscription?

Best regards
Yannick Gaultier
weeblr.com / @weeblr
Hi again

So I have found why the Renew button is not shown, that's another bug happening when one manually assign a subscription to a user:

In the database, the params field is not properly set, the property expirationtype is not set as it should.

After manually changing:


{"notes":""}


to


{"notes":"", "expirationtype":"fixed"}


the renew button is now displayed and appear to be working normally.

So I will apply this fix to the live site and hope for the best - and for fixes for both issues.

Best regards
Yannick Gaultier
weeblr.com / @weeblr
·
Wednesday, 14 October 2020 19:12
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi again,

There was one last bug discovered. As per last message, I had to add


"expirationtype":"fixed"


to the params field of the subscriptions table to make the button appear (after manually adding the subscription to the user account from the admin).

However, after that, I went to the Payplans admin and added some notes to the subscription "Notes" field, to remember all this in the future.

And then the Renew button disappeared again and the customer could not renew!

It turns out that when you save a note from the admin, that removed the "expirationtype":"fixed" property from the params field!!!

Best regards
Yannick Gaultier
weeblr.com / @weeblr
·
Wednesday, 14 October 2020 21:08
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Weebler,

It turns out that when you save a note from the admin, that removed the "expirationtype":"fixed" property from the params field!!!
Regarding this issue, we already addressed this issue and it's already included in Payplans 4.2.2 release.

To check further issues, please update us with your site backend and FTP details.

Update us with a response.
·
Thursday, 15 October 2020 11:01
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi

Regarding this issue, we already addressed this issue and it's already included in Payplans 4.2.2 release.

All the above is with version 4.2.2. Here is the 1st line of my first message.

I have debugged an issue in Payplans 4.2.2


To check further issues, please update us with your site backend and FTP details.

You do not need any FTP details. I have done the PHP debugging for you and you simply need to reproduce on an independant site.

Best regards
·
Thursday, 15 October 2020 16:07
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Weeblr,

All the above is with version 4.2.2. Here is the 1st line of my first message.
Sorry for the confusion, I missed it.

You do not need any FTP details. I have done the PHP debugging for you and you simply need to reproduce on an independant site.
I'll try the same steps at my localend to reproduce the issue. Will get back to you on this again.

Thank you for understanding !
·
Thursday, 15 October 2020 16:17
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post