diff --git a/modules/ppcp-wc-gateway/services.php b/modules/ppcp-wc-gateway/services.php index f8c8e5abe..2ead04fc2 100644 --- a/modules/ppcp-wc-gateway/services.php +++ b/modules/ppcp-wc-gateway/services.php @@ -23,6 +23,7 @@ use Inpsyde\PayPalCommerce\WcGateway\Notice\AuthorizeOrderActionNotice; use Inpsyde\PayPalCommerce\WcGateway\Notice\ConnectAdminNotice; use Inpsyde\PayPalCommerce\WcGateway\Processor\AuthorizedPaymentsProcessor; use Inpsyde\PayPalCommerce\WcGateway\Processor\OrderProcessor; +use Inpsyde\PayPalCommerce\WcGateway\Settings\SectionsRenderer; use Inpsyde\PayPalCommerce\WcGateway\Settings\Settings; use Inpsyde\PayPalCommerce\WcGateway\Settings\SettingsListener; use Inpsyde\PayPalCommerce\WcGateway\Settings\SettingsRenderer; @@ -81,6 +82,9 @@ return array( static function ( ContainerInterface $container ): AuthorizeOrderActionNotice { return new AuthorizeOrderActionNotice(); }, + 'wcgateway.settings.sections-renderer' => static function ( ContainerInterface $container ): SectionsRenderer { + return new SectionsRenderer(); + }, 'wcgateway.settings.render' => static function ( ContainerInterface $container ): SettingsRenderer { $settings = $container->get( 'wcgateway.settings' ); $state = $container->get( 'onboarding.state' ); diff --git a/modules/ppcp-wc-gateway/src/Gateway/class-creditcardgateway.php b/modules/ppcp-wc-gateway/src/Gateway/class-creditcardgateway.php index 90aa5205f..9d8e735f6 100644 --- a/modules/ppcp-wc-gateway/src/Gateway/class-creditcardgateway.php +++ b/modules/ppcp-wc-gateway/src/Gateway/class-creditcardgateway.php @@ -123,20 +123,6 @@ class CreditCardGateway extends PayPalGateway { ); } - /** - * Renders the settings. - * - * @return string - */ - public function generate_ppcp_html(): string { - - ob_start(); - $this->settings_renderer->render( true ); - $content = ob_get_contents(); - ob_end_clean(); - return $content; - } - /** * Returns the title of the gateway. * diff --git a/modules/ppcp-wc-gateway/src/Settings/class-sectionrenderer.php b/modules/ppcp-wc-gateway/src/Settings/class-sectionrenderer.php new file mode 100644 index 000000000..489622e72 --- /dev/null +++ b/modules/ppcp-wc-gateway/src/Settings/class-sectionrenderer.php @@ -0,0 +1,41 @@ +should_render()) { + return; + } + + $current = ! isset($_GET[self::KEY]) ? 'paypal' : sanitize_text_field(wp_unslash($_GET[self::KEY])); + $sections = [ + 'paypal' => __( 'PayPal', 'paypal-for-woocommerce' ), + 'dcc' => __( 'Credit Card', 'paypal-for-woocommerce' ), + ]; + + echo '