Skip to content

Commit 3ae970c

Browse files
committed
feat: Require account selection for payment methods in Alegra integration
1 parent 4613f02 commit 3ae970c

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

includes/class-alegra-integration-wc.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,18 @@ public function validate_payment_mappings_table_field($key, $value): array
337337
}
338338
}
339339

340+
// Account is required when payment_method is selected (both CASH and CREDIT).
341+
if ($payment_method && !$account_id) {
342+
WC_Admin_Settings::add_error(
343+
sprintf(
344+
__('Integration Alegra Woocommerce: La Cuenta bancaria es obligatoria cuando la Forma de pago está seleccionada en el gateway "%s".', 'integration-alegra-woo'),
345+
$gateway_id
346+
)
347+
);
348+
$has_errors = true;
349+
continue;
350+
}
351+
340352
if ( $account_id && !isset($available_bank_accounts[$account_id])) {
341353
WC_Admin_Settings::add_error(
342354
sprintf(

integration-alegra-woo.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* Plugin Name: Integration Alegra Woocommerce
44
* Description: Integración del sistema contable y de facturación Alegra para Woocommerce
5-
* Version: 0.1.2
5+
* Version: 0.1.3
66
* Author: Saúl Morales Pacheco
77
* Author URI: https://saulmoralespa.com
88
* License: GNU General Public License v3.0
@@ -20,7 +20,7 @@
2020
}
2121

2222
if(!defined('INTEGRATION_ALEGRA_WC_SMP_VERSION')){
23-
define('INTEGRATION_ALEGRA_WC_SMP_VERSION', '0.1.2');
23+
define('INTEGRATION_ALEGRA_WC_SMP_VERSION', '0.1.3');
2424
}
2525

2626
add_action( 'plugins_loaded', 'integration_alegra_wc_smp_init');

readme.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Tags: commerce, e-commerce, commerce, WordPress ecommerce, store, sales, sell, s
55
Requires at least: 6.0
66
Tested up to: 6.9
77
Requires PHP: 8.1
8-
Stable tag: 0.1.2
8+
Stable tag: 0.1.3
99
WC requires at least: 9.6
1010
WC tested up to: 10.7
1111
License: GNU General Public License v3.0
@@ -216,6 +216,9 @@ Sí, el plugin incluye una opción de sincronización masiva de productos desde
216216

217217
== Changelog ==
218218

219+
= 0.1.3 =
220+
* Fixed require account selection for payment methods
221+
219222
= 0.1.2 =
220223
* Fixed payment method (Forma de pago) is now required only when payment type is CASH; CREDIT gateways can be saved without it
221224
* Fixed invoice payload no longer includes top-level `paymentMethod` field when payment method is empty (CREDIT without Forma de pago)

0 commit comments

Comments
 (0)