diff --git a/.clippy.toml b/.clippy.toml new file mode 100644 index 00000000..0358cdb5 --- /dev/null +++ b/.clippy.toml @@ -0,0 +1,2 @@ +allow-unwrap-in-tests = true +allow-expect-in-tests = true diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 8bfcce8e..596f992f 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -12,11 +12,3 @@ updates: directory: "/" schedule: interval: "daily" - - - package-ecosystem: "npm" - directory: "/openubl/ui" - schedule: - interval: "daily" - allow: - - dependency-name: "@patternfly/*" - dependency-type: "direct" diff --git a/Cargo.toml b/Cargo.toml index e65f19ed..2db36dce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,31 @@ [workspace] resolver = "2" members = ["xbuilder", "xsender"] + +[workspace.dependencies] +chrono = { version = "0.4.31", features = ["serde"] } +regex = "1.10.2" +log = "0.4.20" +tera = "1.19.1" +lazy_static = "1.4.0" +serde = { version = "1.0.193", features = ["derive"] } +rust_decimal = { version = "1.33.1", features = [ + "serde-str", + "serde-with-str", +] } +rust_decimal_macros = "1.33.1" +xml = "0.8.10" +zip = { version = "0.6.6" } +reqwest = "0.11.22" +base64 = "0.21.5" +thiserror = "1.0.53" +anyhow = "1.0.78" +sha2 = "0.10.8" +rsa = "0.9.6" +rand = "0.8.5" +rcgen = "0.12.0" +x509-parser = "0.15.1" +serial_test = "2.0.0" +tokio = "1.35.1" + +[patch.crates-io] diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 00000000..d322aaba --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "1.78.0" +components = [ "rustfmt", "clippy" ] diff --git a/xbuilder/Cargo.toml b/xbuilder/Cargo.toml index 23f3e200..1f0cecdb 100644 --- a/xbuilder/Cargo.toml +++ b/xbuilder/Cargo.toml @@ -6,14 +6,14 @@ license = "Apache-2.0" description = "Creates XML files based on UBL under the standards of Peru." [dependencies] -chrono = { version = "0.4.31", features = ["serde"] } -regex = "1.10.2" -log = "0.4.20" -tera = "1.19.1" -lazy_static = "1.4.0" -serde = { version = "1.0.193", features = ["derive"] } -rust_decimal = { version = "1.33.1", features = ["serde-str", "serde-with-str"] } -rust_decimal_macros = "1.33.1" +chrono = { workspace = true, features = ["serde"] } +regex = { workspace = true } +log = { workspace = true } +tera = { workspace = true } +lazy_static = { workspace = true } +serde = { workspace = true, features = ["derive"] } +rust_decimal = { workspace = true, features = ["serde-str", "serde-with-str"] } +rust_decimal_macros = { workspace = true } [dev-dependencies] xsender = { path = "../xsender" } diff --git a/xbuilder/README.md b/xbuilder/README.md index 579efdf4..03534614 100644 --- a/xbuilder/README.md +++ b/xbuilder/README.md @@ -125,7 +125,7 @@ fn main() { }; // Enrich object - credit_note.enrich(&defaults); + invoice.enrich(&defaults); // Render XML let xml = render_invoice(invoice); diff --git a/xbuilder/src/enricher/bounds/detalle/cantidad.rs b/xbuilder/src/enricher/bounds/detalle/cantidad.rs index fb100e0a..3fb6ba9d 100644 --- a/xbuilder/src/enricher/bounds/detalle/cantidad.rs +++ b/xbuilder/src/enricher/bounds/detalle/cantidad.rs @@ -6,18 +6,8 @@ pub trait DetalleCantidadGetter { fn get_cantidad(&self) -> Decimal; } -pub trait DetalleCantidadSetter { - fn set_cantidad(&mut self, val: Decimal); -} - impl DetalleCantidadGetter for Detalle { fn get_cantidad(&self) -> Decimal { self.cantidad } } - -impl DetalleCantidadSetter for Detalle { - fn set_cantidad(&mut self, val: Decimal) { - self.cantidad = val; - } -} diff --git a/xbuilder/src/enricher/bounds/proveedor.rs b/xbuilder/src/enricher/bounds/proveedor.rs index 3ff7999d..d8d649eb 100644 --- a/xbuilder/src/enricher/bounds/proveedor.rs +++ b/xbuilder/src/enricher/bounds/proveedor.rs @@ -5,7 +5,6 @@ use crate::models::invoice::Invoice; pub trait ProveedorGetter { fn get_proveedor(&self) -> &Proveedor; - fn get_proveedor_direccion(&self) -> &Option; } pub trait ProveedorSetter { @@ -16,30 +15,18 @@ impl ProveedorGetter for Invoice { fn get_proveedor(&self) -> &Proveedor { &self.proveedor } - - fn get_proveedor_direccion(&self) -> &Option { - &self.proveedor.direccion - } } impl ProveedorGetter for CreditNote { fn get_proveedor(&self) -> &Proveedor { &self.proveedor } - - fn get_proveedor_direccion(&self) -> &Option { - &self.proveedor.direccion - } } impl ProveedorGetter for DebitNote { fn get_proveedor(&self) -> &Proveedor { &self.proveedor } - - fn get_proveedor_direccion(&self) -> &Option { - &self.proveedor.direccion - } } impl ProveedorSetter for Invoice { diff --git a/xbuilder/src/enricher/mod.rs b/xbuilder/src/enricher/mod.rs index acaa9dcb..b469a124 100644 --- a/xbuilder/src/enricher/mod.rs +++ b/xbuilder/src/enricher/mod.rs @@ -8,11 +8,11 @@ use crate::models::credit_note::CreditNote; use crate::models::debit_note::DebitNote; use crate::models::invoice::Invoice; -pub mod bounds; -pub mod fill; -pub mod process; -pub mod rules; -pub mod summary; +mod bounds; +mod fill; +mod process; +mod rules; +mod summary; pub struct Defaults { pub icb_tasa: Decimal, diff --git a/xsender/Cargo.toml b/xsender/Cargo.toml index c0e15c12..1d47402d 100644 --- a/xsender/Cargo.toml +++ b/xsender/Cargo.toml @@ -6,19 +6,19 @@ license = "Apache-2.0" description = "Sends XML files through SOAP - SUNAT" [dependencies] -xml = "0.8.10" -log = "0.4.20" -zip = { version = "0.6.6" } -tera = "1.19.1" -lazy_static = "1.4.0" -serde = { version = "1.0.193", features = ["derive"] } -reqwest = "0.11.22" -regex = "1.10.2" -base64 = "0.21.5" -thiserror = "1.0.53" -anyhow = "1.0.78" -sha2 = "0.10.8" +xml = { workspace = true } +log = { workspace = true } +zip = { workspace = true } +tera = { workspace = true } +lazy_static = { workspace = true } +serde = { workspace = true, features = ["derive"] } +reqwest = { workspace = true } +regex = { workspace = true } +base64 = { workspace = true } +thiserror = { workspace = true } +anyhow = { workspace = true } +sha2 = { workspace = true } [dev-dependencies] -serial_test = "2.0.0" -tokio = { version = "1.35.1", features = ["macros"] } +serial_test = { workspace = true } +tokio = { workspace = true, features = ["macros"] } diff --git a/xsigner/Cargo.toml b/xsigner/Cargo.toml index d3077a6d..7fdf5f32 100644 --- a/xsigner/Cargo.toml +++ b/xsigner/Cargo.toml @@ -6,11 +6,11 @@ license = "Apache-2.0" description = "Sign your XML files" [dependencies] -thiserror = "1.0.53" -anyhow = "1.0.78" -rsa = "0.9.6" -rand = "0.8.5" -rcgen = "0.12.0" -x509-parser = "0.15.1" +thiserror = { workspace = true } +anyhow = { workspace = true } +rsa = { workspace = true } +rand = { workspace = true } +rcgen = { workspace = true } +x509-parser = { workspace = true } [dev-dependencies]