Skip to content

Commit

Permalink
Change order state to failed when receive the order declined webhook
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurmmoreira committed Feb 2, 2024
1 parent 038524d commit c439e4e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Mondu/Mondu/Controllers/WebhooksController.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ private function handle_declined( $params ) {
return $this->return_not_found();
}

$order->add_order_note( esc_html( sprintf( __( 'Mondu order is on declined state.', 'mondu' ) ) ), false );

if ( $order->get_status() == 'on-hold' ) {
$order->update_status('wc-failed', __('Failed', 'woocommerce'));
}

return $this->return_success();
}

Expand Down

0 comments on commit c439e4e

Please sign in to comment.