cfdi40 0.0.1.alfa

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c30e39f4584ad4ec24f70ae950700568d72b0941adb3535ece9132f0ff7f3d19
4
+ data.tar.gz: 9dc2cf08802bee96c4a2cfa362101be5ac6926bf67f613f1d2293b6480c6316c
5
+ SHA512:
6
+ metadata.gz: '070922f0002e8948bec5ce379e198b61a442bcc54ba47ac45f9f46f2bd58bbae9bcdb4b54b5527bc2996a32c793d8f7ea75235bc2b96925f0cdb4d0ef3c4783a'
7
+ data.tar.gz: 552352ed70288e9307c6eb065fe57d0d45f84be27085ceb4698fd19a16ec3f0042ced1f57d7acdb467c254ff504a5bb60522402874e736da1e2f2d6b7cf30271
data/.rubocop.yml ADDED
@@ -0,0 +1,18 @@
1
+ require:
2
+ - rubocop-minitest
3
+ - rubocop-rake
4
+
5
+ AllCops:
6
+ NewCops: enable
7
+ TargetRubyVersion: 2.6
8
+
9
+ Style/StringLiterals:
10
+ Enabled: true
11
+ EnforcedStyle: double_quotes
12
+
13
+ Style/StringLiteralsInInterpolation:
14
+ Enabled: true
15
+ EnforcedStyle: double_quotes
16
+
17
+ Layout/LineLength:
18
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # Cfdi40
2
+
3
+ ## [Unreleased]
4
+
5
+ ### Added
6
+
7
+ - Invoice CFDi signed and valid for general public as receiver
8
+
9
+ ## [0.0.1.alfa] - 2022-11-17
10
+
11
+ - Initial release, proof of concept
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at israel.benitez@synapsis.com.mx. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in cfdi40.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "minitest", "~> 5.0"
11
+
12
+ gem "rubocop", "~> 1.21"
13
+ gem "rubocop-minitest", require: false
14
+ gem "rubocop-rake", require: false
data/Gemfile.lock ADDED
@@ -0,0 +1,54 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ cfdi40 (0.0.1.alfa)
5
+ nokogiri (~> 1.13, >= 1.13.9)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.2)
11
+ json (2.3.1)
12
+ minitest (5.15.0)
13
+ nokogiri (1.13.9-x86_64-linux)
14
+ racc (~> 1.4)
15
+ parallel (1.20.1)
16
+ parser (3.1.2.1)
17
+ ast (~> 2.4.1)
18
+ racc (1.6.0)
19
+ rainbow (3.0.0)
20
+ rake (13.0.6)
21
+ regexp_parser (1.8.2)
22
+ rexml (3.2.5)
23
+ rubocop (1.39.0)
24
+ json (~> 2.3)
25
+ parallel (~> 1.10)
26
+ parser (>= 3.1.2.1)
27
+ rainbow (>= 2.2.2, < 4.0)
28
+ regexp_parser (>= 1.8, < 3.0)
29
+ rexml (>= 3.2.5, < 4.0)
30
+ rubocop-ast (>= 1.23.0, < 2.0)
31
+ ruby-progressbar (~> 1.7)
32
+ unicode-display_width (>= 1.4.0, < 3.0)
33
+ rubocop-ast (1.23.0)
34
+ parser (>= 3.1.1.0)
35
+ rubocop-minitest (0.23.2)
36
+ rubocop (>= 0.90, < 2.0)
37
+ rubocop-rake (0.6.0)
38
+ rubocop (~> 1.0)
39
+ ruby-progressbar (1.11.0)
40
+ unicode-display_width (2.1.0)
41
+
42
+ PLATFORMS
43
+ x86_64-linux
44
+
45
+ DEPENDENCIES
46
+ cfdi40!
47
+ minitest (~> 5.0)
48
+ rake (~> 13.0)
49
+ rubocop (~> 1.21)
50
+ rubocop-minitest
51
+ rubocop-rake
52
+
53
+ BUNDLED WITH
54
+ 2.3.7
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Israel Benítez
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # Cfdi40
2
+
3
+ Tool for read, create, edit, validate and sign CFDIs version 4.0
4
+
5
+ CFDI (Comprobante Fiscal Digital por Internet) are XML documents
6
+ regulated by mexican goverment for tax purpouses.
7
+
8
+ ## Future features
9
+
10
+ * Create and sign a valid XML of an invoice for general public
11
+ (público en general) with minimum data
12
+
13
+ ## Installation
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ ```ruby
18
+ gem 'cfdi40'
19
+ ```
20
+
21
+ And then execute:
22
+
23
+ $ bundle install
24
+
25
+ Or install it yourself as:
26
+
27
+ $ gem install cfdi40
28
+
29
+ ## Usage
30
+
31
+ Work in progress
32
+
33
+ ## Development
34
+
35
+ After checking out the repo, run `bin/setup` to install dependencies.
36
+ Then, run `rake test` to run the tests. You can also run `bin/console`
37
+ for an interactive prompt that will allow you to experiment.
38
+
39
+ To install this gem onto your local machine, run `bundle exec rake
40
+ install`. To release a new version, update the version number in
41
+ `version.rb`, and then run `bundle exec rake release`, which will create
42
+ a git tag for the version, push git commits and the created tag, and
43
+ push the `.gem` file to [rubygems.org](https://rubygems.org).
44
+
45
+ ## Contributing
46
+
47
+ Bug reports and pull requests are welcome on GitHub at
48
+ https://github.com/[USERNAME]/cfdi40. This project is intended to be a
49
+ safe, welcoming space for collaboration, and contributors are expected
50
+ to adhere to the [code of
51
+ conduct](https://github.com/[USERNAME]/cfdi40/blob/master/CODE_OF_CONDUCT.md).
52
+
53
+ ## License
54
+
55
+ The gem is available as open source under the terms of the [MIT
56
+ License](https://opensource.org/licenses/MIT).
57
+
58
+ ## Code of Conduct
59
+
60
+ Everyone interacting in the Cfdi40 project's codebases, issue trackers,
61
+ chat rooms and mailing lists is expected to follow the [code of
62
+ conduct](https://github.com/[USERNAME]/cfdi40/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/test_*.rb"]
10
+ end
11
+
12
+ require "rubocop/rake_task"
13
+
14
+ RuboCop::RakeTask.new
15
+
16
+ task default: %i[test rubocop]
data/cfdi40.gemspec ADDED
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/cfdi40/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "cfdi40"
7
+ spec.version = Cfdi40::VERSION
8
+ spec.authors = ["Israel Benítez"]
9
+ spec.email = ["israel.benitez@i2j.mx"]
10
+
11
+ spec.summary = "Create, sign and read CFDi."
12
+ spec.description = "Tool for create, read and edit XML files of CFDI " \
13
+ "(Comprobantes Fiscales Digitales por Internet) " \
14
+ "regulated by Mexican Government"
15
+ spec.homepage = "https://github.com/israelbz/cfdi40"
16
+ spec.license = "MIT"
17
+ spec.required_ruby_version = ">= 2.6.0"
18
+
19
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
20
+
21
+ spec.metadata["homepage_uri"] = spec.homepage
22
+ spec.metadata["source_code_uri"] = "https://github.com/israelbz/cfdi40"
23
+ spec.metadata["changelog_uri"] = "https://github.com/israelbz/cfdi40/blob/main/CHANGELOG.md"
24
+
25
+ # Specify which files should be added to the gem when it is released.
26
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
28
+ `git ls-files -z`.split("\x0").reject do |f|
29
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
30
+ end
31
+ end
32
+ spec.bindir = "exe"
33
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
34
+ spec.require_paths = ["lib"]
35
+
36
+ # Uncomment to register a new dependency of your gem
37
+ spec.add_dependency "nokogiri", "~> 1.13", ">= 1.13.9"
38
+
39
+ # For more information and examples about making a new gem, check out our
40
+ # guide at: https://bundler.io/guides/creating_gem.html
41
+ spec.metadata["rubygems_mfa_required"] = "true"
42
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Create and Read XML documents
4
+ class Comprobante
5
+ attr_reader :docxml
6
+
7
+ def initialize
8
+ new_docxml
9
+ end
10
+
11
+ def to_s
12
+ docxml.to_xml
13
+ end
14
+
15
+ private
16
+
17
+ def new_docxml
18
+ @docxml = Nokogiri::XML::Document.new("1.0")
19
+ @docxml.encoding = "utf-8"
20
+ root = @docxml.create_element "cfdi:Comprobante"
21
+ root.add_namespace "xsi", "http://www.w3.org/2001/XMLSchema-instance"
22
+ root.add_namespace "cfdi", "http://www.sat.gob.mx/cfd/4"
23
+ root["xsi:schemaLocation"] = "http://www.sat.gob.mx/cfd/3 " \
24
+ "http://www.sat.gob.mx/sitio_internet/cfd/4/cfdv40.xsd"
25
+ root["Version"] = "4.0"
26
+
27
+ @docxml.add_child root
28
+ @docxml
29
+ end
30
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cfdi40
4
+ VERSION = "0.0.1.alfa"
5
+ end
data/lib/cfdi40.rb ADDED
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "nokogiri"
4
+ require_relative "cfdi40/version"
5
+ require_relative "cfdi40/comprobante"
6
+
7
+ # Leading module and entry point for all features and classes
8
+ #
9
+ # # NEW
10
+ # Creates a new CFDi with minumum data
11
+ module Cfdi40
12
+ class Error < StandardError; end
13
+ # Your code goes here...
14
+
15
+ def self.new
16
+ Comprobante.new
17
+ end
18
+ end
data/sig/cfdi40.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Cfdi40
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cfdi40
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.alfa
5
+ platform: ruby
6
+ authors:
7
+ - Israel Benítez
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-11-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: nokogiri
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.13'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.13.9
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.13'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.13.9
33
+ description: Tool for create, read and edit XML files of CFDI (Comprobantes Fiscales
34
+ Digitales por Internet) regulated by Mexican Government
35
+ email:
36
+ - israel.benitez@i2j.mx
37
+ executables: []
38
+ extensions: []
39
+ extra_rdoc_files: []
40
+ files:
41
+ - ".rubocop.yml"
42
+ - CHANGELOG.md
43
+ - CODE_OF_CONDUCT.md
44
+ - Gemfile
45
+ - Gemfile.lock
46
+ - LICENSE.txt
47
+ - README.md
48
+ - Rakefile
49
+ - cfdi40.gemspec
50
+ - lib/cfdi40.rb
51
+ - lib/cfdi40/comprobante.rb
52
+ - lib/cfdi40/version.rb
53
+ - sig/cfdi40.rbs
54
+ homepage: https://github.com/israelbz/cfdi40
55
+ licenses:
56
+ - MIT
57
+ metadata:
58
+ allowed_push_host: https://rubygems.org
59
+ homepage_uri: https://github.com/israelbz/cfdi40
60
+ source_code_uri: https://github.com/israelbz/cfdi40
61
+ changelog_uri: https://github.com/israelbz/cfdi40/blob/main/CHANGELOG.md
62
+ rubygems_mfa_required: 'true'
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: 2.6.0
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">"
75
+ - !ruby/object:Gem::Version
76
+ version: 1.3.1
77
+ requirements: []
78
+ rubygems_version: 3.1.4
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: Create, sign and read CFDi.
82
+ test_files: []