get_webhooks_ids() as $mintveo_id ) { $mintveo_webhook = wc_get_webhook( $mintveo_id ); if ( $mintveo_webhook && 'https://api.mintveo.com/woocommerce/webhook' === $mintveo_webhook->get_delivery_url() ) { $mintveo_webhook->delete( true ); } } } // Tell Mintveo the plugin was deleted, so the store shows as disconnected there and its data // is deleted on schedule. Signed with the store secret, which is removed right after. $mintveo_secret = (string) get_option( 'mintveo_wc_webhook_secret', '' ); if ( '' !== $mintveo_secret ) { $mintveo_body = wp_json_encode( array( 'type' => 'uninstalled' ) ); wp_remote_post( 'https://api.mintveo.com/woocommerce/event', array( 'timeout' => 5, 'headers' => array( 'Content-Type' => 'application/json', 'X-Mintveo-Site' => home_url( '/' ), 'X-Mintveo-Plugin' => '1.1.6', 'X-Mintveo-Signature' => base64_encode( hash_hmac( 'sha256', $mintveo_body, $mintveo_secret, true ) ), // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode ), 'body' => $mintveo_body, ) ); } delete_option( 'mintveo_wc_webhook_secret' ); delete_option( 'mintveo_wc_connected_at' ); delete_option( 'mintveo_wc_version' ); wp_clear_scheduled_hook( 'mintveo_catalog_push' ); wp_clear_scheduled_hook( 'mintveo_heartbeat' );