mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
migrate settings from webhook status page
This commit is contained in:
parent
9ea7949154
commit
35909503b6
8 changed files with 52 additions and 85 deletions
|
@ -16,6 +16,7 @@ use WooCommerce\PayPalCommerce\ApiClient\Helper\DccApplies;
|
|||
use WooCommerce\PayPalCommerce\Onboarding\Environment;
|
||||
use WooCommerce\PayPalCommerce\Onboarding\Render\OnboardingOptionsRenderer;
|
||||
use WooCommerce\PayPalCommerce\Onboarding\State;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
|
||||
return function ( ContainerInterface $container, array $fields ): array {
|
||||
|
||||
|
@ -63,7 +64,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
),
|
||||
'credentials_production_heading' => array(
|
||||
'heading' => __( 'API Credentials', 'woocommerce-paypal-payments' ),
|
||||
|
@ -73,7 +74,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
),
|
||||
'state_from' => Environment::PRODUCTION,
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
),
|
||||
'credentials_sandbox_heading' => array(
|
||||
'heading' => __( 'Sandbox API Credentials', 'woocommerce-paypal-payments' ),
|
||||
|
@ -83,7 +84,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
),
|
||||
'state_from' => Environment::SANDBOX,
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
'description' => __( 'Your account is connected to sandbox, no real charging takes place. To accept live payments, turn off sandbox mode and connect your live PayPal account.', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
|
||||
|
@ -97,7 +98,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
),
|
||||
|
||||
// We need to have a button for each option (ppcp, express)
|
||||
|
@ -113,7 +114,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
'env' => Environment::PRODUCTION,
|
||||
'products' => array( 'PPCP' ),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
),
|
||||
'ppcp_onboarding_production_express' => array(
|
||||
'type' => 'ppcp_onboarding',
|
||||
|
@ -125,7 +126,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
'env' => Environment::PRODUCTION,
|
||||
'products' => array( 'EXPRESS_CHECKOUT' ),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
),
|
||||
'ppcp_onboarding_sandbox_ppcp' => array(
|
||||
'type' => 'ppcp_onboarding',
|
||||
|
@ -137,7 +138,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
'env' => Environment::SANDBOX,
|
||||
'products' => array( 'PPCP' ),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
'description' => __( 'Prior to accepting live payments, you can test payments on your WooCommerce platform in a safe PayPal sandbox environment.', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'ppcp_onboarding_sandbox_express' => array(
|
||||
|
@ -150,7 +151,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
'env' => Environment::SANDBOX,
|
||||
'products' => array( 'EXPRESS_CHECKOUT' ),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
'description' => __( 'Prior to accepting live payments, you can test payments on your WooCommerce platform in a safe PayPal sandbox environment.', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
|
||||
|
@ -168,7 +169,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
'state_from' => Environment::PRODUCTION,
|
||||
'env' => Environment::PRODUCTION,
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
'description' => __( 'Click to reset current credentials and use another account.', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'ppcp_disconnect_sandbox' => array(
|
||||
|
@ -185,7 +186,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
'state_from' => Environment::SANDBOX,
|
||||
'env' => Environment::SANDBOX,
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
'description' => __( 'Click to reset current credentials and use another account.', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'toggle_manual_input' => array(
|
||||
|
@ -197,7 +198,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
),
|
||||
'error_label' => array(
|
||||
'type' => 'ppcp-text',
|
||||
|
@ -208,7 +209,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
),
|
||||
'sandbox_on' => array(
|
||||
'title' => __( 'Sandbox', 'woocommerce-paypal-payments' ),
|
||||
|
@ -221,7 +222,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
),
|
||||
'merchant_email_production' => array(
|
||||
'title' => __( 'Live Email address', 'woocommerce-paypal-payments' ),
|
||||
|
@ -236,7 +237,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
),
|
||||
'merchant_id_production' => array(
|
||||
'title' => __( 'Live Merchant Id', 'woocommerce-paypal-payments' ),
|
||||
|
@ -250,7 +251,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
),
|
||||
'client_id_production' => array(
|
||||
'title' => __( 'Live Client Id', 'woocommerce-paypal-payments' ),
|
||||
|
@ -264,7 +265,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
),
|
||||
'client_secret_production' => array(
|
||||
'title' => __( 'Live Secret Key', 'woocommerce-paypal-payments' ),
|
||||
|
@ -278,7 +279,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
),
|
||||
|
||||
'merchant_email_sandbox' => array(
|
||||
|
@ -294,7 +295,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
),
|
||||
'merchant_id_sandbox' => array(
|
||||
'title' => __( 'Sandbox Merchant Id', 'woocommerce-paypal-payments' ),
|
||||
|
@ -308,7 +309,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
),
|
||||
'client_id_sandbox' => array(
|
||||
'title' => __( 'Sandbox Client Id', 'woocommerce-paypal-payments' ),
|
||||
|
@ -322,7 +323,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
),
|
||||
'client_secret_sandbox' => array(
|
||||
'title' => __( 'Sandbox Secret Key', 'woocommerce-paypal-payments' ),
|
||||
|
@ -336,7 +337,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
),
|
||||
|
||||
'credentials_feature_onboarding_heading' => array(
|
||||
|
@ -346,7 +347,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
'description' => __( 'See which features are available.', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'ppcp_dcc_status' => array(
|
||||
|
@ -357,7 +358,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
),
|
||||
'ppcp_pui_status' => array(
|
||||
'title' => __( 'Pay Upon Invoice', 'woocommerce-paypal-payments' ),
|
||||
|
@ -367,7 +368,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array( 'pui_ready' ),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
),
|
||||
'tracking_enabled' => array(
|
||||
'title' => __( 'Tracking', 'woocommerce-paypal-payments' ),
|
||||
|
@ -380,7 +381,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
'input_class' => $container->get( 'wcgateway.settings.should-disable-tracking-checkbox' ) ? array( 'ppcp-disabled-checkbox' ) : array(),
|
||||
),
|
||||
|
||||
|
@ -391,7 +392,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
'description' => __( 'See which features are available.', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'prefix' => array(
|
||||
|
@ -415,7 +416,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
),
|
||||
'logging_enabled' => array(
|
||||
'title' => __( 'Logging', 'woocommerce-paypal-payments' ),
|
||||
|
@ -430,7 +431,7 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array(),
|
||||
'gateway' => 'connection',
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
),
|
||||
);
|
||||
|
||||
|
|
|
@ -59,7 +59,6 @@ use WooCommerce\PayPalCommerce\WcGateway\Settings\SectionsRenderer;
|
|||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\SettingsListener;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\SettingsRenderer;
|
||||
use WooCommerce\PayPalCommerce\Webhooks\Status\WebhooksStatusPage;
|
||||
|
||||
return array(
|
||||
'wcgateway.paypal-gateway' => static function ( ContainerInterface $container ): PayPalGateway {
|
||||
|
@ -159,7 +158,7 @@ return array(
|
|||
}
|
||||
|
||||
$section = isset( $_GET['section'] ) ? sanitize_text_field( wp_unslash( $_GET['section'] ) ) : '';
|
||||
return in_array( $section, array( Settings::CONNECTION_TAB_ID, PayPalGateway::ID, CreditCardGateway::ID, WebhooksStatusPage::ID, PayUponInvoiceGateway::ID, CardButtonGateway::ID, OXXOGateway::ID ), true );
|
||||
return in_array( $section, array( Settings::CONNECTION_TAB_ID, PayPalGateway::ID, CreditCardGateway::ID, PayUponInvoiceGateway::ID, CardButtonGateway::ID, OXXOGateway::ID ), true );
|
||||
},
|
||||
|
||||
'wcgateway.current-ppcp-settings-page-id' => static function ( ContainerInterface $container ): string {
|
||||
|
@ -224,14 +223,13 @@ return array(
|
|||
CardButtonGateway::ID => __( 'PayPal Card Button', 'woocommerce-paypal-payments' ),
|
||||
OXXOGateway::ID => __( 'OXXO', 'woocommerce-paypal-payments' ),
|
||||
PayUponInvoiceGateway::ID => __( 'Pay upon Invoice', 'woocommerce-paypal-payments' ),
|
||||
WebhooksStatusPage::ID => __( 'Webhooks Status', 'woocommerce-paypal-payments' ),
|
||||
);
|
||||
|
||||
// Remove for all not registered in WC gateways that cannot render anything in this case.
|
||||
$gateways = WC()->payment_gateways->payment_gateways();
|
||||
foreach ( array_diff(
|
||||
array_keys( $sections ),
|
||||
array( Settings::CONNECTION_TAB_ID, PayPalGateway::ID, CreditCardGateway::ID, WebhooksStatusPage::ID )
|
||||
array( Settings::CONNECTION_TAB_ID, PayPalGateway::ID, CreditCardGateway::ID )
|
||||
) as $id ) {
|
||||
if ( ! isset( $gateways[ $id ] ) ) {
|
||||
unset( $sections[ $id ] );
|
||||
|
|
|
@ -29,7 +29,6 @@ use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundProcessor;
|
|||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\SettingsRenderer;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use WooCommerce\PayPalCommerce\Webhooks\Status\WebhooksStatusPage;
|
||||
|
||||
/**
|
||||
* Class PayPalGateway
|
||||
|
@ -297,9 +296,6 @@ class PayPalGateway extends \WC_Payment_Gateway {
|
|||
if ( $this->is_credit_card_tab() ) {
|
||||
return __( 'PayPal Card Processing', 'woocommerce-paypal-payments' );
|
||||
}
|
||||
if ( $this->is_webhooks_tab() ) {
|
||||
return __( 'Webhooks Status', 'woocommerce-paypal-payments' );
|
||||
}
|
||||
if ( $this->is_paypal_tab() ) {
|
||||
return __( 'PayPal Checkout', 'woocommerce-paypal-payments' );
|
||||
}
|
||||
|
@ -326,12 +322,6 @@ class PayPalGateway extends \WC_Payment_Gateway {
|
|||
'woocommerce-paypal-payments'
|
||||
);
|
||||
}
|
||||
if ( $this->is_webhooks_tab() ) {
|
||||
return __(
|
||||
'Status of the webhooks subscription.',
|
||||
'woocommerce-paypal-payments'
|
||||
);
|
||||
}
|
||||
|
||||
if ( is_admin() ) {
|
||||
return __(
|
||||
|
@ -372,16 +362,6 @@ class PayPalGateway extends \WC_Payment_Gateway {
|
|||
return is_admin() && PayUponInvoiceGateway::ID === $this->page_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether we are on the Webhooks Status tab.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function is_webhooks_tab() : bool {
|
||||
return is_admin()
|
||||
&& WebhooksStatusPage::ID === $this->page_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether we are on the connection tab.
|
||||
*
|
||||
|
|
|
@ -12,7 +12,6 @@ namespace WooCommerce\PayPalCommerce\WcGateway\Settings;
|
|||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\CardButtonGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
|
||||
use WooCommerce\PayPalCommerce\Webhooks\Status\WebhooksStatusPage;
|
||||
|
||||
/**
|
||||
* Class PageMatcherTrait.
|
||||
|
@ -33,11 +32,10 @@ trait PageMatcherTrait {
|
|||
}
|
||||
|
||||
$gateway_page_id_map = array(
|
||||
Settings::CONNECTION_TAB_ID => 'connection',
|
||||
Settings::CONNECTION_TAB_ID => Settings::CONNECTION_TAB_ID,
|
||||
PayPalGateway::ID => 'paypal',
|
||||
CreditCardGateway::ID => 'dcc', // TODO: consider using just the gateway ID for PayPal and DCC too.
|
||||
CardButtonGateway::ID => CardButtonGateway::ID,
|
||||
WebhooksStatusPage::ID => WebhooksStatusPage::ID,
|
||||
);
|
||||
return array_key_exists( $current_page_id, $gateway_page_id_map )
|
||||
&& in_array( $gateway_page_id_map[ $current_page_id ], $allowed_gateways, true );
|
||||
|
|
|
@ -11,7 +11,6 @@ namespace WooCommerce\PayPalCommerce\WcGateway\Settings;
|
|||
|
||||
use WooCommerce\PayPalCommerce\Onboarding\State;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
|
||||
use WooCommerce\PayPalCommerce\Webhooks\Status\WebhooksStatusPage;
|
||||
|
||||
/**
|
||||
* Class SectionsRenderer
|
||||
|
@ -77,7 +76,7 @@ class SectionsRenderer {
|
|||
|
||||
foreach ( $this->sections as $id => $label ) {
|
||||
$url = admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=' . $id );
|
||||
if ( in_array( $id, array( Settings::CONNECTION_TAB_ID, CreditCardGateway::ID, WebhooksStatusPage::ID ), true ) ) {
|
||||
if ( in_array( $id, array( Settings::CONNECTION_TAB_ID, CreditCardGateway::ID ), true ) ) {
|
||||
// We need section=ppcp-gateway for the webhooks page because it is not a gateway,
|
||||
// and for DCC because otherwise it will not render the page if gateway is not available (country/currency).
|
||||
// Other gateways render fields differently, and their pages are not expected to work when gateway is not available.
|
||||
|
|
|
@ -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' ),
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Status page.
|
||||
*
|
||||
* @package WooCommerce\PayPalCommerce\Webhooks\Status
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce\Webhooks\Status;
|
||||
|
||||
/**
|
||||
* Class WebhooksStatusPage
|
||||
*/
|
||||
class WebhooksStatusPage {
|
||||
|
||||
const ID = 'ppcp-webhooks-status-page';
|
||||
}
|
|
@ -15,11 +15,11 @@ use Exception;
|
|||
use Interop\Container\ServiceProviderInterface;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
use WooCommerce\PayPalCommerce\Webhooks\Endpoint\ResubscribeEndpoint;
|
||||
use WooCommerce\PayPalCommerce\Webhooks\Endpoint\SimulateEndpoint;
|
||||
use WooCommerce\PayPalCommerce\Webhooks\Endpoint\SimulationStateEndpoint;
|
||||
use WooCommerce\PayPalCommerce\Webhooks\Status\Assets\WebhooksStatusPageAssets;
|
||||
use WooCommerce\PayPalCommerce\Webhooks\Status\WebhooksStatusPage;
|
||||
|
||||
/**
|
||||
* Class WebhookModule
|
||||
|
@ -112,9 +112,8 @@ class WebhookModule implements ModuleInterface {
|
|||
);
|
||||
|
||||
$page_id = $container->get( 'wcgateway.current-ppcp-settings-page-id' );
|
||||
if ( WebhooksStatusPage::ID === $page_id ) {
|
||||
$GLOBALS['hide_save_button'] = true;
|
||||
$asset_loader = $container->get( 'webhook.status.assets' );
|
||||
if ( Settings::CONNECTION_TAB_ID === $page_id ) {
|
||||
$asset_loader = $container->get( 'webhook.status.assets' );
|
||||
assert( $asset_loader instanceof WebhooksStatusPageAssets );
|
||||
add_action(
|
||||
'init',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue