Merge pull request #916 from woocommerce/PCP-742-1.9.0-test5]-when-brand-name-field-is-left-empty,-pui-purchase-fails

When Brand Name field is left empty, PUI purchase fails (742)
This commit is contained in:
Emili Castells 2022-11-02 16:43:48 +01:00 committed by GitHub
commit 68a300e9fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -503,13 +503,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(