Failed payments for appointments shows as pending in my admin

I am configuring Appointments+ plugin. In my case payments will be required to confirm an appointment.

I have noticed that if a user fills all fields of an appointment, clicks the button to pay the appointment, but if for any reason payment fails (eg. the user closes browser tab, decides not to pay at that moment etc), I can see the appointment as pending in my admin dashboard, but the user cannot make another attempt to pay the appointment. The appointment does not show up in the user dashboard, there is no email to the user saying the appointment is pending, and I cannot re-send an email to request payment. What do I need to do?

  • Predrag Dubajic
    • Support

    Hi lfungarelli,

    When you bail an appointment before payment it should show it in profile and on frontend if you use shortcode like this one:
    [app_my_appointments status="paid,confirmed,reserved,pending"]

    However I just tested this on my installation but for some reason the pending appointments are not shown there, seems like we have a bug here so I have created report for our developers to check it out.

    Best regards,
    Predrag

  • Ivan
    • Developer

    Hi lfungarelli !

    You can try this patch for that. Or you can try to change some code manually. For that, please, open {wordpress_folder}/wp-content/plugins/appointments/includes/class-app-appointment.php via FTP, find appointments_get_user_appointments function (approximately 1146th line) and replace

    function appointments_get_user_appointments( $user_id ) {
    	$user_id = absint( $user_id );
    	$user = get_userdata( $user_id );
    	if ( ! $user ) {
    		return array();
    	}
    
    	return appointments_get_appointments(
    		array(
    			'user' => $user_id,
    			'status' => array( 'paid', 'confirmed' )
    		)
    	);
    }

    to

    function appointments_get_user_appointments( $user_id, $statuses = array( 'paid', 'confirmed' ) ) {
    	$user_id = absint( $user_id );
    	$user = get_userdata( $user_id );
    	if ( ! $user ) {
    		return array();
    	}
    
    	return appointments_get_appointments(
    		array(
    			'user' => $user_id,
    			'status' => $statuses
    		)
    	);
    }

    And, also, open {wordpress_folder}/wp-content/plugins/appointments/includes/shortcodes/class-app-shortcode-my-appointments.php file, find process_shortcode function and replace this line (approximately 153rd line )
    $apps = wp_list_pluck( appointments_get_user_appointments( $user_id ), 'ID' ); to $apps = wp_list_pluck( appointments_get_user_appointments( $user_id, $statuses ), 'ID' );

    I think it will be easy for you :slight_smile:

    Also, I'll notify our developers to include these changes to the new version of the plugin.

    Best regards,
    Ivan.

  • lfungarelli
    • Site Builder, Child of Zeus

    Hello Ivan, good day to you!

    I have implemented the code changes you suggested and:

    1) Pending appointments now show in my scheduling page (frontend) when user is logged in, so this issue is fixed;

    2) Pending appointments do not show in user profile (dashboard), so this issue is not fixed by the above code;

    3) Although pending appointments do show up to the user in frontend, there is no button to pay the appointment to confirm it. Since I will require payments to confirm appointments, how can the user confirm (by paying) his own appointment if there´s no link or button to do so?

    Thanks

  • Ajay
    • WPMU DEV Initiate

    I am using buddypress with appointments+ and when the appointment is in pending, it does not show in User's Appointments screen.
    Also, As a provider, is there a way to differentiate between appointments as provider and as a requester. Right now I see them all bundled.

  • Ajay
    • WPMU DEV Initiate

    Hi Adam,
    is there any update on this?
    Also All I see in my buddyprofile is a tab "My Appointments as Provider"
    I dont see a tab for appointments I booked as user. Please let me know. this is one of the main reasons I am using WPMU, or I will not be able to continue with it for much longer.

    Ajay

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.