Skip to content

Commit

Permalink
task: cargo enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosthe19916 committed Jul 22, 2024
1 parent f4c20c8 commit b6f39b3
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 65 deletions.
2 changes: 2 additions & 0 deletions .clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
allow-unwrap-in-tests = true
allow-expect-in-tests = true
8 changes: 0 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
28 changes: 28 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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]
3 changes: 3 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "1.78.0"
components = [ "rustfmt", "clippy" ]
16 changes: 8 additions & 8 deletions xbuilder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
2 changes: 1 addition & 1 deletion xbuilder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ fn main() {
};

// Enrich object
credit_note.enrich(&defaults);
invoice.enrich(&defaults);

// Render XML
let xml = render_invoice(invoice);
Expand Down
10 changes: 0 additions & 10 deletions xbuilder/src/enricher/bounds/detalle/cantidad.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
13 changes: 0 additions & 13 deletions xbuilder/src/enricher/bounds/proveedor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use crate::models::invoice::Invoice;

pub trait ProveedorGetter {
fn get_proveedor(&self) -> &Proveedor;
fn get_proveedor_direccion(&self) -> &Option<Direccion>;
}

pub trait ProveedorSetter {
Expand All @@ -16,30 +15,18 @@ impl ProveedorGetter for Invoice {
fn get_proveedor(&self) -> &Proveedor {
&self.proveedor
}

fn get_proveedor_direccion(&self) -> &Option<Direccion> {
&self.proveedor.direccion
}
}

impl ProveedorGetter for CreditNote {
fn get_proveedor(&self) -> &Proveedor {
&self.proveedor
}

fn get_proveedor_direccion(&self) -> &Option<Direccion> {
&self.proveedor.direccion
}
}

impl ProveedorGetter for DebitNote {
fn get_proveedor(&self) -> &Proveedor {
&self.proveedor
}

fn get_proveedor_direccion(&self) -> &Option<Direccion> {
&self.proveedor.direccion
}
}

impl ProveedorSetter for Invoice {
Expand Down
10 changes: 5 additions & 5 deletions xbuilder/src/enricher/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
28 changes: 14 additions & 14 deletions xsender/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
12 changes: 6 additions & 6 deletions xsigner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]

0 comments on commit b6f39b3

Please sign in to comment.