Add resubscribe webhooks button

This commit is contained in:
Alex P 2021-09-16 17:08:43 +03:00
parent 1720c12ef3
commit d908445e5e
6 changed files with 159 additions and 2 deletions

View file

@ -15,7 +15,7 @@ use WooCommerce\PayPalCommerce\Webhooks\Status\WebhooksStatusPage;
return array(
'wcgateway.settings.fields' => static function ( $container, array $fields ): array {
$status_page_fields = array(
'webhooks_list' => array(
'webhooks_list' => array(
'title' => __( 'Subscribed webhooks', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-table',
'screens' => array(
@ -29,6 +29,18 @@ return array(
return $container->get( 'webhook.status.registered-webhooks-data' );
},
),
'webhooks_resubscribe' => array(
'title' => __( 'Resubscribe webhooks', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-text',
'text' => '<button type="button" class="button ppcp-webhooks-resubscribe">' . esc_html__( 'Resubscribe', 'woocommerce-paypal-payments' ) . '</button>',
'screens' => array(
State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => WebhooksStatusPage::ID,
'description' => __( 'Click to remove the current webhook subscription and subscribe again, for example, if the website domain or URL structure changed.', 'woocommerce-paypal-payments' ),
),
);
return array_merge( $fields, $status_page_fields );