Add check for empty brand name and disable gateway if error message

This commit is contained in:
dinamiko 2022-10-17 15:41:23 +02:00
parent 763e1e287c
commit dee2c66f14

View file

@ -509,13 +509,18 @@ class PayUponInvoice {
) {
$error_messages = array();
$pui_gateway = WC()->payment_gateways->payment_gateways()[ PayUponInvoiceGateway::ID ];
if ( $pui_gateway->get_option( 'brand_name' ) === '' ) {
$error_messages[] = esc_html__( 'Could not enable gateway because "Brand name" field is empty.', 'woocommerce-paypal-payments' );
}
if ( $pui_gateway->get_option( 'logo_url' ) === '' ) {
$error_messages[] = esc_html__( 'Could not enable gateway because "Logo URL" field is empty.', 'woocommerce-paypal-payments' );
}
if ( $pui_gateway->get_option( 'customer_service_instructions' ) === '' ) {
$error_messages[] = esc_html__( 'Could not enable gateway because "Customer service instructions" field is empty.', 'woocommerce-paypal-payments' );
}
if ( count( $error_messages ) > 0 ) { ?>
if ( count( $error_messages ) > 0 ) {
$pui_gateway->update_option( 'enabled', 'no' );
?>
<div class="notice notice-error">
<?php
array_map(