change key values for tabs

This commit is contained in:
David Remer 2020-09-02 12:21:37 +03:00
parent 238f4a9207
commit 5428e0b513
4 changed files with 10 additions and 8 deletions

View file

@ -80,11 +80,11 @@ class CreditCardGateway extends PayPalGateway {
}
$this->method_title = __(
'PayPal Credit Card Processing',
'PayPal Card Processing',
'paypal-for-woocommerce'
);
$this->method_description = __(
'Provide your customers with the option to pay with credit card.',
'Accept debit and credit cards, and local payment methods with PayPals latest solution.',
'paypal-for-woocommerce'
);
$this->title = $this->config->has( 'dcc_gateway_title' ) ?

View file

@ -9,6 +9,7 @@ declare( strict_types=1 );
namespace Inpsyde\PayPalCommerce\WcGateway\Settings;
use Inpsyde\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
use Inpsyde\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
/**
@ -38,10 +39,10 @@ class SectionsRenderer {
}
//phpcs:ignore WordPress.Security.NonceVerification.Recommended
$current = ! isset( $_GET[ self::KEY ] ) ? 'paypal' : sanitize_text_field( wp_unslash( $_GET[ self::KEY ] ) );
$current = ! isset( $_GET[ self::KEY ] ) ? PayPalGateway::ID : sanitize_text_field( wp_unslash( $_GET[ self::KEY ] ) );
$sections = array(
'paypal' => __( 'PayPal', 'paypal-for-woocommerce' ),
'dcc' => __( 'Credit Card', 'paypal-for-woocommerce' ),
PayPalGateway::ID => __( 'PayPal', 'paypal-for-woocommerce' ),
CreditCardGateway::ID => __( 'Credit Card', 'paypal-for-woocommerce' ),
);
echo '<ul class="subsubsub">';

View file

@ -119,11 +119,11 @@ class SettingsListener {
$raw_data = ( isset( $_POST['ppcp'] ) ) ? (array) wp_unslash( $_POST['ppcp'] ) : array();
// phpcs:enable phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
$settings = $this->retrieve_settings_from_raw_data( $raw_data );
if ( isset( $_GET['section'] ) && PayPalGateway::ID === $_GET['section'] ) {
if ( ! isset( $_GET[SectionsRenderer::KEY] ) || PayPalGateway::ID === $_GET[SectionsRenderer::KEY] ) {
$settings['enabled'] = isset( $_POST['woocommerce_ppcp-gateway_enabled'] )
&& 1 === absint( $_POST['woocommerce_ppcp-gateway_enabled'] );
}
if ( isset( $_GET['section'] ) && CreditCardGateway::ID === $_GET['section'] ) {
if ( isset( $_GET[SectionsRenderer::KEY] ) && CreditCardGateway::ID === $_GET[SectionsRenderer::KEY] ) {
$dcc_enabled_post_key = 'woocommerce_ppcp-credit-card-gateway_enabled';
$settings['dcc_gateway_enabled'] = isset( $_POST[ $dcc_enabled_post_key ] )
&& 1 === absint( $_POST[ $dcc_enabled_post_key ] );

View file

@ -12,6 +12,7 @@ namespace Inpsyde\PayPalCommerce\WcGateway\Settings;
use Inpsyde\PayPalCommerce\ApiClient\Helper\DccApplies;
use Inpsyde\PayPalCommerce\Button\Helper\MessagesApply;
use Inpsyde\PayPalCommerce\Onboarding\State;
use Inpsyde\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
use Psr\Container\ContainerInterface;
/**
@ -213,7 +214,7 @@ class SettingsRenderer {
public function render() {
//phpcs:ignore WordPress.Security.NonceVerification.Recommended
$is_dcc = isset( $_GET[ SectionsRenderer::KEY ] ) && 'dcc' === sanitize_text_field( wp_unslash( $_GET[ SectionsRenderer::KEY ] ) );
$is_dcc = isset( $_GET[ SectionsRenderer::KEY ] ) && CreditCardGateway::ID === sanitize_text_field( wp_unslash( $_GET[ SectionsRenderer::KEY ] ) );
$nonce = wp_create_nonce( SettingsListener::NONCE );
?>
<input type="hidden" name="ppcp-nonce" value="<?php echo esc_attr( $nonce ); ?>">