migrate settings from webhook status page

This commit is contained in:
Narek Zakarian 2022-08-31 16:12:16 +04:00
parent 9ea7949154
commit 35909503b6
8 changed files with 52 additions and 85 deletions

View file

@ -10,25 +10,35 @@ declare(strict_types=1);
namespace WooCommerce\PayPalCommerce\Webhooks;
use WooCommerce\PayPalCommerce\Onboarding\State;
use WooCommerce\PayPalCommerce\Webhooks\Status\WebhooksStatusPage;
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
return array(
'wcgateway.settings.fields' => static function ( $container, array $fields ): array {
$status_page_fields = array(
'webhooks_list' => array(
'webhook_status_heading' => array(
'heading' => __( 'Webhook Status', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-heading',
'screens' => array(
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => Settings::CONNECTION_TAB_ID,
'description' => __( 'Status of the webhooks subscription.', 'woocommerce-paypal-payments' ),
),
'webhooks_list' => array(
'title' => __( 'Subscribed webhooks', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-table',
'screens' => array(
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => WebhooksStatusPage::ID,
'gateway' => Settings::CONNECTION_TAB_ID,
'classes' => array( 'ppcp-webhooks-table' ),
'value' => function () use ( $container ) : array {
return $container->get( 'webhook.status.registered-webhooks-data' );
},
),
'webhooks_resubscribe' => array(
'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>',
@ -36,7 +46,7 @@ return array(
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => WebhooksStatusPage::ID,
'gateway' => Settings::CONNECTION_TAB_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' ),
),
);
@ -54,7 +64,7 @@ return array(
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => WebhooksStatusPage::ID,
'gateway' => Settings::CONNECTION_TAB_ID,
'description' => __( 'Click to request a sample webhook payload from PayPal, allowing to check that your server can successfully receive webhooks.', 'woocommerce-paypal-payments' ),
),
)