Skip to content

Downgrading doesn't check for failed/missed payments #9

@dparker1005

Description

@dparker1005

To re-create:

  1. Payment fails at the gateway.
  2. Member notified of the failed payment.
  3. Member logs in and clicks the downgraded member level.
  4. They’re shown the correct price and enter their new credit card details.
  5. Amount charged on receipt shows $0.

Downgrading the membership level should first check that they have paid until the current date, just as the code for memberships with the same payment periods do below:

$payment_date = pmprorate_trim_timestamp( $morder->timestamp );
$next_payment_date = pmprorate_trim_timestamp( pmpro_next_payment( $current_user->ID ) );
$today = pmprorate_trim_timestamp( current_time( 'timestamp' ) );
$days_in_period = ceil( ( $next_payment_date - $payment_date ) / 3600 / 24 );
//if no days in period (next payment should have happened already) return level with no change to avoid divide by 0
if ( $days_in_period <= 0 ) {
return $level;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions