Merge pull request #794 from woocommerce/pcp-355-hide-gateways

Hide additional gateways when not onboarded or not available
This commit is contained in:
Emili Castells 2022-08-19 09:29:09 +02:00 committed by GitHub
commit 5a5ebd0e58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 17 deletions

View file

@ -142,11 +142,15 @@ return array(
$settings = $container->get( 'wcgateway.settings' );
return new DisableGateways( $session_handler, $settings );
},
'wcgateway.is-wc-payments-page' => static function ( ContainerInterface $container ): bool {
$page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
$tab = isset( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : '';
return 'wc-settings' === $page && 'checkout' === $tab;
},
'wcgateway.is-wc-gateways-list-page' => static function ( ContainerInterface $container ): bool {
return $container->get( 'wcgateway.is-wc-payments-page' ) && ! isset( $_GET['section'] );
},
'wcgateway.is-ppcp-settings-page' => static function ( ContainerInterface $container ): bool {
if ( ! $container->get( 'wcgateway.is-wc-payments-page' ) ) {