class-delete-active-platform-checkout-webhook.php
844 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/**
* Class Delete_Active_Platform_Checkout_Webhook
*
* @package WooCommerce\Payments
*/
namespace WCPay\Migrations;
defined( 'ABSPATH' ) || exit;
/**
* Class Delete_Active_Platform_Checkout_Webhook
*
* Fires an event on plugin upgrade to delete the active webhook.
* Runs only once. We want to know whether existing install had it
* enabled before the current version.
*/
class Delete_Active_Platform_Checkout_Webhook {
/**
* Checks whether we should trigger the event.
*/
public static function maybe_delete() {
if ( version_compare( get_option( 'woocommerce_woocommerce_payments_version' ), '4.9.0', '>=' ) ) {
return;
}
self::delete();
}
/**
* Deletes the active webhook.
*/
private static function delete() {
\WCPay\Platform_Checkout\Platform_Checkout_Order_Status_Sync::remove_webhook();
}
}