After trial expire status become expired instead of trail_expired

If I manually expire membership from admin then it set to Trial_expired. but during cron expire it set to Expired. and status changes in this sequence.
Trial -> Active -> expired.
Don't know why membeship go to active state.
I have setup integration with AGILE CRM
so based on status of membership tags are get changed there.
so it create issues for me in check_membership_status function

  • Dimitris
    • Support Star

    Hey there Hazem Tasmem,

    hope you're doing good today! :slight_smile:

    I've already escalated this to our Second Level Support team for further investigation.
    Me or another colleague of mine will keep you posted here, as soon as we've got some valuable insights. Please keep in mind that our SLS team is constantly working with clients' sites, so their response times are wider than ours, your patience here is highly appreciated!

    Warm regards,
    Dimitris

  • Knawat.com
    • Recruit

    Hello Dimitris ,

    Thanks for your response. I have debugged more and found that the issue is happen because of below code.

    /*
     * The subscription will be either automatically activated
     * or set to pending.
     *
     * Important: Set trial_period_completed=true before calling
     * request_payment()!
     */
    if ( $gateway->request_payment( $this ) ) {
    						$next_status = self::STATUS_ACTIVE;
    						if( $is_public )
              							$this->status = $next_status;
    						$this->config_period(); // Needed because of status change.
    }

    This code is set membership Active. without confirm that payment is done or not. this issue happen with gateways which are not extending request_payment method. main gateway class has return TRUE; on this method.

    In gateway class I found below comment.

    * - - - - - - - - - -
     *
     * A single gateway should not implement all three payment methods! Either use
     *   handle_return   - or -
     *   process_purchase and request_payment
     *
     * @since  1.0.0
     * @package Membership2
     * @subpackage Model
     */

    My gateway is mark payment done using IPN call so I have implemented only "handle_return" method as documented. so "request_payment" method will get extended from 'MS_Gateway' Class. where "request_payment" method return TRUE. so without payment confirmation membership get confirmed..

    In My case I am giving free trial to users without any payment interaction. So I have used 'FREE' gateway to give them Free Trial. now Free gateway is part of plugin so I am not able to extend it without plugin modification..

    Can you please suggest solution for this. I don't want to set membership directly Active after trial finish. however its set expired in next check_membership_status cron run but we have setup some integration actions on status change which led as to wrong way because of this Trial > Active > Expired Flow.

    Thanks.

  • Nastia
    • Support Rock Star

    Hello Hazem Tasmem

    Hope all is well!

    Thank you for taking time and sharing with us this information! I've forwarded this to our second level support developers. Please note, our developers' response time is longer-than-normal compared to support staff response times beacuse they are dealing with complex issues.

    We appreciate your patience!

    Have a good day and take care!

    Cheers,
    Nastia

  • Nastia
    • Support Rock Star

    Hello Knawat.com

    I trust you're doing well!

    I apologize for the delayed reply. Our developer still working on this issue I am afraid. Looks like it is more complex than it was expected. I've pinged our developer about this issue to get some feedback.

    Once again, we apologize for the inconvenience, and would appreciate your understanding and cooperation.

    Kind regards,
    Nastia

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.