Skip to content

Commit

Permalink
Fixed spaces field dni
Browse files Browse the repository at this point in the history
Added filter wc_siigo_integration_country_code
  • Loading branch information
Saul Morales committed Oct 7, 2024
1 parent 28dfb4f commit 97a596b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion includes/class-integration-siigo-wc.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,10 @@ public static function generate_invoice($order_id, $previous_status, $next_statu

$type_document = $billing_type_document ?: $shipping_type_document ? : $classic_type_document;
$dni = $billing_dni ?: $shipping_dni ?: $classic_dni;
$dni = trim($dni);

$country_code = $order->get_billing_country() ?: $order->get_shipping_country();
$country_code = apply_filters('wc_siigo_integration_country_code', $country_code);
$state = $order->get_billing_state() ?: $order->get_shipping_state();
$city = $order->get_billing_city() ?: $order->get_shipping_city();
$states_dane = include(dirname(__FILE__) . '/states-dane.php');
Expand All @@ -225,6 +228,7 @@ public static function generate_invoice($order_id, $previous_status, $next_statu
$address = $order->get_billing_address_1() ?: $order->get_shipping_address_1();
$address = apply_filters('wc_siigo_integration_address', $address);

if(!$country_code) throw new Exception('País no encontrado');
if(!$state_code) throw new Exception('Departamento no encontrado');
if(!$city_code) throw new Exception('Ciudad no encontrada');

Expand Down Expand Up @@ -262,7 +266,7 @@ public static function generate_invoice($order_id, $previous_status, $next_statu
"address" => [
"address" => $address,
"city" => [
"country_code" => $order->get_billing_country() ?: $order->get_shipping_country(),
"country_code" => $country_code,
"state_code" => $state_code,
"city_code" => $city_code
],
Expand Down
4 changes: 2 additions & 2 deletions integration-siigo-woo.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Plugin Name: Integration Siigo Woocommerce
* Description: Integración del sistama contable y de facturación Siigo para Woocoommerce
* Version: 0.0.16
* Version: 0.0.17
* Author: Saul Morales Pacheco
* Author URI: https://saulmoralespa.com
* License: GNU General Public License v3.0
Expand All @@ -17,7 +17,7 @@
}

if(!defined('INTEGRATION_SIIGO_WC_SMP_VERSION')){
define('INTEGRATION_SIIGO_WC_SMP_VERSION', '0.0.16');
define('INTEGRATION_SIIGO_WC_SMP_VERSION', '0.0.17');
}

add_action( 'plugins_loaded', 'integration_siigo_wc_smp_init');
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: commerce, e-commerce, commerce, WordPress ecommerce, store, sales, sell, s
Requires at least: 6.0
Tested up to: 6.6.1
Requires PHP: 8.1
Stable tag: 0.0.16
Stable tag: 0.0.17
License: GNU General Public License v3.0
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Expand Down

0 comments on commit 97a596b

Please sign in to comment.