diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 00000000..0877deab
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,19 @@
+version: 2
+updates:
+
+ # Maintain dependencies for GitHub Actions
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "daily"
+ commit-message:
+ prefix: "GitHub Actions"
+ include: "scope"
+ # Maintain dependencies for pom.xml
+ - package-ecosystem: "maven"
+ directory: "/"
+ schedule:
+ interval: "daily"
+ commit-message:
+ prefix: "Maven pom.xml"
+ include: "scope"
diff --git a/.github/workflows/ci-actions.yml b/.github/workflows/ci-actions.yml
index 59e62ab1..2768beee 100644
--- a/.github/workflows/ci-actions.yml
+++ b/.github/workflows/ci-actions.yml
@@ -2,69 +2,29 @@ name: CI
on:
push:
+ branches-ignore:
+ - "dependabot/**"
paths-ignore:
- 'README.md'
pull_request:
- types: [assigned, opened, synchronize, reopened, ready_for_review, edited]
paths-ignore:
- 'README.md'
- schedule:
- - cron: '0 0 * * *'
-jobs:
+env:
+ CI: true
+jobs:
linux-jvm-tests:
name: JDK ${{matrix.java-version}} JVM Tests
- timeout-minutes: 120
strategy:
matrix:
- java-version: [8, 11, 15]
-
+ java-version: [ 11, 17 ]
runs-on: ubuntu-latest
-
steps:
- uses: actions/checkout@v2
- - uses: actions/setup-java@v1
+ - uses: actions/setup-java@v2
with:
+ distribution: "temurin"
java-version: ${{ matrix.java-version }}
- name: Build with Maven
- run: mvn install
- - name: Prepare failure archive (if maven failed)
- if: failure()
- shell: bash
- run: find . -name '*-reports' -type d | tar -czvf test-reports.tgz -T -
- - name: Upload failure Archive (if maven failed)
- uses: actions/upload-artifact@v1
- if: failure()
- with:
- name: test-reports-linux-jvm${{matrix.java-version}}
- path: 'test-reports.tgz'
-
- code-scan:
- name: Code Scan
- if: ${{ github.event_name != 'pull_request' && github.repository_owner == 'project-openubl' }}
- timeout-minutes: 120
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-java@v1
- with:
- java-version: 11
- - name: Build with Maven and Coverage/Sonar
- run: mvn verify -P coverage,sonar
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- - name: Codecov metrics
- uses: codecov/codecov-action@v1
- - name: Prepare failure archive (if maven failed)
- if: failure()
- shell: bash
- run: find . -name '*-reports' -type d | tar -czvf test-reports.tgz -T -
- - name: Upload failure Archive (if maven failed)
- uses: actions/upload-artifact@v1
- if: failure()
- with:
- name: test-reports-linux-jvm-codescan
- path: 'test-reports.tgz'
+ run: mvn verify
diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml
new file mode 100644
index 00000000..86748165
--- /dev/null
+++ b/.github/workflows/cron.yml
@@ -0,0 +1,20 @@
+name: CI
+
+on:
+ schedule:
+ - cron: '0 0 * * *'
+env:
+ CI: true
+
+jobs:
+ linux-jvm-tests:
+ name: JDK ${{matrix.java-version}} JVM Tests
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-java@v2
+ with:
+ distribution: "temurin"
+ java-version: ${{ matrix.java-version }}
+ - name: Build with Maven
+ run: mvn verify
diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml
new file mode 100644
index 00000000..23bebb0c
--- /dev/null
+++ b/.github/workflows/push.yml
@@ -0,0 +1,28 @@
+name: Master branch
+
+on:
+ push:
+ branches:
+ - master
+
+env:
+ CI: true
+
+jobs:
+ code-scan:
+ name: Code Scan
+ if: ${{ github.event_name != 'pull_request' && github.repository_owner == 'project-openubl' }}
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-java@v2
+ with:
+ distribution: "temurin"
+ java-version: 8
+ - name: Build with Maven and Coverage/Sonar
+ run: mvn verify -P coverage,sonar
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+ - name: Codecov metrics
+ uses: codecov/codecov-action@v1
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
deleted file mode 100644
index 85b17378..00000000
--- a/.github/workflows/stale.yml
+++ /dev/null
@@ -1,19 +0,0 @@
-name: Mark stale issues and pull requests
-
-on:
- schedule:
- - cron: "0 0 * * *"
-
-jobs:
- stale:
-
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/stale@v1
- with:
- repo-token: ${{ secrets.GITHUB_TOKEN }}
- stale-issue-message: 'This issue has been there for very long time and nobody changed it.'
- stale-pr-message: 'This pull request has been there for very long time and nobody changed it'
- stale-issue-label: 'no-issue-activity'
- stale-pr-label: 'no-pr-activity'
diff --git a/LICENSE b/LICENSE
index e48e0963..f49a4e16 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,277 +1,201 @@
-Eclipse Public License - v 2.0
-
- THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
- PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
- OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
-
-1. DEFINITIONS
-
-"Contribution" means:
-
- a) in the case of the initial Contributor, the initial content
- Distributed under this Agreement, and
-
- b) in the case of each subsequent Contributor:
- i) changes to the Program, and
- ii) additions to the Program;
- where such changes and/or additions to the Program originate from
- and are Distributed by that particular Contributor. A Contribution
- "originates" from a Contributor if it was added to the Program by
- such Contributor itself or anyone acting on such Contributor's behalf.
- Contributions do not include changes or additions to the Program that
- are not Modified Works.
-
-"Contributor" means any person or entity that Distributes the Program.
-
-"Licensed Patents" mean patent claims licensable by a Contributor which
-are necessarily infringed by the use or sale of its Contribution alone
-or when combined with the Program.
-
-"Program" means the Contributions Distributed in accordance with this
-Agreement.
-
-"Recipient" means anyone who receives the Program under this Agreement
-or any Secondary License (as applicable), including Contributors.
-
-"Derivative Works" shall mean any work, whether in Source Code or other
-form, that is based on (or derived from) the Program and for which the
-editorial revisions, annotations, elaborations, or other modifications
-represent, as a whole, an original work of authorship.
-
-"Modified Works" shall mean any work in Source Code or other form that
-results from an addition to, deletion from, or modification of the
-contents of the Program, including, for purposes of clarity any new file
-in Source Code form that contains any contents of the Program. Modified
-Works shall not include works that contain only declarations,
-interfaces, types, classes, structures, or files of the Program solely
-in each case in order to link to, bind by name, or subclass the Program
-or Modified Works thereof.
-
-"Distribute" means the acts of a) distributing or b) making available
-in any manner that enables the transfer of a copy.
-
-"Source Code" means the form of a Program preferred for making
-modifications, including but not limited to software source code,
-documentation source, and configuration files.
-
-"Secondary License" means either the GNU General Public License,
-Version 2.0, or any later versions of that license, including any
-exceptions or additional permissions as identified by the initial
-Contributor.
-
-2. GRANT OF RIGHTS
-
- a) Subject to the terms of this Agreement, each Contributor hereby
- grants Recipient a non-exclusive, worldwide, royalty-free copyright
- license to reproduce, prepare Derivative Works of, publicly display,
- publicly perform, Distribute and sublicense the Contribution of such
- Contributor, if any, and such Derivative Works.
-
- b) Subject to the terms of this Agreement, each Contributor hereby
- grants Recipient a non-exclusive, worldwide, royalty-free patent
- license under Licensed Patents to make, use, sell, offer to sell,
- import and otherwise transfer the Contribution of such Contributor,
- if any, in Source Code or other form. This patent license shall
- apply to the combination of the Contribution and the Program if, at
- the time the Contribution is added by the Contributor, such addition
- of the Contribution causes such combination to be covered by the
- Licensed Patents. The patent license shall not apply to any other
- combinations which include the Contribution. No hardware per se is
- licensed hereunder.
-
- c) Recipient understands that although each Contributor grants the
- licenses to its Contributions set forth herein, no assurances are
- provided by any Contributor that the Program does not infringe the
- patent or other intellectual property rights of any other entity.
- Each Contributor disclaims any liability to Recipient for claims
- brought by any other entity based on infringement of intellectual
- property rights or otherwise. As a condition to exercising the
- rights and licenses granted hereunder, each Recipient hereby
- assumes sole responsibility to secure any other intellectual
- property rights needed, if any. For example, if a third party
- patent license is required to allow Recipient to Distribute the
- Program, it is Recipient's responsibility to acquire that license
- before distributing the Program.
-
- d) Each Contributor represents that to its knowledge it has
- sufficient copyright rights in its Contribution, if any, to grant
- the copyright license set forth in this Agreement.
-
- e) Notwithstanding the terms of any Secondary License, no
- Contributor makes additional grants to any Recipient (other than
- those set forth in this Agreement) as a result of such Recipient's
- receipt of the Program under the terms of a Secondary License
- (if permitted under the terms of Section 3).
-
-3. REQUIREMENTS
-
-3.1 If a Contributor Distributes the Program in any form, then:
-
- a) the Program must also be made available as Source Code, in
- accordance with section 3.2, and the Contributor must accompany
- the Program with a statement that the Source Code for the Program
- is available under this Agreement, and informs Recipients how to
- obtain it in a reasonable manner on or through a medium customarily
- used for software exchange; and
-
- b) the Contributor may Distribute the Program under a license
- different than this Agreement, provided that such license:
- i) effectively disclaims on behalf of all other Contributors all
- warranties and conditions, express and implied, including
- warranties or conditions of title and non-infringement, and
- implied warranties or conditions of merchantability and fitness
- for a particular purpose;
-
- ii) effectively excludes on behalf of all other Contributors all
- liability for damages, including direct, indirect, special,
- incidental and consequential damages, such as lost profits;
-
- iii) does not attempt to limit or alter the recipients' rights
- in the Source Code under section 3.2; and
-
- iv) requires any subsequent distribution of the Program by any
- party to be under a license that satisfies the requirements
- of this section 3.
-
-3.2 When the Program is Distributed as Source Code:
-
- a) it must be made available under this Agreement, or if the
- Program (i) is combined with other material in a separate file or
- files made available under a Secondary License, and (ii) the initial
- Contributor attached to the Source Code the notice described in
- Exhibit A of this Agreement, then the Program may be made available
- under the terms of such Secondary Licenses, and
-
- b) a copy of this Agreement must be included with each copy of
- the Program.
-
-3.3 Contributors may not remove or alter any copyright, patent,
-trademark, attribution notices, disclaimers of warranty, or limitations
-of liability ("notices") contained within the Program from any copy of
-the Program which they Distribute, provided that Contributors may add
-their own appropriate notices.
-
-4. COMMERCIAL DISTRIBUTION
-
-Commercial distributors of software may accept certain responsibilities
-with respect to end users, business partners and the like. While this
-license is intended to facilitate the commercial use of the Program,
-the Contributor who includes the Program in a commercial product
-offering should do so in a manner which does not create potential
-liability for other Contributors. Therefore, if a Contributor includes
-the Program in a commercial product offering, such Contributor
-("Commercial Contributor") hereby agrees to defend and indemnify every
-other Contributor ("Indemnified Contributor") against any losses,
-damages and costs (collectively "Losses") arising from claims, lawsuits
-and other legal actions brought by a third party against the Indemnified
-Contributor to the extent caused by the acts or omissions of such
-Commercial Contributor in connection with its distribution of the Program
-in a commercial product offering. The obligations in this section do not
-apply to any claims or Losses relating to any actual or alleged
-intellectual property infringement. In order to qualify, an Indemnified
-Contributor must: a) promptly notify the Commercial Contributor in
-writing of such claim, and b) allow the Commercial Contributor to control,
-and cooperate with the Commercial Contributor in, the defense and any
-related settlement negotiations. The Indemnified Contributor may
-participate in any such claim at its own expense.
-
-For example, a Contributor might include the Program in a commercial
-product offering, Product X. That Contributor is then a Commercial
-Contributor. If that Commercial Contributor then makes performance
-claims, or offers warranties related to Product X, those performance
-claims and warranties are such Commercial Contributor's responsibility
-alone. Under this section, the Commercial Contributor would have to
-defend claims against the other Contributors related to those performance
-claims and warranties, and if a court requires any other Contributor to
-pay any damages as a result, the Commercial Contributor must pay
-those damages.
-
-5. NO WARRANTY
-
-EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
-PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS"
-BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
-IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF
-TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
-PURPOSE. Each Recipient is solely responsible for determining the
-appropriateness of using and distributing the Program and assumes all
-risks associated with its exercise of rights under this Agreement,
-including but not limited to the risks and costs of program errors,
-compliance with applicable laws, damage to or loss of data, programs
-or equipment, and unavailability or interruption of operations.
-
-6. DISCLAIMER OF LIABILITY
-
-EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
-PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS
-SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
-PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
-EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-7. GENERAL
-
-If any provision of this Agreement is invalid or unenforceable under
-applicable law, it shall not affect the validity or enforceability of
-the remainder of the terms of this Agreement, and without further
-action by the parties hereto, such provision shall be reformed to the
-minimum extent necessary to make such provision valid and enforceable.
-
-If Recipient institutes patent litigation against any entity
-(including a cross-claim or counterclaim in a lawsuit) alleging that the
-Program itself (excluding combinations of the Program with other software
-or hardware) infringes such Recipient's patent(s), then such Recipient's
-rights granted under Section 2(b) shall terminate as of the date such
-litigation is filed.
-
-All Recipient's rights under this Agreement shall terminate if it
-fails to comply with any of the material terms or conditions of this
-Agreement and does not cure such failure in a reasonable period of
-time after becoming aware of such noncompliance. If all Recipient's
-rights under this Agreement terminate, Recipient agrees to cease use
-and distribution of the Program as soon as reasonably practicable.
-However, Recipient's obligations under this Agreement and any licenses
-granted by Recipient relating to the Program shall continue and survive.
-
-Everyone is permitted to copy and distribute copies of this Agreement,
-but in order to avoid inconsistency the Agreement is copyrighted and
-may only be modified in the following manner. The Agreement Steward
-reserves the right to publish new versions (including revisions) of
-this Agreement from time to time. No one other than the Agreement
-Steward has the right to modify this Agreement. The Eclipse Foundation
-is the initial Agreement Steward. The Eclipse Foundation may assign the
-responsibility to serve as the Agreement Steward to a suitable separate
-entity. Each new version of the Agreement will be given a distinguishing
-version number. The Program (including Contributions) may always be
-Distributed subject to the version of the Agreement under which it was
-received. In addition, after a new version of the Agreement is published,
-Contributor may elect to Distribute the Program (including its
-Contributions) under the new version.
-
-Except as expressly stated in Sections 2(a) and 2(b) above, Recipient
-receives no rights or licenses to the intellectual property of any
-Contributor under this Agreement, whether expressly, by implication,
-estoppel or otherwise. All rights in the Program not expressly granted
-under this Agreement are reserved. Nothing in this Agreement is intended
-to be enforceable by any entity that is not a Contributor or Recipient.
-No third-party beneficiary rights are created under this Agreement.
-
-Exhibit A - Form of Secondary Licenses Notice
-
-"This Source Code may also be made available under the following
-Secondary Licenses when the conditions for such availability set forth
-in the Eclipse Public License, v. 2.0 are satisfied: {name license(s),
-version(s), and exceptions or additional permissions here}."
-
- Simply including a copy of this Agreement, including this Exhibit A
- is not sufficient to license the Source Code under Secondary Licenses.
-
- If it is not possible or desirable to put the notice in a particular
- file, then You may include the notice in a location (such as a LICENSE
- file in a relevant directory) where a recipient would be likely to
- look for such a notice.
-
- You may add additional accurate notices of copyright ownership.
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
\ No newline at end of file
diff --git a/README.md b/README.md
index 5df0972e..42399b42 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,3 @@
-[](https://project-openubl.github.io/)
-
[](https://search.maven.org/artifact/io.github.project-openubl/xbuilder/)
[](https://opensource.org/licenses/EPL-2.0)

@@ -27,3 +25,11 @@ XBuilder esta diseñado para que puedas crear XMLs fácilmente.
- [Documentación](https://project-openubl.github.io)
- [Discusiones](https://github.com/project-openubl/xsender/discussions)
+
+## Developers
+
+### Update snapshots
+
+```shell
+mvn clean test -Dxbuilder.snapshot.update
+```
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index fd21925b..e9f9a514 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,11 +4,11 @@
Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
and other contributors as indicated by the @author tags.
- Licensed under the Eclipse Public License - v 2.0 (the "License");
+ Licensed under the Apache License - 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
- https://www.eclipse.org/legal/epl-2.0/
+ https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@@ -23,22 +23,25 @@
io.github.project-openublxbuilder
- 1.3.0-SNAPSHOT
+ 2.0.0-SNAPSHOTXML Builder :: LibXML Builder Libraryjar
- 1.8
- 1.8
+ 11
+ 11UTF-8UTF-82.22.2
+ write${basedir}
+ 1.18.22
+ 2.7.5.Final2.6.4
@@ -84,19 +87,15 @@
- org.freemarker
- freemarker
- 2.3.28
+ org.projectlombok
+ lombok
+ ${lombok.version}
+ provided
- org.hibernate
- hibernate-validator
- 6.1.4.Final
-
-
- org.glassfish
- jakarta.el
- 3.0.3
+ io.quarkus.qute
+ qute-core
+ ${quarkus.version}
@@ -150,7 +149,7 @@
com.mycilalicense-maven-plugin
- 3.0
+ 4.1tools/copyright.txt
@@ -173,6 +172,33 @@
+
+
+ com.hubspot.maven.plugins
+ prettier-maven-plugin
+ 0.17
+
+ 1.6.1
+ 120
+ 4
+ false
+ true
+ true
+
+ src/main/java/**/*.java
+ src/test/java/**/*.java
+
+
+
+
+ validate
+
+ ${plugin.prettier.goal}
+
+
+
+
+
org.sonatype.plugins
@@ -185,6 +211,14 @@
true
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ ${maven.compiler.source}
+ ${maven.compiler.target}
+
+
@@ -328,7 +362,16 @@
-
+
+ ci
+
+
+ env.CI
+
+
+
+ check
+
+
-
diff --git a/release.sh b/release.sh
deleted file mode 100755
index f71cc9d7..00000000
--- a/release.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env bash
-#
-# Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
-# and other contributors as indicated by the @author tags.
-#
-# Licensed under the Eclipse Public License - v 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.eclipse.org/legal/epl-2.0/
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-
-echo "===================================="
-read -p "Enter Release: " releaseVersion
-read -p "Enter Next Release (SNAPSHOT): " nextVersion
-read -s -p "Enter Github Token: " token
-
-# Update to release
-mvn versions:set -DnewVersion="$releaseVersion"
-
-git add .
-git commit -m "Release $releaseVersion"
-git push "https://$token@github.com/project-openubl/xbuilder.git"
-
-# Create tag and push
-git tag "$releaseVersion"
-git push "https://$token@github.com/project-openubl/xbuilder.git" --tags
-
-# Create next snapshot
-mvn versions:set -DnewVersion="$nextVersion-SNAPSHOT"
-
-git add .
-git commit -m "Prepare next release $nextVersion-SNAPSHOT"
-git push "https://$token@github.com/project-openubl/xbuilder.git"
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog.java
similarity index 67%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog.java
index 2f957860..45a1b673 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,25 +14,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.catalogs;
+package io.github.project.openubl.xbuilder.content.catalogs;
import java.util.Optional;
import java.util.function.Supplier;
import java.util.stream.Stream;
public interface Catalog {
- Supplier extends RuntimeException> invalidCatalogValue = (Supplier) ()
- -> new IllegalStateException("No se pudo convertir el valor del catálogo");
+ Supplier extends RuntimeException> invalidCatalogValue = (Supplier) () ->
+ new IllegalStateException("No se pudo convertir el valor del catálogo");
/**
* @return an instance of Catalog which is equal to ValueOf or contains the same code
*/
static Optional valueOfCode(Class enumType, String code) {
- return Stream.of(enumType.getEnumConstants())
- .filter(p -> p.toString().equalsIgnoreCase(code) || p.getCode().equals(code))
- .findFirst();
+ return Stream
+ .of(enumType.getEnumConstants())
+ .filter(p -> p.toString().equalsIgnoreCase(code) || p.getCode().equals(code))
+ .findFirst();
}
String getCode();
}
-
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog1.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog1.java
similarity index 81%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog1.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog1.java
index 469f1794..50ca5d94 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog1.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog1.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,13 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.catalogs;
+package io.github.project.openubl.xbuilder.content.catalogs;
import java.util.Optional;
import java.util.stream.Stream;
public enum Catalog1 implements Catalog {
-
FACTURA("01"),
BOLETA("03"),
NOTA_CREDITO("07"),
@@ -45,14 +44,11 @@ public enum Catalog1 implements Catalog {
}
public static Optional valueOfCode(String code) {
- return Stream.of(Catalog1.values())
- .filter(p -> p.code.equals(code))
- .findFirst();
+ return Stream.of(Catalog1.values()).filter(p -> p.code.equals(code)).findFirst();
}
@Override
public String getCode() {
return code;
}
-
}
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog10.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog10.java
similarity index 82%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog10.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog10.java
index 540a4083..25e5312e 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog10.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog10.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.catalogs;
+package io.github.project.openubl.xbuilder.content.catalogs;
public enum Catalog10 implements Catalog {
INTERES_POR_MORA("01"),
@@ -31,5 +31,4 @@ public enum Catalog10 implements Catalog {
public String getCode() {
return code;
}
-
}
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog12.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog12.java
similarity index 87%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog12.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog12.java
index 8eb6b43f..da66bcb1 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog12.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog12.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.catalogs;
+package io.github.project.openubl.xbuilder.content.catalogs;
public enum Catalog12 implements Catalog {
FACTURA_EMITIDA_PARA_CORREGIR_ERROR_EN_EL_RUC("01"),
@@ -39,5 +39,4 @@ public enum Catalog12 implements Catalog {
public String getCode() {
return code;
}
-
}
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog12_Anticipo.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog12_Anticipo.java
similarity index 82%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog12_Anticipo.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog12_Anticipo.java
index 0dcb738c..2cbbbda4 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog12_Anticipo.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog12_Anticipo.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,13 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.catalogs;
+package io.github.project.openubl.xbuilder.content.catalogs;
public enum Catalog12_Anticipo implements Catalog {
FACTURA_EMITIDA_POR_ANTICIPOS("02"),
BOLETA_DE_VENTA_EMITIDA_POR_ANTICIPOS("03");
-
private final String code;
Catalog12_Anticipo(String code) {
@@ -31,5 +30,4 @@ public enum Catalog12_Anticipo implements Catalog {
public String getCode() {
return code;
}
-
}
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog12_Doc_Trib_Relacionado_Invoice.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog12_Doc_Trib_Relacionado_BoletaFactura.java
similarity index 75%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog12_Doc_Trib_Relacionado_Invoice.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog12_Doc_Trib_Relacionado_BoletaFactura.java
index 9965f7d2..faa72fd4 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog12_Doc_Trib_Relacionado_Invoice.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog12_Doc_Trib_Relacionado_BoletaFactura.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,9 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.catalogs;
+package io.github.project.openubl.xbuilder.content.catalogs;
-public enum Catalog12_Doc_Trib_Relacionado_Invoice implements Catalog {
+public enum Catalog12_Doc_Trib_Relacionado_BoletaFactura implements Catalog {
TICKET_DE_SALIDA("04"),
CODIGO_SCOP("05"),
FACTURA_ELECTRONICA_REMITENTE("06"),
@@ -27,7 +27,7 @@ public enum Catalog12_Doc_Trib_Relacionado_Invoice implements Catalog {
private final String code;
- Catalog12_Doc_Trib_Relacionado_Invoice(String code) {
+ Catalog12_Doc_Trib_Relacionado_BoletaFactura(String code) {
this.code = code;
}
@@ -35,5 +35,4 @@ public enum Catalog12_Doc_Trib_Relacionado_Invoice implements Catalog {
public String getCode() {
return code;
}
-
}
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog12_Doc_Trib_Relacionado_CreditNote.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog12_Doc_Trib_Relacionado_NotaCredito.java
similarity index 72%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog12_Doc_Trib_Relacionado_CreditNote.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog12_Doc_Trib_Relacionado_NotaCredito.java
index 1ca0196a..ae1829de 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog12_Doc_Trib_Relacionado_CreditNote.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog12_Doc_Trib_Relacionado_NotaCredito.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,9 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.catalogs;
+package io.github.project.openubl.xbuilder.content.catalogs;
-public enum Catalog12_Doc_Trib_Relacionado_CreditNote implements Catalog {
+public enum Catalog12_Doc_Trib_Relacionado_NotaCredito implements Catalog {
FACTURA_EMITIDA_PARA_CORREGIR_ERROR_EN_EL_RUC("01"),
TICKET_DE_SALIDA("04"),
CODIGO_SCOP("05"),
@@ -24,7 +24,7 @@ public enum Catalog12_Doc_Trib_Relacionado_CreditNote implements Catalog {
private final String code;
- Catalog12_Doc_Trib_Relacionado_CreditNote(String code) {
+ Catalog12_Doc_Trib_Relacionado_NotaCredito(String code) {
this.code = code;
}
@@ -32,5 +32,4 @@ public enum Catalog12_Doc_Trib_Relacionado_CreditNote implements Catalog {
public String getCode() {
return code;
}
-
}
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog12_Doc_Trib_Relacionado_DebitNote.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog12_Doc_Trib_Relacionado_NotaDebito.java
similarity index 71%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog12_Doc_Trib_Relacionado_DebitNote.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog12_Doc_Trib_Relacionado_NotaDebito.java
index 3946f148..43a70497 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog12_Doc_Trib_Relacionado_DebitNote.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog12_Doc_Trib_Relacionado_NotaDebito.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,16 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.catalogs;
+package io.github.project.openubl.xbuilder.content.catalogs;
-public enum Catalog12_Doc_Trib_Relacionado_DebitNote implements Catalog {
+public enum Catalog12_Doc_Trib_Relacionado_NotaDebito implements Catalog {
TICKET_DE_SALIDA("04"),
CODIGO_SCOP("05"),
OTROS("99");
private final String code;
- Catalog12_Doc_Trib_Relacionado_DebitNote(String code) {
+ Catalog12_Doc_Trib_Relacionado_NotaDebito(String code) {
this.code = code;
}
@@ -31,5 +31,4 @@ public enum Catalog12_Doc_Trib_Relacionado_DebitNote implements Catalog {
public String getCode() {
return code;
}
-
}
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog16.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog16.java
similarity index 76%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog16.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog16.java
index 7ef10ba3..f12873c5 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog16.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog16.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,12 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.catalogs;
+package io.github.project.openubl.xbuilder.content.catalogs;
public enum Catalog16 implements Catalog {
-
PRECIO_UNITARIO_INCLUYE_IGV("01"),
- VALOR_FERENCIAL_UNITARIO_EN_OPERACIONES_NO_ONEROSAS("02");
+ VALOR_REFERENCIAL_UNITARIO_EN_OPERACIONES_NO_ONEROSAS("02");
private final String code;
@@ -31,5 +30,4 @@ public enum Catalog16 implements Catalog {
public String getCode() {
return code;
}
-
}
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog18.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog18.java
similarity index 82%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog18.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog18.java
index 607e1b87..9cf564e8 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog18.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog18.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,10 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.catalogs;
+package io.github.project.openubl.xbuilder.content.catalogs;
public enum Catalog18 implements Catalog {
-
TRANSPORTE_PUBLICO("01"),
TRANSPORTE_PRIVADO("02");
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog19.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog19.java
similarity index 82%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog19.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog19.java
index 9c96dee4..6cd82f4e 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog19.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog19.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,10 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.catalogs;
+package io.github.project.openubl.xbuilder.content.catalogs;
public enum Catalog19 implements Catalog {
-
ADICIONAR("1"),
MODIFICAR("2"),
ANULADO("3");
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog1_Guia.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog1_Guia.java
similarity index 76%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog1_Guia.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog1_Guia.java
index 3b7b823a..ca52aceb 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog1_Guia.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog1_Guia.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,13 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.catalogs;
+package io.github.project.openubl.xbuilder.content.catalogs;
import java.util.Optional;
import java.util.stream.Stream;
public enum Catalog1_Guia implements Catalog {
-
GUIA_REMISION_REMITENTE("09"),
GUIA_REMISION_TRANSPORTISTA("31");
@@ -31,14 +30,11 @@ public enum Catalog1_Guia implements Catalog {
}
public static Optional valueOfCode(String code) {
- return Stream.of(Catalog1_Guia.values())
- .filter(p -> p.code.equals(code))
- .findFirst();
+ return Stream.of(Catalog1_Guia.values()).filter(p -> p.code.equals(code)).findFirst();
}
@Override
public String getCode() {
return code;
}
-
}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog1_Invoice.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog1_Invoice.java
new file mode 100644
index 00000000..d0a0d803
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog1_Invoice.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.catalogs;
+
+public enum Catalog1_Invoice implements Catalog {
+ FACTURA("01"),
+ BOLETA("03");
+
+ private final String code;
+
+ Catalog1_Invoice(String code) {
+ this.code = code;
+ }
+
+ @Override
+ public String getCode() {
+ return code;
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog20.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog20.java
similarity index 85%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog20.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog20.java
index f07e4f60..64757c14 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog20.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog20.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,10 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.catalogs;
+package io.github.project.openubl.xbuilder.content.catalogs;
public enum Catalog20 implements Catalog {
-
VENTA("01"),
VENTA_SUJETA_A_CONFIRMACION_DEL_COMPRADOR("14"),
COMPRA("02"),
@@ -38,5 +37,4 @@ public enum Catalog20 implements Catalog {
public String getCode() {
return code;
}
-
}
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog21.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog21.java
similarity index 84%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog21.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog21.java
index 7f98b3d4..742ba264 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog21.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog21.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,10 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.catalogs;
+package io.github.project.openubl.xbuilder.content.catalogs;
public enum Catalog21 implements Catalog {
-
NUMERACION_DAM("01"),
NUMERO_DE_ORDEN_DE_ENTREGA("02"),
NUMERO_SCOP("03"),
@@ -35,5 +34,4 @@ public enum Catalog21 implements Catalog {
public String getCode() {
return code;
}
-
}
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog22.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog22.java
similarity index 86%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog22.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog22.java
index 9486047a..fb351921 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog22.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog22.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,12 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.catalogs;
+package io.github.project.openubl.xbuilder.content.catalogs;
import java.math.BigDecimal;
public enum Catalog22 implements Catalog {
-
VENTA_INTERNA("01", BigDecimal.valueOf(2)),
ADQUISICION_DE_COMBUSTIBLE("02", BigDecimal.valueOf(1)),
AGENTE_DE_PERCEPCION_CON_TASA_ESPECIAL("03", BigDecimal.valueOf(0.5));
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog23.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog23.java
similarity index 84%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog23.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog23.java
index fb99a027..c3521e18 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog23.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog23.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,12 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.catalogs;
+package io.github.project.openubl.xbuilder.content.catalogs;
import java.math.BigDecimal;
public enum Catalog23 implements Catalog {
-
TASA_TRES("01", BigDecimal.valueOf(3));
private final String code;
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog5.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog5.java
similarity index 89%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog5.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog5.java
index 30b6aa07..652e8216 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog5.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog5.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,10 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.catalogs;
+package io.github.project.openubl.xbuilder.content.catalogs;
public enum Catalog5 implements Catalog {
-
IGV("1000", "VAT", "S", "IGV"),
IMPUESTO_ARROZ_PILADO("1016", "VAT", "S", "IVAP"),
ISC("2000", "EXC", "S", "ISC"),
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog51.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog51.java
new file mode 100644
index 00000000..c2caa21e
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog51.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.catalogs;
+
+public enum Catalog51 implements Catalog {
+ VENTA_INTERNA("0101"),
+ OPERACION_SUJETA_A_DETRACCION("1001"),
+ OPERACION_SUJETA_A_PERCEPCION("2001");
+
+ private final String code;
+
+ Catalog51(String code) {
+ this.code = code;
+ }
+
+ @Override
+ public String getCode() {
+ return code;
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog52.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog52.java
similarity index 66%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog52.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog52.java
index 7213c059..d9eef884 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog52.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog52.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,11 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.catalogs;
+package io.github.project.openubl.xbuilder.content.catalogs;
public enum Catalog52 implements Catalog {
-
- MONTO_EN_LETRAS("1000", "MONTO EN LETRAS");
+ MONTO_EN_LETRAS("1000", "MONTO EN LETRAS"),
+ COMPROBANTE_DE_PERCEPCION("2000", "COMPROBANTE DE PERCEPCION"),
+ VENTA_REALIZADA_POR_EMISOR_ITINERANTE("2005", "VENTA REALIZADA POR EMISOR ITINERANTE"),
+ OPERACION_SUJETA_A_DETRACCION("2006", "OPERACION SUJETA A DETRACCION");
private final String code;
private final String label;
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog53.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog53.java
new file mode 100644
index 00000000..7f4d608c
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog53.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.catalogs;
+
+public enum Catalog53 implements Catalog {
+ DESCUENTO_AFECTA_BASE_IMPONIBLE_IGV_IVAP("00"),
+ DESCUENTO_NO_AFECTA_BASE_IMPONIBLE_IGV_IVAP("01"),
+ DESCUENTO_GLOBAL_AFECTA_BASE_IMPONIBLE_IGV_IVAP("02"),
+ DESCUENTO_GLOBAL_NO_AFECTA_BASE_IMPONIBLE_IGV_IVAP("03"),
+ DESCUENTO_GLOBAL_POR_ANTICIPOS_GRAVADOS_AFECTA_BASE_IMPONIBLE_IGV_IVAP("04"),
+ DESCUENTO_GLOBAL_POR_ANTICIPOS_EXONERADOS("05"),
+ DESCUENTO_GLOBAL_POR_ANTICIPOS_INAFECTOS("06"),
+ FACTOR_DE_COMPENSACION("07"),
+ ANTICIPO_DE_ISC("20"),
+ FISE("45"),
+ RECARGO_AL_CONSUMO_Y_O_PROPINAS("46"),
+ CARGOS_QUE_AFECTAN_BASE_IMPONIBLE_IGV_IVAP("47"),
+ CARGOS_QUE_NO_AFECTAN_BASE_IMPONIBLE_IGV_IVAP("48"),
+ CARGOS_GLOBALES_QUE_AFECTAN_BASE_IMPONIBLE_IGV_IVAP("49"),
+ CARGOS_GLOBALES_QUE_NO_AFECTAN_BASE_IMPONIBLE_IGV_IVAP("50"),
+ PERCEPCION_VENTA_INTERNA("51"),
+ PERCEPCION_A_LA_ADQUISICION_DE_COMBUSTIBLE("52"),
+ PERCEPCION_REALIZADA_AL_AGENTE__DE_PERCEPCION_CON_TASA_ESPECIAL("53"),
+ FACTOR_DE_APORTACION("54"),
+ RETENCION_DE_RENTA_POR_ANTICIPOS("61"),
+ RETENCION_DEL_IGV("62"),
+ RETENCION_DE_RENTA_DE_SEGUNDA_CATEGORIA("62");
+
+ private final String code;
+
+ Catalog53(String code) {
+ this.code = code;
+ }
+
+ @Override
+ public String getCode() {
+ return code;
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog53_Anticipo.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog53_Anticipo.java
new file mode 100644
index 00000000..26d29483
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog53_Anticipo.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.catalogs;
+
+public enum Catalog53_Anticipo implements Catalog {
+ DESCUENTO_GLOBAL_POR_ANTICIPOS_GRAVADOS_AFECTA_BASE_IMPONIBLE_IGV_IVAP("04"),
+ DESCUENTO_GLOBAL_POR_ANTICIPOS_EXONERADOS("05"),
+ DESCUENTO_GLOBAL_POR_ANTICIPOS_INAFECTOS("06");
+
+ private final String code;
+
+ Catalog53_Anticipo(String code) {
+ this.code = code;
+ }
+
+ @Override
+ public String getCode() {
+ return code;
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog54.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog54.java
similarity index 78%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog54.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog54.java
index 5e4c7262..67b3ab6c 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog54.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog54.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,14 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.catalogs;
+package io.github.project.openubl.xbuilder.content.catalogs;
public enum Catalog54 implements Catalog {
-
AZUCAR("001"),
ALCOHOL_ETILICO("003"),
- RECURSOS_HIDROBIOLOGICOS("004"),
- ;
+ RECURSOS_HIDROBIOLOGICOS("004");
private final String code;
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog59.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog59.java
similarity index 89%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog59.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog59.java
index 6574745c..31f82244 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog59.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog59.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,10 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.catalogs;
+package io.github.project.openubl.xbuilder.content.catalogs;
public enum Catalog59 implements Catalog {
-
DEPOSITO_EN_CUENTA("001"),
GIRO("002"),
TRANSFERENCIA_DE_FONDOS("003"),
@@ -29,7 +28,9 @@ public enum Catalog59 implements Catalog {
EFECTIVO_EN_LOS_DEMAS_CASOS("009"),
MEDIOS_DE_PAGO_USADOS_EN_COMERCIO_EXTERIOR("010"),
DOCUMENTOS_EMITIDOS_POR_LAS_EDPYMES_Y_LAS_COOPERATIVAS("011"),
- TARJETA_DE_CREDITO_EMITIDA_EN_EL_PAIS_O_EN_EXTERIOR_EMITIDA_POR_EMPRESA_NO_PERTENECIENTE_AL_SISTEMA_FINANCIERO("012"),
+ TARJETA_DE_CREDITO_EMITIDA_EN_EL_PAIS_O_EN_EXTERIOR_EMITIDA_POR_EMPRESA_NO_PERTENECIENTE_AL_SISTEMA_FINANCIERO(
+ "012"
+ ),
TARJETAS_DE_CREDITO_EMITIDAS_EN_EL_EXTERIOR_POR_EMPRESAS_BANCARIAS_O_FINANCIERAS_NO_DOMICILIADAS("013"),
TRANSFERENCIAS_COMERCIO_EXTERIOR("101"),
CHEQUES_BANCARIOS_COMERCIO_EXTERIOR("102"),
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog6.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog6.java
similarity index 83%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog6.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog6.java
index 90146e97..25f94698 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog6.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog6.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,10 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.catalogs;
+package io.github.project.openubl.xbuilder.content.catalogs;
public enum Catalog6 implements Catalog {
-
DOC_TRIB_NO_DOM_SIN_RUC("0"),
DNI("1"),
EXTRANJERIA("4"),
@@ -35,5 +34,4 @@ public enum Catalog6 implements Catalog {
public String getCode() {
return code;
}
-
}
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog7.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog7.java
similarity index 93%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog7.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog7.java
index 3858dff9..5d593f92 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog7.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog7.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,10 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.catalogs;
+package io.github.project.openubl.xbuilder.content.catalogs;
public enum Catalog7 implements Catalog {
-
GRAVADO_OPERACION_ONEROSA("10", true, Catalog5.IGV, Catalog7_1.GRAVADO),
GRAVADO_RETIRO_POR_PREMIO("11", false, Catalog5.GRATUITO, Catalog7_1.GRAVADO),
GRAVADO_RETIRO_POR_DONACION("12", false, Catalog5.GRATUITO, Catalog7_1.GRAVADO),
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog7_1.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog7_1.java
similarity index 83%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog7_1.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog7_1.java
index f0473e4e..b186a2f5 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog7_1.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog7_1.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.catalogs;
+package io.github.project.openubl.xbuilder.content.catalogs;
public enum Catalog7_1 implements Catalog {
GRAVADO("01"),
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog8.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog8.java
similarity index 82%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog8.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog8.java
index 9389d818..d6a19616 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog8.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog8.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,10 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.catalogs;
+package io.github.project.openubl.xbuilder.content.catalogs;
public enum Catalog8 implements Catalog {
-
SISTEMA_AL_VALOR("01"),
APLICACION_AL_MONTO_FIJO("02"),
SISTEMA_DE_PRECIOS_DE_VENTA_AL_PUBLICO("02");
@@ -32,5 +31,4 @@ public enum Catalog8 implements Catalog {
public String getCode() {
return code;
}
-
}
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog9.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog9.java
similarity index 85%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog9.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog9.java
index c2a1f664..5136ae7f 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog9.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/Catalog9.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.catalogs;
+package io.github.project.openubl.xbuilder.content.catalogs;
public enum Catalog9 implements Catalog {
ANULACION_DE_LA_OPERACION("01"),
@@ -38,5 +38,4 @@ public enum Catalog9 implements Catalog {
public String getCode() {
return code;
}
-
}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/CatalogContadoCredito.java b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/CatalogContadoCredito.java
new file mode 100644
index 00000000..cb1db972
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/catalogs/CatalogContadoCredito.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.catalogs;
+
+public enum CatalogContadoCredito implements Catalog {
+ CONTADO("Contado"),
+ CREDITO("Credito");
+
+ private final String code;
+
+ CatalogContadoCredito(String code) {
+ this.code = code;
+ }
+
+ @Override
+ public String getCode() {
+ return code;
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/common/Cliente.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/common/Cliente.java
new file mode 100644
index 00000000..95f2e2ab
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/common/Cliente.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.common;
+
+import lombok.Builder;
+import lombok.Data;
+
+@Data
+@Builder
+public class Cliente {
+
+ private String tipoDocumentoIdentidad;
+ private String numeroDocumentoIdentidad;
+ private String nombre;
+
+ private Direccion direccion;
+ private Contacto contacto;
+}
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/clock/SystemClock.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/common/Contacto.java
similarity index 64%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/clock/SystemClock.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/models/common/Contacto.java
index 251b9042..ea372652 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/clock/SystemClock.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/common/Contacto.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,14 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.clock;
+package io.github.project.openubl.xbuilder.content.models.common;
-import java.util.Calendar;
-import java.util.TimeZone;
+import lombok.Builder;
+import lombok.Data;
-public interface SystemClock {
-
- TimeZone getTimeZone();
- Calendar getCalendarInstance();
+@Data
+@Builder
+public class Contacto {
+ private String telefono;
+ private String email;
}
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/facade/DocumentWrapper.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/common/Direccion.java
similarity index 53%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/facade/DocumentWrapper.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/models/common/Direccion.java
index 86da231e..e4b28e4e 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/facade/DocumentWrapper.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/common/Direccion.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,24 +14,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.facade;
+package io.github.project.openubl.xbuilder.content.models.common;
-public class DocumentWrapper {
+import lombok.Builder;
+import lombok.Data;
- private final String xml;
- private final T output;
+@Data
+@Builder
+public class Direccion {
- public DocumentWrapper(String xml, T output) {
- this.xml = xml;
- this.output = output;
- }
+ private String ubigeo;
- public String getXml() {
- return xml;
- }
+ private String codigoLocal;
+ private String urbanizacion;
- public T getOutput() {
- return output;
- }
+ private String departamento;
+ private String provincia;
+ private String distrito;
+ private String direccion;
+ private String codigoPais;
}
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/HighLevelGroupValidation.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/common/Firmante.java
similarity index 63%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/HighLevelGroupValidation.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/models/common/Firmante.java
index 8246c9e7..dbbacf0c 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/HighLevelGroupValidation.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/common/Firmante.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,10 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.input.constraints;
+package io.github.project.openubl.xbuilder.content.models.common;
-/**
- * Validations that are executed after {@link javax.validation.groups.Default} group
- */
-public interface HighLevelGroupValidation {
+import lombok.Builder;
+import lombok.Data;
+
+@Data
+@Builder
+public class Firmante {
+
+ private String ruc;
+ private String razonSocial;
}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/common/Proveedor.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/common/Proveedor.java
new file mode 100644
index 00000000..a3935ce3
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/common/Proveedor.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.common;
+
+import lombok.Builder;
+import lombok.Data;
+
+@Data
+@Builder
+public class Proveedor {
+
+ private String ruc;
+ private String nombreComercial;
+ private String razonSocial;
+
+ private Direccion direccion;
+ private Contacto contacto;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/Anticipo.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/Anticipo.java
new file mode 100644
index 00000000..57346eaa
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/Anticipo.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.standard.general;
+
+import java.math.BigDecimal;
+import lombok.Builder;
+import lombok.Data;
+
+@Data
+@Builder
+public class Anticipo {
+
+ private String tipo;
+ private String comprobanteTipo;
+ private String comprobanteSerieNumero;
+ private BigDecimal monto;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/BaseDocumento.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/BaseDocumento.java
new file mode 100644
index 00000000..0f0fede2
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/BaseDocumento.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.standard.general;
+
+import io.github.project.openubl.xbuilder.content.models.common.Cliente;
+import io.github.project.openubl.xbuilder.content.models.common.Firmante;
+import io.github.project.openubl.xbuilder.content.models.common.Proveedor;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalTime;
+import java.util.List;
+import java.util.Map;
+import lombok.Data;
+import lombok.Singular;
+import lombok.experimental.SuperBuilder;
+
+@Data
+@SuperBuilder
+public abstract class BaseDocumento {
+
+ @Singular
+ private Map leyendas;
+
+ private String moneda;
+ private BigDecimal tasaIgv;
+ private BigDecimal tasaIcb;
+
+ private String serie;
+ private Integer numero;
+
+ private LocalDate fechaEmision;
+ private LocalTime horaEmision;
+
+ private Cliente cliente;
+ private Proveedor proveedor;
+ private Firmante firmante;
+
+ private TotalImpuestos totalImpuestos;
+
+ @Singular
+ private List detalles;
+
+ private List guiasRemisionRelacionadas;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/BaseDocumentoNota.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/BaseDocumentoNota.java
new file mode 100644
index 00000000..9ff4feee
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/BaseDocumentoNota.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.standard.general;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.SuperBuilder;
+
+@Data
+@SuperBuilder
+@EqualsAndHashCode(callSuper = true)
+public abstract class BaseDocumentoNota extends BaseDocumento {
+
+ private String tipoNota;
+
+ private String comprobanteAfectadoSerieNumero;
+ private String comprobanteAfectadoTipo;
+ private String sustentoDescripcion;
+
+ private TotalImporteNote totalImporte;
+}
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/NoteInputModel_SerieComprobanteAfectadoGroupValidation.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/BaseDocumentoTributarioRelacionado.java
similarity index 61%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/NoteInputModel_SerieComprobanteAfectadoGroupValidation.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/BaseDocumentoTributarioRelacionado.java
index d1e62c13..df5c884c 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/NoteInputModel_SerieComprobanteAfectadoGroupValidation.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/BaseDocumentoTributarioRelacionado.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,10 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.input.constraints;
+package io.github.project.openubl.xbuilder.content.models.standard.general;
-/**
- * Validations that are executed after {@link javax.validation.groups.Default} group
- */
-public interface NoteInputModel_SerieComprobanteAfectadoGroupValidation {
+public abstract class BaseDocumentoTributarioRelacionado {
+
+ private String serieNumero;
}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/CargoDescuento.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/CargoDescuento.java
new file mode 100644
index 00000000..d8228256
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/CargoDescuento.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.standard.general;
+
+import java.math.BigDecimal;
+import lombok.Data;
+
+@Data
+public class CargoDescuento extends BaseDocumentoTributarioRelacionado {
+
+ private String tipo;
+ private BigDecimal monto;
+ private BigDecimal porcentaje;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/CreditNote.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/CreditNote.java
new file mode 100644
index 00000000..e95a7535
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/CreditNote.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.standard.general;
+
+import java.util.List;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.SuperBuilder;
+
+@Data
+@SuperBuilder
+@EqualsAndHashCode(callSuper = true)
+public class CreditNote extends BaseDocumentoNota {
+
+ private List otrosDocumentosTributariosRelacionados;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/CuotaDePago.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/CuotaDePago.java
new file mode 100644
index 00000000..7eaca7b9
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/CuotaDePago.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.standard.general;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import lombok.Builder;
+import lombok.Data;
+
+@Data
+@Builder
+public class CuotaDePago {
+
+ private BigDecimal importe;
+ private LocalDate fechaPago;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/DebitNote.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/DebitNote.java
new file mode 100644
index 00000000..640327ad
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/DebitNote.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.standard.general;
+
+import java.util.List;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.SuperBuilder;
+
+@Data
+@SuperBuilder
+@EqualsAndHashCode(callSuper = true)
+public class DebitNote extends BaseDocumentoNota {
+
+ private List otrosDocumentosTributariosRelacionados;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/Detraccion.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/Detraccion.java
new file mode 100644
index 00000000..121c3d49
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/Detraccion.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.standard.general;
+
+import java.math.BigDecimal;
+import lombok.Builder;
+import lombok.Data;
+
+@Data
+@Builder
+public class Detraccion {
+
+ /**
+ * Catalog59
+ **/
+ private String medioDePago;
+ private String cuentaBancaria;
+
+ /**
+ * Catalog54
+ **/
+ private String tipoBienDetraido;
+ private BigDecimal porcentaje;
+ private BigDecimal monto;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/DocumentoDetalle.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/DocumentoDetalle.java
new file mode 100644
index 00000000..87bb331e
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/DocumentoDetalle.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.standard.general;
+
+import java.math.BigDecimal;
+import lombok.Builder;
+import lombok.Data;
+
+@Data
+@Builder
+public class DocumentoDetalle {
+
+ private Integer index;
+ private String descripcion;
+ private String unidadMedida;
+ private BigDecimal cantidad;
+ private BigDecimal precio;
+ private boolean precioConImpuestos;
+ private BigDecimal precioReferencia;
+ private String precioReferenciaTipo;
+
+ // Impuestos
+ private BigDecimal igv;
+ private BigDecimal igvBaseImponible;
+ private String igvTipo;
+
+ private BigDecimal icb;
+ private boolean icbAplica;
+
+ // Totales
+ private BigDecimal totalImpuestos;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/DocumentoTributarioRelacionado_CreditNote.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/DocumentoTributarioRelacionado_CreditNote.java
new file mode 100644
index 00000000..ebdaf197
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/DocumentoTributarioRelacionado_CreditNote.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.standard.general;
+
+import lombok.Data;
+
+@Data
+public class DocumentoTributarioRelacionado_CreditNote extends BaseDocumentoTributarioRelacionado {
+
+ private String tipoDocumento;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/DocumentoTributarioRelacionado_DebitNote.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/DocumentoTributarioRelacionado_DebitNote.java
new file mode 100644
index 00000000..cec0e069
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/DocumentoTributarioRelacionado_DebitNote.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.standard.general;
+
+import lombok.Data;
+
+@Data
+public class DocumentoTributarioRelacionado_DebitNote extends BaseDocumentoTributarioRelacionado {
+
+ private String tipoDocumento;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/DocumentoTributarioRelacionado_Invoice.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/DocumentoTributarioRelacionado_Invoice.java
new file mode 100644
index 00000000..3d863a91
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/DocumentoTributarioRelacionado_Invoice.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.standard.general;
+
+import lombok.Data;
+
+@Data
+public class DocumentoTributarioRelacionado_Invoice extends BaseDocumentoTributarioRelacionado {
+
+ private String tipoDocumento;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/FormaDePago.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/FormaDePago.java
new file mode 100644
index 00000000..0c8abcf7
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/FormaDePago.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.standard.general;
+
+import java.math.BigDecimal;
+import java.util.List;
+import lombok.Data;
+import lombok.Singular;
+import lombok.experimental.SuperBuilder;
+
+@Data
+@SuperBuilder
+public class FormaDePago {
+
+ private String tipo;
+ private BigDecimal total;
+
+ @Singular
+ private List cuotas;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/GuiaRemisionRelacionada.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/GuiaRemisionRelacionada.java
new file mode 100644
index 00000000..0f09789b
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/GuiaRemisionRelacionada.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.standard.general;
+
+import lombok.Data;
+
+@Data
+public class GuiaRemisionRelacionada {
+
+ private String serieNumero;
+ private String tipoDocumento;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/Invoice.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/Invoice.java
new file mode 100644
index 00000000..5828552a
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/Invoice.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.standard.general;
+
+import io.github.project.openubl.xbuilder.content.models.common.Direccion;
+import java.time.LocalDate;
+import java.util.List;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.Singular;
+import lombok.ToString;
+import lombok.experimental.SuperBuilder;
+
+@Data
+@SuperBuilder
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class Invoice extends BaseDocumento {
+
+ private LocalDate fechaVencimiento;
+ private String tipoComprobante;
+
+ /**
+ * Catalog51
+ */
+ private String tipoOperacion;
+
+ private FormaDePago formaDePago;
+ private TotalImporteInvoice totalImporte;
+ private Direccion direccionEntrega;
+ private Detraccion detraccion;
+ private Percepcion percepcion;
+
+ @Singular
+ private List anticipos;
+
+ @Singular
+ private List otrosDocumentosTributariosRelacionados;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/Percepcion.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/Percepcion.java
new file mode 100644
index 00000000..8cbcc351
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/Percepcion.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.standard.general;
+
+import java.math.BigDecimal;
+import lombok.Builder;
+import lombok.Data;
+
+@Data
+@Builder
+public class Percepcion {
+
+ /**
+ * Catalog53
+ */
+ private String tipo;
+ private BigDecimal montoBase; // importeSinImpuestos
+ private BigDecimal porcentaje; // Establecido por el "tipo"
+ private BigDecimal monto; // montoBase * porcentaje
+ private BigDecimal montoTotal; // montoBase + monto
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/TotalImporte.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/TotalImporte.java
new file mode 100644
index 00000000..e3131b78
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/TotalImporte.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.standard.general;
+
+import java.math.BigDecimal;
+import lombok.Data;
+import lombok.experimental.SuperBuilder;
+
+@Data
+@SuperBuilder
+public abstract class TotalImporte {
+
+ private BigDecimal importe;
+ private BigDecimal importeSinImpuestos;
+ private BigDecimal importeConImpuestos;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/TotalImporteInvoice.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/TotalImporteInvoice.java
new file mode 100644
index 00000000..4f1f0142
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/TotalImporteInvoice.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.standard.general;
+
+import java.math.BigDecimal;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+import lombok.experimental.SuperBuilder;
+
+@Data
+@SuperBuilder
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class TotalImporteInvoice extends TotalImporte {
+
+ private BigDecimal anticipos;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/TotalImporteNote.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/TotalImporteNote.java
new file mode 100644
index 00000000..72ac567c
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/TotalImporteNote.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.standard.general;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+import lombok.experimental.SuperBuilder;
+
+@Data
+@SuperBuilder
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class TotalImporteNote extends TotalImporte {}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/TotalImpuestos.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/TotalImpuestos.java
new file mode 100644
index 00000000..a820df4c
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/general/TotalImpuestos.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.standard.general;
+
+import java.math.BigDecimal;
+import lombok.Builder;
+import lombok.Data;
+
+@Data
+@Builder
+public class TotalImpuestos {
+
+ private BigDecimal total;
+ private BigDecimal ivapImporte;
+ private BigDecimal ivapBaseImponible;
+ private BigDecimal gravadoImporte;
+ private BigDecimal gravadoBaseImponible;
+ private BigDecimal inafectoImporte;
+ private BigDecimal inafectoBaseImponible;
+ private BigDecimal exoneradoImporte;
+ private BigDecimal exoneradoBaseImponible;
+ private BigDecimal gratuitoImporte;
+ private BigDecimal gratuitoBaseImponible;
+ private BigDecimal icbImporte;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/guia/info.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/guia/info.java
new file mode 100644
index 00000000..03e95062
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/standard/guia/info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.standard.guia;
+
+import lombok.Data;
+
+@Data
+public class info {}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/baja/Baja.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/baja/Baja.java
new file mode 100644
index 00000000..a3490ad7
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/baja/Baja.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.sunat.baja;
+
+import io.github.project.openubl.xbuilder.content.models.common.Firmante;
+import io.github.project.openubl.xbuilder.content.models.common.Proveedor;
+import lombok.Data;
+
+@Data
+public class Baja {
+
+ private Integer numero;
+ private Long fechaEmision;
+ private Firmante firmante;
+ private Proveedor proveedor;
+ private String descripcionSustento;
+ private BajaDetalle comprobante;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/baja/BajaDetalle.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/baja/BajaDetalle.java
new file mode 100644
index 00000000..c62bf764
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/baja/BajaDetalle.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.sunat.baja;
+
+import lombok.Data;
+
+@Data
+public class BajaDetalle {
+
+ private String serieNumero;
+ private String tipoComprobante;
+ private Long fechaEmision;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/percepcionretencion/BasePercepcionRetencion.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/percepcionretencion/BasePercepcionRetencion.java
new file mode 100644
index 00000000..50e0d59c
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/percepcionretencion/BasePercepcionRetencion.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.sunat.percepcionretencion;
+
+import io.github.project.openubl.xbuilder.content.models.common.Cliente;
+import io.github.project.openubl.xbuilder.content.models.common.Firmante;
+import io.github.project.openubl.xbuilder.content.models.common.Proveedor;
+import java.util.List;
+
+public abstract class BasePercepcionRetencion {
+
+ private Integer numero;
+ private Long fechaEmision;
+ private String observacion;
+ private Proveedor proveedor;
+ private Cliente cliente;
+ private Firmante firmante;
+ private List detalle;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/percepcionretencion/ComprobanteAfectado.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/percepcionretencion/ComprobanteAfectado.java
new file mode 100644
index 00000000..9e03c21f
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/percepcionretencion/ComprobanteAfectado.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.sunat.percepcionretencion;
+
+import java.math.BigDecimal;
+import lombok.Data;
+
+@Data
+public class ComprobanteAfectado {
+
+ private String moneda;
+ private String tipo;
+ private String serieNumero;
+ private Long fechaEmision;
+ private BigDecimal importeTotal;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/percepcionretencion/Percepcion.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/percepcionretencion/Percepcion.java
new file mode 100644
index 00000000..4b8fa079
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/percepcionretencion/Percepcion.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.sunat.percepcionretencion;
+
+import lombok.Data;
+
+@Data
+public class Percepcion extends BasePercepcionRetencion {
+
+ private String serie;
+ private String regimen;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/percepcionretencion/PercepcionRetencionDetalle.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/percepcionretencion/PercepcionRetencionDetalle.java
new file mode 100644
index 00000000..831394b0
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/percepcionretencion/PercepcionRetencionDetalle.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.sunat.percepcionretencion;
+
+import java.math.BigDecimal;
+import lombok.Data;
+
+@Data
+public class PercepcionRetencionDetalle {
+
+ private Integer numeroCobroPago;
+ private Long fechaCobroPago;
+ private BigDecimal importeCobroPago;
+ private ComprobanteAfectado comprobante;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/percepcionretencion/Retencion.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/percepcionretencion/Retencion.java
new file mode 100644
index 00000000..b1d92228
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/percepcionretencion/Retencion.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.sunat.percepcionretencion;
+
+import lombok.Data;
+
+@Data
+public class Retencion extends BasePercepcionRetencion {
+
+ private String serie;
+ private String regimen;
+}
diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/SunatNamespacesSingleton.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/Comprobante.java
similarity index 54%
rename from src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/SunatNamespacesSingleton.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/Comprobante.java
index b51cd802..6f78fc70 100644
--- a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/SunatNamespacesSingleton.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/Comprobante.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,20 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.integrationtest;
+package io.github.project.openubl.xbuilder.content.models.sunat.resumen;
-public class SunatNamespacesSingleton {
+import io.github.project.openubl.xbuilder.content.models.common.Cliente;
+import lombok.Data;
- private static SunatNamespaces instance;
-
- private SunatNamespacesSingleton() {
- }
-
- public static SunatNamespaces getInstance() {
- if (instance == null) {
- instance = new SunatNamespaces();
- }
- return instance;
- }
+@Data
+public class Comprobante {
+ private String tipo;
+ private String serieNumero;
+ private Cliente cliente;
+ private ComprobanteValorVenta valorVenta;
+ private ComprobanteImpuestos impuestos;
}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/ComprobanteAfectado.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/ComprobanteAfectado.java
new file mode 100644
index 00000000..12839b2d
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/ComprobanteAfectado.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.sunat.resumen;
+
+import lombok.Data;
+
+@Data
+public class ComprobanteAfectado {
+
+ private String tipo;
+ private String serieNumero;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/ComprobanteImpuestos.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/ComprobanteImpuestos.java
new file mode 100644
index 00000000..16cf282e
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/ComprobanteImpuestos.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.sunat.resumen;
+
+import java.math.BigDecimal;
+import lombok.Data;
+
+@Data
+public class ComprobanteImpuestos {
+
+ private BigDecimal igv;
+ private BigDecimal icb;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/ComprobanteValorVenta.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/ComprobanteValorVenta.java
new file mode 100644
index 00000000..107dd9ec
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/ComprobanteValorVenta.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.sunat.resumen;
+
+import java.math.BigDecimal;
+import lombok.Data;
+
+@Data
+public class ComprobanteValorVenta {
+
+ private BigDecimal importeTotal;
+ private BigDecimal otrosCargos;
+ private BigDecimal gravado;
+ private BigDecimal exonerado;
+ private BigDecimal inafecto;
+ private BigDecimal gratuito;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/ResumenDiario.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/ResumenDiario.java
new file mode 100644
index 00000000..12f2f1bf
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/ResumenDiario.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.content.models.sunat.resumen;
+
+import io.github.project.openubl.xbuilder.content.models.common.Firmante;
+import io.github.project.openubl.xbuilder.content.models.common.Proveedor;
+import java.util.List;
+import lombok.Data;
+
+@Data
+public class ResumenDiario {
+
+ private Integer numero;
+ private Long fechaEmision;
+ private Long fechaEmisionDeComprobantesAsociados;
+ private Firmante firmante;
+ private Proveedor proveedor;
+ private List detalle;
+}
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/DocumentInputModel_PuedeCrearComprobanteConSerieFGroupValidation.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/ResumenDiarioDetalle.java
similarity index 60%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/DocumentInputModel_PuedeCrearComprobanteConSerieFGroupValidation.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/ResumenDiarioDetalle.java
index b30b54a1..79de37a1 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/DocumentInputModel_PuedeCrearComprobanteConSerieFGroupValidation.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/sunat/resumen/ResumenDiarioDetalle.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,10 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.input.constraints;
+package io.github.project.openubl.xbuilder.content.models.sunat.resumen;
-/**
- * Validations that are executed after {@link javax.validation.groups.Default} group
- */
-public interface DocumentInputModel_PuedeCrearComprobanteConSerieFGroupValidation {
+import lombok.Data;
+
+@Data
+public class ResumenDiarioDetalle {
+
+ private String tipoOperacion;
+ private Comprobante comprobante;
+ private ComprobanteAfectado comprobanteAfectado;
}
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/utils/RegexUtils.java b/src/main/java/io/github/project/openubl/xbuilder/content/models/utils/UBLRegex.java
similarity index 76%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/utils/RegexUtils.java
rename to src/main/java/io/github/project/openubl/xbuilder/content/models/utils/UBLRegex.java
index 18e6c3b7..68c2bd20 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/utils/RegexUtils.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/content/models/utils/UBLRegex.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,16 +14,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.utils;
+package io.github.project.openubl.xbuilder.content.models.utils;
import java.util.regex.Pattern;
+import lombok.Data;
-public class RegexUtils {
+@Data
+public class UBLRegex {
public static final Pattern FACTURA_SERIE_REGEX = Pattern.compile("^[F|f].*$");
public static final Pattern BOLETA_SERIE_REGEX = Pattern.compile("^[B|b].*$");
- private RegexUtils() {
+ private UBLRegex() {
// Just static methods
}
}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/ContentEnricher.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/ContentEnricher.java
new file mode 100644
index 00000000..17b913c3
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/ContentEnricher.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher;
+
+import io.github.project.openubl.xbuilder.content.models.standard.general.BaseDocumentoNota;
+import io.github.project.openubl.xbuilder.content.models.standard.general.CreditNote;
+import io.github.project.openubl.xbuilder.content.models.standard.general.DebitNote;
+import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice;
+import io.github.project.openubl.xbuilder.enricher.config.DateProvider;
+import io.github.project.openubl.xbuilder.enricher.config.Defaults;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import io.github.project.openubl.xbuilder.enricher.kie.RuleUnit;
+import io.github.project.openubl.xbuilder.enricher.kie.ruleunits.BodyRuleContext;
+import io.github.project.openubl.xbuilder.enricher.kie.ruleunits.BodyRuleUnit;
+import io.github.project.openubl.xbuilder.enricher.kie.ruleunits.HeaderRuleContext;
+import io.github.project.openubl.xbuilder.enricher.kie.ruleunits.HeaderRuleUnit;
+import java.time.LocalDate;
+import java.util.stream.Stream;
+
+public class ContentEnricher {
+
+ private final Defaults defaults;
+ private final DateProvider dateProvider;
+
+ public ContentEnricher(Defaults defaults, DateProvider dateProvider) {
+ this.defaults = defaults;
+ this.dateProvider = dateProvider;
+ }
+
+ public void enrich(Invoice input) {
+ LocalDate systemLocalDate = dateProvider.now();
+
+ Stream
+ .of(RulePhase.PhaseType.ENRICH, RulePhase.PhaseType.PROCESS, RulePhase.PhaseType.SUMMARY)
+ .forEach(phaseType -> {
+ // Header
+ HeaderRuleContext ruleContextHeader = HeaderRuleContext.builder().localDate(systemLocalDate).build();
+ RuleUnit ruleUnitHeader = new HeaderRuleUnit(phaseType, defaults, ruleContextHeader);
+ ruleUnitHeader.modify(input);
+
+ // Body
+ BodyRuleContext ruleContextBody = BodyRuleContext
+ .builder()
+ .tasaIgv(input.getTasaIgv())
+ .tasaIcb(input.getTasaIcb())
+ .build();
+ RuleUnit ruleUnitBody = new BodyRuleUnit(phaseType, defaults, ruleContextBody);
+ input.getDetalles().forEach(ruleUnitBody::modify);
+ input.getAnticipos().forEach(ruleUnitBody::modify);
+ });
+ }
+
+ public void enrich(CreditNote input) {
+ enrichNote(input);
+ }
+
+ public void enrich(DebitNote input) {
+ enrichNote(input);
+ }
+
+ private void enrichNote(BaseDocumentoNota input) {
+ LocalDate systemLocalDate = dateProvider.now();
+
+ Stream
+ .of(RulePhase.PhaseType.ENRICH, RulePhase.PhaseType.PROCESS, RulePhase.PhaseType.SUMMARY)
+ .forEach(phaseType -> {
+ // Header
+ HeaderRuleContext ruleContextHeader = HeaderRuleContext.builder().localDate(systemLocalDate).build();
+ RuleUnit ruleUnitHeader = new HeaderRuleUnit(phaseType, defaults, ruleContextHeader);
+ ruleUnitHeader.modify(input);
+
+ // Body
+ BodyRuleContext ruleContextBody = BodyRuleContext
+ .builder()
+ .tasaIgv(input.getTasaIgv())
+ .tasaIcb(input.getTasaIcb())
+ .build();
+ RuleUnit ruleUnitBody = new BodyRuleUnit(phaseType, defaults, ruleContextBody);
+ input.getDetalles().forEach(ruleUnitBody::modify);
+ });
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/config/Constants.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/config/DateProvider.java
similarity index 68%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/config/Constants.java
rename to src/main/java/io/github/project/openubl/xbuilder/enricher/config/DateProvider.java
index 767f70eb..86687093 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/config/Constants.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/config/DateProvider.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,10 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.config;
+package io.github.project.openubl.xbuilder.enricher.config;
-public class Constants {
-
- public static final String DEFAULT_CODIGO_LOCAL = "0000";
+import java.time.LocalDate;
+public interface DateProvider {
+ LocalDate now();
}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/config/Defaults.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/config/Defaults.java
new file mode 100644
index 00000000..5a9c6e9f
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/config/Defaults.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.config;
+
+import java.math.BigDecimal;
+import lombok.Builder;
+import lombok.Getter;
+
+@Getter
+@Builder
+public class Defaults {
+
+ private String moneda;
+ private String unidadMedida;
+ private BigDecimal icbTasa;
+ private BigDecimal igvTasa;
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/AbstractBodyRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/AbstractBodyRule.java
new file mode 100644
index 00000000..abf22eca
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/AbstractBodyRule.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie;
+
+import io.github.project.openubl.xbuilder.enricher.config.Defaults;
+import io.github.project.openubl.xbuilder.enricher.kie.ruleunits.BodyRuleContext;
+
+public abstract class AbstractBodyRule implements RuleFactory, Rule {
+
+ private Defaults defaults;
+ private BodyRuleContext ruleContext;
+
+ @Override
+ public Rule create(Defaults defaults, RuleContext ruleContext) {
+ this.defaults = defaults;
+ if (ruleContext instanceof BodyRuleContext) {
+ this.ruleContext = (BodyRuleContext) ruleContext;
+ } else {
+ throw new IllegalStateException("HeaderRule requires HeaderContext");
+ }
+ return this;
+ }
+
+ public Defaults getDefaults() {
+ return defaults;
+ }
+
+ public BodyRuleContext getRuleContext() {
+ return ruleContext;
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/AbstractHeaderRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/AbstractHeaderRule.java
new file mode 100644
index 00000000..7706ea02
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/AbstractHeaderRule.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie;
+
+import io.github.project.openubl.xbuilder.enricher.config.Defaults;
+import io.github.project.openubl.xbuilder.enricher.kie.ruleunits.HeaderRuleContext;
+
+public abstract class AbstractHeaderRule implements RuleFactory, Rule {
+
+ private Defaults defaults;
+ private HeaderRuleContext ruleContext;
+
+ @Override
+ public Rule create(Defaults defaults, RuleContext ruleContext) {
+ this.defaults = defaults;
+ if (ruleContext instanceof HeaderRuleContext) {
+ this.ruleContext = (HeaderRuleContext) ruleContext;
+ } else {
+ throw new IllegalStateException("HeaderRule requires HeaderContext");
+ }
+ return this;
+ }
+
+ public Defaults getDefaults() {
+ return defaults;
+ }
+
+ public HeaderRuleContext getRuleContext() {
+ return ruleContext;
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/Rule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/Rule.java
new file mode 100644
index 00000000..3df509d8
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/Rule.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie;
+
+public interface Rule {
+ void modify(Object object);
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/RuleContext.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/RuleContext.java
new file mode 100644
index 00000000..b20e9bee
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/RuleContext.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie;
+
+public interface RuleContext {}
diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/DocumentLineInputModel_CantidadValidaICBGroupValidation.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/RuleFactory.java
similarity index 61%
rename from src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/DocumentLineInputModel_CantidadValidaICBGroupValidation.java
rename to src/main/java/io/github/project/openubl/xbuilder/enricher/kie/RuleFactory.java
index 131f43ed..b0564a00 100644
--- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/DocumentLineInputModel_CantidadValidaICBGroupValidation.java
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/RuleFactory.java
@@ -1,12 +1,12 @@
-/**
+/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
- * Licensed under the Eclipse Public License - v 2.0 (the "License");
+ * Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.eclipse.org/legal/epl-2.0/
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,10 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.project.openubl.xmlbuilderlib.models.input.constraints;
+package io.github.project.openubl.xbuilder.enricher.kie;
-/**
- * Validations that are executed after {@link javax.validation.groups.Default} group
- */
-public interface DocumentLineInputModel_CantidadValidaICBGroupValidation {
+import io.github.project.openubl.xbuilder.enricher.config.Defaults;
+
+public interface RuleFactory {
+ boolean test(Object object);
+
+ Rule create(Defaults defaults, RuleContext ruleContext);
}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/RuleFactoryRegistry.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/RuleFactoryRegistry.java
new file mode 100644
index 00000000..dacd481d
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/RuleFactoryRegistry.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie;
+
+import java.util.List;
+import java.util.Map;
+import java.util.ServiceLoader;
+import java.util.stream.Collectors;
+
+public class RuleFactoryRegistry {
+
+ public static List getRuleFactories(RulePhase.PhaseType phaseType) {
+ return ServiceLoader
+ .load(RuleFactory.class)
+ .stream()
+ .map(ruleProvider -> {
+ RulePhase rulePhase = ruleProvider.type().getAnnotation(RulePhase.class);
+ return Map.entry(ruleProvider, rulePhase);
+ })
+ .filter(ruleProviderPhaseEntry -> {
+ RulePhase rulePhase = ruleProviderPhaseEntry.getValue();
+ return rulePhase.type().equals(phaseType);
+ })
+ .sorted((o1, o2) -> o2.getValue().priority() - o1.getValue().priority())
+ .map(ruleProviderPhaseEntry -> ruleProviderPhaseEntry.getKey().get())
+ .collect(Collectors.toList());
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/RulePhase.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/RulePhase.java
new file mode 100644
index 00000000..86e37b8e
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/RulePhase.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface RulePhase {
+ PhaseType type();
+
+ int priority() default 0;
+
+ enum PhaseType {
+ ENRICH,
+ PROCESS,
+ SUMMARY,
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/RuleUnit.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/RuleUnit.java
new file mode 100644
index 00000000..7dbec3e9
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/RuleUnit.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie;
+
+public interface RuleUnit {
+ void modify(Object object);
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/anticipo/ComprobanteTipoRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/anticipo/ComprobanteTipoRule.java
new file mode 100644
index 00000000..d93060b3
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/anticipo/ComprobanteTipoRule.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.anticipo;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isAnticipo;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenAnticipo;
+
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog;
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog12;
+import io.github.project.openubl.xbuilder.content.models.standard.general.Anticipo;
+import io.github.project.openubl.xbuilder.content.models.utils.UBLRegex;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractBodyRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.ENRICH)
+public class ComprobanteTipoRule extends AbstractBodyRule {
+
+ @Override
+ public boolean test(Object object) {
+ return isAnticipo.test(object);
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = anticipo -> {
+ String comprobanteTipo = null;
+ if (anticipo.getComprobanteTipo() == null) {
+ if (UBLRegex.FACTURA_SERIE_REGEX.matcher(anticipo.getComprobanteSerieNumero()).matches()) {
+ comprobanteTipo = Catalog12.FACTURA_EMITIDA_POR_ANTICIPOS.getCode();
+ } else if (UBLRegex.BOLETA_SERIE_REGEX.matcher(anticipo.getComprobanteSerieNumero()).matches()) {
+ comprobanteTipo = Catalog12.BOLETA_DE_VENTA_EMITIDA_POR_ANTICIPOS.getCode();
+ }
+ } else {
+ Catalog12 catalog12 = Catalog
+ .valueOfCode(Catalog12.class, anticipo.getComprobanteTipo())
+ .orElseThrow(Catalog.invalidCatalogValue);
+ comprobanteTipo = catalog12.getCode();
+ }
+
+ anticipo.setComprobanteTipo(comprobanteTipo);
+ };
+ whenAnticipo.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/anticipo/TipoAnticipoRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/anticipo/TipoAnticipoRule.java
new file mode 100644
index 00000000..6d1ad863
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/anticipo/TipoAnticipoRule.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.anticipo;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isAnticipo;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenAnticipo;
+
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog;
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog53_Anticipo;
+import io.github.project.openubl.xbuilder.content.models.standard.general.Anticipo;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractBodyRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.ENRICH)
+public class TipoAnticipoRule extends AbstractBodyRule {
+
+ @Override
+ public boolean test(Object object) {
+ return isAnticipo.test(object);
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = anticipo -> {
+ String tipoAnticipo;
+ if (anticipo.getComprobanteTipo() == null) {
+ tipoAnticipo =
+ Catalog53_Anticipo.DESCUENTO_GLOBAL_POR_ANTICIPOS_GRAVADOS_AFECTA_BASE_IMPONIBLE_IGV_IVAP.getCode();
+ } else {
+ Catalog53_Anticipo catalog53 = Catalog
+ .valueOfCode(Catalog53_Anticipo.class, anticipo.getTipo())
+ .orElseThrow(Catalog.invalidCatalogValue);
+ tipoAnticipo = catalog53.getCode();
+ }
+
+ anticipo.setTipo(tipoAnticipo);
+ };
+ whenAnticipo.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/detalle/IgvTipoRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/detalle/IgvTipoRule.java
new file mode 100644
index 00000000..32cb5c22
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/detalle/IgvTipoRule.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.detalle;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isBaseDocumentoDetalle;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenBaseDocumentoDetalle;
+
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog;
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog7;
+import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoDetalle;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractBodyRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.ENRICH)
+public class IgvTipoRule extends AbstractBodyRule {
+
+ @Override
+ public boolean test(Object object) {
+ return isBaseDocumentoDetalle.test(object);
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = detalle -> {
+ Catalog7 catalog7;
+ if (detalle.getIgvTipo() == null) {
+ catalog7 = Catalog7.GRAVADO_OPERACION_ONEROSA;
+ } else {
+ catalog7 =
+ Catalog.valueOfCode(Catalog7.class, detalle.getIgvTipo()).orElseThrow(Catalog.invalidCatalogValue);
+ }
+
+ detalle.setIgvTipo(catalog7.getCode());
+ };
+ whenBaseDocumentoDetalle.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/detalle/PrecioDeReferenciaTipoRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/detalle/PrecioDeReferenciaTipoRule.java
new file mode 100644
index 00000000..6ad9cb56
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/detalle/PrecioDeReferenciaTipoRule.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.detalle;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isBaseDocumentoDetalle;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenBaseDocumentoDetalle;
+
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog;
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog16;
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog7;
+import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoDetalle;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractBodyRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.ENRICH)
+public class PrecioDeReferenciaTipoRule extends AbstractBodyRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isBaseDocumentoDetalle.test(object) &&
+ whenBaseDocumentoDetalle.apply(object).map(documento -> documento.getIgvTipo() != null).orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = detalle -> {
+ Catalog7 catalog7 = Catalog
+ .valueOfCode(Catalog7.class, detalle.getIgvTipo())
+ .orElseThrow(Catalog.invalidCatalogValue);
+ Catalog16 catalog16 = catalog7.isOperacionOnerosa()
+ ? Catalog16.PRECIO_UNITARIO_INCLUYE_IGV
+ : Catalog16.VALOR_REFERENCIAL_UNITARIO_EN_OPERACIONES_NO_ONEROSAS;
+
+ detalle.setPrecioReferenciaTipo(catalog16.getCode());
+ };
+ whenBaseDocumentoDetalle.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/detalle/UnidadDeMedidaRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/detalle/UnidadDeMedidaRule.java
new file mode 100644
index 00000000..45715779
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/body/detalle/UnidadDeMedidaRule.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.detalle;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isBaseDocumentoDetalle;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenBaseDocumentoDetalle;
+
+import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoDetalle;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractBodyRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.ENRICH)
+public class UnidadDeMedidaRule extends AbstractBodyRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isBaseDocumentoDetalle.test(object) &&
+ whenBaseDocumentoDetalle.apply(object).map(documento -> documento.getUnidadMedida() == null).orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = detalle -> detalle.setUnidadMedida(getDefaults().getUnidadMedida());
+ whenBaseDocumentoDetalle.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/ClienteTipoDocumentoRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/ClienteTipoDocumentoRule.java
new file mode 100644
index 00000000..408e85c1
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/ClienteTipoDocumentoRule.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isBaseDocumento;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenBaseDocumento;
+
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog;
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog6;
+import io.github.project.openubl.xbuilder.content.models.standard.general.BaseDocumento;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.ENRICH)
+public class ClienteTipoDocumentoRule extends AbstractHeaderRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isBaseDocumento.test(object) &&
+ whenBaseDocumento
+ .apply(object)
+ .map(documento ->
+ documento.getCliente() != null && documento.getCliente().getTipoDocumentoIdentidad() != null
+ )
+ .orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = document -> {
+ Catalog6 catalog6 = Catalog
+ .valueOfCode(Catalog6.class, document.getCliente().getTipoDocumentoIdentidad())
+ .orElseThrow(Catalog.invalidCatalogValue);
+ document.getCliente().setTipoDocumentoIdentidad(catalog6.getCode());
+ };
+ whenBaseDocumento.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/FechaEmisionRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/FechaEmisionRule.java
new file mode 100644
index 00000000..bbeed6ed
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/FechaEmisionRule.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isBaseDocumento;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenBaseDocumento;
+
+import io.github.project.openubl.xbuilder.content.models.standard.general.BaseDocumento;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.ENRICH)
+public class FechaEmisionRule extends AbstractHeaderRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isBaseDocumento.test(object) &&
+ whenBaseDocumento.apply(object).map(documento -> documento.getFechaEmision() == null).orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = document -> document.setFechaEmision(getRuleContext().getLocalDate());
+ whenBaseDocumento.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/FirmanteRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/FirmanteRule.java
new file mode 100644
index 00000000..0ceddeb4
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/FirmanteRule.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isBaseDocumento;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenBaseDocumento;
+
+import io.github.project.openubl.xbuilder.content.models.common.Firmante;
+import io.github.project.openubl.xbuilder.content.models.standard.general.BaseDocumento;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.ENRICH)
+public class FirmanteRule extends AbstractHeaderRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isBaseDocumento.test(object) &&
+ whenBaseDocumento.apply(object).map(documento -> documento.getProveedor() != null).orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = document -> {
+ if (document.getFirmante() == null) {
+ document.setFirmante(Firmante.builder().build());
+ }
+
+ if (document.getFirmante().getRuc() == null) {
+ document.getFirmante().setRuc(document.getProveedor().getRuc());
+ }
+ if (document.getFirmante().getRazonSocial() == null) {
+ document.getFirmante().setRazonSocial(document.getProveedor().getRazonSocial());
+ }
+ };
+ whenBaseDocumento.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/MonedaRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/MonedaRule.java
new file mode 100644
index 00000000..b9ac1320
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/MonedaRule.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isBaseDocumento;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenBaseDocumento;
+
+import io.github.project.openubl.xbuilder.content.models.standard.general.BaseDocumento;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.ENRICH)
+public class MonedaRule extends AbstractHeaderRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isBaseDocumento.test(object) &&
+ whenBaseDocumento.apply(object).map(documento -> documento.getMoneda() == null).orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = document -> document.setMoneda(getDefaults().getMoneda());
+ whenBaseDocumento.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/ProveedorDireccionRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/ProveedorDireccionRule.java
new file mode 100644
index 00000000..cfc689e0
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/ProveedorDireccionRule.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isBaseDocumento;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenBaseDocumento;
+
+import io.github.project.openubl.xbuilder.content.models.common.Direccion;
+import io.github.project.openubl.xbuilder.content.models.standard.general.BaseDocumento;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.ENRICH)
+public class ProveedorDireccionRule extends AbstractHeaderRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isBaseDocumento.test(object) &&
+ whenBaseDocumento.apply(object).map(documento -> documento.getProveedor() != null).orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = document -> {
+ if (document.getProveedor().getDireccion() == null) {
+ document.getProveedor().setDireccion(Direccion.builder().build());
+ }
+
+ if (document.getProveedor().getDireccion().getCodigoLocal() == null) {
+ document.getProveedor().getDireccion().setCodigoLocal("0000");
+ }
+ };
+ whenBaseDocumento.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/TasaIcbRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/TasaIcbRule.java
new file mode 100644
index 00000000..54fb4c2e
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/TasaIcbRule.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isBaseDocumento;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenBaseDocumento;
+
+import io.github.project.openubl.xbuilder.content.models.standard.general.BaseDocumento;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.ENRICH)
+public class TasaIcbRule extends AbstractHeaderRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isBaseDocumento.test(object) &&
+ whenBaseDocumento.apply(object).map(documento -> documento.getTasaIcb() == null).orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = document -> document.setTasaIcb(getDefaults().getIcbTasa());
+ whenBaseDocumento.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/TasaIgvRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/TasaIgvRule.java
new file mode 100644
index 00000000..6cba9342
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/TasaIgvRule.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isBaseDocumento;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenBaseDocumento;
+
+import io.github.project.openubl.xbuilder.content.models.standard.general.BaseDocumento;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.ENRICH)
+public class TasaIgvRule extends AbstractHeaderRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isBaseDocumento.test(object) &&
+ whenBaseDocumento.apply(object).map(documento -> documento.getTasaIgv() == null).orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = document -> document.setTasaIgv(getDefaults().getIgvTasa());
+ whenBaseDocumento.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/DetraccionRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/DetraccionRule.java
new file mode 100644
index 00000000..b65e3fff
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/DetraccionRule.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.invoice;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isInvoice;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenInvoice;
+
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog52;
+import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.ENRICH)
+public class DetraccionRule extends AbstractHeaderRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isInvoice.test(object) &&
+ whenInvoice.apply(object).map(documento -> documento.getDetraccion() != null).orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = document -> {
+ Catalog52 leyenda = Catalog52.OPERACION_SUJETA_A_DETRACCION;
+
+ Map leyendas = new HashMap<>(document.getLeyendas());
+ leyendas.put(leyenda.getCode(), leyenda.getLabel());
+
+ document.setLeyendas(leyendas);
+ };
+ whenInvoice.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/DireccionDeEntregaRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/DireccionDeEntregaRule.java
new file mode 100644
index 00000000..f53ebf03
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/DireccionDeEntregaRule.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.invoice;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isInvoice;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenInvoice;
+
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog52;
+import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.ENRICH)
+public class DireccionDeEntregaRule extends AbstractHeaderRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isInvoice.test(object) &&
+ whenInvoice.apply(object).map(documento -> documento.getDireccionEntrega() != null).orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = document -> {
+ Catalog52 leyenda = Catalog52.VENTA_REALIZADA_POR_EMISOR_ITINERANTE;
+
+ Map leyendas = new HashMap<>(document.getLeyendas());
+ leyendas.put(leyenda.getCode(), leyenda.getLabel());
+
+ document.setLeyendas(leyendas);
+ };
+ whenInvoice.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/FormaDePagoRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/FormaDePagoRule.java
new file mode 100644
index 00000000..95fae2e6
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/FormaDePagoRule.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.invoice;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isInvoice;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenInvoice;
+
+import io.github.project.openubl.xbuilder.content.models.standard.general.FormaDePago;
+import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.ENRICH)
+public class FormaDePagoRule extends AbstractHeaderRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isInvoice.test(object) &&
+ whenInvoice.apply(object).map(documento -> documento.getFormaDePago() == null).orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = document -> {
+ document.setFormaDePago(FormaDePago.builder().build());
+ };
+ whenInvoice.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/FormaDePagoTipoRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/FormaDePagoTipoRule.java
new file mode 100644
index 00000000..1632b709
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/FormaDePagoTipoRule.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.invoice;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isInvoice;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenInvoice;
+
+import io.github.project.openubl.xbuilder.content.catalogs.CatalogContadoCredito;
+import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.ENRICH)
+public class FormaDePagoTipoRule extends AbstractHeaderRule {
+
+ @Override
+ public boolean test(Object object) {
+ return isInvoice.test(object);
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = document -> {
+ CatalogContadoCredito formaDePagoTipo = document.getFormaDePago().getCuotas() == null ||
+ document.getFormaDePago().getCuotas().isEmpty()
+ ? CatalogContadoCredito.CONTADO
+ : CatalogContadoCredito.CREDITO;
+
+ document.getFormaDePago().setTipo(formaDePagoTipo.getCode());
+ };
+ whenInvoice.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/FormaDePagoTotalRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/FormaDePagoTotalRule.java
new file mode 100644
index 00000000..2ba6acd5
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/FormaDePagoTotalRule.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.invoice;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isInvoice;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenInvoice;
+
+import io.github.project.openubl.xbuilder.content.models.standard.general.CuotaDePago;
+import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.math.BigDecimal;
+import java.util.Objects;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.ENRICH)
+public class FormaDePagoTotalRule extends AbstractHeaderRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isInvoice.test(object) &&
+ whenInvoice
+ .apply(object)
+ .map(documento -> documento.getFormaDePago() != null && documento.getFormaDePago().getCuotas() != null)
+ .orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = document -> {
+ BigDecimal total = document
+ .getFormaDePago()
+ .getCuotas()
+ .stream()
+ .map(CuotaDePago::getImporte)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+
+ document.getFormaDePago().setTotal(total);
+ };
+ whenInvoice.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/PercepcionRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/PercepcionRule.java
new file mode 100644
index 00000000..410339ff
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/PercepcionRule.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.invoice;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isInvoice;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenInvoice;
+
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog52;
+import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.ENRICH)
+public class PercepcionRule extends AbstractHeaderRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isInvoice.test(object) &&
+ whenInvoice.apply(object).map(documento -> documento.getPercepcion() != null).orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = document -> {
+ Catalog52 leyenda = Catalog52.COMPROBANTE_DE_PERCEPCION;
+
+ Map leyendas = new HashMap<>(document.getLeyendas());
+ leyendas.put(leyenda.getCode(), leyenda.getLabel());
+
+ document.setLeyendas(leyendas);
+ };
+ whenInvoice.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/TipoComprobanteRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/TipoComprobanteRule.java
new file mode 100644
index 00000000..1723cb4a
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/TipoComprobanteRule.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.invoice;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isInvoice;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenBaseDocumento;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenInvoice;
+
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog1_Invoice;
+import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.ENRICH)
+public class TipoComprobanteRule extends AbstractHeaderRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isInvoice.test(object) &&
+ whenBaseDocumento.apply(object).map(documento -> documento.getSerie() != null).orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = invoice -> {
+ String newTipoComprobante = null;
+ if (invoice.getSerie().matches("^[F|f].*$")) {
+ newTipoComprobante = Catalog1_Invoice.FACTURA.getCode();
+ } else if (invoice.getSerie().matches("^[B|b].*$")) {
+ newTipoComprobante = Catalog1_Invoice.BOLETA.getCode();
+ }
+
+ invoice.setTipoComprobante(newTipoComprobante);
+ };
+ whenInvoice.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/TipoOperacionRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/TipoOperacionRule.java
new file mode 100644
index 00000000..77c617d9
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/invoice/TipoOperacionRule.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.invoice;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isInvoice;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenInvoice;
+
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog51;
+import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.ENRICH)
+public class TipoOperacionRule extends AbstractHeaderRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isInvoice.test(object) &&
+ whenInvoice.apply(object).map(documento -> documento.getTipoOperacion() == null).orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = invoice -> {
+ String tipoOperacion = null;
+ if (invoice.getTipoOperacion() == null) {
+ if (invoice.getDetraccion() != null) {
+ tipoOperacion = Catalog51.OPERACION_SUJETA_A_DETRACCION.getCode();
+ } else if (invoice.getPercepcion() != null) {
+ tipoOperacion = Catalog51.OPERACION_SUJETA_A_PERCEPCION.getCode();
+ } else {
+ tipoOperacion = Catalog51.VENTA_INTERNA.getCode();
+ }
+ }
+
+ invoice.setTipoOperacion(tipoOperacion);
+ };
+ whenInvoice.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/note/ComprobanteAfectadoTipoRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/note/ComprobanteAfectadoTipoRule.java
new file mode 100644
index 00000000..834a44b8
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/note/ComprobanteAfectadoTipoRule.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.note;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isNote;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenNote;
+
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog1;
+import io.github.project.openubl.xbuilder.content.models.standard.general.BaseDocumentoNota;
+import io.github.project.openubl.xbuilder.content.models.utils.UBLRegex;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.ENRICH)
+public class ComprobanteAfectadoTipoRule extends AbstractHeaderRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isNote.test(object) &&
+ whenNote.apply(object).map(note -> note.getComprobanteAfectadoSerieNumero() != null).orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = note -> {
+ String tipoComprobanteAfectado = null;
+
+ if (UBLRegex.FACTURA_SERIE_REGEX.matcher(note.getSerie()).matches()) {
+ tipoComprobanteAfectado = Catalog1.FACTURA.getCode();
+ } else if (UBLRegex.BOLETA_SERIE_REGEX.matcher(note.getSerie()).matches()) {
+ tipoComprobanteAfectado = Catalog1.BOLETA.getCode();
+ }
+
+ note.setComprobanteAfectadoTipo(tipoComprobanteAfectado);
+ };
+ whenNote.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/note/creditnote/TipoNotaCreditoRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/note/creditnote/TipoNotaCreditoRule.java
new file mode 100644
index 00000000..e6e42e07
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/note/creditnote/TipoNotaCreditoRule.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.note.creditnote;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isCreditNote;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenCreditNote;
+
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog9;
+import io.github.project.openubl.xbuilder.content.models.standard.general.CreditNote;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.ENRICH)
+public class TipoNotaCreditoRule extends AbstractHeaderRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isCreditNote.test(object) &&
+ whenCreditNote.apply(object).map(note -> note.getTipoNota() == null).orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = note -> note.setTipoNota(Catalog9.ANULACION_DE_LA_OPERACION.getCode());
+ whenCreditNote.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/note/debitnote/TipoNotaDebitoRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/note/debitnote/TipoNotaDebitoRule.java
new file mode 100644
index 00000000..17faeb4f
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/enrich/header/note/debitnote/TipoNotaDebitoRule.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.note.debitnote;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isDebitNote;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenDebitNote;
+
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog10;
+import io.github.project.openubl.xbuilder.content.models.standard.general.DebitNote;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.ENRICH)
+public class TipoNotaDebitoRule extends AbstractHeaderRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isDebitNote.test(object) &&
+ whenDebitNote.apply(object).map(note -> note.getTipoNota() == null).orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = note -> note.setTipoNota(Catalog10.AUMENTO_EN_EL_VALOR.getCode());
+ whenDebitNote.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/process/body/detalle/IcbAplicaRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/process/body/detalle/IcbAplicaRule.java
new file mode 100644
index 00000000..ba3fda7c
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/process/body/detalle/IcbAplicaRule.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.process.body.detalle;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isBaseDocumentoDetalle;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenBaseDocumentoDetalle;
+
+import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoDetalle;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractBodyRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.math.BigDecimal;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.PROCESS)
+public class IcbAplicaRule extends AbstractBodyRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isBaseDocumentoDetalle.test(object) &&
+ whenBaseDocumentoDetalle
+ .apply(object)
+ .map(documento ->
+ !documento.isIcbAplica() &&
+ documento.getIcb() != null &&
+ documento.getIcb().compareTo(BigDecimal.ZERO) > 0
+ )
+ .orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = detalle -> {
+ detalle.setIcbAplica(true);
+ };
+ whenBaseDocumentoDetalle.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/process/body/detalle/IcbRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/process/body/detalle/IcbRule.java
new file mode 100644
index 00000000..868b6da9
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/process/body/detalle/IcbRule.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.process.body.detalle;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isBaseDocumentoDetalle;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenBaseDocumentoDetalle;
+
+import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoDetalle;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractBodyRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.math.BigDecimal;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.PROCESS)
+public class IcbRule extends AbstractBodyRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isBaseDocumentoDetalle.test(object) &&
+ whenBaseDocumentoDetalle.apply(object).map(documento -> documento.getIcb() == null).orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = detalle -> {
+ BigDecimal icb = detalle.isIcbAplica()
+ ? detalle.getCantidad().multiply(getRuleContext().getTasaIcb())
+ : BigDecimal.ZERO;
+ detalle.setIcb(icb);
+ };
+ whenBaseDocumentoDetalle.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/process/body/detalle/IgvBaseImponibleRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/process/body/detalle/IgvBaseImponibleRule.java
new file mode 100644
index 00000000..a8382b27
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/process/body/detalle/IgvBaseImponibleRule.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.process.body.detalle;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isBaseDocumentoDetalle;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenBaseDocumentoDetalle;
+
+import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoDetalle;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractBodyRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.math.BigDecimal;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.PROCESS)
+public class IgvBaseImponibleRule extends AbstractBodyRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isBaseDocumentoDetalle.test(object) &&
+ whenBaseDocumentoDetalle
+ .apply(object)
+ .map(documento ->
+ documento.getIgvBaseImponible() == null &&
+ documento.getCantidad() != null &&
+ documento.getPrecio() != null &&
+ documento.getPrecioReferencia() != null
+ )
+ .orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = detalle -> {
+ BigDecimal baseImponible = !detalle.isPrecioConImpuestos()
+ ? detalle.getCantidad().multiply(detalle.getPrecio())
+ : detalle.getCantidad().multiply(detalle.getPrecioReferencia());
+ detalle.setIgvBaseImponible(baseImponible);
+ };
+ whenBaseDocumentoDetalle.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/process/body/detalle/IgvRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/process/body/detalle/IgvRule.java
new file mode 100644
index 00000000..24c8d7d0
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/process/body/detalle/IgvRule.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.process.body.detalle;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isBaseDocumentoDetalle;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenBaseDocumentoDetalle;
+
+import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoDetalle;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractBodyRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.math.BigDecimal;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.PROCESS)
+public class IgvRule extends AbstractBodyRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isBaseDocumentoDetalle.test(object) &&
+ whenBaseDocumentoDetalle
+ .apply(object)
+ .map(documento -> documento.getIgv() == null && documento.getIgvBaseImponible() != null)
+ .orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = detalle -> {
+ BigDecimal igv = detalle.getIgvBaseImponible().multiply(getRuleContext().getTasaIgv());
+ detalle.setIgv(igv);
+ };
+ whenBaseDocumentoDetalle.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/process/body/detalle/PrecioDeReferenciaRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/process/body/detalle/PrecioDeReferenciaRule.java
new file mode 100644
index 00000000..338548a6
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/process/body/detalle/PrecioDeReferenciaRule.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.process.body.detalle;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isBaseDocumentoDetalle;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenBaseDocumentoDetalle;
+
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog;
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog7;
+import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoDetalle;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractBodyRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.PROCESS)
+public class PrecioDeReferenciaRule extends AbstractBodyRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isBaseDocumentoDetalle.test(object) &&
+ whenBaseDocumentoDetalle
+ .apply(object)
+ .map(documento ->
+ documento.getPrecioReferencia() == null &&
+ documento.getPrecio() != null &&
+ documento.getIgvTipo() != null
+ )
+ .orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = detalle -> {
+ Catalog7 catalog7 = Catalog
+ .valueOfCode(Catalog7.class, detalle.getIgvTipo())
+ .orElseThrow(Catalog.invalidCatalogValue);
+
+ BigDecimal precioReferencia;
+ if (detalle.isPrecioConImpuestos()) {
+ precioReferencia =
+ catalog7.isOperacionOnerosa()
+ ? detalle
+ .getPrecio()
+ .divide(getRuleContext().getTasaIgv().add(BigDecimal.ONE), 10, RoundingMode.HALF_EVEN)
+ : detalle.getPrecio();
+ } else {
+ precioReferencia =
+ catalog7.isOperacionOnerosa()
+ ? detalle.getPrecio().multiply(getRuleContext().getTasaIgv().add(BigDecimal.ONE))
+ : detalle.getPrecio();
+ }
+
+ detalle.setPrecioReferencia(precioReferencia);
+ };
+ whenBaseDocumentoDetalle.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/process/body/detalle/TotalImpuestosRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/process/body/detalle/TotalImpuestosRule.java
new file mode 100644
index 00000000..1d6d443e
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/process/body/detalle/TotalImpuestosRule.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.process.body.detalle;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isBaseDocumentoDetalle;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenBaseDocumentoDetalle;
+
+import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoDetalle;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractBodyRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.math.BigDecimal;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.PROCESS)
+public class TotalImpuestosRule extends AbstractBodyRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isBaseDocumentoDetalle.test(object) &&
+ whenBaseDocumentoDetalle
+ .apply(object)
+ .map(documento ->
+ documento.getTotalImpuestos() == null && documento.getIgv() != null && documento.getIcb() != null
+ )
+ .orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = detalle -> {
+ BigDecimal totalImpuestos = detalle.getIgv().add(detalle.getIcb());
+ detalle.setTotalImpuestos(totalImpuestos);
+ };
+ whenBaseDocumentoDetalle.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/process/header/package-info.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/process/header/package-info.java
new file mode 100644
index 00000000..bab4d9e4
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/process/header/package-info.java
@@ -0,0 +1,17 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.process.header;
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/body/package-info.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/body/package-info.java
new file mode 100644
index 00000000..cebdc2fe
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/body/package-info.java
@@ -0,0 +1,17 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.summary.body;
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/header/invoice/DetraccionRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/header/invoice/DetraccionRule.java
new file mode 100644
index 00000000..cd56de98
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/header/invoice/DetraccionRule.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.summary.header.invoice;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isInvoice;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenInvoice;
+
+import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.SUMMARY)
+public class DetraccionRule extends AbstractHeaderRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isInvoice.test(object) &&
+ whenInvoice
+ .apply(object)
+ .map(invoice -> invoice.getTotalImporte() != null && invoice.getDetraccion() != null)
+ .orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = invoice -> {
+ BigDecimal detraccionMonto = invoice
+ .getDetraccion()
+ .getPorcentaje()
+ .multiply(invoice.getTotalImporte().getImporteConImpuestos())
+ .setScale(2, RoundingMode.HALF_EVEN);
+
+ invoice.getDetraccion().setMonto(detraccionMonto);
+ };
+ whenInvoice.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/header/invoice/PercepcionRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/header/invoice/PercepcionRule.java
new file mode 100644
index 00000000..d505d22e
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/header/invoice/PercepcionRule.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.summary.header.invoice;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isInvoice;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenInvoice;
+
+import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice;
+import io.github.project.openubl.xbuilder.content.models.standard.general.Percepcion;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.Optional;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.SUMMARY)
+public class PercepcionRule extends AbstractHeaderRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isInvoice.test(object) &&
+ whenInvoice
+ .apply(object)
+ .map(invoice -> invoice.getPercepcion() != null && invoice.getTotalImporte() != null)
+ .orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = invoice -> {
+ BigDecimal montoBase = invoice.getTotalImporte().getImporteSinImpuestos();
+ BigDecimal porcentaje = Optional.ofNullable(invoice.getPercepcion().getPorcentaje()).orElse(BigDecimal.ONE);
+ BigDecimal monto = montoBase.multiply(porcentaje).setScale(2, RoundingMode.HALF_EVEN);
+ BigDecimal montoTotal = montoBase.add(monto);
+
+ invoice.getPercepcion().setMontoBase(montoBase);
+ invoice.getPercepcion().setPorcentaje(porcentaje);
+ invoice.getPercepcion().setMonto(monto);
+ invoice.getPercepcion().setMontoTotal(montoTotal);
+ };
+ whenInvoice.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/header/invoice/TotalImporteRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/header/invoice/TotalImporteRule.java
new file mode 100644
index 00000000..f937d8e6
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/header/invoice/TotalImporteRule.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.summary.header.invoice;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isInvoice;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenInvoice;
+
+import io.github.project.openubl.xbuilder.content.models.standard.general.Anticipo;
+import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice;
+import io.github.project.openubl.xbuilder.content.models.standard.general.TotalImporteInvoice;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import io.github.project.openubl.xbuilder.enricher.kie.rules.utils.DetalleUtils;
+import java.math.BigDecimal;
+import java.util.Objects;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.SUMMARY)
+public class TotalImporteRule extends AbstractHeaderRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isInvoice.test(object) &&
+ whenInvoice
+ .apply(object)
+ .map(invoice -> invoice.getTotalImporte() == null && invoice.getDetalles() != null)
+ .orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = invoice -> {
+ BigDecimal totalImpuestos = DetalleUtils.getTotalImpuestos(invoice.getDetalles());
+
+ BigDecimal importeSinImpuestos = DetalleUtils.getImporteSinImpuestos(invoice.getDetalles());
+ BigDecimal importeConImpuestos = importeSinImpuestos.add(totalImpuestos);
+
+ BigDecimal anticipos = invoice
+ .getAnticipos()
+ .stream()
+ .map(Anticipo::getMonto)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+
+ BigDecimal importeTotal = importeConImpuestos.subtract(anticipos);
+
+ invoice.setTotalImporte(
+ TotalImporteInvoice
+ .builder()
+ .importeSinImpuestos(importeSinImpuestos)
+ .importeConImpuestos(importeConImpuestos)
+ .anticipos(anticipos)
+ .importe(importeTotal)
+ .build()
+ );
+ };
+ whenInvoice.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/header/invoice/TotalImpuestosRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/header/invoice/TotalImpuestosRule.java
new file mode 100644
index 00000000..45defe49
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/header/invoice/TotalImpuestosRule.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.summary.header.invoice;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isInvoice;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenInvoice;
+
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog;
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog5;
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog53_Anticipo;
+import io.github.project.openubl.xbuilder.content.models.standard.general.Anticipo;
+import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoDetalle;
+import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice;
+import io.github.project.openubl.xbuilder.content.models.standard.general.TotalImpuestos;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import io.github.project.openubl.xbuilder.enricher.kie.rules.utils.DetalleUtils;
+import io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Impuesto;
+import java.math.BigDecimal;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.SUMMARY)
+public class TotalImpuestosRule extends AbstractHeaderRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isInvoice.test(object) &&
+ whenInvoice
+ .apply(object)
+ .map(documento -> documento.getTotalImpuestos() == null && documento.getDetalles() != null)
+ .orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = invoice -> {
+ Impuesto ivap = DetalleUtils.calImpuestoByTipo(invoice.getDetalles(), Catalog5.IMPUESTO_ARROZ_PILADO);
+ Impuesto gravado = DetalleUtils.calImpuestoByTipo(invoice.getDetalles(), Catalog5.IGV);
+ Impuesto inafecto = DetalleUtils.calImpuestoByTipo(invoice.getDetalles(), Catalog5.INAFECTO);
+ Impuesto exonerado = DetalleUtils.calImpuestoByTipo(invoice.getDetalles(), Catalog5.EXONERADO);
+ Impuesto gratuito = DetalleUtils.calImpuestoByTipo(invoice.getDetalles(), Catalog5.GRATUITO);
+
+ BigDecimal icb = invoice
+ .getDetalles()
+ .stream()
+ .map(DocumentoDetalle::getIcb)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+
+ BigDecimal totalAnticiposGravados = invoice
+ .getAnticipos()
+ .stream()
+ .filter(f -> {
+ Optional catalog53_anticipo = Catalog.valueOfCode(
+ Catalog53_Anticipo.class,
+ f.getTipo()
+ );
+ return (
+ catalog53_anticipo.isPresent() &&
+ catalog53_anticipo
+ .get()
+ .equals(
+ Catalog53_Anticipo.DESCUENTO_GLOBAL_POR_ANTICIPOS_GRAVADOS_AFECTA_BASE_IMPONIBLE_IGV_IVAP
+ )
+ );
+ })
+ .map(Anticipo::getMonto)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+ BigDecimal gravadoBaseImponible = gravado.getBaseImponible().subtract(totalAnticiposGravados);
+ BigDecimal gravadoImporte = gravadoBaseImponible.multiply(invoice.getTasaIgv());
+
+ BigDecimal total = ivap.getImporte().add(gravadoImporte).add(icb);
+
+ TotalImpuestos totalImpuestos = TotalImpuestos
+ .builder()
+ .ivapImporte(ivap.getImporte())
+ .ivapBaseImponible(ivap.getBaseImponible())
+ .gravadoImporte(gravadoImporte)
+ .gravadoBaseImponible(gravadoBaseImponible)
+ .inafectoImporte(inafecto.getImporte())
+ .inafectoBaseImponible(inafecto.getBaseImponible())
+ .exoneradoImporte(exonerado.getImporte())
+ .exoneradoBaseImponible(exonerado.getBaseImponible())
+ .gratuitoImporte(gratuito.getImporte())
+ .gratuitoBaseImponible(gratuito.getBaseImponible())
+ .icbImporte(icb)
+ .total(total)
+ .build();
+
+ invoice.setTotalImpuestos(totalImpuestos);
+ };
+ whenInvoice.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/header/note/TotalImporteRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/header/note/TotalImporteRule.java
new file mode 100644
index 00000000..5afb62e5
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/header/note/TotalImporteRule.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.summary.header.note;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isNote;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenNote;
+
+import io.github.project.openubl.xbuilder.content.models.standard.general.BaseDocumentoNota;
+import io.github.project.openubl.xbuilder.content.models.standard.general.TotalImporteNote;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import io.github.project.openubl.xbuilder.enricher.kie.rules.utils.DetalleUtils;
+import java.math.BigDecimal;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.SUMMARY)
+public class TotalImporteRule extends AbstractHeaderRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isNote.test(object) &&
+ whenNote
+ .apply(object)
+ .map(note -> note.getTotalImporte() == null && note.getDetalles() != null)
+ .orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = note -> {
+ BigDecimal importeSinImpuestos = DetalleUtils.getImporteSinImpuestos(note.getDetalles());
+ BigDecimal totalImpuestos = DetalleUtils.getTotalImpuestos(note.getDetalles());
+
+ BigDecimal importe = importeSinImpuestos.add(totalImpuestos);
+
+ note.setTotalImporte(
+ TotalImporteNote.builder().importe(importe).importeSinImpuestos(importeSinImpuestos).build()
+ );
+ };
+ whenNote.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/header/note/TotalImpuestosRule.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/header/note/TotalImpuestosRule.java
new file mode 100644
index 00000000..baff3b29
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/summary/header/note/TotalImpuestosRule.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.summary.header.note;
+
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.isNote;
+import static io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Helpers.whenNote;
+
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog5;
+import io.github.project.openubl.xbuilder.content.models.standard.general.BaseDocumento;
+import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoDetalle;
+import io.github.project.openubl.xbuilder.content.models.standard.general.TotalImpuestos;
+import io.github.project.openubl.xbuilder.enricher.kie.AbstractHeaderRule;
+import io.github.project.openubl.xbuilder.enricher.kie.RulePhase;
+import io.github.project.openubl.xbuilder.enricher.kie.rules.utils.DetalleUtils;
+import io.github.project.openubl.xbuilder.enricher.kie.rules.utils.Impuesto;
+import java.math.BigDecimal;
+import java.util.Objects;
+import java.util.function.Consumer;
+
+@RulePhase(type = RulePhase.PhaseType.SUMMARY)
+public class TotalImpuestosRule extends AbstractHeaderRule {
+
+ @Override
+ public boolean test(Object object) {
+ return (
+ isNote.test(object) &&
+ whenNote
+ .apply(object)
+ .map(documento -> documento.getTotalImpuestos() == null && documento.getDetalles() != null)
+ .orElse(false)
+ );
+ }
+
+ @Override
+ public void modify(Object object) {
+ Consumer consumer = document -> {
+ Impuesto ivap = DetalleUtils.calImpuestoByTipo(document.getDetalles(), Catalog5.IMPUESTO_ARROZ_PILADO);
+ Impuesto gravado = DetalleUtils.calImpuestoByTipo(document.getDetalles(), Catalog5.IGV);
+ Impuesto inafecto = DetalleUtils.calImpuestoByTipo(document.getDetalles(), Catalog5.INAFECTO);
+ Impuesto exonerado = DetalleUtils.calImpuestoByTipo(document.getDetalles(), Catalog5.EXONERADO);
+ Impuesto gratuito = DetalleUtils.calImpuestoByTipo(document.getDetalles(), Catalog5.GRATUITO);
+
+ BigDecimal icb = document
+ .getDetalles()
+ .stream()
+ .map(DocumentoDetalle::getIcb)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+
+ BigDecimal total = ivap.getImporte().add(gravado.getImporte()).add(icb);
+
+ TotalImpuestos totalImpuestos = TotalImpuestos
+ .builder()
+ .ivapImporte(ivap.getImporte())
+ .ivapBaseImponible(ivap.getBaseImponible())
+ .gravadoImporte(gravado.getImporte())
+ .gravadoBaseImponible(gravado.getBaseImponible())
+ .inafectoImporte(inafecto.getImporte())
+ .inafectoBaseImponible(inafecto.getBaseImponible())
+ .exoneradoImporte(exonerado.getImporte())
+ .exoneradoBaseImponible(exonerado.getBaseImponible())
+ .gratuitoImporte(gratuito.getImporte())
+ .gratuitoBaseImponible(gratuito.getBaseImponible())
+ .icbImporte(icb)
+ .total(total)
+ .build();
+
+ document.setTotalImpuestos(totalImpuestos);
+ };
+ whenNote.apply(object).ifPresent(consumer);
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/utils/DetalleUtils.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/utils/DetalleUtils.java
new file mode 100644
index 00000000..8649f284
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/utils/DetalleUtils.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.utils;
+
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog;
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog5;
+import io.github.project.openubl.xbuilder.content.catalogs.Catalog7;
+import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoDetalle;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Objects;
+import java.util.function.Supplier;
+import java.util.stream.Stream;
+
+public class DetalleUtils {
+
+ public static BigDecimal getImporteSinImpuestos(List detalles) {
+ return detalles
+ .stream()
+ .filter(item -> {
+ Catalog7 catalog7 = Catalog
+ .valueOfCode(Catalog7.class, item.getIgvTipo())
+ .orElseThrow(Catalog.invalidCatalogValue);
+ return !catalog7.getTaxCategory().equals(Catalog5.GRATUITO);
+ })
+ .map(DocumentoDetalle::getIgvBaseImponible)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+ }
+
+ public static BigDecimal getTotalImpuestos(List detalles) {
+ return detalles
+ .stream()
+ .filter(detalle -> {
+ Catalog7 catalog7 = Catalog
+ .valueOfCode(Catalog7.class, detalle.getIgvTipo())
+ .orElseThrow(Catalog.invalidCatalogValue);
+ return !catalog7.getTaxCategory().equals(Catalog5.GRATUITO);
+ })
+ .map(DocumentoDetalle::getTotalImpuestos)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+ }
+
+ public static Impuesto calImpuestoByTipo(List detalle, Catalog5 categoria) {
+ Supplier> stream = () ->
+ detalle
+ .stream()
+ .filter($il -> {
+ Catalog7 catalog7 = Catalog
+ .valueOfCode(Catalog7.class, $il.getIgvTipo())
+ .orElseThrow(Catalog.invalidCatalogValue);
+ return catalog7.getTaxCategory().equals(categoria);
+ });
+
+ BigDecimal baseImponible = stream
+ .get()
+ .map(DocumentoDetalle::getIgvBaseImponible)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+ BigDecimal importe = stream
+ .get()
+ .map(DocumentoDetalle::getIgv)
+ .filter(Objects::nonNull)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+
+ return Impuesto.builder().importe(importe).baseImponible(baseImponible).build();
+ }
+}
diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/utils/Helpers.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/utils/Helpers.java
new file mode 100644
index 00000000..57f10264
--- /dev/null
+++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/utils/Helpers.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License - 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.github.project.openubl.xbuilder.enricher.kie.rules.utils;
+
+import io.github.project.openubl.xbuilder.content.models.standard.general.Anticipo;
+import io.github.project.openubl.xbuilder.content.models.standard.general.BaseDocumento;
+import io.github.project.openubl.xbuilder.content.models.standard.general.BaseDocumentoNota;
+import io.github.project.openubl.xbuilder.content.models.standard.general.CreditNote;
+import io.github.project.openubl.xbuilder.content.models.standard.general.DebitNote;
+import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoDetalle;
+import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice;
+import java.util.Optional;
+import java.util.function.Function;
+import java.util.function.Predicate;
+
+public class Helpers {
+
+ public static final Predicate