mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
print warning when client_id is not present while trying to store merchant_email
This commit is contained in:
parent
fa1c2e4246
commit
321a32420f
2 changed files with 21 additions and 0 deletions
|
@ -108,6 +108,12 @@ class SettingsListener {
|
||||||
$this->settings->set( 'merchant_id', $merchant_id );
|
$this->settings->set( 'merchant_id', $merchant_id );
|
||||||
$this->settings->set( 'merchant_email', $merchant_email );
|
$this->settings->set( 'merchant_email', $merchant_email );
|
||||||
|
|
||||||
|
if ( ! $this->settings->has( 'client_id' ) || ! $this->settings->get( 'client_id' ) ) {
|
||||||
|
$redirect_url = admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=ppcp-gateway&ppcp-onboarding-error=1' );
|
||||||
|
wp_safe_redirect( $redirect_url, 302 );
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
$is_sandbox = $this->settings->has( 'sandbox_on' ) && $this->settings->get( 'sandbox_on' );
|
$is_sandbox = $this->settings->has( 'sandbox_on' ) && $this->settings->get( 'sandbox_on' );
|
||||||
if ( $is_sandbox ) {
|
if ( $is_sandbox ) {
|
||||||
$this->settings->set( 'merchant_id_sandbox', $merchant_id );
|
$this->settings->set( 'merchant_id_sandbox', $merchant_id );
|
||||||
|
|
|
@ -224,6 +224,21 @@ class SettingsRenderer {
|
||||||
*/
|
*/
|
||||||
public function render() {
|
public function render() {
|
||||||
|
|
||||||
|
//phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||||
|
if ( isset( $_GET['ppcp-onboarding-error'] ) ) :
|
||||||
|
?>
|
||||||
|
<div class="notice notice-error">
|
||||||
|
<p><strong>
|
||||||
|
<?php
|
||||||
|
esc_html_e(
|
||||||
|
'We could not properly fetch the necessary credentials. Please try again.',
|
||||||
|
'paypal-payments-for-woocommerce'
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
</strong></p>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
endif;
|
||||||
//phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
//phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||||
$is_dcc = isset( $_GET[ SectionsRenderer::KEY ] ) && CreditCardGateway::ID === 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 );
|
$nonce = wp_create_nonce( SettingsListener::NONCE );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue