se extrae libreria de etrivial

FossilOrigin-Name: 5cae2a8c5985850e97b3d416ba14a90c66e2c05e3a4f9c28fdbc767d6c29748f
This commit is contained in:
bit4bit@riseup.net 2020-05-23 18:56:22 +00:00
parent 6f9aa80527
commit 10f021d0fd
73 changed files with 33116 additions and 615 deletions

13
AUTHORS.rst Normal file
View File

@ -0,0 +1,13 @@
=======
Credits
=======
Development Lead
----------------
* Jovany Leandro G.C <bit4bit@riseup.net>
Contributors
------------
None yet. Why not be the first?

128
CONTRIBUTING.rst Normal file
View File

@ -0,0 +1,128 @@
.. highlight:: shell
============
Contributing
============
Contributions are welcome, and they are greatly appreciated! Every little bit
helps, and credit will always be given.
You can contribute in many ways:
Types of Contributions
----------------------
Report Bugs
~~~~~~~~~~~
Report bugs at https://github.com/bit4bit/facho/issues.
If you are reporting a bug, please include:
* Your operating system name and version.
* Any details about your local setup that might be helpful in troubleshooting.
* Detailed steps to reproduce the bug.
Fix Bugs
~~~~~~~~
Look through the GitHub issues for bugs. Anything tagged with "bug" and "help
wanted" is open to whoever wants to implement it.
Implement Features
~~~~~~~~~~~~~~~~~~
Look through the GitHub issues for features. Anything tagged with "enhancement"
and "help wanted" is open to whoever wants to implement it.
Write Documentation
~~~~~~~~~~~~~~~~~~~
facho could always use more documentation, whether as part of the
official facho docs, in docstrings, or even on the web in blog posts,
articles, and such.
Submit Feedback
~~~~~~~~~~~~~~~
The best way to send feedback is to file an issue at https://github.com/bit4bit/facho/issues.
If you are proposing a feature:
* Explain in detail how it would work.
* Keep the scope as narrow as possible, to make it easier to implement.
* Remember that this is a volunteer-driven project, and that contributions
are welcome :)
Get Started!
------------
Ready to contribute? Here's how to set up `facho` for local development.
1. Fork the `facho` repo on GitHub.
2. Clone your fork locally::
$ git clone git@github.com:your_name_here/facho.git
3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development::
$ mkvirtualenv facho
$ cd facho/
$ python setup.py develop
4. Create a branch for local development::
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
5. When you're done making changes, check that your changes pass flake8 and the
tests, including testing other Python versions with tox::
$ flake8 facho tests
$ python setup.py test or py.test
$ tox
To get flake8 and tox, just pip install them into your virtualenv.
6. Commit your changes and push your branch to GitHub::
$ git add .
$ git commit -m "Your detailed description of your changes."
$ git push origin name-of-your-bugfix-or-feature
7. Submit a pull request through the GitHub website.
Pull Request Guidelines
-----------------------
Before you submit a pull request, check that it meets these guidelines:
1. The pull request should include tests.
2. If the pull request adds functionality, the docs should be updated. Put
your new functionality into a function with a docstring, and add the
feature to the list in README.rst.
3. The pull request should work for Python 2.7, 3.4, 3.5 and 3.6, and for PyPy. Check
https://travis-ci.org/bit4bit/facho/pull_requests
and make sure that the tests pass for all supported Python versions.
Tips
----
To run a subset of tests::
$ py.test tests.test_facho
Deploying
---------
A reminder for the maintainers on how to deploy.
Make sure all your changes are committed (including an entry in HISTORY.rst).
Then run::
$ bumpversion patch # possible: major / minor / patch
$ git push
$ git push --tags
Travis will then deploy to PyPI if tests pass.

14
COPYRIGHT Normal file
View File

@ -0,0 +1,14 @@
Copyright (C) 2020 Jovany Leandro G.C <bit4bit@riseup.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

8
HISTORY.rst Normal file
View File

@ -0,0 +1,8 @@
=======
History
=======
0.1.0 (2019-12-31)
------------------
* First release on PyPI.

638
LICENSE
View File

@ -1,625 +1,33 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Version 3, 29 June 2007
Facturacion Electronica Colombia
Copyright (C) 2019 Jovany Leandro G.C
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Preamble
The GNU General Public License is a free, copyleft license for software and
other kinds of works.
The licenses for most software and other practical works are designed to take
away your freedom to share and change the works. By contrast, the GNU General
Public License is intended to guarantee your freedom to share and change all
versions of a program--to make sure it remains free software for all its users.
We, the Free Software Foundation, use the GNU General Public License for most
of our software; it applies also to any other work released this way by its
authors. You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our
General Public Licenses are designed to make sure that you have the freedom
to distribute copies of free software (and charge for them if you wish), that
you receive source code or can get it if you want it, that you can change
the software or use pieces of it in new free programs, and that you know you
can do these things.
To protect your rights, we need to prevent others from denying you these rights
or asking you to surrender the rights. Therefore, you have certain responsibilities
if you distribute copies of the software, or if you modify it: responsibilities
to respect the freedom of others.
For example, if you distribute copies of such a program, whether gratis or
for a fee, you must pass on to the recipients the same freedoms that you received.
You must make sure that they, too, receive or can get the source code. And
you must show them these terms so they know their rights.
Developers that use the GNU GPL protect your rights with two steps: (1) assert
copyright on the software, and (2) offer you this License giving you legal
permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains that
there is no warranty for this free software. For both users' and authors'
sake, the GPL requires that modified versions be marked as changed, so that
their problems will not be attributed erroneously to authors of previous versions.
Some devices are designed to deny users access to install or run modified
versions of the software inside them, although the manufacturer can do so.
This is fundamentally incompatible with the aim of protecting users' freedom
to change the software. The systematic pattern of such abuse occurs in the
area of products for individuals to use, which is precisely where it is most
unacceptable. Therefore, we have designed this version of the GPL to prohibit
the practice for those products. If such problems arise substantially in other
domains, we stand ready to extend this provision to those domains in future
versions of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents. States
should not allow patents to restrict development and use of software on general-purpose
computers, but in those that do, we wish to avoid the special danger that
patents applied to a free program could make it effectively proprietary. To
prevent this, the GPL assures that patents cannot be used to render the program
non-free.
The precise terms and conditions for copying, distribution and modification
follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of works,
such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this License.
Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals
or organizations.
To "modify" a work means to copy from or adapt all or part of the work in
a fashion requiring copyright permission, other than the making of an exact
copy. The resulting work is called a "modified version" of the earlier work
or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based on the
Program.
To "propagate" a work means to do anything with it that, without permission,
would make you directly or secondarily liable for infringement under applicable
copyright law, except executing it on a computer or modifying a private copy.
Propagation includes copying, distribution (with or without modification),
making available to the public, and in some countries other activities as
well.
To "convey" a work means any kind of propagation that enables other parties
to make or receive copies. Mere interaction with a user through a computer
network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices" to the
extent that it includes a convenient and prominently visible feature that
(1) displays an appropriate copyright notice, and (2) tells the user that
there is no warranty for the work (except to the extent that warranties are
provided), that licensees may convey the work under this License, and how
to view a copy of this License. If the interface presents a list of user commands
or options, such as a menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work for making
modifications to it. "Object code" means any non-source form of a work.
A "Standard Interface" means an interface that either is an official standard
defined by a recognized standards body, or, in the case of interfaces specified
for a particular programming language, one that is widely used among developers
working in that language.
The "System Libraries" of an executable work include anything, other than
the work as a whole, that (a) is included in the normal form of packaging
a Major Component, but which is not part of that Major Component, and (b)
serves only to enable use of the work with that Major Component, or to implement
a Standard Interface for which an implementation is available to the public
in source code form. A "Major Component", in this context, means a major essential
component (kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to produce
the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all the source
code needed to generate, install, and (for an executable work) run the object
code and to modify the work, including scripts to control those activities.
However, it does not include the work's System Libraries, or general-purpose
tools or generally available free programs which are used unmodified in performing
those activities but which are not part of the work. For example, Corresponding
Source includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically linked
subprograms that the work is specifically designed to require, such as by
intimate data communication or control flow between those subprograms and
other parts of the work.
The Corresponding Source need not include anything that users can regenerate
automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of copyright
on the Program, and are irrevocable provided the stated conditions are met.
This License explicitly affirms your unlimited permission to run the unmodified
Program. The output from running a covered work is covered by this License
only if the output, given its content, constitutes a covered work. This License
acknowledges your rights of fair use or other equivalent, as provided by copyright
law.
You may make, run and propagate covered works that you do not convey, without
conditions so long as your license otherwise remains in force. You may convey
covered works to others for the sole purpose of having them make modifications
exclusively for you, or provide you with facilities for running those works,
provided that you comply with the terms of this License in conveying all material
for which you do not control copyright. Those thus making or running the covered
works for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of your copyrighted
material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the conditions
stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological measure
under any applicable law fulfilling obligations under article 11 of the WIPO
copyright treaty adopted on 20 December 1996, or similar laws prohibiting
or restricting circumvention of such measures.
When you convey a covered work, you waive any legal power to forbid circumvention
of technological measures to the extent such circumvention is effected by
exercising rights under this License with respect to the covered work, and
you disclaim any intention to limit operation or modification of the work
as a means of enforcing, against the work's users, your or third parties'
legal rights to forbid circumvention of technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you receive
it, in any medium, provided that you conspicuously and appropriately publish
on each copy an appropriate copyright notice; keep intact all notices stating
that this License and any non-permissive terms added in accord with section
7 apply to the code; keep intact all notices of the absence of any warranty;
and give all recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey, and you
may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to produce
it from the Program, in the form of source code under the terms of section
4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified it, and
giving a relevant date.
b) The work must carry prominent notices stating that it is released under
this License and any conditions added under section 7. This requirement modifies
the requirement in section 4 to "keep intact all notices".
c) You must license the entire work, as a whole, under this License to anyone
who comes into possession of a copy. This License will therefore apply, along
with any applicable section 7 additional terms, to the whole of the work,
and all its parts, regardless of how they are packaged. This License gives
no permission to license the work in any other way, but it does not invalidate
such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display Appropriate
Legal Notices; however, if the Program has interactive interfaces that do
not display Appropriate Legal Notices, your work need not make them do so.
A compilation of a covered work with other separate and independent works,
which are not by their nature extensions of the covered work, and which are
not combined with it such as to form a larger program, in or on a volume of
a storage or distribution medium, is called an "aggregate" if the compilation
and its resulting copyright are not used to limit the access or legal rights
of the compilation's users beyond what the individual works permit. Inclusion
of a covered work in an aggregate does not cause this License to apply to
the other parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of sections
4 and 5, provided that you also convey the machine-readable Corresponding
Source under the terms of this License, in one of these ways:
a) Convey the object code in, or embodied in, a physical product (including
a physical distribution medium), accompanied by the Corresponding Source fixed
on a durable physical medium customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product (including
a physical distribution medium), accompanied by a written offer, valid for
at least three years and valid for as long as you offer spare parts or customer
support for that product model, to give anyone who possesses the object code
either (1) a copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical medium customarily
used for software interchange, for a price no more than your reasonable cost
of physically performing this conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the written
offer to provide the Corresponding Source. This alternative is allowed only
occasionally and noncommercially, and only if you received the object code
with such an offer, in accord with subsection 6b.
d) Convey the object code by offering access from a designated place (gratis
or for a charge), and offer equivalent access to the Corresponding Source
in the same way through the same place at no further charge. You need not
require recipients to copy the Corresponding Source along with the object
code. If the place to copy the object code is a network server, the Corresponding
Source may be on a different server (operated by you or a third party) that
supports equivalent copying facilities, provided you maintain clear directions
next to the object code saying where to find the Corresponding Source. Regardless
of what server hosts the Corresponding Source, you remain obligated to ensure
that it is available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided you inform
other peers where the object code and Corresponding Source of the work are
being offered to the general public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excluded from
the Corresponding Source as a System Library, need not be included in conveying
the object code work.
A "User Product" is either (1) a "consumer product", which means any tangible
personal property which is normally used for personal, family, or household
purposes, or (2) anything designed or sold for incorporation into a dwelling.
In determining whether a product is a consumer product, doubtful cases shall
be resolved in favor of coverage. For a particular product received by a particular
user, "normally used" refers to a typical or common use of that class of product,
regardless of the status of the particular user or of the way in which the
particular user actually uses, or expects or is expected to use, the product.
A product is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent the
only significant mode of use of the product.
"Installation Information" for a User Product means any methods, procedures,
authorization keys, or other information required to install and execute modified
versions of a covered work in that User Product from a modified version of
its Corresponding Source. The information must suffice to ensure that the
continued functioning of the modified object code is in no case prevented
or interfered with solely because modification has been made.
If you convey an object code work under this section in, or with, or specifically
for use in, a User Product, and the conveying occurs as part of a transaction
in which the right of possession and use of the User Product is transferred
to the recipient in perpetuity or for a fixed term (regardless of how the
transaction is characterized), the Corresponding Source conveyed under this
section must be accompanied by the Installation Information. But this requirement
does not apply if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has been installed
in ROM).
The requirement to provide Installation Information does not include a requirement
to continue to provide support service, warranty, or updates for a work that
has been modified or installed by the recipient, or for the User Product in
which it has been modified or installed. Access to a network may be denied
when the modification itself materially and adversely affects the operation
of the network or violates the rules and protocols for communication across
the network.
Corresponding Source conveyed, and Installation Information provided, in accord
with this section must be in a format that is publicly documented (and with
an implementation available to the public in source code form), and must require
no special password or key for unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this License
by making exceptions from one or more of its conditions. Additional permissions
that are applicable to the entire Program shall be treated as though they
were included in this License, to the extent that they are valid under applicable
law. If additional permissions apply only to part of the Program, that part
may be used separately under those permissions, but the entire Program remains
governed by this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option remove any
additional permissions from that copy, or from any part of it. (Additional
permissions may be written to require their own removal in certain cases when
you modify the work.) You may place additional permissions on material, added
by you to a covered work, for which you have or can give appropriate copyright
permission.
Notwithstanding any other provision of this License, for material you add
to a covered work, you may (if authorized by the copyright holders of that
material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the terms of
sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or author
attributions in that material or in the Appropriate Legal Notices displayed
by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or requiring
that modified versions of such material be marked in reasonable ways as different
from the original version; or
d) Limiting the use for publicity purposes of names of licensors or authors
of the material; or
e) Declining to grant rights under trademark law for use of some trade names,
trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that material by
anyone who conveys the material (or modified versions of it) with contractual
assumptions of liability to the recipient, for any liability that these contractual
assumptions directly impose on those licensors and authors.
All other non-permissive additional terms are considered "further restrictions"
within the meaning of section 10. If the Program as you received it, or any
part of it, contains a notice stating that it is governed by this License
along with a term that is a further restriction, you may remove that term.
If a license document contains a further restriction but permits relicensing
or conveying under this License, you may add to a covered work material governed
by the terms of that license document, provided that the further restriction
does not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you must place,
in the relevant source files, a statement of the additional terms that apply
to those files, or a notice indicating where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the form
of a separately written license, or stated as exceptions; the above requirements
apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly provided
under this License. Any attempt otherwise to propagate or modify it is void,
and will automatically terminate your rights under this License (including
any patent licenses granted under the third paragraph of section 11).
However, if you cease all violation of this License, then your license from
a particular copyright holder is reinstated (a) provisionally, unless and
until the copyright holder explicitly and finally terminates your license,
and (b) permanently, if the copyright holder fails to notify you of the violation
by some reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently
if the copyright holder notifies you of the violation by some reasonable means,
this is the first time you have received notice of violation of this License
(for any work) from that copyright holder, and you cure the violation prior
to 30 days after your receipt of the notice.
Termination of your rights under this section does not terminate the licenses
of parties who have received copies or rights from you under this License.
If your rights have been terminated and not permanently reinstated, you do
not qualify to receive new licenses for the same material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run a copy
of the Program. Ancillary propagation of a covered work occurring solely as
a consequence of using peer-to-peer transmission to receive a copy likewise
does not require acceptance. However, nothing other than this License grants
you permission to propagate or modify any covered work. These actions infringe
copyright if you do not accept this License. Therefore, by modifying or propagating
a covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically receives
a license from the original licensors, to run, modify and propagate that work,
subject to this License. You are not responsible for enforcing compliance
by third parties with this License.
An "entity transaction" is a transaction transferring control of an organization,
or substantially all assets of one, or subdividing an organization, or merging
organizations. If propagation of a covered work results from an entity transaction,
each party to that transaction who receives a copy of the work also receives
whatever licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the Corresponding
Source of the work from the predecessor in interest, if the predecessor has
it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the rights
granted or affirmed under this License. For example, you may not impose a
license fee, royalty, or other charge for exercise of rights granted under
this License, and you may not initiate litigation (including a cross-claim
or counterclaim in a lawsuit) alleging that any patent claim is infringed
by making, using, selling, offering for sale, or importing the Program or
any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this License
of the Program or a work on which the Program is based. The work thus licensed
is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims owned or controlled
by the contributor, whether already acquired or hereafter acquired, that would
be infringed by some manner, permitted by this License, of making, using,
or selling its contributor version, but do not include claims that would be
infringed only as a consequence of further modification of the contributor
version. For purposes of this definition, "control" includes the right to
grant patent sublicenses in a manner consistent with the requirements of this
License.
Each contributor grants you a non-exclusive, worldwide, royalty-free patent
license under the contributor's essential patent claims, to make, use, sell,
offer for sale, import and otherwise run, modify and propagate the contents
of its contributor version.
In the following three paragraphs, a "patent license" is any express agreement
or commitment, however denominated, not to enforce a patent (such as an express
permission to practice a patent or covenant not to sue for patent infringement).
To "grant" such a patent license to a party means to make such an agreement
or commitment not to enforce a patent against the party.
If you convey a covered work, knowingly relying on a patent license, and the
Corresponding Source of the work is not available for anyone to copy, free
of charge and under the terms of this License, through a publicly available
network server or other readily accessible means, then you must either (1)
cause the Corresponding Source to be so available, or (2) arrange to deprive
yourself of the benefit of the patent license for this particular work, or
(3) arrange, in a manner consistent with the requirements of this License,
to extend the patent license to downstream recipients. "Knowingly relying"
means you have actual knowledge that, but for the patent license, your conveying
the covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that country
that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or arrangement,
you convey, or propagate by procuring conveyance of, a covered work, and grant
a patent license to some of the parties receiving the covered work authorizing
them to use, propagate, modify or convey a specific copy of the covered work,
then the patent license you grant is automatically extended to all recipients
of the covered work and works based on it.
A patent license is "discriminatory" if it does not include within the scope
of its coverage, prohibits the exercise of, or is conditioned on the non-exercise
of one or more of the rights that are specifically granted under this License.
You may not convey a covered work if you are a party to an arrangement with
a third party that is in the business of distributing software, under which
you make payment to the third party based on the extent of your activity of
conveying the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory patent
license (a) in connection with copies of the covered work conveyed by you
(or copies made from those copies), or (b) primarily for and in connection
with specific products or compilations that contain the covered work, unless
you entered into that arrangement, or that patent license was granted, prior
to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting any implied
license or other defenses to infringement that may otherwise be available
to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or otherwise)
that contradict the conditions of this License, they do not excuse you from
the conditions of this License. If you cannot convey a covered work so as
to satisfy simultaneously your obligations under this License and any other
pertinent obligations, then as a consequence you may not convey it at all.
For example, if you agree to terms that obligate you to collect a royalty
for further conveying from those to whom you convey the Program, the only
way you could satisfy both those terms and this License would be to refrain
entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have permission to
link or combine any covered work with a work licensed under version 3 of the
GNU Affero General Public License into a single combined work, and to convey
the resulting work. The terms of this License will continue to apply to the
part which is the covered work, but the special requirements of the GNU Affero
General Public License, section 13, concerning interaction through a network
will apply to the combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of the
GNU General Public License from time to time. Such new versions will be similar
in spirit to the present version, but may differ in detail to address new
problems or concerns.
Each version is given a distinguishing version number. If the Program specifies
that a certain numbered version of the GNU General Public License "or any
later version" applies to it, you have the option of following the terms and
conditions either of that numbered version or of any later version published
by the Free Software Foundation. If the Program does not specify a version
number of the GNU General Public License, you may choose any version ever
published by the Free Software Foundation.
If the Program specifies that a proxy can decide which future versions of
the GNU General Public License can be used, that proxy's public statement
of acceptance of a version permanently authorizes you to choose that version
for the Program.
Later license versions may give you additional or different permissions. However,
no additional obligations are imposed on any author or copyright holder as
a result of your choosing to follow a later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM
PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM
AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO
USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE
PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided above cannot
be given local legal effect according to their terms, reviewing courts shall
apply local law that most closely approximates an absolute waiver of all civil
liability in connection with the Program, unless a warranty or assumption
of liability accompanies a copy of the Program in return for a fee. END OF
TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible
use to the public, the best way to achieve this is to make it free software
which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach
them to the start of each source file to most effectively state the exclusion
of warranty; and each file should have at least the "copyright" line and a
pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <https://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short notice like
this when it starts in an interactive mode:
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
<program> Copyright (C) <year> <name of author>
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it under certain
conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands might
be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary. For
more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General Public
License instead of this License. But first, please read <https://www.gnu.org/
licenses /why-not-lgpl.html>.

11
MANIFEST.in Normal file
View File

@ -0,0 +1,11 @@
include AUTHORS.rst
include CONTRIBUTING.rst
include HISTORY.rst
include LICENSE
include README.rst
recursive-include tests *
recursive-exclude * __pycache__
recursive-exclude * *.py[co]
recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif

88
Makefile Normal file
View File

@ -0,0 +1,88 @@
.PHONY: clean clean-test clean-pyc clean-build docs help
.DEFAULT_GOAL := help
define BROWSER_PYSCRIPT
import os, webbrowser, sys
try:
from urllib import pathname2url
except:
from urllib.request import pathname2url
webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
endef
export BROWSER_PYSCRIPT
define PRINT_HELP_PYSCRIPT
import re, sys
for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print("%-20s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT
BROWSER := python -c "$$BROWSER_PYSCRIPT"
help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts
clean-build: ## remove build artifacts
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
clean-pyc: ## remove Python file artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
clean-test: ## remove test and coverage artifacts
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/
rm -fr .pytest_cache
lint: ## check style with flake8
flake8 facho tests
test: ## run tests quickly with the default Python
py.test
test-all: ## run tests on every Python version with tox
tox
coverage: ## check code coverage quickly with the default Python
coverage run --source facho -m pytest
coverage report -m
coverage html
$(BROWSER) htmlcov/index.html
docs: ## generate Sphinx HTML documentation, including API docs
rm -f docs/facho.rst
rm -f docs/modules.rst
sphinx-apidoc -o docs/ facho
$(MAKE) -C docs clean
$(MAKE) -C docs html
$(BROWSER) docs/_build/html/index.html
servedocs: docs ## compile the docs watching for changes
watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .
release: dist ## package and upload a release
twine upload dist/*
dist: clean ## builds source and wheel package
python setup.py sdist
python setup.py bdist_wheel
ls -l dist
install: clean ## install the package to the active Python's site-packages
python setup.py install

27
README.rst Normal file
View File

@ -0,0 +1,27 @@
=====
facho
=====
Libreria para facturacion electronica colombia.
- facho/facho.py: abstracion para manipulacion del XML
- facho/fe/form.py: abstraciones para creacion de facturas.
- facho/fe/form.py(DIANInvoiceXML): decora abstraciones con campos requeridos por la DIAN.
- facho/fe/fe.py(DianXMLExtensionSigner): extension para firmar xml
- facho/fe/client/dian.py(DianClient): cliente para consultas sincronicas a API de DIAN
DIAN HABILITACION CERTIFICADO DE PRUEBA
===============================
guia oficial actualizada al 2020-04-20: https://www.dian.gov.co/fizcalizacioncontrol/herramienconsulta/FacturaElectronica/Facturaci%C3%B3n_Gratuita_DIAN/Documents/Guia_usuario_08052019.pdf#search=numeracion
ERROR X509SerialNumber
=============
lxml.etree.DocumentInvalid: Element '{http://www.w3.org/2000/09/xmldsig#}X509SerialNumber': '632837201711293159666920255411738137494572618415' is not a valid value of the atomic type 'xs:integer'
Actualmente el xmlschema usado por xmlsig para el campo X509SerialNumber es tipo
integer ahi que parchar manualmente a tipo string, en el archivo site-packages/xmlsig/data/xmldsig-core-schema.xsd.

20
docs/Makefile Normal file
View File

@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = python -msphinx
SPHINXPROJ = facho
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

1
docs/authors.rst Normal file
View File

@ -0,0 +1 @@
.. include:: ../AUTHORS.rst

163
docs/conf.py Executable file
View File

@ -0,0 +1,163 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# facho documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensions (or modules to document with autodoc) are in another
# directory, add these directories to sys.path here. If the directory is
# relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
#
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
import facho
# -- General configuration ---------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'facho'
copyright = u"2019, Jovany Leandro G.C"
author = u"Jovany Leandro G.C"
# The version info for the project you're documenting, acts as replacement
# for |version| and |release|, also used in various other places throughout
# the built documents.
#
# The short X.Y version.
version = facho.__version__
# The full version, including alpha/beta/rc tags.
release = facho.__version__
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
# -- Options for HTML output -------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
# Theme options are theme-specific and customize the look and feel of a
# theme further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# -- Options for HTMLHelp output ---------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'fachodoc'
# -- Options for LaTeX output ------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass
# [howto, manual, or own class]).
latex_documents = [
(master_doc, 'facho.tex',
u'facho Documentation',
u'Jovany Leandro G.C', 'manual'),
]
# -- Options for manual page output ------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'facho',
u'facho Documentation',
[author], 1)
]
# -- Options for Texinfo output ----------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'facho',
u'facho Documentation',
author,
'facho',
'One line description of project.',
'Miscellaneous'),
]

1
docs/contributing.rst Normal file
View File

@ -0,0 +1 @@
.. include:: ../CONTRIBUTING.rst

1
docs/history.rst Normal file
View File

@ -0,0 +1 @@
.. include:: ../HISTORY.rst

20
docs/index.rst Normal file
View File

@ -0,0 +1,20 @@
Welcome to facho's documentation!
======================================
.. toctree::
:maxdepth: 2
:caption: Contents:
readme
installation
usage
modules
contributing
authors
history
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

51
docs/installation.rst Normal file
View File

@ -0,0 +1,51 @@
.. highlight:: shell
============
Installation
============
Stable release
--------------
To install facho, run this command in your terminal:
.. code-block:: console
$ pip install facho
This is the preferred method to install facho, as it will always install the most recent stable release.
If you don't have `pip`_ installed, this `Python installation guide`_ can guide
you through the process.
.. _pip: https://pip.pypa.io
.. _Python installation guide: http://docs.python-guide.org/en/latest/starting/installation/
From sources
------------
The sources for facho can be downloaded from the `Github repo`_.
You can either clone the public repository:
.. code-block:: console
$ git clone git://github.com/bit4bit/facho
Or download the `tarball`_:
.. code-block:: console
$ curl -OL https://github.com/bit4bit/facho/tarball/master
Once you have a copy of the source, you can install it with:
.. code-block:: console
$ python setup.py install
.. _Github repo: https://github.com/bit4bit/facho
.. _tarball: https://github.com/bit4bit/facho/tarball/master

36
docs/make.bat Normal file
View File

@ -0,0 +1,36 @@
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=python -msphinx
)
set SOURCEDIR=.
set BUILDDIR=_build
set SPHINXPROJ=facho
if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The Sphinx module was not found. Make sure you have Sphinx installed,
echo.then set the SPHINXBUILD environment variable to point to the full
echo.path of the 'sphinx-build' executable. Alternatively you may add the
echo.Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
:end
popd

1
docs/readme.rst Normal file
View File

@ -0,0 +1 @@
.. include:: ../README.rst

7
docs/usage.rst Normal file
View File

@ -0,0 +1,7 @@
=====
Usage
=====
To use facho in a project::
import facho

9
facho/__init__.py Normal file
View File

@ -0,0 +1,9 @@
# -*- coding: utf-8 -*-
# This file is part of facho. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
"""Top-level package for facho."""
__author__ = """Jovany Leandro G.C"""
__email__ = 'bit4bit@riseup.net'
__version__ = '0.1.0'

49
facho/cli.py Normal file
View File

@ -0,0 +1,49 @@
import sys
import click
import logging.config
logging.config.dictConfig({
'version': 1,
'formatters': {
'verbose': {
'format': '%(name)s: %(message)s'
}
},
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose',
},
},
'loggers': {
'zeep.transports': {
'level': 'DEBUG',
'propagate': True,
'handlers': ['console'],
},
}
})
@click.command()
@click.option('--nit', required=True)
@click.option('--nit-proveedor', required=True)
@click.option('--id-software', required=True)
@click.option('--username', required=True)
@click.option('--password', required=True)
def consultaResolucionesFacturacion(nit, nit_proveedor, id_software, username, password):
from facho.fe.client import dian
client_dian = dian.DianClient(username,
password)
resp = client_dian.request(dian.ConsultaResolucionesFacturacionPeticion(
nit, nit_proveedor, id_software
))
print(str(resp))
@click.group()
def main():
pass
main.add_command(consultaResolucionesFacturacion)

193
facho/facho.py Normal file
View File

@ -0,0 +1,193 @@
# This file is part of facho. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from lxml import etree
from lxml.etree import Element, SubElement, tostring
import re
class LXMLBuilder:
"""
extrae la manipulacion de XML
"""
# TODO buscar el termino mas adecuado
# ya que son varios lo procesos que se
# exponen en la misma clase
# * creacion
# * busquedad
# * comparacion
def __init__(self, nsmap):
self.nsmap = nsmap
self._re_node_expr = re.compile(r'^(?P<path>((?P<ns>\w+):)?(?P<tag>[a-zA-Z0-9_-]+))(?P<attrs>\[.+\])?')
self._re_attrs = re.compile(r'(\w+)\s*=\s*\"?(\w+)\"?')
def match_expression(self, node_expr):
match = re.search(self._re_node_expr, node_expr)
return match.groupdict()
@classmethod
def from_string(cls, content, clean_namespaces=False):
if clean_namespaces:
content = re.sub(r'\<\s*[a-zA-Z\-0-9]+\s*:', '<', content)
content = re.sub(r'\<\/\s*[a-zA-Z\-0-9]+\s*:', '</', content)
return etree.fromstring(content)
@classmethod
def build_element_from_string(cls, string, nsmap):
return Element(string, nsmap=nsmap)
def build_element(self, tag, ns=None, attribs={}):
attribs['nsmap'] = ns
if ns:
tag = '{%s}%s' % (self.nsmap[ns], tag)
return Element(tag, **attribs)
def build_from_expression(self, node_expr):
match = re.search(self._re_node_expr, node_expr)
expr = match.groupdict()
attrs = dict(re.findall(self._re_attrs, expr['attrs'] or ''))
attrs['nsmap'] = None
if expr['ns'] and expr['tag']:
ns = expr['ns']
tag = expr['tag']
if self.nsmap:
node = Element('{%s}%s' % (self.nsmap[ns], tag), **attrs)
else:
node = Element(tag, **attrs)
return node
return Element(expr['tag'], **attrs)
def _normalize_tag(self, tag):
return re.sub(r'^(\{.+\}|.+:)', '', tag)
def get_tag(self, elem):
return self._normalize_tag(elem.tag)
def same_tag(self, a, b):
return self._normalize_tag(a) \
== self._normalize_tag(b)
def find_relative(self, elem, xpath, ns):
return elem.find(xpath, ns)
def append(self, elem, child):
elem.append(child)
def set_text(self, elem, text):
elem.text = text
def get_text(self, elem):
return elem.text
def set_attribute(self, elem, key, value):
elem.attrib[key] = value
def tostring(self, elem):
return tostring(elem).decode('utf-8')
class FachoXML:
"""
Decora XML con funciones de consulta XPATH de un solo elemento
"""
def __init__(self, root, builder=None, nsmap=None):
if builder is None:
self.builder = LXMLBuilder(nsmap)
else:
self.builder = builder
self.nsmap = nsmap
if isinstance(root, str):
self.root = self.builder.build_element_from_string(root, nsmap)
else:
self.root = root
self.xpath_for = {}
self.extensions = []
def add_extension(self, extension):
self.extensions.append(extension)
def attach_extensions(self):
root_tag = self.builder.get_tag(self.root)
# construir las extensiones o adicionar en caso de indicar
for extension in self.extensions:
xpath, elements = extension.build(self)
for new_element in elements:
elem = self.find_or_create_element('/'+ root_tag + xpath)
self.builder.append(elem, new_element)
def fragment(self, xpath, append=False):
parent = self.find_or_create_element(xpath, append=append)
return FachoXML(parent, nsmap=self.nsmap)
def register_alias_xpath(self, alias, xpath):
self.xpath_for[alias] = xpath
def _normalize_xpath(self, xpath):
return xpath.replace('//', '/')
def find_or_create_element(self, xpath, append=False):
"""
@param xpath ruta xpath para crear o consultar de un solo elemendo
@param append True si se debe adicionar en la ruta xpath indicada
@return elemento segun self.builder
"""
xpath = self._normalize_xpath(xpath)
if xpath in self.xpath_for:
xpath = self.xpath_for[xpath]
node_paths = xpath.split('/')
node_paths.pop(0) #remove empty /
root_node = self.builder.build_from_expression(node_paths[0])
if not self.builder.same_tag(root_node.tag, self.root.tag):
raise ValueError('xpath %s must be absolute to /%s' % (xpath, self.root.tag))
else:
node_paths.pop(0)
# crea jerarquia segun xpath indicado
parent = None
current_elem = self.root
for node_path in node_paths:
node_expr = self.builder.match_expression(node_path)
node = self.builder.build_from_expression(node_path)
child = self.builder.find_relative(current_elem, node_expr['path'], self.nsmap)
parent = current_elem
if child is not None:
current_elem = child
else:
self.builder.append(current_elem, node)
current_elem = node
# se fuerza la adicion como un nuevo elemento
if append:
node = self.builder.build_from_expression(node_paths[-1])
self.builder.append(parent, node)
return node
return current_elem
def set_element(self, xpath, content, **attrs):
xpath = self._normalize_xpath(xpath)
format_ = attrs.pop('format_', '%s')
elem = self.find_or_create_element(xpath)
if content:
self.builder.set_text(elem, format_ % content)
for k, v in attrs.items():
self.builder.set_attribute(elem, k, v)
return elem
def get_element_text(self, xpath, format_=str):
xpath = self._normalize_xpath(xpath)
text = self.builder.get_text(self.find_or_create_element(xpath))
return format_(text)
def tostring(self):
return self.builder.tostring(self.root)

3
facho/fe/__init__.py Normal file
View File

@ -0,0 +1,3 @@
from .fe import DianXMLExtensionSigner
from .fe import FeXML
from .fe import NAMESPACES

View File

@ -0,0 +1,2 @@
# This file is part of facho. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.

107
facho/fe/client/dian.py Normal file
View File

@ -0,0 +1,107 @@
from facho import facho
import zeep
from zeep.wsse.username import UsernameToken
import urllib.request
from datetime import datetime
from dataclasses import dataclass, asdict, field
from typing import List
import http.client
import hashlib
import secrets
import base64
__all__ = ['DianClient',
'ConsultaResolucionesFacturacionPeticion',
'ConsultaResolucionesFacturacionRespuesta']
class SOAPService:
def get_wsdl(self):
raise NotImplementedError()
def get_service(self):
raise NotImplementedError()
def builder_response(self, as_dict):
raise NotImplementedError()
def todict(self):
return asdict(self)
@dataclass
class ConsultaResolucionesFacturacionRespuesta:
@dataclass
class RangoFacturacion:
NumeroResolucion: str
FechaResolucion: datetime
Prefijo: str
RangoInicial: int
RangoFinal: int
FechaVigenciaDesde: datetime
FechaVigenciaHasta: datetime
ClaveTecnica: str
CodigoOperacion: str
DescripcionOperacion: str
IdentificadorOperacion: str
RangoFacturacion: List[RangoFacturacion]
@classmethod
def fromdict(cls, data):
return cls(
data['CodigoOperacion'],
data['DescripcionOperacion'],
data['IdentificadorOperacion'],
data['RangoFacturacion']
)
@dataclass
class ConsultaResolucionesFacturacionPeticion(SOAPService):
NITObligadoFacturarElectronicamente: str
NITProveedorTecnologico: str
IdentificadorSoftware: str
def get_wsdl(self):
return 'https://facturaelectronica.dian.gov.co/servicios/B2BIntegrationEngine-servicios/FacturaElectronica/consultaResolucionesFacturacion.wsdl'
def get_service(self):
return 'ConsultaResolucionesFacturacion'
def build_response(self, as_dict):
return ConsultaResolucionesFacturacionRespuesta.fromdict(as_dict)
class DianClient:
def __init__(self, user, password):
self._username = user
self._password = password
def _open(self, service):
return zeep.Client(service.get_wsdl(), wsse=UsernameToken(self._username, self._password))
def _remote_service(self, conn, service):
return conn.service[service.get_service()]
def _close(self, conn):
return
def request(self, service):
if not isinstance(service, SOAPService):
raise TypeError('service not type SOAPService')
client = self._open(service)
method = self._remote_service(client, service)
resp = method(**service.todict())
self._close(client)
return service.build_response(resp)

View File

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- DIAN Genericode listas de valores:: Ultima modificación 18-02-2019 - evb-->
<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
<Identification>
<ShortName>AlgoritmoCUFE</ShortName>
<LongName xml:lang="es">Algoritmo de encriptado del CUFE</LongName>
<Version>1</Version>
<CanonicalUri>urn:dian:names:especificacion:ubl:listacodigos:gc:AlgoritmoCUFE</CanonicalUri>
<CanonicalVersionUri>urn:dian:names:especificacion:ubl:listacodigos:gc:AlgoritmoCUFE-2.1</CanonicalVersionUri>
<LocationUri>http://dian.gov.co/ubl/os-ubl-2.0/cl/gc/default/AlgoritmoCUFE-2.1.gc</LocationUri>
<Agency>
<LongName xml:lang="es">DIAN (Dirección de Impuestos y Aduanas Nacionales)</LongName>
<Identifier>195</Identifier>
</Agency>
</Identification>
<ColumnSet>
<Column Id="code" Use="required">
<ShortName>Code</ShortName>
<LongName xml:lang="es">Codigo Comun</LongName>
<Data Type="normalizedString"/>
</Column>
<Column Id="name" Use="required">
<ShortName>Name</ShortName>
<LongName xml:lang="es">Nombre</LongName>
<Data Type="string"/>
</Column>
<Key Id="codeKey">
<ShortName>CodeKey</ShortName>
<ColumnRef Ref="code"/>
</Key>
</ColumnSet>
<SimpleCodeList>
<Row>
<Value ColumnRef="code">
<SimpleValue>CUDE-SHA384</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Algoritmo SHA-384</SimpleValue>
</Value>
</Row>
</SimpleCodeList>
</gc:CodeList>

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- DIAN Genericode listas de valores:: Ultima modificación 18-02-2019 - evb-->
<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
<Identification>
<ShortName>AlgoritmoCUFE</ShortName>
<LongName xml:lang="es">Algoritmo de encriptado del CUFE</LongName>
<Version>1</Version>
<CanonicalUri>urn:dian:names:especificacion:ubl:listacodigos:gc:AlgoritmoCUFE</CanonicalUri>
<CanonicalVersionUri>urn:dian:names:especificacion:ubl:listacodigos:gc:AlgoritmoCUFE-2.1</CanonicalVersionUri>
<LocationUri>http://dian.gov.co/ubl/os-ubl-2.0/cl/gc/default/AlgoritmoCUFE-2.1.gc</LocationUri>
<Agency>
<LongName xml:lang="es">DIAN (Dirección de Impuestos y Aduanas Nacionales)</LongName>
<Identifier>195</Identifier>
</Agency>
</Identification>
<ColumnSet>
<Column Id="code" Use="required">
<ShortName>Code</ShortName>
<LongName xml:lang="es">Codigo Comun</LongName>
<Data Type="normalizedString"/>
</Column>
<Column Id="name" Use="required">
<ShortName>Name</ShortName>
<LongName xml:lang="es">Nombre</LongName>
<Data Type="string"/>
</Column>
<Key Id="codeKey">
<ShortName>CodeKey</ShortName>
<ColumnRef Ref="code"/>
</Key>
</ColumnSet>
<SimpleCodeList>
<Row>
<Value ColumnRef="code">
<SimpleValue>CUFE-SHA384</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Algoritmo SHA-384</SimpleValue>
</Value>
</Row>
</SimpleCodeList>
</gc:CodeList>

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- DIAN Genericode listas de valores:: Ultima modificación 18-02-2019 - evb-->
<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
<Identification>
<ShortName>CodigoDescuento</ShortName>
<LongName xml:lang="es">Codigos de descuentos</LongName>
<Version>1</Version>
<CanonicalUri>urn:dian:names:especificacion:ubl:listacodigos:gc:CodigoDescuento</CanonicalUri>
<CanonicalVersionUri>urn:dian:names:especificacion:ubl:listacodigos:gc:CodigoDescuento-2.1</CanonicalVersionUri>
<LocationUri>http://dian.gov.co/ubl/os-ubl-2.0/cl/gc/default/CodigoDescuento-2.1.gc</LocationUri>
<Agency>
<LongName xml:lang="es">DIAN (Dirección de Impuestos y Aduanas Nacionales)</LongName>
<Identifier>195</Identifier>
</Agency>
</Identification>
<ColumnSet>
<Column Id="code" Use="required">
<ShortName>Code</ShortName>
<LongName xml:lang="es">Codigo Comun</LongName>
<Data Type="normalizedString"/>
</Column>
<Column Id="name" Use="required">
<ShortName>Name</ShortName>
<LongName xml:lang="es">Nombre</LongName>
<Data Type="string"/>
</Column>
<Key Id="codeKey">
<ShortName>CodeKey</ShortName>
<ColumnRef Ref="code"/>
</Key>
</ColumnSet>
<SimpleCodeList>
<Row>
<Value ColumnRef="code">
<SimpleValue>00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Descuento no condicionado</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>01</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Descuento condicionado</SimpleValue>
</Value>
</Row>
</SimpleCodeList>
</gc:CodeList>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- DIAN Genericode listas de valores:: Ultima modificación 18-02-2019 - evb-->
<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
<Identification>
<ShortName>CodigoPrecioReferencia</ShortName>
<LongName xml:lang="es">Lista de códigos para precios de referencia</LongName>
<Version>1</Version>
<CanonicalUri>urn:dian:names:especificacion:ubl:listacodigos:gc:CodigoPrecioReferencia</CanonicalUri>
<CanonicalVersionUri>urn:dian:names:especificacion:ubl:listacodigos:gc:CodigoPrecioReferencia-2.1</CanonicalVersionUri>
<LocationUri>http://dian.gov.co/ubl/os-ubl-2.0/cl/gc/default/CodigoPrecioReferencia-2.1.gc</LocationUri>
<Agency>
<LongName xml:lang="es">DIAN (Dirección de Impuestos y Aduanas Nacionales)</LongName>
<Identifier>195</Identifier>
</Agency>
</Identification>
<ColumnSet>
<Column Id="code" Use="required">
<ShortName>Code</ShortName>
<LongName xml:lang="es">Codigo Comun</LongName>
<Data Type="normalizedString"/>
</Column>
<Column Id="name" Use="required">
<ShortName>Name</ShortName>
<LongName xml:lang="es">Nombre</LongName>
<Data Type="string"/>
</Column>
<Key Id="codeKey">
<ShortName>CodeKey</ShortName>
<ColumnRef Ref="code"/>
</Key>
</ColumnSet>
<SimpleCodeList>
<Row>
<Value ColumnRef="code">
<SimpleValue>01</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Valor comercial</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>02</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Valor en inventarios</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>03</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Otro valor</SimpleValue>
</Value>
</Row>
</SimpleCodeList>
</gc:CodeList>

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- DIAN Genericode listas de valores:: Ultima modificación 18-02-2019 - evb-->
<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
<Identification>
<ShortName>ConceptoNotaCredito</ShortName>
<LongName xml:lang="es">Concepto de Correción para Notas crédito</LongName>
<Version>1</Version>
<CanonicalUri>urn:dian:names:especificacion:ubl:listacodigos:gc:ConceptoNotaCredito</CanonicalUri>
<CanonicalVersionUri>urn:dian:names:especificacion:ubl:listacodigos:gc:ConceptoNotaCredito-2.1</CanonicalVersionUri>
<LocationUri>http://dian.gov.co/ubl/os-ubl-2.0/cl/gc/default/ConceptoNotaCredito-2.1.gc</LocationUri>
<Agency>
<LongName xml:lang="es">DIAN (Dirección de Impuestos y Aduanas Nacionales)</LongName>
<Identifier>195</Identifier>
</Agency>
</Identification>
<ColumnSet>
<Column Id="code" Use="required">
<ShortName>Code</ShortName>
<LongName xml:lang="es">Codigo Comun</LongName>
<Data Type="normalizedString"/>
</Column>
<Column Id="name" Use="required">
<ShortName>Name</ShortName>
<LongName xml:lang="es">Nombre</LongName>
<Data Type="string"/>
</Column>
<Key Id="codeKey">
<ShortName>CodeKey</ShortName>
<ColumnRef Ref="code"/>
</Key>
</ColumnSet>
<SimpleCodeList>
<Row>
<Value ColumnRef="code">
<SimpleValue>1</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Devolución parcial de los bienes y/o no aceptación parcial del servicio</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>2</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Anulación de factura electrónica</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>3</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Rebaja o descuento parcial o total</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>4</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Ajuste de precio</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>5</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Otros</SimpleValue>
</Value>
</Row>
</SimpleCodeList>
</gc:CodeList>

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- DIAN Genericode listas de valores:: Ultima modificación 18-02-2019 - evb-->
<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
<Identification>
<ShortName>ConceptoNotaDebito</ShortName>
<LongName xml:lang="es">Concepto de Correción para Notas débito</LongName>
<Version>1</Version>
<CanonicalUri>urn:dian:names:especificacion:ubl:listacodigos:gc:ConceptoNotaDebito</CanonicalUri>
<CanonicalVersionUri>urn:dian:names:especificacion:ubl:listacodigos:gc:ConceptoNotaDebito-2.1</CanonicalVersionUri>
<LocationUri>http://dian.gov.co/ubl/os-ubl-2.0/cl/gc/default/ConceptoNotaDebito-2.1.gc</LocationUri>
<Agency>
<LongName xml:lang="es">DIAN (Dirección de Impuestos y Aduanas Nacionales)</LongName>
<Identifier>195</Identifier>
</Agency>
</Identification>
<ColumnSet>
<Column Id="code" Use="required">
<ShortName>Code</ShortName>
<LongName xml:lang="es">Codigo Comun</LongName>
<Data Type="normalizedString"/>
</Column>
<Column Id="name" Use="required">
<ShortName>Name</ShortName>
<LongName xml:lang="es">Nombre</LongName>
<Data Type="string"/>
</Column>
<Key Id="codeKey">
<ShortName>CodeKey</ShortName>
<ColumnRef Ref="code"/>
</Key>
</ColumnSet>
<SimpleCodeList>
<Row>
<Value ColumnRef="code">
<SimpleValue>1</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Intereses</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>2</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Gastos por cobrar</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>3</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Cambio del valor</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>4</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Otro</SimpleValue>
</Value>
</Row>
</SimpleCodeList>
</gc:CodeList>

View File

@ -0,0 +1,298 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- DIAN Genericode listas de valores:: Ultima modificación 18-02-2019 - evb-->
<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
<Identification>
<ShortName>Departamentos</ShortName>
<LongName xml:lang="es">Departamentos</LongName>
<Version>1</Version>
<CanonicalUri>urn:dian:names:especificacion:ubl:listacodigos:gc:Departamentos</CanonicalUri>
<CanonicalVersionUri>urn:dian:names:especificacion:ubl:listacodigos:gc:Departamentos-2.1</CanonicalVersionUri>
<LocationUri>http://dian.gov.co/ubl/os-ubl-2.0/cl/gc/default/Departamentos-2.1.gc</LocationUri>
<Agency>
<LongName xml:lang="es">DIAN (Dirección de Impuestos y Aduanas Nacionales)</LongName>
<Identifier>195</Identifier>
</Agency>
</Identification>
<ColumnSet>
<Column Id="code" Use="required">
<ShortName>Code</ShortName>
<LongName xml:lang="es">Codigo Comun</LongName>
<Data Type="normalizedString"/>
</Column>
<Column Id="name" Use="required">
<ShortName>Name</ShortName>
<LongName xml:lang="es">Nombre</LongName>
<Data Type="string"/>
</Column>
<Key Id="codeKey">
<ShortName>CodeKey</ShortName>
<ColumnRef Ref="code"/>
</Key>
</ColumnSet>
<SimpleCodeList>
<Row>
<Value ColumnRef="code">
<SimpleValue>91</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Amazonas</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>05</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Antioquia</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>81</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Arauca</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>08</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Atlántico</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>11</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Bogotá</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>13</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Bolívar</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>15</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Boyacá</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>17</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Caldas</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>18</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Caquetá</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>85</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Casanare</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>19</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Cauca</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>20</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Cesar</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>27</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Chocó</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>23</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Córdoba</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>25</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Cundinamarca</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>94</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Guainía</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>95</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Guaviare</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>41</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Huila</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>44</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>La Guajira</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>47</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Magdalena</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>50</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Meta</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>52</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Nariño</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>54</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Norte de Santander</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>86</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Putumayo</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>63</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Quindío</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>66</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Risaralda</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>88</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>San Andrés y Providencia</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>68</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Santander</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>70</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Sucre</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>73</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Tolima</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>76</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Valle del Cauca</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>97</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Vaupés</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>99</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Vichada</SimpleValue>
</Value>
</Row>
</SimpleCodeList>
</gc:CodeList>

View File

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- DIAN Genericode listas de valores:: Ultima modificación 18-02-2019 - evb-->
<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
<Identification>
<ShortName>EventoDocumento</ShortName>
<LongName xml:lang="es">Eventos de un Documento Electrónico</LongName>
<Version>1</Version>
<CanonicalUri>urn:dian:names:especificacion:ubl:listacodigos:gc:EventoDocumento</CanonicalUri>
<CanonicalVersionUri>urn:dian:names:especificacion:ubl:listacodigos:gc:EventoDocumento-2.1</CanonicalVersionUri>
<LocationUri>http://dian.gov.co/ubl/os-ubl-2.0/cl/gc/default/EventoDocumento-2.1.gc</LocationUri>
<Agency>
<LongName xml:lang="es">DIAN (Dirección de Impuestos y Aduanas Nacionales)</LongName>
<Identifier>195</Identifier>
</Agency>
</Identification>
<ColumnSet>
<Column Id="code" Use="required">
<ShortName>Code</ShortName>
<LongName xml:lang="es">Codigo Comun</LongName>
<Data Type="normalizedString"/>
</Column>
<Column Id="name" Use="required">
<ShortName>Name</ShortName>
<LongName xml:lang="es">Nombre</LongName>
<Data Type="string"/>
</Column>
<Key Id="codeKey">
<ShortName>CodeKey</ShortName>
<ColumnRef Ref="code"/>
</Key>
</ColumnSet>
<SimpleCodeList>
<Row>
<Value ColumnRef="code">
<SimpleValue>02</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Uso Autorizado por la DIAN</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>030</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Solicitación de Corrección en Documento</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>031</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Rechazo de Documento</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>032</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Recibimiento de los Bienes</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>033</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Aceptación de Documento</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>040</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Factura Ofrecida para Negociación como Título Valor</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>041</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Factura Negociada como Título Valor</SimpleValue>
</Value>
</Row>
</SimpleCodeList>
</gc:CodeList>

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- DIAN Genericode listas de valores:: Ultima modificación 18-02-2019 - evb-->
<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
<Identification>
<ShortName>FormasPago</ShortName>
<LongName xml:lang="es">Tipos de Formas de Pago</LongName>
<Version>1</Version>
<CanonicalUri>urn:dian:names:especificacion:ubl:listacodigos:gc:FormasPago</CanonicalUri>
<CanonicalVersionUri>urn:dian:names:especificacion:ubl:listacodigos:gc:FormasPago-2.1</CanonicalVersionUri>
<LocationUri>http://dian.gov.co/ubl/os-ubl-2.0/cl/gc/default/FormasPago-2.1.gc</LocationUri>
<Agency>
<LongName xml:lang="es">DIAN (Dirección de Impuestos y Aduanas Nacionales)</LongName>
<Identifier>195</Identifier>
</Agency>
</Identification>
<ColumnSet>
<Column Id="code" Use="required">
<ShortName>Code</ShortName>
<LongName xml:lang="es">Codigo Comun</LongName>
<Data Type="normalizedString"/>
</Column>
<Column Id="name" Use="required">
<ShortName>Name</ShortName>
<LongName xml:lang="es">Nombre</LongName>
<Data Type="string"/>
</Column>
<Key Id="codeKey">
<ShortName>CodeKey</ShortName>
<ColumnRef Ref="code"/>
</Key>
</ColumnSet>
<SimpleCodeList>
<Row>
<Value ColumnRef="code">
<SimpleValue>1</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Contado</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>2</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Crédito</SimpleValue>
</Value>
</Row>
</SimpleCodeList>
</gc:CodeList>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,634 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- DIAN Genericode listas de valores:: Ultima modificación 18-02-2019 - evb-->
<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
<Identification>
<ShortName>MediosPago</ShortName>
<LongName xml:lang="es">Medios de Pago</LongName>
<Version>1</Version>
<CanonicalUri>urn:dian:names:especificacion:ubl:listacodigos:gc:MediosPago</CanonicalUri>
<CanonicalVersionUri>urn:dian:names:especificacion:ubl:listacodigos:gc:MediosPago-2.1</CanonicalVersionUri>
<LocationUri>http://dian.gov.co/ubl/os-ubl-2.0/cl/gc/default/MediosPago-2.1.gc</LocationUri>
<Agency>
<LongName xml:lang="es">DIAN (Dirección de Impuestos y Aduanas Nacionales)</LongName>
<Identifier>195</Identifier>
</Agency>
</Identification>
<ColumnSet>
<Column Id="code" Use="required">
<ShortName>Code</ShortName>
<LongName xml:lang="es">Codigo Comun</LongName>
<Data Type="normalizedString"/>
</Column>
<Column Id="name" Use="required">
<ShortName>Name</ShortName>
<LongName xml:lang="es">Nombre</LongName>
<Data Type="string"/>
</Column>
<Key Id="codeKey">
<ShortName>CodeKey</ShortName>
<ColumnRef Ref="code"/>
</Key>
</ColumnSet>
<SimpleCodeList>
<Row>
<Value ColumnRef="code">
<SimpleValue>1</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Instrumento no definido</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>2</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Crédito ACH</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>3</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Débito ACH</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>4</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Reversión débito de demanda ACH</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>5</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Reversión crédito de demanda ACH </SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>6</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Crédito de demanda ACH</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>7</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Débito de demanda ACH</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>8</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Mantener</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>9</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Clearing Nacional o Regional</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>10</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Efectivo</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>11</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Reversión Crédito Ahorro</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>12</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Reversión Débito Ahorro</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>13</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Crédito Ahorro</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>14</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Débito Ahorro</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>15</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Bookentry Crédito</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>16</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Bookentry Débito</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>17</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Concentración de la demanda en efectivo /Desembolso Crédito (CCD)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>18</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Concentración de la demanda en efectivo / Desembolso (CCD) débito</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>19</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Crédito Pago negocio corporativo (CTP)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>20</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Cheque</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>21</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Poyecto bancario</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>22</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Proyecto bancario certificado</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>23</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Cheque bancario</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>24</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Nota cambiaria esperando aceptación</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>25</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Cheque certificado</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>26</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Cheque Local</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>27</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Débito Pago Neogcio Corporativo (CTP)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>28</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Crédito Negocio Intercambio Corporativo (CTX)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>29</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Débito Negocio Intercambio Corporativo (CTX)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>30</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Transferecia Crédito</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>31</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Transferencia Débito</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>32</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Concentración Efectivo / Desembolso Crédito plus (CCD+)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>33</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Concentración Efectivo / Desembolso Débito plus (CCD+)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>34</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Pago y depósito pre acordado (PPD)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>35</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Concentración efectivo ahorros / Desembolso Crédito (CCD)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>36</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Concentración efectivo ahorros / Desembolso Drédito (CCD)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>37</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Pago Negocio Corporativo Ahorros Crédito (CTP)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>38</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Pago Neogcio Corporativo Ahorros Débito (CTP)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>39</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Crédito Negocio Intercambio Corporativo (CTX)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>40</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Débito Negocio Intercambio Corporativo (CTX)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>41</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Concentración efectivo/Desembolso Crédito plus (CCD+) </SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>42</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Consiganción bancaria</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>43</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Concentración efectivo / Desembolso Débito plus (CCD+)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>44</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Nota cambiaria</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>45</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Transferencia Crédito Bancario</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>46</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Transferencia Débito Interbancario</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>47</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Transferencia Débito Bancaria</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>48</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Tarjeta Crédito</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>49</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Tarjeta Débito</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>50</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Postgiro</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>51</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Telex estándar bancario francés</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>52</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Pago comercial urgente</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>53</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Pago Tesorería Urgente</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>60</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Nota promisoria</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>61</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Nota promisoria firmada por el acreedor</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>62</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Nota promisoria firmada por el acreedor, avalada por el banco</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>63</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Nota promisoria firmada por el acreedor, avalada por un tercero</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>64</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Nota promisoria firmada pro el banco</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>65</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Nota promisoria firmada por un banco avalada por otro banco</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>66</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Nota promisoria firmada </SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>67</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Nota promisoria firmada por un tercero avalada por un banco</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>70</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Retiro de nota por el por el acreedor</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>74</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Retiro de nota por el por el acreedor sobre un banco</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>75</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Retiro de nota por el acreedor, avalada por otro banco</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>76</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Retiro de nota por el acreedor, sobre un banco avalada por un tercero</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>77</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Retiro de una nota por el acreedor sobre un tercero</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>78</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Retiro de una nota por el acreedor sobre un tercero avalada por un banco</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>91</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Nota bancaria tranferible</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>92</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Cheque local traferible</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>93</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Giro referenciado</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>94</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Giro urgente</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>95</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Giro formato abierto</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>96</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Método de pago solicitado no usuado</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>97</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Clearing entre partners</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>ZZZ</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Acuerdo mutuo</SimpleValue>
</Value>
</Row>
</SimpleCodeList>
</gc:CodeList>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- DIAN Genericode listas de validacion :: Ultima modificación 18-02-2019 - evb-->
<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
<Identification>
<ShortName>TarifaImpuestoINC</ShortName>
<LongName xml:lang="es">Tarifas por Impuesto</LongName>
<Version>1</Version>
<CanonicalUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TarifaImpuestoINC</CanonicalUri>
<CanonicalVersionUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TarifaImpuestoINC-2.1</CanonicalVersionUri>
<LocationUri>http://dian.gov.co/ubl/os-ubl-2.0/cl/gc/default/TarifaImpuestoINC-2.1.gc</LocationUri>
<Agency>
<LongName xml:lang="es">DIAN (Dirección de Impuestos y Aduanas Nacionales)</LongName>
<Identifier>195</Identifier>
</Agency>
</Identification>
<ColumnSet>
<Column Id="code" Use="required">
<ShortName>Code</ShortName>
<LongName xml:lang="es">Codigo Comun</LongName>
<Data Type="normalizedString"/>
</Column>
<Column Id="name" Use="required">
<ShortName>Name</ShortName>
<LongName xml:lang="es">Nombre</LongName>
<Data Type="string"/>
</Column>
<Column Id="description" Use="required">
<ShortName>Description</ShortName>
<LongName xml:lang="es">Descripcion</LongName>
<Data Type="string"/>
</Column>
<Key Id="codeKey">
<ShortName>CodeKey</ShortName>
<ColumnRef Ref="code"/>
</Key>
</ColumnSet>
<SimpleCodeList>
<Row>
<Value ColumnRef="code">
<SimpleValue>2.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>INC</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Tarifa especial</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>4.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>INC</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Tarifa especial</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>8.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>INC</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Tarifa general</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>16.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>INC</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Tarifa especial</SimpleValue>
</Value>
</Row>
</SimpleCodeList>
</gc:CodeList>

View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- DIAN Genericode listas de validacion :: Ultima modificación 18-02-2019 - evb-->
<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
<Identification>
<ShortName>TarifaImpuestoIVA</ShortName>
<LongName xml:lang="es">Tarifas por Impuesto IVA</LongName>
<Version>1</Version>
<CanonicalUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TarifaImpuestoIVA</CanonicalUri>
<CanonicalVersionUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TarifaImpuestoIVA-2.1</CanonicalVersionUri>
<LocationUri>http://dian.gov.co/ubl/os-ubl-2.0/cl/gc/default/TarifaImpuestoIVA-2.1.gc</LocationUri>
<Agency>
<LongName xml:lang="es">DIAN (Dirección de Impuestos y Aduanas Nacionales)</LongName>
<Identifier>195</Identifier>
</Agency>
</Identification>
<ColumnSet>
<Column Id="code" Use="required">
<ShortName>Code</ShortName>
<LongName xml:lang="es">Codigo Comun</LongName>
<Data Type="normalizedString"/>
</Column>
<Column Id="name" Use="required">
<ShortName>Name</ShortName>
<LongName xml:lang="es">Nombre</LongName>
<Data Type="string"/>
</Column>
<Column Id="description" Use="required">
<ShortName>Description</ShortName>
<LongName xml:lang="es">Descripcion</LongName>
<Data Type="string"/>
</Column>
<Key Id="codeKey">
<ShortName>CodeKey</ShortName>
<ColumnRef Ref="code"/>
</Key>
</ColumnSet>
<SimpleCodeList>
<Row>
<Value ColumnRef="code">
<SimpleValue>0.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>IVA</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Exento</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>5.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>IVA</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Bienes / Servicios al 5</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>16.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>IVA</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Contratos firmados con el estado antes de ley 1819</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>19.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>IVA</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Tarifa general</SimpleValue>
</Value>
</Row>
</SimpleCodeList>
</gc:CodeList>

View File

@ -0,0 +1,479 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- DIAN Genericode listas de validacion :: Ultima modificación 18-02-2019 - evb-->
<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
<Identification>
<ShortName>TarifaImpuestoReteFuente</ShortName>
<LongName xml:lang="es">Tarifas por Impuesto</LongName>
<Version>1</Version>
<CanonicalUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TarifaImpuestos</CanonicalUri>
<CanonicalVersionUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TarifaImpuestos-2.1</CanonicalVersionUri>
<LocationUri>http://dian.gov.co/ubl/os-ubl-2.0/cl/gc/default/TarifaImpuestos-2.1.gc</LocationUri>
<Agency>
<LongName xml:lang="es">DIAN (Dirección de Impuestos y Aduanas Nacionales)</LongName>
<Identifier>195</Identifier>
</Agency>
</Identification>
<ColumnSet>
<Column Id="code" Use="required">
<ShortName>Code</ShortName>
<LongName xml:lang="es">Codigo Comun</LongName>
<Data Type="normalizedString"/>
</Column>
<Column Id="name" Use="required">
<ShortName>Name</ShortName>
<LongName xml:lang="es">Nombre</LongName>
<Data Type="string"/>
</Column>
<Column Id="description" Use="required">
<ShortName>Description</ShortName>
<LongName xml:lang="es">Descripcion</LongName>
<Data Type="string"/>
</Column>
<Key Id="codeKey">
<ShortName>CodeKey</ShortName>
<ColumnRef Ref="code"/>
</Key>
</ColumnSet>
<SimpleCodeList>
<Row>
<Value ColumnRef="code">
<SimpleValue>2.50</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Compras generales (declarantes)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>3.50</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Compras generales (no declarantes)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>1.50</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Compras con tarjeta débito o crédito</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>1.50</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Compras de bienes o productos agrícolas o pecuarios sin procesamiento industrial</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>2.50</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Compras de bienes o productos agrícolas o pecuarios con procesamiento industrial (declarantes)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>3.50</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Compras de bienes o productos agrícolas o pecuarios con procesamiento industrial declarantes (no declarantes)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>0.50</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Compras de café pergamino o cereza</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>0.10</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Compras de combustibles derivados del petróleo</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>1.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Enajenación de activos fijos de personas naturales (notarías y tránsito son agentes retenedores)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>1.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Compras de vehículos</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>1.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Compras de bienes raíces cuya destinación y uso sea vivienda de habitación (por las primeras 20.000 UVT, es decir hasta $637.780.000)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>2.50</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Compras  de bienes raíces cuya destinación y uso sea vivienda de habitación (exceso de las primeras 20.000 UVT, es decir superior a $637.780.000)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>2.50</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Compras  de bienes raíces cuya destinación y uso sea distinto a vivienda de habitación</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>4.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Servicios generales (declarantes)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>6.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Servicios generales (no declarantes)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>4.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Por emolumentos eclesiásticos (declarantes)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>3.50</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Por emolumentos eclesiásticos (no declarantes)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>1.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Servicios de transporte de carga</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>3.50</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Servicios de  transporte nacional de pasajeros por vía terrestre (declarantes)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>3.50</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Servicios de  transporte nacional de pasajeros por vía terrestre (no declarantes)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>1.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Servicios de  transporte nacional de pasajeros por vía aérea o marítima</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>1.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Servicios prestados por empresas de servicios temporales (sobre AIU)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>2.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Servicios prestados por empresas de vigilancia y aseo (sobre AIU)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>2.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Servicios integrales de salud prestados por IPS</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>3.50</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Servicios de hoteles y restaurantes (declarantes)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>3.50</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Servicios de hoteles y restaurantes (no declarantes)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>4.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Arrendamiento de bienes muebles</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>3.50</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Arrendamiento de bienes inmuebles (declarantes)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>3.50</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Arrendamiento de bienes inmuebles (no declarantes)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>2.50</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Otros ingresos tributarios (declarantes)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>3.50</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Otros ingresos tributarios (no declarantes)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>11.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Honorarios y comisiones (personas jurídicas)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>11.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Honorarios y comisiones personas naturales que suscriban contrato o cuya sumatoria de los pagos o abonos en cuenta superen las 3.300 UVT ($105.135.000)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>10.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Honorarios y comisiones (no declarantes)</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>3.50</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Servicios de licenciamiento o derecho de uso de software</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>7.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Intereses o rendimientos financieros</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>4.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Rendimientos financieros provenientes de títulos de renta fija</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>20.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Loterías, rifas, apuestas y similares</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>3.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Retención en colocación independiente de juegos de suerte y azar</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>2.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>Contratos de construcción  y urbanización</SimpleValue>
</Value>
</Row>
</SimpleCodeList>
</gc:CodeList>

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- DIAN Genericode listas de validacion :: Ultima modificación 18-02-2019 - evb-->
<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
<Identification>
<ShortName>TarifaImpuestos</ShortName>
<LongName xml:lang="es">Tarifas por Impuesto</LongName>
<Version>1</Version>
<CanonicalUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TarifaImpuestos</CanonicalUri>
<CanonicalVersionUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TarifaImpuestos-2.1</CanonicalVersionUri>
<LocationUri>http://dian.gov.co/ubl/os-ubl-2.0/cl/gc/default/TarifaImpuestos-2.1.gc</LocationUri>
<Agency>
<LongName xml:lang="es">DIAN (Dirección de Impuestos y Aduanas Nacionales)</LongName>
<Identifier>195</Identifier>
</Agency>
</Identification>
<ColumnSet>
<Column Id="code" Use="required">
<ShortName>Code</ShortName>
<LongName xml:lang="es">Codigo Comun</LongName>
<Data Type="normalizedString"/>
</Column>
<Column Id="name" Use="required">
<ShortName>Name</ShortName>
<LongName xml:lang="es">Nombre</LongName>
<Data Type="string"/>
</Column>
<Column Id="description" Use="required">
<ShortName>Description</ShortName>
<LongName xml:lang="es">Descripcion</LongName>
<Data Type="string"/>
</Column>
<Key Id="codeKey">
<ShortName>CodeKey</ShortName>
<ColumnRef Ref="code"/>
</Key>
</ColumnSet>
<SimpleCodeList>
<Row>
<Value ColumnRef="code">
<SimpleValue>15.00</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteIVA</SimpleValue>
</Value>
<Value ColumnRef="description">
<SimpleValue>ReteIVA</SimpleValue>
</Value>
</Row>
</SimpleCodeList>
</gc:CodeList>

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- DIAN Genericode listas de valores:: Ultima modificación 18-02-2019 - evb-->
<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
<Identification>
<ShortName>TipoAmbiente</ShortName>
<LongName xml:lang="es">Ambiente de destino</LongName>
<Version>1</Version>
<CanonicalUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TipoAmbiente</CanonicalUri>
<CanonicalVersionUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TipoAmbiente-2.1</CanonicalVersionUri>
<LocationUri>http://dian.gov.co/ubl/os-ubl-2.0/cl/gc/default/TipoAmbiente-2.1.gc</LocationUri>
<Agency>
<LongName xml:lang="es">DIAN (Dirección de Impuestos y Aduanas Nacionales)</LongName>
<Identifier>195</Identifier>
</Agency>
</Identification>
<ColumnSet>
<Column Id="code" Use="required">
<ShortName>Code</ShortName>
<LongName xml:lang="es">Codigo Comun</LongName>
<Data Type="normalizedString"/>
</Column>
<Column Id="name" Use="required">
<ShortName>Name</ShortName>
<LongName xml:lang="es">Nombre</LongName>
<Data Type="string"/>
</Column>
<Key Id="codeKey">
<ShortName>CodeKey</ShortName>
<ColumnRef Ref="code"/>
</Key>
</ColumnSet>
<SimpleCodeList>
<Row>
<Value ColumnRef="code">
<SimpleValue>1</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Producción</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>2</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Pruebas</SimpleValue>
</Value>
</Row>
</SimpleCodeList>
</gc:CodeList>

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- DIAN Asociacion lista de codigos :: Author : Eric Van Boxsom :: Ultima modificación 05-02-2019 - evb-->
<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
<Identification>
<ShortName>TipoCodigoProducto</ShortName>
<LongName xml:lang="es">Eventos de un documento electronico</LongName>
<Version>1</Version>
<CanonicalUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TipoCodigoProducto</CanonicalUri>
<CanonicalVersionUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TipoCodigoProducto-2.1</CanonicalVersionUri>
<LocationUri>http://dian.gov.co/ubl/os-ubl-2.0/cl/gc/default/TipoCodigoProducto-2.1.gc</LocationUri>
<Agency>
<LongName xml:lang="es">DIAN (Dirección de Impuestos y Aduanas Nacionales)</LongName>
<Identifier>195</Identifier>
</Agency>
</Identification>
<ColumnSet>
<Column Id="code" Use="required">
<ShortName>Code</ShortName>
<Data Type="normalizedString"/>
</Column>
<Column Id="name" Use="required">
<ShortName>Nombre</ShortName>
<Data Type="normalizedString"/>
</Column>
<Key Id="codeKey">
<ShortName>CodeKey</ShortName>
<ColumnRef Ref="code"/>
</Key>
</ColumnSet>
<SimpleCodeList>
<Row>
<Value ColumnRef="code">
<SimpleValue>001</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>UNSPSC</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>010</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>GTIN</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>999</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Estándar de adopción del contribuyente</SimpleValue>
</Value>
</Row>
</SimpleCodeList>
</gc:CodeList>

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- DIAN Genericode listas de valores:: Ultima modificación 18-02-2019 - evb-->
<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
<Identification>
<ShortName>TipoDocumento</ShortName>
<LongName xml:lang="es">Tipo de Documento</LongName>
<Version>1</Version>
<CanonicalUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TipoDocumento</CanonicalUri>
<CanonicalVersionUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TipoDocumento-2.1</CanonicalVersionUri>
<LocationUri>http://dian.gov.co/ubl/os-ubl-2.0/cl/gc/default/TipoDocumento-2.1.gc</LocationUri>
<Agency>
<LongName xml:lang="es">DIAN (Dirección de Impuestos y Aduanas Nacionales)</LongName>
<Identifier>195</Identifier>
</Agency>
</Identification>
<ColumnSet>
<Column Id="code" Use="required">
<ShortName>Code</ShortName>
<LongName xml:lang="es">Codigo Comun</LongName>
<Data Type="normalizedString"/>
</Column>
<Column Id="name" Use="required">
<ShortName>Name</ShortName>
<LongName xml:lang="es">Nombre</LongName>
<Data Type="string"/>
</Column>
<Key Id="codeKey">
<ShortName>CodeKey</ShortName>
<ColumnRef Ref="code"/>
</Key>
</ColumnSet>
<SimpleCodeList>
<Row>
<Value ColumnRef="code">
<SimpleValue>01</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Factura de Venta Nacional</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>02</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Factura de Exportación </SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>03</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Factura de Contingencia</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>91</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Nota Crédito</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>92</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Nota Débito</SimpleValue>
</Value>
</Row>
</SimpleCodeList>
</gc:CodeList>

View File

@ -0,0 +1,122 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- DIAN Genericode listas de valores:: Ultima modificación 18-02-2019 - evb-->
<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
<Identification>
<ShortName>TipoEntrega</ShortName>
<LongName xml:lang="es">Condiciones de Entrega</LongName>
<Version>1</Version>
<CanonicalUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TipoEntrega</CanonicalUri>
<CanonicalVersionUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TipoEntrega-2.1</CanonicalVersionUri>
<LocationUri>http://dian.gov.co/ubl/os-ubl-2.0/cl/gc/default/TipoEntrega-2.1.gc</LocationUri>
<Agency>
<LongName xml:lang="es">DIAN (Dirección de Impuestos y Aduanas Nacionales)</LongName>
<Identifier>195</Identifier>
</Agency>
</Identification>
<ColumnSet>
<Column Id="code" Use="required">
<ShortName>Code</ShortName>
<LongName xml:lang="es">Codigo Comun</LongName>
<Data Type="normalizedString"/>
</Column>
<Column Id="name" Use="required">
<ShortName>Name</ShortName>
<LongName xml:lang="es">Nombre</LongName>
<Data Type="string"/>
</Column>
<Key Id="codeKey">
<ShortName>CodeKey</ShortName>
<ColumnRef Ref="code"/>
</Key>
</ColumnSet>
<SimpleCodeList>
<Row>
<Value ColumnRef="code">
<SimpleValue>CFR</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Costo y flete</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>CIF</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Costo, flete y seguro</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>CIP</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Transporte y Seguro Pagados hasta</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>CPT</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Transporte Pagado Hasta</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>DAP</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Entregado en un Lugar</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>DAT</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Entregado en Terminal</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>DDP</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Entregado con Pago de Derechos</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>EXW</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>En Fábrica</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>FAS</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Franco al costado del buque</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>FCA</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Franco transportista</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>FOB</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Franco a bordo</SimpleValue>
</Value>
</Row>
</SimpleCodeList>
</gc:CodeList>

View File

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- DIAN Genericode listas de valores:: Ultima modificación 18-02-2019 - evb-->
<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
<Identification>
<ShortName>TipoIdFiscal</ShortName>
<LongName xml:lang="es">Tipo de Identificador Fiscal</LongName>
<Version>1</Version>
<CanonicalUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TipoIdFiscal</CanonicalUri>
<CanonicalVersionUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TipoIdFiscal-2.1</CanonicalVersionUri>
<LocationUri>http://dian.gov.co/ubl/os-ubl-2.0/cl/gc/default/TipoIdFiscal-2.1.gc</LocationUri>
<Agency>
<LongName xml:lang="es">DIAN (Dirección de Impuestos y Aduanas Nacionales)</LongName>
<Identifier>195</Identifier>
</Agency>
</Identification>
<ColumnSet>
<Column Id="code" Use="required">
<ShortName>Code</ShortName>
<LongName xml:lang="es">Codigo Comun</LongName>
<Data Type="normalizedString"/>
</Column>
<Column Id="name" Use="required">
<ShortName>Name</ShortName>
<LongName xml:lang="es">Nombre</LongName>
<Data Type="string"/>
</Column>
<Key Id="codeKey">
<ShortName>CodeKey</ShortName>
<ColumnRef Ref="code"/>
</Key>
</ColumnSet>
<SimpleCodeList>
<Row>
<Value ColumnRef="code">
<SimpleValue>11</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Registro civil </SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>12</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Tarjeta de identidad </SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>13</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Cédula de ciudadanía </SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>21</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Tarjeta de extranjería </SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>22</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Cédula de extranjería </SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>31</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>NIT</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>41</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Pasaporte </SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>42</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Documento de identificación extranjero </SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>50</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>NIT de otro país</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>91</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>NUIP * </SimpleValue>
</Value>
</Row>
</SimpleCodeList>
</gc:CodeList>

View File

@ -0,0 +1,162 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- DIAN Genericode listas de valores:: Ultima modificación 18-02-2019 - evb-->
<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
<Identification>
<ShortName>TipoImpuesto</ShortName>
<LongName xml:lang="es">Tipo de Tributos</LongName>
<Version>1</Version>
<CanonicalUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TipoImpuesto</CanonicalUri>
<CanonicalVersionUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TipoImpuesto-2.1</CanonicalVersionUri>
<LocationUri>http://dian.gov.co/ubl/os-ubl-2.0/cl/gc/default/TipoImpuesto-2.1.gc</LocationUri>
<Agency>
<LongName xml:lang="es">DIAN (Dirección de Impuestos y Aduanas Nacionales)</LongName>
<Identifier>195</Identifier>
</Agency>
</Identification>
<ColumnSet>
<Column Id="code" Use="required">
<ShortName>Code</ShortName>
<LongName xml:lang="es">Codigo Comun</LongName>
<Data Type="normalizedString"/>
</Column>
<Column Id="name" Use="required">
<ShortName>Name</ShortName>
<LongName xml:lang="es">Nombre</LongName>
<Data Type="string"/>
</Column>
<Key Id="codeKey">
<ShortName>CodeKey</ShortName>
<ColumnRef Ref="code"/>
</Key>
</ColumnSet>
<SimpleCodeList>
<Row>
<Value ColumnRef="code">
<SimpleValue>01</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>IVA</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>02</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>IC</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>03</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ICA</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>04</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>INC</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>05</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteIVA</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>06</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteFuente</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>07</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteICA</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>08</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>ReteCREE</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>20</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>FtoHorticultura</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>21</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Timbre</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>22</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Bolsas</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>23</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>INCarbono</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>24</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>INCombustibles</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>25</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Sobretasa Combustibles</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>26</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Sordicom</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>ZZ</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Nombre de la figura tributaria</SimpleValue>
</Value>
</Row>
</SimpleCodeList>
</gc:CodeList>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
<Identification>
<ShortName>TipoOperacion</ShortName>
<LongName xml:lang="es">Tipo de operacion del documento</LongName>
<Version>1</Version>
<CanonicalUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TipoOperacion</CanonicalUri>
<CanonicalVersionUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TipoOperacion-2.1</CanonicalVersionUri>
<LocationUri>http://dian.gov.co/ubl/os-ubl-2.0/cl/gc/default/TipoOperacion-2.1.gc</LocationUri>
<Agency>
<LongName xml:lang="es">DIAN (Dirección de Impuestos y Aduanas Nacionales)</LongName>
<Identifier>195</Identifier>
</Agency>
</Identification>
<ColumnSet>
<Column Id="code" Use="required">
<ShortName>Code</ShortName>
<Data Type="normalizedString"/>
</Column>
<Column Id="name" Use="required">
<ShortName>Nombre</ShortName>
<Data Type="normalizedString"/>
</Column>
<Key Id="codeKey">
<ShortName>CodeKey</ShortName>
<ColumnRef Ref="code"/>
</Key>
</ColumnSet>
<SimpleCodeList>
<Row>
<Value ColumnRef="code">
<SimpleValue>10</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Estandar</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>09</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>AIU</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>11</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Mandatos</SimpleValue>
</Value>
</Row>
</SimpleCodeList>
</gc:CodeList>

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
<Identification>
<ShortName>TipoOperacion</ShortName>
<LongName xml:lang="es">Tipo de operacion del documento</LongName>
<Version>1</Version>
<CanonicalUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TipoOperacion</CanonicalUri>
<CanonicalVersionUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TipoOperacion-2.1</CanonicalVersionUri>
<LocationUri>http://dian.gov.co/ubl/os-ubl-2.0/cl/gc/default/TipoOperacion-2.1.gc</LocationUri>
<Agency>
<LongName xml:lang="es">DIAN (Dirección de Impuestos y Aduanas Nacionales)</LongName>
<Identifier>195</Identifier>
</Agency>
</Identification>
<ColumnSet>
<Column Id="code" Use="required">
<ShortName>Code</ShortName>
<Data Type="normalizedString"/>
</Column>
<Column Id="name" Use="required">
<ShortName>Nombre</ShortName>
<Data Type="normalizedString"/>
</Column>
<Key Id="codeKey">
<ShortName>CodeKey</ShortName>
<ColumnRef Ref="code"/>
</Key>
</ColumnSet>
<SimpleCodeList>
<Row>
<Value ColumnRef="code">
<SimpleValue>20</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Nota Crédito que referencia una factura electrónica.</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>22</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Nota Crédito sin referencia a facturas*.</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>23</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Nota Crédito para facturación electrónica V1 (Decreto 2242).</SimpleValue>
</Value>
</Row>
</SimpleCodeList>
</gc:CodeList>

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
<Identification>
<ShortName>TipoOperacion</ShortName>
<LongName xml:lang="es">Tipo de operacion del documento</LongName>
<Version>1</Version>
<CanonicalUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TipoOperacion</CanonicalUri>
<CanonicalVersionUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TipoOperacion-2.1</CanonicalVersionUri>
<LocationUri>http://dian.gov.co/ubl/os-ubl-2.0/cl/gc/default/TipoOperacion-2.1.gc</LocationUri>
<Agency>
<LongName xml:lang="es">DIAN (Dirección de Impuestos y Aduanas Nacionales)</LongName>
<Identifier>195</Identifier>
</Agency>
</Identification>
<ColumnSet>
<Column Id="code" Use="required">
<ShortName>Code</ShortName>
<Data Type="normalizedString"/>
</Column>
<Column Id="name" Use="required">
<ShortName>Nombre</ShortName>
<Data Type="normalizedString"/>
</Column>
<Key Id="codeKey">
<ShortName>CodeKey</ShortName>
<ColumnRef Ref="code"/>
</Key>
</ColumnSet>
<SimpleCodeList>
<Row>
<Value ColumnRef="code">
<SimpleValue>30</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Nota Débito que referencia una factura electrónica.</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>32</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Nota Débito sin referencia a facturas.</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>33</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Nota Débito para facturación electrónica V1 (Decreto 2242).</SimpleValue>
</Value>
</Row>
</SimpleCodeList>
</gc:CodeList>

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- DIAN Genericode listas de valores:: Ultima modificación 18-02-2019 - evb-->
<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
<Identification>
<ShortName>TipoOrganizacion</ShortName>
<LongName xml:lang="es">Tipo de organización jurídica (Personas)</LongName>
<Version>1</Version>
<CanonicalUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TipoOrganizacion</CanonicalUri>
<CanonicalVersionUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TipoOrganizacion-2.1</CanonicalVersionUri>
<LocationUri>http://dian.gov.co/ubl/os-ubl-2.0/cl/gc/default/TipoOrganizacion-2.1.gc</LocationUri>
<Agency>
<LongName xml:lang="es">DIAN (Dirección de Impuestos y Aduanas Nacionales)</LongName>
<Identifier>195</Identifier>
</Agency>
</Identification>
<ColumnSet>
<Column Id="code" Use="required">
<ShortName>Code</ShortName>
<LongName xml:lang="es">Codigo Comun</LongName>
<Data Type="normalizedString"/>
</Column>
<Column Id="name" Use="required">
<ShortName>Name</ShortName>
<LongName xml:lang="es">Nombre</LongName>
<Data Type="string"/>
</Column>
<Key Id="codeKey">
<ShortName>CodeKey</ShortName>
<ColumnRef Ref="code"/>
</Key>
</ColumnSet>
<SimpleCodeList>
<Row>
<Value ColumnRef="code">
<SimpleValue>1</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Persona Jurídica</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>2</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Persona Natural</SimpleValue>
</Value>
</Row>
</SimpleCodeList>
</gc:CodeList>

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- DIAN Genericode listas de valores:: Ultima modificación 18-02-2019 - evb-->
<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
<Identification>
<ShortName>TipoResponsabilidad</ShortName>
<LongName xml:lang="es">Responsabilidades fiscales; Régimen fiscal</LongName>
<Version>1</Version>
<CanonicalUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TipoResponsabilidad</CanonicalUri>
<CanonicalVersionUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TipoResponsabilidad-2.1</CanonicalVersionUri>
<LocationUri>http://dian.gov.co/ubl/os-ubl-2.0/cl/gc/default/TipoResponsabilidad-2.1.gc</LocationUri>
<Agency>
<LongName xml:lang="es">DIAN (Dirección de Impuestos y Aduanas Nacionales)</LongName>
<Identifier>195</Identifier>
</Agency>
</Identification>
<ColumnSet>
<Column Id="code" Use="required">
<ShortName>Code</ShortName>
<LongName xml:lang="es">Codigo Comun</LongName>
<Data Type="normalizedString"/>
</Column>
<Column Id="name" Use="required">
<ShortName>Name</ShortName>
<LongName xml:lang="es">Nombre</LongName>
<Data Type="string"/>
</Column>
<Key Id="codeKey">
<ShortName>CodeKey</ShortName>
<ColumnRef Ref="code"/>
</Key>
</ColumnSet>
<SimpleCodeList>
<Row>
<Value ColumnRef="code">
<SimpleValue>O-13</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Gran contribuyente</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>O-15</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Autorretenedor</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>O-23</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Agente de retención IVA</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>O-47</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>Régimen simple de tributación</SimpleValue>
</Value>
</Row>
<Row>
<Value ColumnRef="code">
<SimpleValue>ZZ</SimpleValue>
</Value>
<Value ColumnRef="name">
<SimpleValue>No aplica</SimpleValue>
</Value>
</Row>
</SimpleCodeList>
</gc:CodeList>

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- DIAN Genericode listas de validacion :: Ultima modificación 18-02-2019 - evb-->
<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
<Identification>
<ShortName>TiposEventos</ShortName>
<LongName xml:lang="es">Tarifas por Impuesto</LongName>
<Version>1</Version>
<CanonicalUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TiposEventos</CanonicalUri>
<CanonicalVersionUri>urn:dian:names:especificacion:ubl:listacodigos:gc:TiposEventos-2.1</CanonicalVersionUri>
<LocationUri>http://dian.gov.co/ubl/os-ubl-2.0/cl/gc/default/TiposEventos-2.1.gc</LocationUri>
<Agency>
<LongName xml:lang="es">DIAN (Dirección de Impuestos y Aduanas Nacionales)</LongName>
<Identifier>195</Identifier>
</Agency>
</Identification>
<ColumnSet>
<Column Id="code" Use="required">
<ShortName>Code</ShortName>
<LongName xml:lang="es">Codigo Comun</LongName>
<Data Type="normalizedString"/>
</Column>
<Column Id="name" Use="required">
<ShortName>Name</ShortName>
<LongName xml:lang="es">Nombre</LongName>
<Data Type="string"/>
</Column>
</ColumnSet>
<SimpleCodeList>
<Row><Value ColumnRef="code"><SimpleValue>02</SimpleValue></Value><Value ColumnRef="name"><SimpleValue>Documento validado por la DIANSimpleValue></Value></Row>
<Row><Value ColumnRef="code"><SimpleValue>04</SimpleValue></Value><Value ColumnRef="name"><SimpleValue>Documento rechazado por la DIANSimpleValue></Value></Row>
<Row><Value ColumnRef="code"><SimpleValue>031</SimpleValue></Value><Value ColumnRef="name"><SimpleValue>Rechazo de DocumentoSimpleValue></Value></Row>
<Row><Value ColumnRef="code"><SimpleValue>032</SimpleValue></Value><Value ColumnRef="name"><SimpleValue>Recepción de mercacías y/o serviciosSimpleValue></Value></Row>
<Row><Value ColumnRef="code"><SimpleValue>033</SimpleValue></Value><Value ColumnRef="name"><SimpleValue>Aceptación de DocumentoSimpleValue></Value></Row>
</SimpleCodeList>
</gc:CodeList>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,61 @@
import os.path
from lxml import etree
DATA_DIR = os.path.dirname(os.path.abspath(__file__))
class CodeList:
def __init__(self, filename, primary_column):
self.short_name = ''
self.long_name = ''
self.version = 1
self.canonical_uri = ''
self.canonical_version_uri = ''
self.location_uri = ''
self.rows = {}
self._load(filename, primary_column)
def _load(self, filename, primary_column):
tree = etree.parse(filename)
#obtener identificadores...
self.short_name = tree.find('./Identification/ShortName').text
self.long_name = tree.find('./Identification/LongName').text
self.version = tree.find('./Identification/Version').text
self.canonical_uri = tree.find('./Identification/CanonicalUri').text
self.canonical_version_uri = tree.find('./Identification/CanonicalVersionUri').text
self.location_uri = tree.find('./Identification/LocationUri').text
#obtener registros...
for row in tree.findall('./SimpleCodeList/Row'):
new_row = self.xmlrow_to_dict(row)
primary_key = new_row[primary_column]
self.rows[primary_key] = new_row.copy()
def xmlrow_to_dict(self, xmlrow):
row = {}
#construir registro...
for value in xmlrow.getchildren():
row[value.attrib['ColumnRef']] = value.getchildren()[0].text
return row
def __getitem__(self, key):
return self.rows[str(key)]
# nombres de variables igual a ./Identification/ShortName
# TODO: garantizar unica carga en python
__all__ = ['TipoOrganizacion',
'TipoResponsabilidad',
'TipoAmbiente']
TipoOrganizacion = CodeList(os.path.join(DATA_DIR, 'TipoOrganizacion-2.1.gc'), 'name')
TipoResponsabilidad = CodeList(os.path.join(DATA_DIR, 'TipoResponsabilidad-2.1.gc'), 'name')
TipoAmbiente = CodeList(os.path.join(DATA_DIR, 'TipoAmbiente-2.1.gc'), 'name')

126
facho/fe/fe.py Normal file
View File

@ -0,0 +1,126 @@
# This file is part of facho. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from ..facho import FachoXML
import xmlsig
import xades
from datetime import datetime
import OpenSSL
import warnings
NAMESPACES = {
'fe': 'http://www.dian.gov.co/contratos/facturaelectronica/v1',
'cac': 'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2',
'cbc': 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2',
'cdt': 'urn:DocumentInformation:names:specification:ubl:colombia:schema:xsd:DocumentInformationAggregateComponents-1',
'clm54217': 'urn:un:unece:uncefact:codelist:specification:54217:2001',
'clmIANAMIMEMediaType': 'urn:un:unece:uncefact:codelist:specification:IANAMIMEMediaType:2003',
'ext': 'urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2',
'qdt': 'urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2',
'sts': 'http://www.dian.gov.co/contratos/facturaelectronica/v1/Structures',
'udt': 'urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2',
'xsi': 'http://www.w3.org/2001/XMLSchema-instance',
'xades': 'http://uri.etsi.org/01903/v1.3.2#',
'ds': 'http://www.w3.org/2000/09/xmldsig#',
}
class FeXML(FachoXML):
def __init__(self, root, namespace):
super().__init__("{%s}%s" % (namespace, root),
nsmap=NAMESPACES)
self._cn = root.rstrip('/')
#self.find_or_create_element(self._cn)
class DianXMLExtensionSigner:
POLICY_ID = 'https://facturaelectronica.dian.gov.co/politicadefirma/v2/politicadefirmav2.pdf'
POLICY_NAME = 'Dian'
def __init__(self, pkcs12_path, passphrase=None):
self._pkcs12_path = pkcs12_path
self._passphrase = None
if passphrase:
self._passphrase = passphrase.encode('utf-8')
@classmethod
def from_pkcs12(self, filepath, password=None):
p12 = OpenSSL.crypto.load_pkcs12(open(filepath, 'rb').read(), password)
# return (xpath, xml.Element)
def build(self, fachoxml):
dian_path = '/ext:UBLExtensions/ext:UBLExtension/ext:ExtensionContent'
signature = xmlsig.template.create(
xmlsig.constants.TransformInclC14N,
xmlsig.constants.TransformRsaSha256,
"Signature",
)
ref = xmlsig.template.add_reference(
signature, xmlsig.constants.TransformSha256, uri="", name="R1"
)
xmlsig.template.add_transform(ref, xmlsig.constants.TransformEnveloped)
xmlsig.template.add_reference(
signature, xmlsig.constants.TransformSha256, uri="#KI", name="RKI"
)
ki = xmlsig.template.ensure_key_info(signature, name="KI")
data = xmlsig.template.add_x509_data(ki)
xmlsig.template.x509_data_add_certificate(data)
serial = xmlsig.template.x509_data_add_issuer_serial(data)
xmlsig.template.x509_issuer_serial_add_issuer_name(serial)
xmlsig.template.x509_issuer_serial_add_serial_number(serial)
xmlsig.template.add_key_value(ki)
qualifying = xades.template.create_qualifying_properties(signature)
xades.utils.ensure_id(qualifying)
xades.utils.ensure_id(qualifying)
# TODO assert with http://www.sic.gov.co/hora-legal-colombiana
props = xades.template.create_signed_properties(qualifying, datetime=datetime.now())
xades.template.add_claimed_role(props, "supplier")
#signed_do = xades.template.ensure_signed_data_object_properties(props)
#xades.template.add_data_object_format(
# signed_do, "#R1",
# identifier=xades.ObjectIdentifier("Idenfitier0", "Description")
#)
#xades.template.add_commitment_type_indication(
# signed_do,
# xades.ObjectIdentifier("Idenfitier0", "Description"),
# qualifiers_type=["Tipo"],
#)
#xades.template.add_commitment_type_indication(
# signed_do,
# xades.ObjectIdentifier("Idenfitier1", references=["#R1"]),
# references=["#R1"],
#)
#xades.template.add_data_object_format(
# signed_do,
# "#RKI",
# description="Desc",
# mime_type="application/xml",
# encoding="UTF-8",
#)
fachoxml.root.append(signature)
policy = xades.policy.GenericPolicyId(
self.POLICY_ID,
self.POLICY_NAME,
xmlsig.constants.TransformSha256)
ctx = xades.XAdESContext(policy)
ctx.load_pkcs12(OpenSSL.crypto.load_pkcs12(open(self._pkcs12_path, 'rb').read(),
self._passphrase))
ctx.sign(signature)
ctx.verify(signature)
#xmlsig take parent root
fachoxml.root.remove(signature)
return (dian_path, [signature])

295
facho/fe/form.py Normal file
View File

@ -0,0 +1,295 @@
# This file is part of facho. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import hashlib
from functools import reduce
import copy
from dataclasses import dataclass
from datetime import datetime
from .data import dian
from . import fe
class DataError(Exception):
def __init__(self, errors):
self._errors = errors
class DataValidator:
# valida y retorna errores [(key, error)..]
def validate(self) -> []:
raise NotImplementedError()
def try_validate(self):
errors = self.validate()
if errors:
raise DataError(errors)
@dataclass
class Party(DataValidator):
name: str
ident: str
responsability_code: str
organization_code: str
phone: str = ''
address: str = ''
email: str = ''
legal_name: str = ''
legal_company_ident: str = ''
legal_address: str = ''
def validate(self):
errors = []
try:
dian.TipoResponsabilidad[self.responsability_code]
except KeyError:
errors.append(('responsability_code', 'not found'))
try:
dian.TipoOrganizacion[self.organization_code]
except KeyError:
errors.append(('organization_code', 'not found'))
return errors
@dataclass
class TaxSubTotal:
percent: float
tax_scheme_ident: str = '01'
tax_amount: float = 0.0
taxable_amount: float = 0.0
def calculate(self, invline):
self.tax_amount = invline.total_amount * (self.percent / 100)
self.taxable_amount = invline.total_amount
@dataclass
class TaxTotal:
subtotals: list
tax_amount: float = 0.0
taxable_amount: float = 0.0
def calculate(self, invline):
for subtax in self.subtotals:
subtax.calculate(invline)
self.tax_amount += subtax.tax_amount
self.taxable_amount += subtax.taxable_amount
@dataclass
class InvoiceLine:
quantity: int
description: str
item_ident: int
price_amount: float
tax: TaxTotal
@property
def total_amount(self):
return self.quantity * self.price_amount
@property
def total_tax_inclusive_amount(self):
return self.tax.taxable_amount
@property
def total_tax_exclusive_amount(self):
return self.tax.tax_amount
def calculate(self):
self.tax.calculate(self)
@dataclass
class LegalMonetaryTotal:
line_extension_amount: float = 0.0
tax_exclusive_amount: float = 0.0
tax_inclusive_amount: float = 0.0
charge_total_amount: float = 0.0
payable_amount: float = 0.0
class Invoice(DataValidator):
def __init__(self):
self.invoice_period_start = None
self.invoice_period_end = None
self.invoice_issue = None
self.invoice_ident = None
self.invoice_cufe = None
self.invoice_legal_monetary_total = LegalMonetaryTotal(0, 0, 0, 0, 0)
self.invoice_customer = None
self.invoice_supplier = None
self.invoice_lines = []
def set_period(self, startdate, enddate):
self.invoice_period_start = startdate
self.invoice_period_end = enddate
def set_issue(self, dtime: datetime):
self.invoice_issue = dtime
def set_ident(self, ident: str):
self.invoice_ident = ident
def set_supplier(self, party: Party):
self.invoice_supplier = party
def set_customer(self, party: Party):
self.invoice_customer = party
def add_invoice_line(self, line: InvoiceLine):
self.invoice_lines.append(line)
def validate(self):
errors_customer = [('customer.%s' % (field), err) for field, err in self.invoice_customer.validate()]
errors_supplier = [('supplier.%s' % (field), err) for field, err in self.invoice_customer.validate()]
return errors_customer + errors_supplier
def _calculate_legal_monetary_total(self):
for invline in self.invoice_lines:
self.invoice_legal_monetary_total.line_extension_amount += invline.total_amount
self.invoice_legal_monetary_total.tax_exclusive_amount += invline.total_amount
self.invoice_legal_monetary_total.charge_total_amount += invline.total_amount
self.invoice_legal_monetary_total.payable_amount = self.invoice_legal_monetary_total.tax_exclusive_amount \
+ self.invoice_legal_monetary_total.line_extension_amount \
+ self.invoice_legal_monetary_total.tax_inclusive_amount
def calculate(self):
self._calculate_legal_monetary_total()
for invline in self.invoice_lines:
invline.calculate()
class DIANInvoiceXML(fe.FeXML):
def __init__(self, invoice, TipoAmbiente = 'Pruebas'):
super().__init__('Invoice', 'http://www.dian.gov.co/contratos/facturaelectronica/v1')
self.attach_invoice(invoice, TipoAmbiente)
def attach_invoice(self, invoice, TipoAmbiente):
"""adiciona etiquetas a FEXML y retorna FEXML
en caso de fallar validacion retorna None"""
fexml = self
invoice.try_validate()
invoice.calculate()
cufe = self._generate_cufe(invoice, TipoAmbiente)
fexml.set_element('/fe:Invoice/cbc:ID', invoice.invoice_ident)
fexml.set_element('/fe:Invoice/cbc:UUID[schemaName="CUFE-SHA384"]', cufe)
fexml.set_element('/fe:Invoice/cbc:IssueDate', invoice.invoice_issue.strftime('%Y-%m-%d'))
fexml.set_element('/fe:Invoice/cbc:IssueTime', invoice.invoice_issue.strftime('%H:%M:%S'))
fexml.set_element('/fe:Invoice/cac:InvoicePeriod/cbc:StartDate', invoice.invoice_period_start.strftime('%Y-%m-%d'))
fexml.set_element('/fe:Invoice/cac:InvoicePeriod/cbc:EndDate', invoice.invoice_period_end.strftime('%Y-%m-%d'))
fexml.set_element('/fe:Invoice/cbc:LineCountNumeric', len(invoice.invoice_lines))
fexml.set_element('/fe:Invoice/fe:AccountingSupplierParty/fe:Party/cac:PartyIdentification/cbc:ID',
invoice.invoice_supplier.ident)
fexml.set_element('/fe:Invoice/fe:AccountingSupplierParty/fe:Party/fe:PartyTaxScheme/cbc:TaxLevelCode',
invoice.invoice_supplier.responsability_code)
fexml.set_element('/fe:Invoice/fe:AccountingSupplierParty/cbc:AdditionalAccountID',
invoice.invoice_supplier.organization_code)
fexml.set_element('/fe:Invoice/fe:AccountingSupplierParty/fe:Party/cac:PartyName/cbc:Name',
invoice.invoice_supplier.name)
fexml.set_element('/fe:Invoice/fe:AccountingSupplierParty/fe:Party/fe:PartyLegalEntity/cbc:RegistrationName',
invoice.invoice_supplier.legal_name)
fexml.set_element('/fe:Invoice/fe:AccountingSupplierParty/fe:Party/fe:PhysicalLocation/fe:Address/cac:AddressLine/cbc:Line',
invoice.invoice_supplier.address)
fexml.set_element('/fe:Invoice/fe:AccountingCustomerParty/fe:Party/cac:PartyIdentification/cbc:ID',
invoice.invoice_customer.ident)
fexml.set_element('/fe:Invoice/fe:AccountingCustomerParty/fe:Party/fe:PartyTaxScheme/cbc:TaxLevelCode',
invoice.invoice_customer.responsability_code)
fexml.set_element('/fe:Invoice/fe:AccountingCustomerParty/cbc:AdditionalAccountID',
invoice.invoice_customer.organization_code)
fexml.set_element('/fe:Invoice/fe:AccountingCustomerParty/fe:Party/cac:PartyName/cbc:Name',
invoice.invoice_customer.name)
fexml.set_element('/fe:Invoice/fe:AccountingCustomerParty/fe:Party/fe:PartyLegalEntity/cbc:RegistrationName',
invoice.invoice_customer.legal_name)
fexml.set_element('/fe:Invoice/fe:AccountingCustomerParty/fe:Party/fe:PhysicalLocation/fe:Address/cac:AddressLine/cbc:Line',
invoice.invoice_customer.address)
fexml.set_element('/fe:Invoice/fe:LegalMonetaryTotal/cbc:LineExtensionAmount',
invoice.invoice_legal_monetary_total.line_extension_amount,
currencyID='COP')
fexml.set_element('/fe:Invoice/fe:LegalMonetaryTotal/cbc:TaxExclusiveAmount',
invoice.invoice_legal_monetary_total.tax_exclusive_amount,
currencyID='COP')
fexml.set_element('/fe:Invoice/fe:LegalMonetaryTotal/cbc:TaxInclusiveAmount',
invoice.invoice_legal_monetary_total.tax_inclusive_amount,
currencyID='COP')
fexml.set_element('/fe:Invoice/fe:LegalMonetaryTotal/cbc:ChargeTotalAmount',
invoice.invoice_legal_monetary_total.charge_total_amount,
currencyID='COP')
fexml.set_element('/fe:Invoice/fe:LegalMonetaryTotal/cbc:PayableAmount',
invoice.invoice_legal_monetary_total.payable_amount,
currencyID='COP')
for index, invoice_line in enumerate(invoice.invoice_lines):
line = fexml.fragment('/fe:Invoice/fe:InvoiceLine', append=True)
line.set_element('/fe:InvoiceLine/cbc:ID', index)
line.set_element('/fe:InvoiceLine/cbc:InvoicedQuantity', invoice_line.quantity, unitCode = 'NAR')
line.set_element('/fe:InvoiceLine/cbc:LineExtensionAmount', invoice_line.total_amount, currencyID="COP")
line.set_element('/fe:InvoiceLine/fe:Price/cbc:PriceAmount', invoice_line.price_amount, currencyID="COP")
line.set_element('/fe:InvoiceLine/fe:Item/cbc:Description', invoice_line.description)
return fexml
def _generate_cufe(self, invoice, TipoAmbiente = 'Pruebas'):
NumFac = invoice.invoice_ident
FecFac = invoice.invoice_issue.strftime('%Y-%m-%d')
HoraFac = invoice.invoice_issue.strftime('%H:%H:%S')
ValorBruto = invoice.invoice_legal_monetary_total.line_extension_amount
ValorTotalPagar = invoice.invoice_legal_monetary_total.payable_amount
ValorImpuestoPara = {}
ValorImpuesto1 = 0.0
CodImpuesto1 = 1
ValorImpuesto2 = 0.0
CodImpuesto2 = 4
ValorImpuesto3 = 0.0
CodImpuesto3 = 3
for invoice_line in invoice.invoice_lines:
for subtotal in invoice_line.tax.subtotals:
# TODO cual es la naturaleza de tax_scheme_ident?
codigo_impuesto = int(subtotal.tax_scheme_ident)
ValorImpuestoPara.setdefault(codigo_impuesto, 0.0)
ValorImpuestoPara[codigo_impuesto] += subtotal.tax_amount
NitOFE = invoice.invoice_supplier.ident
NumAdq = invoice.invoice_customer.ident
TipoAmb = int(dian.TipoAmbiente[TipoAmbiente]['code'])
formatVars = {
'%s': NumFac,
'%s': FecFac,
'%.02f': HoraFac,
'%.02f': ValorBruto,
'%.02f': ValorTotalPagar,
'%.02f': ValorImpuestoPara.get(CodImpuesto1, 0.0),
'%02d': CodImpuesto1,
'%.02f': ValorImpuestoPara.get(CodImpuesto2, 0.0),
'%02d': CodImpuesto2,
'%.02f': ValorImpuestoPara.get(CodImpuesto3, 0.0),
'%02d': CodImpuesto3,
'%s': NitOFE,
'%s': NumAdq,
'%d': TipoAmb,
}
cufe = "".join(formatVars.keys()) % tuple(formatVars.values())
# crear hash...
h = hashlib.sha384()
h.update(cufe.encode('utf-8'))
return h.hexdigest()

12
requirements_dev.txt Normal file
View File

@ -0,0 +1,12 @@
pip==18.1
bumpversion==0.5.3
wheel==0.32.1
watchdog==0.9.0
flake8==3.5.0
tox==3.5.2
coverage==4.5.1
Sphinx==1.8.1
twine==1.12.1
pytest==3.8.2
pytest-runner==4.2

26
setup.cfg Normal file
View File

@ -0,0 +1,26 @@
[bumpversion]
current_version = 0.1.0
commit = True
tag = True
[bumpversion:file:setup.py]
search = version='{current_version}'
replace = version='{new_version}'
[bumpversion:file:facho/__init__.py]
search = __version__ = '{current_version}'
replace = __version__ = '{new_version}'
[bdist_wheel]
universal = 1
[flake8]
exclude = docs
[aliases]
# Define setup.py command aliases here
test = pytest
[tool:pytest]
collect_ignore = ['setup.py']

57
setup.py Normal file
View File

@ -0,0 +1,57 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of facho. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
"""The setup script."""
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = ['Click>=6.0', 'zeep>=3.4.0', 'pyOpenSSL>=19.1.0', 'xmlsig>=0.1.3', 'xades>=0.2.1']
setup_requirements = ['pytest-runner', ]
test_requirements = ['pytest', ]
setup(
author="Jovany Leandro G.C",
author_email='bit4bit@riseup.net',
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Natural Language :: English',
"Programming Language :: Python :: 2",
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
description="Facturacion Electronica Colombia",
entry_points={
'console_scripts': [
'facho=facho.cli:main',
],
},
install_requires=requirements,
license="GNU General Public License v3",
long_description=readme + '\n\n' + history,
include_package_data=True,
keywords='facho',
name='facho',
packages=find_packages(exclude=("tests",)),
setup_requires=setup_requirements,
test_suite='tests',
tests_require=test_requirements,
url='https://github.com/bit4bit/facho',
version='0.1.0',
zip_safe=False,
)

Binary file not shown.

100
tests/example.key Normal file
View File

@ -0,0 +1,100 @@
-----BEGIN PRIVATE KEY-----
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
WNQaUlbaQE98jDqbQMPshtUjBLKOPjI=
-----END PRIVATE KEY-----

BIN
tests/example.p12 Normal file

Binary file not shown.

51
tests/example.pem Normal file
View File

@ -0,0 +1,51 @@
-----BEGIN CERTIFICATE-----
MIII/zCCBOegAwIBAgIUbtlmzQEoerIxde1IY+v9+F5R0q8wDQYJKoZIhvcNAQEL
BQAwDzENMAsGA1UEAwwEdGVzdDAeFw0yMDA0MTkxNzM1MDZaFw0yMDA0MjAxNzM1
MDZaMA8xDTALBgNVBAMMBHRlc3QwggQiMA0GCSqGSIb3DQEBAQUAA4IEDwAwggQK
AoIEAQDUC1qvQDokLiwUweP4wyp5pV7519jFxkaqXMxJq/+3THKDGRY/DRP7FrmJ
699sXxAdtK7ARihsmwZ43JXEeDDvLe6iV30YgogCqNcsqMNI/DP5xxJl+jmjfRpC
IOtBxfQEUdoZAOnmTgPcwdRIMqNVNEODlScLC+EKNmtz1zButXyE752T8y1oltZX
H2MysRNkS1c+roiYr8/wbD3zzUHi+AXyxvuPIGKvYq/Llnp/tctaGfugsdq8DRa1
6ExqtU2vmFXQuWcMQ56ImeTf84Qz2uqQjcP8YD6polQ0QQSrGFzfmilLBDkfRKS6
kKsNrX+0BufLO4C3lHUX76KmGzWTFSGlinFjAVnFHVIPPTDpPiTKYnRToDHuWv8J
A2XbMJMgZiXbG//0sGgpYmxuZsevBM9NNnKLd4zmqiY/tU1kdJrQY+jllDTbXANT
1dTe/wpjQ2pFNbhLjcoBk2KDtCxFyLzYYpCP+oVzqpTdjY38tam67qPKEePP6lQ4
yIfRExy35IEOGjuT8EcGDR7RblsIb3VXbFBt+PlKGtfAVcu5luS+XJLoL8ke49GF
BsthBY5y0P7hIh/xIhf473ZHb0eHXV8lHzLpEbQc3aKH9bLnhx5LL2RD8eyXxvzH
9Vy0oVpUy5LpYkNdyHu5aPjJG+IySnAKocz/Ch1AFv5sKzL3j6WhcY7igvMdOTYY
EsnmkN7kT3lSQSEjuM9gbgTpNVx4BqSvpP/6pm3scE1qulLL/qsHrLOTVzbjYIaf
M0j+stihqjsGseT+bxZPaZG/GZabdPRB6KpJDMQfkh3+OMrZa+m1EJt1OR3LHo31
kriLJcQw6qhwODSTFuXf/+bU96FOC1KT/IXFzxK44ed9wmKqpbCRzRnCvuZvZ7gW
2di9ND6ETzwciSFKyHXGi0UTGPPFjWw04R8bc7JFgtn3j7Dt84tN4utrTndh6Z91
HyXfxi0Xa2TGKssPH5WJZrfBlJYAursrcwBl1sRhTezAtN6wRJZ2t1orC4ZfdFXH
Prdl2HrIyp1piZfO3TP2xMgKcc7F9tcwzrLIK4jRVjLNiA1CvNTN99vLrAimTNUs
9nIOYey98rlMnFLc0TsD4ePdbClNiGBv8GtwlRXAoSIgxHUOo/VMfIAPrrqrerMo
mRcAJBI7T2z+E3Z7+tojvYs14Y+m62IU9M92rkGDPybeCvHjOETSMBvXilgBNQTY
UviIGJZ52CUyy8l4kcBaZ77jhSXkgJFE1CRCzDvhglvtFFQvU70XzU/LcReZfpMx
3X5m+3mLkGUXXg56889cdbxNPcgpOQiYRj6XgwZxuiH5UkXgPCDrNT1MZrI6BoHH
VUf5FyoWHpg2PLAOHCJY2Yhw5u1bAgMBAAGjUzBRMB0GA1UdDgQWBBQOZFs2xrOA
PGeF6I7IEUuY27xahzAfBgNVHSMEGDAWgBQOZFs2xrOAPGeF6I7IEUuY27xahzAP
BgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IEAQCziMnPdcLrP63omR+X
XwWBjDKamvBpU1cE1FR8nb/3jl9+7A8IJ3I2IXvQAO9ZDkZfXc+btHIMwnOKoTwS
nT1HKqEhN1JH6DMnRrLYHZk8xetQFvhEpAedJ9d4RESoqHvsiAF6SS+66chLs9SE
zOy5Y6QeBwY+LQPioctzV2BCT3v6Vbbjb1zr6bFipPqQfzDl2i7lASPojWrutzzf
DmNBQLgtQ4kvKO7GlLi/agTmozc8zcYbvn0CtEQKDiYFpe4DQLlMol2Z1YwC1GLk
TWgvvqj4tFYm5N8du3Hj3+Dp/2QDI3+HOOk+6x9jOvuTizVqAbx506c4GL1hFj/z
kN+5RGHHNty50akKqPTu5Tb1VDCcIjWrv6CeYAN4Qacqpazlk8k9OLPFywnEgFse
RaojGcL03z5kMP/v5cYRxwq+ZE2H0mJ+PtOM+WtjdaOK9t0Re8iSxRkVd+/m8fQw
t53VPaYkLKP/KQXfFzseX/VjfihutCLm6yZ89eiTaIyXEckqeruNousEB4ePezZD
w8aLEX2PF3mtHqjU7Fger0VUpnWwZ+Mp+Z97YKRzEFcAISmyZUZVwZmWDwNSt6xw
vSosQPiv3oVKRI2LIIpt0jq+R4dONW5heH0ehGcRjObz6q+Xb0olDAmo6m8GObCM
4I5HCeFhTeEmwPn9ybD2L1N5FPEX8jKZJC/fWdqi8baYKscinpoeR8P/5AAnP3iw
eoBld0feFCj8EEO/wfQcm8E0itSuTvWxKzKwNd7AfZM7PcF0uQn0X3rhwPoAqzMk
rAuhjoflm2NI/GhZJzotB5nuJov0sGIKPqtFMa6Wo/HUYz1wJD5smOw7tBCFEP5M
wALk4S8Af9naSrU0kRSGci43ZfCmXD+9NA9fQ5Jv2COlDxZPcGzNAro4zV0WDLo+
FTyjUNwb2D4KnLSyjjjJsY8TozSHjTGdaDUUyE7qzKGms1kt/QPOThz3udWM/Sir
BEX/UFawNlxPzs7RRuU3BQcpG2nYnBQmKWmAG3LvUWvAoKYXe5Puv9bT7nBYNHVi
4lDwLFKuR09pHUt6k3lgQcrP0KyZZD6EzYQuFKqU7BYdxJwreXDUOHzlZpHNjoIw
pf4VrhiUy4I7brj9PweoGVSu3e0JkePqe1K3kPmLXY4sffPqoSZKYrcGeRvEOzhB
FqW2ZUfuDTAcYhHIPnxMgQxCsqIrYjov2yhaCJ9kGsiM8gPCCLxzQU3Itr2UHC/h
LJ3KKHaqLBxkl4HtKIHD8tDL5NSg8nNA1PgzIrdoNCBUVVkGcKlr1U7lRv2DlvOq
MdpIG4fJoRCC3U3Ai5YSZcgLSPB6RfXMMCdNmZHqARAGiA8qi8OeZKrhpqNzTW2o
CK3K
-----END CERTIFICATE-----

44
tests/test_client_dian.py Normal file
View File

@ -0,0 +1,44 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of facho. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from facho.fe.client import dian
from facho import facho
import pytest
from datetime import datetime
class FakeDianClient(dian.DianClient):
def __init__(self, username, password, resp):
super().__init__(username, password)
self.response = resp
def _open(self, service):
return None
def _close(self, conn):
pass
def _remote_service(self, conn, service):
def fake_remote(**kw):
return self.response
return fake_remote
def test_sopa_consultaresolucionesfacturacion():
expected_resp = {
'CodigoOperacion': 'OK',
'DescripcionOperacion': '',
'IdentificadorOperacion': '',
'RangoFacturacion': []
}
client_dian = FakeDianClient('user', 'pass', expected_resp)
resp = client_dian.request(dian.ConsultaResolucionesFacturacionPeticion(
'860046645', '800037646', '13a6a789-47ca-4728-adb8-372fca76e692'
))
assert resp.CodigoOperacion == 'OK'

16
tests/test_data.py Normal file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of facho. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
"""Tests for `facho` package."""
import pytest
import facho.fe.data.dian as dian
def test_dian():
assert dian.TipoResponsabilidad.short_name == 'TipoResponsabilidad'
assert dian.TipoResponsabilidad['Autorretenedor']['name'] == 'Autorretenedor'
assert dian.TipoOrganizacion.short_name == 'TipoOrganizacion'
assert dian.TipoOrganizacion['Persona Natural']['name'] == 'Persona Natural'

142
tests/test_facho.py Normal file
View File

@ -0,0 +1,142 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of facho. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
"""Tests for `facho` package."""
import pytest
#from click.testing import CliRunner
from facho import facho
#from facho import cli
def test_facho_xml():
xml = facho.FachoXML('root')
invoice = xml.find_or_create_element('/root/Invoice')
assert xml.tostring() == '<root><Invoice/></root>'
invoice.text = 'Test'
assert xml.tostring() == '<root><Invoice>Test</Invoice></root>'
invoice_line = xml.find_or_create_element('/root/Invoice/Line')
assert xml.tostring() == '<root><Invoice>Test<Line/></Invoice></root>'
def test_facho_xml_with_attr():
xml = facho.FachoXML('root')
invoice = xml.find_or_create_element('/root/Invoice[id=123]')
assert xml.tostring() == '<root><Invoice id="123"/></root>'
def test_facho_xml_idempotent():
xml = facho.FachoXML('root')
invoice = xml.find_or_create_element('/root/Invoice')
assert xml.tostring() == '<root><Invoice/></root>'
xml.find_or_create_element('/root/Invoice')
assert xml.tostring() == '<root><Invoice/></root>'
xml.find_or_create_element('/root/Invoice')
assert xml.tostring() == '<root><Invoice/></root>'
xml.find_or_create_element('/root/Invoice/Line')
assert xml.tostring() == '<root><Invoice><Line/></Invoice></root>'
xml.find_or_create_element('/root/Invoice/Line')
assert xml.tostring() == '<root><Invoice><Line/></Invoice></root>'
def test_facho_xml_aliases():
xml = facho.FachoXML('root')
xml.register_alias_xpath('Invoice', '/root/Invoice')
invoice = xml.find_or_create_element('Invoice')
assert xml.tostring() == '<root><Invoice/></root>'
invoice.text = 'Test'
assert xml.tostring() == '<root><Invoice>Test</Invoice></root>'
def test_facho_xmlns():
xml = facho.FachoXML('root', nsmap={
'ext': 'https://ext',
'sts': 'https://sts',
})
invoiceAuthorization = xml.find_or_create_element('/root/ext:UBLExtensions/ext:UBLExtension/'
'ext:ExtensionContent/sts:DianExtensions/'
'sts:InvoiceControl/sts:InvoiceAuthorization')
assert xml.tostring().strip() == '<root xmlns:ext="https://ext" xmlns:sts="https://sts"><ext:UBLExtensions>'\
'<ext:UBLExtension>'\
'<ext:ExtensionContent>'\
'<sts:DianExtensions>'\
'<sts:InvoiceControl>'\
'<sts:InvoiceAuthorization/>'\
'</sts:InvoiceControl></sts:DianExtensions></ext:ExtensionContent></ext:UBLExtension></ext:UBLExtensions></root>'
invoiceAuthorization.text = '123456789'
assert xml.tostring().strip() == '<root xmlns:ext="https://ext" xmlns:sts="https://sts"><ext:UBLExtensions>'\
'<ext:UBLExtension>'\
'<ext:ExtensionContent>'\
'<sts:DianExtensions>'\
'<sts:InvoiceControl>'\
'<sts:InvoiceAuthorization>123456789</sts:InvoiceAuthorization>'\
'</sts:InvoiceControl></sts:DianExtensions></ext:ExtensionContent></ext:UBLExtension></ext:UBLExtensions></root>'
def test_facho_xmlns_idempotent():
xml = facho.FachoXML('root', nsmap={
'ext': 'https://ext',
'sts': 'https://sts',
})
xml.find_or_create_element('/root/ext:Extension/sts:Sotoros')
assert xml.tostring() == '<root xmlns:ext="https://ext" xmlns:sts="https://sts"><ext:Extension><sts:Sotoros/></ext:Extension></root>'
xml.find_or_create_element('/root/ext:Extension/sts:Sotoros')
assert xml.tostring() == '<root xmlns:ext="https://ext" xmlns:sts="https://sts"><ext:Extension><sts:Sotoros/></ext:Extension></root>'
def test_facho_xml_set_element_with_format():
xml = facho.FachoXML('root')
invoice = xml.set_element('/root/Invoice', 1, format_='%02d')
assert xml.tostring() == '<root><Invoice>01</Invoice></root>'
def test_facho_xml_fragment():
xml = facho.FachoXML('root')
invoice = xml.fragment('/root/Invoice')
invoice.set_element('/Invoice/Id', 1)
assert xml.tostring() == '<root><Invoice><Id>1</Id></Invoice></root>'
def test_facho_xml_fragments():
xml = facho.FachoXML('Invoice')
line = xml.fragment('/Invoice/Line')
line.set_element('/Line/Id', 1)
line = xml.fragment('/Invoice/Line', append=True)
line.set_element('/Line/Id', 2)
line = xml.fragment('/Invoice/Line', append=True)
line.set_element('/Line/Id', 3)
assert xml.tostring() == '<Invoice><Line><Id>1</Id></Line><Line><Id>2</Id></Line><Line><Id>3</Id></Line></Invoice>'
def test_facho_xml_nested_fragments():
xml = facho.FachoXML('Invoice')
party = xml.fragment('/Invoice/Party')
party.set_element('/Party/Name', 'test')
address = party.fragment('/Party/Address')
address.set_element('/Address/Line', 'line 1')
party.set_element('/Party/LastName', 'test')
assert xml.tostring() == '<Invoice><Party><Name>test</Name><Address><Line>line 1</Line></Address><LastName>test</LastName></Party></Invoice>'
def test_facho_xml_get_element_text():
xml = facho.FachoXML('Invoice')
xml.set_element('/Invoice/ID', 'ABC123')
assert xml.get_element_text('/Invoice/ID') == 'ABC123'
line = xml.fragment('/Invoice/Line')
line.set_element('/Line/Quantity', 5)
assert line.get_element_text('/Line/Quantity', format_=int) == 5

37
tests/test_fe.py Normal file
View File

@ -0,0 +1,37 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of facho. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import pytest
from facho import fe
def test_xmlsigned_build():
#openssl req -x509 -sha256 -nodes -subj "/CN=test" -days 1 -newkey rsa:2048 -keyout example.key -out example.pem
#openssl pkcs12 -export -out example.p12 -inkey example.key -in example.pem
signer = fe.DianXMLExtensionSigner('./tests/example.p12')
xml = fe.FeXML('Invoice',
'http://www.dian.gov.co/contratos/facturaelectronica/v1')
xml.add_extension(signer)
xml.attach_extensions()
elem = xml.find_or_create_element('/fe:Invoice/ext:UBLExtensions/ext:UBLExtension/ext:ExtensionContent/ds:Signature')
assert elem is not None
#assert elem.findall('ds:SignedInfo', fe.NAMESPACES) is not None
def test_xmlsigned_with_passphrase_build():
#openssl req -x509 -sha256 -nodes -subj "/CN=test" -days 1 -newkey rsa:2048 -keyout example.key -out example.pem
#openssl pkcs12 -export -out example.p12 -inkey example.key -in example.pem
signer = fe.DianXMLExtensionSigner('./tests/example-with-passphrase.p12', 'test')
xml = fe.FeXML('Invoice',
'http://www.dian.gov.co/contratos/facturaelectronica/v1')
xml.add_extension(signer)
xml.attach_extensions()
elem = xml.find_or_create_element('/fe:Invoice/ext:UBLExtensions/ext:UBLExtension/ext:ExtensionContent/ds:Signature')
assert elem is not None
#assert elem.findall('ds:SignedInfo', fe.NAMESPACES) is not None

86
tests/test_fe_form.py Normal file
View File

@ -0,0 +1,86 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of facho. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
"""Tests for `facho` package."""
import pytest
from datetime import datetime
import facho.fe.form as form
from facho import fe
@pytest.fixture
def simple_invoice():
inv = form.Invoice()
inv.set_period(datetime.now(), datetime.now())
inv.set_issue(datetime.now())
inv.set_ident('ABC123')
inv.set_supplier(form.Party(
name = 'facho-supplier',
ident = 123,
responsability_code = 'No aplica',
organization_code = 'Persona Natural'
))
inv.set_customer(form.Party(
name = 'facho-customer',
ident = 321,
responsability_code = 'No aplica',
organization_code = 'Persona Natural'
))
inv.add_invoice_line(form.InvoiceLine(
quantity = 1,
description = 'producto facho',
item_ident = 9999,
price_amount = 100.0,
tax = form.TaxTotal(
tax_amount = 0.0,
taxable_amount = 0.0,
subtotals = [
form.TaxSubTotal(
percent = 19.0,
)
]
)
))
return inv
def test_invoicesimple_build(simple_invoice):
assert simple_invoice.validate() == []
xml = form.DIANInvoiceXML(simple_invoice)
supplier_name = xml.get_element_text('/fe:Invoice/fe:AccountingSupplierParty/fe:Party/cac:PartyName/cbc:Name')
assert supplier_name == simple_invoice.invoice_supplier.name
supplier_identification_number = xml.get_element_text('/fe:Invoice/fe:AccountingSupplierParty/fe:Party/cac:PartyIdentification/cbc:ID')
assert int(supplier_identification_number) == simple_invoice.invoice_supplier.ident
customer_name = xml.get_element_text('/fe:Invoice/fe:AccountingCustomerParty/fe:Party/cac:PartyName/cbc:Name')
assert customer_name == simple_invoice.invoice_customer.name
customer_identification_number = xml.get_element_text('/fe:Invoice/fe:AccountingCustomerParty/fe:Party/cac:PartyIdentification/cbc:ID')
assert int(customer_identification_number) == simple_invoice.invoice_customer.ident
def test_invoicesimple_build_with_cufe(simple_invoice):
assert simple_invoice.validate() == []
xml = form.DIANInvoiceXML(simple_invoice)
cufe = xml.get_element_text('/fe:Invoice/cbc:UUID')
assert cufe != ''
def test_invoicesimple_xml_signed(simple_invoice):
assert simple_invoice.validate() == []
xml = form.DIANInvoiceXML(simple_invoice)
signer = fe.DianXMLExtensionSigner('./tests/example.p12')
xml.add_extension(signer)
xml.attach_extensions()
elem = xml.find_or_create_element('/fe:Invoice/ext:UBLExtensions/ext:UBLExtension/ext:ExtensionContent/ds:Signature')
assert elem.text is not None

28
tox.ini Normal file
View File

@ -0,0 +1,28 @@
[tox]
envlist = py27, py34, py35, py36, flake8
[travis]
python =
3.6: py36
3.5: py35
3.4: py34
2.7: py27
[testenv:flake8]
basepython = python
deps = flake8
commands = flake8 facho
[testenv]
setenv =
PYTHONPATH = {toxinidir}
deps =
-r{toxinidir}/requirements_dev.txt
; If you want to make tox run the tests with the same versions, create a
; requirements.txt with the pinned versions and uncomment the following line:
; -r{toxinidir}/requirements.txt
commands =
pip install -U pip
py.test --basetemp={envtmpdir}