Skip to content

Commit

Permalink
Make sure orders are marked as error if the changeMembershipLevel cal…
Browse files Browse the repository at this point in the history
…l fails here.
  • Loading branch information
ideadude committed Jun 25, 2021
1 parent cef1b3a commit c60db46
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion services/ipnhandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,12 @@
} else {
//if the initial payment failed, cancel with status error instead of cancelled
if ( $initial_payment_status === "Failed" ) {
pmpro_cancelMembershipLevel( $last_subscription_order->membership_id, $last_subscription_order->user_id, 'error' );
$cancelled = pmpro_cancelMembershipLevel( $last_subscription_order->membership_id, $last_subscription_order->user_id, 'error' );

// If we couldn't cancel, still set the order status to error.
if ( $cancelled === null ) {
$last_subscription_order->updateStatus('error');
}
} else {
pmpro_cancelMembershipLevel( $last_subscription_order->membership_id, $last_subscription_order->user_id, 'cancelled' );
}
Expand Down

0 comments on commit c60db46

Please sign in to comment.