CB Subs integration email expiration timing

4 years 7 months ago #313457 by activha
Replied by activha on topic CB Subs integration email expiration timing

Is the status of the basket changing when the renewal comes through?


No the basket does not change its status. I think that this is coming from CBSubs emails integration

By the way, that's a problem because for auto recurring with several days like SEPA STRIPE, we don't even know that the basket will be paid, or is pending or is dealt with by STRIPE until STRIPE sends back a payment completed or payment failed (dispute). Could you enhance this process ?

Also we have noticed that the last failed payment did not reverse the payment but only unsubscribed the subscription. Previously the payment was also reversed and indicated as this on CBSubs. Did you change something or did STRIPE change something ?

Please Log in to join the conversation.

4 years 7 months ago #313458 by krileon
Replied by krileon on topic CB Subs integration email expiration timing

No the basket does not change its status. I think that this is coming from CBSubs emails integration

I don't see how. Unless the subscription status has changed CBSubs Emails will do nothing. They would've had to actually expire for it to send the expiration email. Regardless there are some differences between the Presentation tab emails and CBSubs Emails conditions that are being corrected as per the below ticket, which might be the cause of the issue.

forge.joomlapolis.com/issues/7658

By the way, that's a problem because for auto recurring with several days like SEPA STRIPE, we don't even know that the basket will be paid, or is pending or is dealt with by STRIPE until STRIPE sends back a payment completed or payment failed (dispute). Could you enhance this process ?

There's nothing to enhance. It's waiting for Stripe to tell CBSubs if the renewal was successful or not. This is how all recurring payments work for all gateways.

Also we have noticed that the last failed payment did not reverse the payment but only unsubscribed the subscription. Previously the payment was also reversed and indicated as this on CBSubs. Did you change something or did STRIPE change something ?

Nothing was changed on our end in regards to dispute handling. If it was a dispute notification it will put the subscription in a reversed status. If it was a failed payment notification then it will fail the renewal and simply expire.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

4 years 7 months ago - 4 years 7 months ago #313551 by activha
Replied by activha on topic CB Subs integration email expiration timing

There's nothing to enhance. It's waiting for Stripe to tell CBSubs if the renewal was successful or not. This is how all recurring payments work for all gateways.


Ok understood ! In this case and if the basket does not go in the Pending state during the SEPA renewal period which may go up to 7 days, could you suggest how we can avoid to show such renewal in our lists ?

We use the following in the filter area of the list, to only display baskets which needs to be addressed by our staff :
( ( SELECT COUNT(*) FROM `#__cbsubs_subscriptions` AS sub WHERE sub.`user_id` = u.`id` AND sub.`plan_id` IN ( 6, 39, 40, 41, 51, 45, 31, 42, 43, 44, 52 ) AND sub.`expiry_date` <= date_add(NOW(), INTERVAL 1 DAY) AND sub.`autorecurring_type` = 0 ) >= 1 
AND ( SELECT COUNT(*) FROM `#__cbsubs_subscriptions` AS sub WHERE sub.`user_id` = u.`id` AND sub.`plan_id` IN ( 6, 39, 40, 41, 51, 45, 31, 42, 43, 44, 52 ) AND sub.`autorecurring_type` = 2 ) = 0 
AND ( SELECT COUNT(*) FROM `#__cbsubs_subscriptions` AS sub WHERE sub.`user_id` = u.`id` AND sub.`plan_id` IN ( 6, 39, 40, 41, 51, 45, 31, 42, 43, 44, 52 ) AND sub.`expiry_date` > date_add(NOW(), INTERVAL 1 DAY)  ) = 0 
AND ( SELECT COUNT(*) FROM `#__cbsubs_payments` AS a WHERE a.`for_user_id` = u.`id` AND a.`time_created` > date_sub(NOW(), INTERVAL 366 DAY) AND a.`payment_status` = 'Pending' ) = 0 
AND (ue.`cb_crmstate` IN (0, 1, 4, 8) OR  ue.`cb_crmstate` IS NULL))

More precisely should we use autorecurring_type or autorenew_type ? what's the difference exactly ?

Please Log in to join the conversation.

4 years 7 months ago #313552 by krileon
Replied by krileon on topic CB Subs integration email expiration timing

Ok understood ! In this case and if the basket does not go in the Pending state during the SEPA renewal period which may go up to 7 days, could you suggest how we can avoid to show such renewal in our lists ?

Your date check would need to take into account the plans grace period, which is stored in the `graceperiod` column in _cbsubs_plans. I don't know if you'll be able to do that strictly through SQL as we've a PHP side function for handling math dates. I guess you could just hardcode the 7 days addition to the date if plan id = X.

More precisely should we use autorecurring_type or autorenew_type ? what's the difference exactly ?

autorecurring_type determines if it's auto recurring with or without notifications. The values for it are as follows.

0 = Not autorecurring
1 = Autorecurring without notifications
2 = Autorecurring with notifications

autorenew_type determines if it's manual renewals, auto recurring renewals, or both (when a plan allows for either/or). The values for it are as follows.

0 = Manual
1 = User-chosen
2 = Mandatory

So for your query if you want manual renewals you'd just filter by autorecurring_type = 0. If you want auto recurring you'd filter by autorecurring_type = 2.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

4 years 7 months ago #313557 by activha
Replied by activha on topic CB Subs integration email expiration timing

I guess you could just hardcode the 7 days addition to the date if plan id = X.


This is exactly where I am stuck.
If we add say 7 days to the first query
sub.`expiry_date` <= date_add(NOW(), INTERVAL 7 DAY)
it will only include expiring plans 7 days after today, while what we want is only the plans expiring in 7 days

Do you have an idea of how I could find a way to solve this with CBSubs tables ?

Please Log in to join the conversation.

4 years 7 months ago - 4 years 7 months ago #313558 by krileon
Replied by krileon on topic CB Subs integration email expiration timing
You need to add the 7 days to the expiry date. The stored expiry date does not store with the grace period added. Once you've done that you'll be matching against the actual date CBSubs would truly expire them. From there you can do whatever you like as far as comparing against it.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.223 seconds

Facebook Twitter LinkedIn