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 @@ -[![XBuilder](https://raw.githubusercontent.com/project-openubl/xbuilder/master/xbuilder.svg)](https://project-openubl.github.io/) - [![Maven Central](https://img.shields.io/maven-central/v/io.github.project-openubl/xbuilder)](https://search.maven.org/artifact/io.github.project-openubl/xbuilder/) [![License](https://img.shields.io/badge/License-EPL%202.0-green.svg)](https://opensource.org/licenses/EPL-2.0) ![CI](https://github.com/project-openubl/xbuilder/workflows/CI/badge.svg) @@ -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-openubl xbuilder - 1.3.0-SNAPSHOT + 2.0.0-SNAPSHOT XML Builder :: Lib XML Builder Library jar - 1.8 - 1.8 + 11 + 11 UTF-8 UTF-8 2.22.2 + write ${basedir} + 1.18.22 + 2.7.5.Final 2.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.mycila license-maven-plugin - 3.0 + 4.1
tools/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 invalidCatalogValue = (Supplier) () - -> new IllegalStateException("No se pudo convertir el valor del catálogo"); + Supplier 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 isInvoice = o -> o instanceof Invoice; + public static final Predicate isCreditNote = o -> o instanceof CreditNote; + public static final Predicate isDebitNote = o -> o instanceof DebitNote; + public static final Predicate isNote = o -> o instanceof BaseDocumentoNota; + + public static final Predicate isBaseDocumento = isInvoice.or(isCreditNote).or(isDebitNote); + public static final Predicate isBaseDocumentoDetalle = o -> o instanceof DocumentoDetalle; + + public static final Predicate isAnticipo = o -> o instanceof Anticipo; + + public static final Function> whenInvoice = o -> { + if (o instanceof Invoice) { + return Optional.of((Invoice) o); + } + return Optional.empty(); + }; + + public static final Function> whenCreditNote = o -> { + if (o instanceof CreditNote) { + return Optional.of((CreditNote) o); + } + return Optional.empty(); + }; + + public static final Function> whenDebitNote = o -> { + if (o instanceof DebitNote) { + return Optional.of((DebitNote) o); + } + return Optional.empty(); + }; + + public static final Function> whenBaseDocumento = o -> { + if (o instanceof BaseDocumento) { + return Optional.of((BaseDocumento) o); + } + return Optional.empty(); + }; + + public static final Function> whenNote = o -> { + if (o instanceof BaseDocumentoNota) { + return Optional.of((BaseDocumentoNota) o); + } + return Optional.empty(); + }; + + public static final Function> whenBaseDocumentoDetalle = o -> { + if (o instanceof DocumentoDetalle) { + return Optional.of((DocumentoDetalle) o); + } + return Optional.empty(); + }; + + public static final Function> whenAnticipo = o -> { + if (o instanceof Anticipo) { + return Optional.of((Anticipo) o); + } + return Optional.empty(); + }; +} diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/utils/Impuesto.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/utils/Impuesto.java new file mode 100644 index 00000000..8cad3c0d --- /dev/null +++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/rules/utils/Impuesto.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.enricher.kie.rules.utils; + +import java.math.BigDecimal; +import lombok.Builder; +import lombok.Data; + +@Data +@Builder +public class Impuesto { + + private BigDecimal importe; + private BigDecimal baseImponible; +} diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/ruleunits/BodyRuleContext.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/ruleunits/BodyRuleContext.java new file mode 100644 index 00000000..748c70a9 --- /dev/null +++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/ruleunits/BodyRuleContext.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.enricher.kie.ruleunits; + +import io.github.project.openubl.xbuilder.enricher.kie.RuleContext; +import java.math.BigDecimal; +import lombok.Builder; +import lombok.Getter; + +@Getter +@Builder +public class BodyRuleContext implements RuleContext { + + private BigDecimal tasaIgv; + private BigDecimal tasaIcb; +} diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/ruleunits/BodyRuleUnit.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/ruleunits/BodyRuleUnit.java new file mode 100644 index 00000000..c42aeff8 --- /dev/null +++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/ruleunits/BodyRuleUnit.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.ruleunits; + +import io.github.project.openubl.xbuilder.enricher.config.Defaults; +import io.github.project.openubl.xbuilder.enricher.kie.RuleFactory; +import io.github.project.openubl.xbuilder.enricher.kie.RuleFactoryRegistry; +import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; +import io.github.project.openubl.xbuilder.enricher.kie.RuleUnit; +import java.util.List; + +public class BodyRuleUnit implements RuleUnit { + + private final Defaults defaults; + private final BodyRuleContext context; + private final List rules; + + public BodyRuleUnit(RulePhase.PhaseType phaseType, Defaults defaults, BodyRuleContext context) { + this.defaults = defaults; + this.context = context; + this.rules = RuleFactoryRegistry.getRuleFactories(phaseType); + } + + @Override + public void modify(Object object) { + int prevHashCode; + int currentHashCode; + + do { + prevHashCode = object.hashCode(); + rules + .stream() + .filter(factory -> factory.test(object)) + .map(factory -> factory.create(defaults, context)) + .forEach(rule -> rule.modify(object)); + currentHashCode = object.hashCode(); + } while (prevHashCode != currentHashCode); + } +} diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/ruleunits/HeaderRuleContext.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/ruleunits/HeaderRuleContext.java new file mode 100644 index 00000000..25c46442 --- /dev/null +++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/ruleunits/HeaderRuleContext.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.enricher.kie.ruleunits; + +import io.github.project.openubl.xbuilder.enricher.kie.RuleContext; +import java.time.LocalDate; +import lombok.Builder; +import lombok.Getter; + +@Getter +@Builder +public class HeaderRuleContext implements RuleContext { + + private LocalDate localDate; +} diff --git a/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/ruleunits/HeaderRuleUnit.java b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/ruleunits/HeaderRuleUnit.java new file mode 100644 index 00000000..5cde4df2 --- /dev/null +++ b/src/main/java/io/github/project/openubl/xbuilder/enricher/kie/ruleunits/HeaderRuleUnit.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.ruleunits; + +import io.github.project.openubl.xbuilder.enricher.config.Defaults; +import io.github.project.openubl.xbuilder.enricher.kie.RuleFactory; +import io.github.project.openubl.xbuilder.enricher.kie.RuleFactoryRegistry; +import io.github.project.openubl.xbuilder.enricher.kie.RulePhase; +import io.github.project.openubl.xbuilder.enricher.kie.RuleUnit; +import java.util.List; + +public class HeaderRuleUnit implements RuleUnit { + + private final Defaults defaults; + private final HeaderRuleContext context; + private final List rules; + + public HeaderRuleUnit(RulePhase.PhaseType phaseType, Defaults defaults, HeaderRuleContext context) { + this.defaults = defaults; + this.context = context; + this.rules = RuleFactoryRegistry.getRuleFactories(phaseType); + } + + @Override + public void modify(Object object) { + int prevHashCode; + int currentHashCode; + + do { + prevHashCode = object.hashCode(); + rules + .stream() + .filter(factory -> factory.test(object)) + .map(factory -> factory.create(defaults, context)) + .forEach(rule -> rule.modify(object)); + currentHashCode = object.hashCode(); + } while (prevHashCode != currentHashCode); + } +} diff --git a/src/main/java/io/github/project/openubl/xbuilder/renderer/EngineProducer.java b/src/main/java/io/github/project/openubl/xbuilder/renderer/EngineProducer.java new file mode 100644 index 00000000..b481c142 --- /dev/null +++ b/src/main/java/io/github/project/openubl/xbuilder/renderer/EngineProducer.java @@ -0,0 +1,231 @@ +/* + * 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.renderer; + +import io.github.project.openubl.xbuilder.content.catalogs.Catalog; +import io.github.project.openubl.xbuilder.content.catalogs.Catalog7; +import io.quarkus.qute.Engine; +import io.quarkus.qute.HtmlEscaper; +import io.quarkus.qute.ReflectionValueResolver; +import io.quarkus.qute.TemplateLocator.TemplateLocation; +import io.quarkus.qute.ValueResolver; +import io.quarkus.qute.Variant; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.Reader; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.net.URL; +import java.net.URLConnection; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.LocalTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Locale; +import java.util.Optional; + +public class EngineProducer { + + private final List suffixes = List.of("qute.html", "qute.txt", "html", "txt", "xml"); + private final String basePath = "templates/"; + private final Locale defaultLocale = Locale.ENGLISH; + private final Charset defaultCharset = StandardCharsets.UTF_8; + + private final Engine engine = Engine + .builder() + .addDefaults() + .addLocator(this::locate) + .removeStandaloneLines(true) + .addResultMapper(new HtmlEscaper(List.of("text/html", "text/xml", "application/xml", "application/xhtml+xml"))) + .addValueResolver(new ReflectionValueResolver()) + .addValueResolver( + ValueResolver + .builder() + .applyToBaseClass(LocalTime.class) + .applyToName("format") + .resolveSync(ctx -> { + DateTimeFormatter dtf = DateTimeFormatter.ofPattern((String) ctx.getParams().get(0).getLiteral()); + return ((LocalTime) ctx.getBase()).format(dtf); + }) + .build() + ) + .addValueResolver( + ValueResolver + .builder() + .applyToBaseClass(BigDecimal.class) + .applyToName("scale") + .applyToParameters(1) + .resolveSync(ctx -> + ((BigDecimal) ctx.getBase()).setScale( + (Integer) ctx.getParams().get(0).getLiteral(), + RoundingMode.HALF_EVEN + ) + ) + .build() + ) + .addValueResolver( + ValueResolver + .builder() + .applyToBaseClass(BigDecimal.class) + .applyToName("multiply") + .resolveSync(ctx -> + ((BigDecimal) ctx.getBase()).multiply(new BigDecimal((Integer) ctx.getParams().get(0).getLiteral())) + .setScale(2, RoundingMode.HALF_EVEN) + ) + .build() + ) + .addValueResolver( + ValueResolver + .builder() + .applyToBaseClass(Integer.class) + .applyToName("add") + .applyToParameters(1) + .resolveSync(ctx -> (Integer) ctx.getBase() + (Integer) ctx.getParams().get(0).getLiteral()) + .build() + ) + .addValueResolver( + ValueResolver + .builder() + .applyToBaseClass(Integer.class) + .applyToName("format") + .applyToParameters(1) + .resolveSync(ctx -> String.format((String) ctx.getParams().get(0).getLiteral(), ctx.getBase())) + .build() + ) + .addValueResolver( + ValueResolver + .builder() + .applyToBaseClass(String.class) + .applyToName("toCatalog7") + .resolveSync(ctx -> + Catalog.valueOfCode(Catalog7.class, (String) ctx.getBase()).orElseThrow(Catalog.invalidCatalogValue) + ) + .build() + ) + .build(); + + public String getBasePath() { + return basePath; + } + + public Engine getEngine() { + return engine; + } + + private Optional locate(String path) { + URL resource; + String templatePath = basePath + path; + + resource = locatePath(templatePath); + if (resource == null) { + // Try path with suffixes + for (String suffix : suffixes) { + String pathWithSuffix = path + "." + suffix; + templatePath = basePath + pathWithSuffix; + resource = locatePath(templatePath); + if (resource != null) { + break; + } + } + } + if (resource != null) { + return Optional.of(new ResourceTemplateLocation(resource, createVariant(templatePath))); + } + return Optional.empty(); + } + + private URL locatePath(String path) { + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + if (cl == null) { + cl = EngineProducer.class.getClassLoader(); + } + return cl.getResource(path); + } + + private Variant createVariant(String path) { + // Guess the content type from the path + String contentType = getContentType(path); + return new Variant(defaultLocale, defaultCharset, contentType); + } + + private String getContentType(String templatePath) { + String fileName = templatePath; + int slashIdx = fileName.lastIndexOf('/'); + if (slashIdx != -1) { + fileName = fileName.substring(slashIdx, fileName.length()); + } + int dotIdx = fileName.lastIndexOf('.'); + if (dotIdx != -1) { + String suffix = fileName.substring(dotIdx + 1, fileName.length()); + String additionalContentType = URLConnection.getFileNameMap().getContentTypeFor(suffix); + if (additionalContentType != null) { + return additionalContentType; + } + if (suffix.equalsIgnoreCase("json")) { + return Variant.APPLICATION_JSON; + } + String contentType = URLConnection.getFileNameMap().getContentTypeFor(fileName); + if (contentType != null) { + return contentType; + } + } + + return "application/octet-stream"; + } + + private static class ResourceTemplateLocation implements TemplateLocation { + + private final URL resource; + private final Optional variant; + + public ResourceTemplateLocation(URL resource, Variant variant) { + this.resource = resource; + this.variant = Optional.ofNullable(variant); + } + + @Override + public Reader read() { + Charset charset = null; + if (variant.isPresent()) { + charset = variant.get().getCharset(); + } + if (charset == null) { + charset = StandardCharsets.UTF_8; + } + try { + return new InputStreamReader(resource.openStream(), charset); + } catch (IOException e) { + return null; + } + } + + @Override + public Optional getVariant() { + return variant; + } + } + + private static class EngineProducerHolder { + + private static final EngineProducer INSTANCE = new EngineProducer(); + } + + public static EngineProducer getInstance() { + return EngineProducerHolder.INSTANCE; + } +} diff --git a/src/main/java/io/github/project/openubl/xbuilder/renderer/TemplateProducer.java b/src/main/java/io/github/project/openubl/xbuilder/renderer/TemplateProducer.java new file mode 100644 index 00000000..1ae24ebc --- /dev/null +++ b/src/main/java/io/github/project/openubl/xbuilder/renderer/TemplateProducer.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.renderer; + +import io.quarkus.qute.Template; + +public class TemplateProducer { + + public Template getInvoice() { + return EngineProducer.getInstance().getEngine().getTemplate("Renderer/invoice.xml"); + } + + public Template getCreditNote() { + return EngineProducer.getInstance().getEngine().getTemplate("Renderer/creditNote.xml"); + } + + public Template getDebitNote() { + return EngineProducer.getInstance().getEngine().getTemplate("Renderer/debitNote.xml"); + } + + private static class TemplateProducerHolder { + + private static final TemplateProducer INSTANCE = new TemplateProducer(); + } + + public static TemplateProducer getInstance() { + return TemplateProducerHolder.INSTANCE; + } +} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/utils/CertificateDetails.java b/src/main/java/io/github/project/openubl/xbuilder/signature/CertificateDetails.java similarity index 87% rename from src/main/java/io/github/project/openubl/xmlbuilderlib/utils/CertificateDetails.java rename to src/main/java/io/github/project/openubl/xbuilder/signature/CertificateDetails.java index b75278b0..3ee612fc 100644 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/utils/CertificateDetails.java +++ b/src/main/java/io/github/project/openubl/xbuilder/signature/CertificateDetails.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.utils; +package io.github.project.openubl.xbuilder.signature; import java.security.PrivateKey; import java.security.cert.X509Certificate; diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/utils/CertificateDetailsFactory.java b/src/main/java/io/github/project/openubl/xbuilder/signature/CertificateDetailsFactory.java similarity index 77% rename from src/main/java/io/github/project/openubl/xmlbuilderlib/utils/CertificateDetailsFactory.java rename to src/main/java/io/github/project/openubl/xbuilder/signature/CertificateDetailsFactory.java index 00d8d45b..0e17c860 100644 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/utils/CertificateDetailsFactory.java +++ b/src/main/java/io/github/project/openubl/xbuilder/signature/CertificateDetailsFactory.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,15 @@ * 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.signature; import java.io.IOException; import java.io.InputStream; -import java.security.*; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.UnrecoverableEntryException; import java.security.cert.Certificate; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; @@ -27,7 +31,7 @@ public class CertificateDetailsFactory { public static CertificateDetails create(InputStream is, String jksPassword) - throws KeyStoreException, UnrecoverableEntryException, NoSuchAlgorithmException, IOException, CertificateException { + throws KeyStoreException, UnrecoverableEntryException, NoSuchAlgorithmException, IOException, CertificateException { CertificateDetails certDetails = null; boolean isAliasWithPrivateKey = false; @@ -49,7 +53,10 @@ public static CertificateDetails create(InputStream is, String jksPassword) } if (isAliasWithPrivateKey) { - KeyStore.PrivateKeyEntry pkEntry = (KeyStore.PrivateKeyEntry) keyStore.getEntry(alias, new KeyStore.PasswordProtection(jksPassword.toCharArray())); + KeyStore.PrivateKeyEntry pkEntry = (KeyStore.PrivateKeyEntry) keyStore.getEntry( + alias, + new KeyStore.PasswordProtection(jksPassword.toCharArray()) + ); PrivateKey myPrivateKey = pkEntry.getPrivateKey(); // Load certificate chain @@ -62,5 +69,4 @@ public static CertificateDetails create(InputStream is, String jksPassword) return certDetails; } - } diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/xml/XMLSigner.java b/src/main/java/io/github/project/openubl/xbuilder/signature/XMLSigner.java similarity index 70% rename from src/main/java/io/github/project/openubl/xmlbuilderlib/xml/XMLSigner.java rename to src/main/java/io/github/project/openubl/xbuilder/signature/XMLSigner.java index 00ffc196..3f6264e1 100644 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/xml/XMLSigner.java +++ b/src/main/java/io/github/project/openubl/xbuilder/signature/XMLSigner.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,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.github.project.openubl.xmlbuilderlib.xml; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; +package io.github.project.openubl.xbuilder.signature; +import java.io.IOException; +import java.security.InvalidAlgorithmParameterException; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.cert.X509Certificate; +import java.util.Collections; import javax.xml.crypto.MarshalException; -import javax.xml.crypto.dsig.*; +import javax.xml.crypto.dsig.CanonicalizationMethod; +import javax.xml.crypto.dsig.DigestMethod; +import javax.xml.crypto.dsig.Reference; +import javax.xml.crypto.dsig.SignatureMethod; +import javax.xml.crypto.dsig.SignedInfo; +import javax.xml.crypto.dsig.Transform; +import javax.xml.crypto.dsig.XMLSignature; +import javax.xml.crypto.dsig.XMLSignatureException; +import javax.xml.crypto.dsig.XMLSignatureFactory; import javax.xml.crypto.dsig.dom.DOMSignContext; import javax.xml.crypto.dsig.keyinfo.KeyInfo; import javax.xml.crypto.dsig.keyinfo.KeyInfoFactory; @@ -31,31 +39,27 @@ import javax.xml.crypto.dsig.spec.C14NMethodParameterSpec; import javax.xml.crypto.dsig.spec.TransformParameterSpec; import javax.xml.parsers.ParserConfigurationException; -import java.io.IOException; -import java.security.InvalidAlgorithmParameterException; -import java.security.NoSuchAlgorithmException; -import java.security.PrivateKey; -import java.security.cert.X509Certificate; -import java.util.Collections; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; public class XMLSigner { - public static Document signXML( - String text, - String referenceID, - X509Certificate certificate, - PrivateKey privateKey - ) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, XMLSignatureException, MarshalException, IOException, SAXException, ParserConfigurationException { + public static Document signXML(String text, String referenceID, X509Certificate certificate, PrivateKey privateKey) + throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, XMLSignatureException, MarshalException, IOException, SAXException, ParserConfigurationException { Document document = XmlSignatureHelper.convertStringToXMLDocument(text); return signXML(document, referenceID, certificate, privateKey); } public static Document signXML( - Document document, - String referenceID, - X509Certificate certificate, - PrivateKey privateKey - ) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, MarshalException, XMLSignatureException, ParserConfigurationException { + Document document, + String referenceID, + X509Certificate certificate, + PrivateKey privateKey + ) + throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, MarshalException, XMLSignatureException, ParserConfigurationException { addUBLExtensions(document); addUBLExtension(document); Node nodeExtensionContent = addExtensionContent(document); @@ -67,13 +71,24 @@ public static Document signXML( XMLSignatureFactory signatureFactory = XMLSignatureFactory.getInstance("DOM"); - Reference reference = signatureFactory.newReference("", - signatureFactory.newDigestMethod(DigestMethod.SHA1, null), - Collections.singletonList(signatureFactory.newTransform(Transform.ENVELOPED, (TransformParameterSpec) null)), null, null); + Reference reference = signatureFactory.newReference( + "", + signatureFactory.newDigestMethod(DigestMethod.SHA1, null), + Collections.singletonList( + signatureFactory.newTransform(Transform.ENVELOPED, (TransformParameterSpec) null) + ), + null, + null + ); SignedInfo signedInfo = signatureFactory.newSignedInfo( - signatureFactory.newCanonicalizationMethod(CanonicalizationMethod.INCLUSIVE, (C14NMethodParameterSpec) null), - signatureFactory.newSignatureMethod(SignatureMethod.RSA_SHA1, null), Collections.singletonList(reference)); + signatureFactory.newCanonicalizationMethod( + CanonicalizationMethod.INCLUSIVE, + (C14NMethodParameterSpec) null + ), + signatureFactory.newSignatureMethod(SignatureMethod.RSA_SHA1, null), + Collections.singletonList(reference) + ); KeyInfoFactory keyInfoFactory = signatureFactory.getKeyInfoFactory(); X509Data xdata = keyInfoFactory.newX509Data(Collections.singletonList(certificate)); @@ -115,5 +130,4 @@ private static Node addExtensionContent(Document document) { } return nodeExtensionContent; } - } diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/xml/XmlSignatureHelper.java b/src/main/java/io/github/project/openubl/xbuilder/signature/XmlSignatureHelper.java similarity index 86% rename from src/main/java/io/github/project/openubl/xmlbuilderlib/xml/XmlSignatureHelper.java rename to src/main/java/io/github/project/openubl/xbuilder/signature/XmlSignatureHelper.java index 6db8dca6..b51c40b9 100644 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/xml/XmlSignatureHelper.java +++ b/src/main/java/io/github/project/openubl/xbuilder/signature/XmlSignatureHelper.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,8 +14,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.github.project.openubl.xmlbuilderlib.xml; +package io.github.project.openubl.xbuilder.signature; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.io.StringReader; +import javax.xml.XMLConstants; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.validation.Schema; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.bootstrap.DOMImplementationRegistry; @@ -25,16 +34,6 @@ import org.xml.sax.InputSource; import org.xml.sax.SAXException; -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.validation.Schema; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.StringReader; - public class XmlSignatureHelper { private XmlSignatureHelper() { @@ -45,7 +44,8 @@ public static DocumentBuilder newDocumentBuilder(Boolean disallowDoctypeDecl) th return newDocumentBuilder(disallowDoctypeDecl, null); } - public static DocumentBuilder newDocumentBuilder(Boolean disallowDoctypeDecl, Schema schema) throws ParserConfigurationException { + public static DocumentBuilder newDocumentBuilder(Boolean disallowDoctypeDecl, Schema schema) + throws ParserConfigurationException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); dbf.setValidating(false); @@ -63,15 +63,21 @@ public static DocumentBuilder newDocumentBuilder(Boolean disallowDoctypeDecl, Sc return dbf.newDocumentBuilder(); } - public static void transformNonTextNodeToOutputStream(Node node, OutputStream os, boolean omitXmlDeclaration, String encoding) - throws Exception { //NOPMD + public static void transformNonTextNodeToOutputStream( + Node node, + OutputStream os, + boolean omitXmlDeclaration, + String encoding + ) throws Exception { //NOPMD // previously we used javax.xml.transform.Transformer, however the JDK xalan implementation did not work correctly with a specified encoding // therefore we switched to DOMImplementationLS if (encoding == null) { encoding = "UTF-8"; } DOMImplementationRegistry domImplementationRegistry = DOMImplementationRegistry.newInstance(); - DOMImplementationLS domImplementationLS = (DOMImplementationLS) domImplementationRegistry.getDOMImplementation("LS"); + DOMImplementationLS domImplementationLS = (DOMImplementationLS) domImplementationRegistry.getDOMImplementation( + "LS" + ); LSOutput lsOutput = domImplementationLS.createLSOutput(); lsOutput.setEncoding(encoding); lsOutput.setByteStream(os); @@ -86,11 +92,11 @@ public static byte[] getBytesFromDocument(Document outputDoc) throws Exception { return outStream.toByteArray(); } - public static Document convertStringToXMLDocument(String xmlString) throws ParserConfigurationException, IOException, SAXException { + public static Document convertStringToXMLDocument(String xmlString) + throws ParserConfigurationException, IOException, SAXException { //API to obtain DOM Document instance DocumentBuilder builder = XmlSignatureHelper.newDocumentBuilder(true); //Parse the content to Document object return builder.parse(new InputSource(new StringReader(xmlString))); } - } diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/clock/SystemClockSingleton.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/clock/SystemClockSingleton.java deleted file mode 100644 index 5ca4dd8a..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/clock/SystemClockSingleton.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.clock; - -import java.util.Calendar; -import java.util.TimeZone; - -public class SystemClockSingleton { - - private static SystemClockSingleton instance; - - private final SystemClock clock; - - private SystemClockSingleton() { - clock = new SystemClock() { - @Override - public TimeZone getTimeZone() { - return TimeZone.getTimeZone("America/Lima"); - } - - @Override - public Calendar getCalendarInstance() { - return Calendar.getInstance(); - } - }; - } - - public static SystemClockSingleton getInstance() { - if (instance == null) { - synchronized (SystemClockSingleton.class) { - if (instance == null) { - instance = new SystemClockSingleton(); - } - } - } - return instance; - } - - public SystemClock getClock() { - return clock; - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/config/Config.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/config/Config.java deleted file mode 100644 index dc79b260..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/config/Config.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.config; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog10; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog7; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog9; - -import java.math.BigDecimal; - -public interface Config { - - BigDecimal getIgv(); - - BigDecimal getIvap(); - - String getDefaultMoneda(); - - String getDefaultUnidadMedida(); - - Catalog9 getDefaultTipoNotaCredito(); - - Catalog10 getDefaultTipoNotaDebito(); - - BigDecimal getDefaultIcb(); - - Catalog7 getDefaultTipoIgv(); - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/config/DefaultConfig.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/config/DefaultConfig.java deleted file mode 100644 index 3279f737..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/config/DefaultConfig.java +++ /dev/null @@ -1,119 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.config; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog10; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog7; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog9; - -import java.math.BigDecimal; - -public class DefaultConfig implements Config { - - private BigDecimal igv; - private BigDecimal ivap; - private String defaultMoneda; - private String defaultUnidadMedida; - private Catalog9 defaultTipoNotaCredito; - private Catalog10 defaultTipoNotaDebito; - private BigDecimal defaultIcb; - private Catalog7 defaultTipoIgv; - - public DefaultConfig() { - this.defaultMoneda = "PEN"; - this.defaultUnidadMedida = "NIU"; - this.igv = new BigDecimal("0.18"); - this.ivap = new BigDecimal("0.04"); - this.defaultIcb = new BigDecimal("0.2"); - this.defaultTipoNotaCredito = Catalog9.ANULACION_DE_LA_OPERACION; - this.defaultTipoNotaDebito = Catalog10.AUMENTO_EN_EL_VALOR; - this.defaultTipoIgv = Catalog7.GRAVADO_OPERACION_ONEROSA; - } - - @Override - public BigDecimal getIgv() { - return igv; - } - - @Override - public BigDecimal getIvap() { - return ivap; - } - - @Override - public String getDefaultMoneda() { - return defaultMoneda; - } - - @Override - public String getDefaultUnidadMedida() { - return defaultUnidadMedida; - } - - @Override - public Catalog9 getDefaultTipoNotaCredito() { - return defaultTipoNotaCredito; - } - - @Override - public Catalog10 getDefaultTipoNotaDebito() { - return defaultTipoNotaDebito; - } - - @Override - public BigDecimal getDefaultIcb() { - return defaultIcb; - } - - @Override - public Catalog7 getDefaultTipoIgv() { - return defaultTipoIgv; - } - - public void setIgv(BigDecimal igv) { - this.igv = igv; - } - - public void setIvap(BigDecimal ivap) { - this.ivap = ivap; - } - - public void setDefaultMoneda(String defaultMoneda) { - this.defaultMoneda = defaultMoneda; - } - - public void setDefaultUnidadMedida(String defaultUnidadMedida) { - this.defaultUnidadMedida = defaultUnidadMedida; - } - - public void setDefaultTipoNotaCredito(Catalog9 defaultTipoNotaCredito) { - this.defaultTipoNotaCredito = defaultTipoNotaCredito; - } - - public void setDefaultTipoNotaDebito(Catalog10 defaultTipoNotaDebito) { - this.defaultTipoNotaDebito = defaultTipoNotaDebito; - } - - public void setDefaultIcb(BigDecimal defaultIcb) { - this.defaultIcb = defaultIcb; - } - - public void setDefaultTipoIgv(Catalog7 defaultTipoIgv) { - this.defaultTipoIgv = defaultTipoIgv; - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/facade/DocumentManager.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/facade/DocumentManager.java deleted file mode 100644 index f73132a9..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/facade/DocumentManager.java +++ /dev/null @@ -1,160 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.facade; - -import io.github.project.openubl.xmlbuilderlib.clock.SystemClock; -import io.github.project.openubl.xmlbuilderlib.clock.SystemClockSingleton; -import io.github.project.openubl.xmlbuilderlib.config.Config; -import io.github.project.openubl.xmlbuilderlib.freemarker.FreemarkerExecutor; -import io.github.project.openubl.xmlbuilderlib.hibernate.validator.ValidatorSingleton; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.CompleteValidation; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.invoice.InvoiceInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.note.creditNote.CreditNoteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.note.debitNote.DebitNoteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.sunat.PerceptionInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.sunat.RetentionInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.sunat.SummaryDocumentInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.sunat.VoidedDocumentInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.invoice.InvoiceOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.note.creditNote.CreditNoteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.note.debitNote.DebitNoteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.sunat.PerceptionOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.sunat.RetentionOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.sunat.SummaryDocumentOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.sunat.VoidedDocumentOutputModel; -import io.github.project.openubl.xmlbuilderlib.utils.InputToOutput; - -import javax.validation.ConstraintViolation; -import javax.validation.ConstraintViolationException; -import javax.validation.Validator; -import java.util.Set; - -public class DocumentManager { - - private DocumentManager() { - // Only static methods - } - - private static SystemClock getDefaultSystemClock() { - return SystemClockSingleton.getInstance().getClock(); - } - - private static void validateInput(Object input) { - Validator validator = ValidatorSingleton.getInstance().getValidator(); - Set> violations = validator.validate(input, CompleteValidation.class); - if (!violations.isEmpty()) { - throw new ConstraintViolationException(violations); - } - } - - public static DocumentWrapper createXML(InvoiceInputModel input, Config config) { - validateInput(input); - InvoiceOutputModel output = InputToOutput.toOutput(input, config, getDefaultSystemClock()); - String xml = FreemarkerExecutor.createXML(output); - return new DocumentWrapper<>(xml, output); - } - - public static DocumentWrapper createXML(InvoiceInputModel input, Config config, SystemClock systemClock) { - validateInput(input); - InvoiceOutputModel output = InputToOutput.toOutput(input, config, systemClock); - String xml = FreemarkerExecutor.createXML(output); - return new DocumentWrapper<>(xml, output); - } - - public static DocumentWrapper createXML(CreditNoteInputModel input, Config config) { - validateInput(input); - CreditNoteOutputModel output = InputToOutput.toOutput(input, config, getDefaultSystemClock()); - String xml = FreemarkerExecutor.createXML(output); - return new DocumentWrapper<>(xml, output); - } - - public static DocumentWrapper createXML(CreditNoteInputModel input, Config config, SystemClock systemClock) { - validateInput(input); - CreditNoteOutputModel output = InputToOutput.toOutput(input, config, systemClock); - String xml = FreemarkerExecutor.createXML(output); - return new DocumentWrapper<>(xml, output); - } - - public static DocumentWrapper createXML(DebitNoteInputModel input, Config config) { - validateInput(input); - DebitNoteOutputModel output = InputToOutput.toOutput(input, config, getDefaultSystemClock()); - String xml = FreemarkerExecutor.createXML(output); - return new DocumentWrapper<>(xml, output); - } - - public static DocumentWrapper createXML(DebitNoteInputModel input, Config config, SystemClock systemClock) { - DebitNoteOutputModel output = InputToOutput.toOutput(input, config, systemClock); - String xml = FreemarkerExecutor.createXML(output); - return new DocumentWrapper<>(xml, output); - } - - public static DocumentWrapper createXML(VoidedDocumentInputModel input, Config config) { - validateInput(input); - VoidedDocumentOutputModel output = InputToOutput.toOutput(input, config, getDefaultSystemClock()); - String xml = FreemarkerExecutor.createXML(output); - return new DocumentWrapper<>(xml, output); - } - - public static DocumentWrapper createXML(VoidedDocumentInputModel input, Config config, SystemClock systemClock) { - validateInput(input); - VoidedDocumentOutputModel output = InputToOutput.toOutput(input, config, systemClock); - String xml = FreemarkerExecutor.createXML(output); - return new DocumentWrapper<>(xml, output); - } - - public static DocumentWrapper createXML(SummaryDocumentInputModel input, Config config) { - validateInput(input); - SummaryDocumentOutputModel output = InputToOutput.toOutput(input, config, getDefaultSystemClock()); - String xml = FreemarkerExecutor.createXML(output); - return new DocumentWrapper<>(xml, output); - } - - public static DocumentWrapper createXML(SummaryDocumentInputModel input, Config config, SystemClock systemClock) { - validateInput(input); - SummaryDocumentOutputModel output = InputToOutput.toOutput(input, config, systemClock); - String xml = FreemarkerExecutor.createXML(output); - return new DocumentWrapper<>(xml, output); - } - - public static DocumentWrapper createXML(PerceptionInputModel input, Config config) { - validateInput(input); - PerceptionOutputModel output = InputToOutput.toOutput(input, config, getDefaultSystemClock()); - String xml = FreemarkerExecutor.createXML(output); - return new DocumentWrapper<>(xml, output); - } - - public static DocumentWrapper createXML(PerceptionInputModel input, Config config, SystemClock systemClock) { - validateInput(input); - PerceptionOutputModel output = InputToOutput.toOutput(input, config, systemClock); - String xml = FreemarkerExecutor.createXML(output); - return new DocumentWrapper<>(xml, output); - } - - public static DocumentWrapper createXML(RetentionInputModel input, Config config) { - validateInput(input); - RetentionOutputModel output = InputToOutput.toOutput(input, config, getDefaultSystemClock()); - String xml = FreemarkerExecutor.createXML(output); - return new DocumentWrapper<>(xml, output); - } - - public static DocumentWrapper createXML(RetentionInputModel input, Config config, SystemClock systemClock) { - validateInput(input); - RetentionOutputModel output = InputToOutput.toOutput(input, config, systemClock); - String xml = FreemarkerExecutor.createXML(output); - return new DocumentWrapper<>(xml, output); - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/DocumentLineOutputModelFactory.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/DocumentLineOutputModelFactory.java deleted file mode 100644 index cdc6bcc2..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/DocumentLineOutputModelFactory.java +++ /dev/null @@ -1,203 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.factory; - -import io.github.project.openubl.xmlbuilderlib.clock.SystemClock; -import io.github.project.openubl.xmlbuilderlib.config.Config; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.*; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentLineInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.*; - -import java.math.BigDecimal; -import java.math.RoundingMode; - -public class DocumentLineOutputModelFactory { - - private DocumentLineOutputModelFactory() { - // Only static methods - } - - public static DocumentLineOutputModel getDocumentLineOutput(DocumentLineInputModel input, Config config, SystemClock systemClock) { - DocumentLineOutputModel.Builder builder = DocumentLineOutputModel.Builder.aDocumentLineOutputModel() - .withDescripcion(input.getDescripcion()) - .withUnidadMedida(input.getUnidadMedida() != null ? input.getUnidadMedida() : config.getDefaultUnidadMedida()) - .withCantidad(input.getCantidad()) - .withPrecioUnitario(input.getPrecioUnitario()) - .withPrecioConIgv(input.getPrecioConIgv()); - - // Impuestos - DocumentLineImpuestosOutputModel impuestosOutput; - if (input.getPrecioUnitario() != null) { - impuestosOutput = getDocumentLineImpuestosOutput_LeftRight(input, config, systemClock); - } else if (input.getPrecioConIgv() != null) { - impuestosOutput = getDocumentLineImpuestosOutput_RightLeft(input, config, systemClock); - } else { - throw new IllegalStateException("Precio con impuestos y/o sin impuestos no encontrado, no se pueden calcular los impuestos"); - } - builder.withImpuestos(impuestosOutput); - - // Precio con/sin impuestos - BigDecimal precioUnitario; - BigDecimal precioConIgv; - BigDecimal valorVentaSinImpuestos; - - if (input.getPrecioUnitario() != null) { - precioUnitario = input.getPrecioUnitario(); - precioConIgv = input.getPrecioUnitario().multiply(input.getCantidad()) - .add(impuestosOutput.getIgv().getImporte()) - .divide(input.getCantidad(), 2, RoundingMode.HALF_EVEN); - - // Valor de venta (sin impuestos) - valorVentaSinImpuestos = precioUnitario.multiply(input.getCantidad()) - .setScale(2, RoundingMode.HALF_EVEN); - } else if (input.getPrecioConIgv() != null) { - precioUnitario = input.getPrecioConIgv().multiply(input.getCantidad()) - .subtract(impuestosOutput.getIgv().getImporte()) - .divide(input.getCantidad(), 2, RoundingMode.HALF_EVEN); - precioConIgv = input.getPrecioConIgv(); - - // Valor de venta (sin impuestos) - valorVentaSinImpuestos = precioConIgv.multiply(input.getCantidad()) - .subtract(impuestosOutput.getIgv().getImporte()) - .setScale(2, RoundingMode.HALF_EVEN); - } else { - throw new IllegalStateException("Precio con impuestos y/o sin impuestos no encontrado, no se pueden calcular el precion con impuestos"); - } - - builder.withPrecioConIgv(precioConIgv) - .withPrecioUnitario( - // Trick to make 0 - impuestosOutput.getIgv().getTipo().isOperacionOnerosa() ? precioUnitario : BigDecimal.ZERO - ); - - // Valor de venta (sin impuestos) - builder.withValorVentaSinImpuestos(valorVentaSinImpuestos); - - // Precio de referencia - builder.withPrecioDeReferencia(DocumentLinePrecioReferenciaOutputModel.Builder.aDetallePrecioReferenciaOutputModel() - .withPrecio( - impuestosOutput.getIgv().getTipo().isOperacionOnerosa() - ? precioConIgv - : precioUnitario - ) - .withTipoPrecio( - impuestosOutput.getIgv().getTipo().isOperacionOnerosa() - ? Catalog16.PRECIO_UNITARIO_INCLUYE_IGV - : Catalog16.VALOR_FERENCIAL_UNITARIO_EN_OPERACIONES_NO_ONEROSAS - ) - .build() - ); - - return builder.build(); - } - - private static DocumentLineImpuestosOutputModel getDocumentLineImpuestosOutput_LeftRight(DocumentLineInputModel input, Config config, SystemClock systemClock) { - DocumentLineImpuestosOutputModel.Builder builder = DocumentLineImpuestosOutputModel.Builder.aDocumentLineImpuestosOutputModel(); - - - BigDecimal subtotal = input.getCantidad().multiply(input.getPrecioUnitario()).setScale(2, RoundingMode.HALF_EVEN); - - // IGV - Catalog7 igvTipo = input.getTipoIgv() != null - ? Catalog.valueOfCode(Catalog7.class, input.getTipoIgv()).orElseThrow(Catalog.invalidCatalogValue) - : config.getDefaultTipoIgv(); - - BigDecimal igvValor; - if (igvTipo.getGrupo().equals(Catalog7_1.GRAVADO)) { - igvValor = igvTipo.equals(Catalog7.GRAVADO_IVAP) ? config.getIvap() : config.getIgv(); - } else { - igvValor = BigDecimal.ZERO; - } - - BigDecimal igvBaseImponible = subtotal.add(BigDecimal.ZERO); // Just to copy value - BigDecimal igvImporte = igvBaseImponible.multiply(igvValor).setScale(2, RoundingMode.HALF_EVEN); - - builder.withIgv(ImpuestoDetalladoIGVOutputModel.Builder.anImpuestoDetalladoIGVOutputModel() - .withTipo(igvTipo) - .withCategoria(igvTipo.getTaxCategory()) - .withBaseImponible(igvBaseImponible) - .withImporte(igvImporte) - .withPorcentaje(igvValor.multiply(new BigDecimal("100"))) - .build() - ); - - // ICB - BigDecimal icbImporte = BigDecimal.ZERO; - if (input.isIcb()) { - BigDecimal icbValor = config.getDefaultIcb(); - icbImporte = input.getCantidad().multiply(icbValor).setScale(2, RoundingMode.HALF_EVEN); - - builder.withIcb(ImpuestoDetalladoICBOutputModel.Builder.anImpuestoDetalladoICBOutputModel() - .withCategoria(Catalog5.ICBPER) - .withIcbValor(icbValor) - .withImporte(icbImporte) - .build()); - } - - return builder.withImporteTotal( - igvImporte.add(icbImporte) - ).build(); - } - - private static DocumentLineImpuestosOutputModel getDocumentLineImpuestosOutput_RightLeft(DocumentLineInputModel input, Config config, SystemClock systemClock) { - DocumentLineImpuestosOutputModel.Builder builder = DocumentLineImpuestosOutputModel.Builder.aDocumentLineImpuestosOutputModel(); - - - BigDecimal total = input.getCantidad().multiply(input.getPrecioConIgv()).setScale(2, RoundingMode.HALF_EVEN); - - // ICB - BigDecimal icbImporte = BigDecimal.ZERO; - if (input.isIcb()) { - BigDecimal icbValor = config.getDefaultIcb(); - icbImporte = input.getCantidad().multiply(icbValor).setScale(2, RoundingMode.HALF_EVEN); - - builder.withIcb(ImpuestoDetalladoICBOutputModel.Builder.anImpuestoDetalladoICBOutputModel() - .withCategoria(Catalog5.ICBPER) - .withIcbValor(icbValor) - .withImporte(icbImporte) - .build()); - } - - // IGV - Catalog7 igvTipo = input.getTipoIgv() != null - ? Catalog.valueOfCode(Catalog7.class, input.getTipoIgv()).orElseThrow(Catalog.invalidCatalogValue) - : config.getDefaultTipoIgv(); - - BigDecimal igvValor; - if (igvTipo.getGrupo().equals(Catalog7_1.GRAVADO)) { - igvValor = igvTipo.equals(Catalog7.GRAVADO_IVAP) ? config.getIvap() : config.getIgv(); - } else { - igvValor = BigDecimal.ZERO; - } - - BigDecimal igvBaseImponible = total.divide(igvValor.add(BigDecimal.ONE), 2, RoundingMode.HALF_EVEN); - BigDecimal igvImporte = total.subtract(igvBaseImponible); - - builder.withIgv(ImpuestoDetalladoIGVOutputModel.Builder.anImpuestoDetalladoIGVOutputModel() - .withTipo(igvTipo) - .withCategoria(igvTipo.getTaxCategory()) - .withBaseImponible(igvBaseImponible) - .withImporte(igvImporte) - .withPorcentaje(igvValor.multiply(new BigDecimal("100"))) - .build() - ); - - return builder.withImporteTotal( - igvImporte.add(icbImporte) - ).build(); - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/InvoiceAndNoteOutputModelFactory.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/InvoiceAndNoteOutputModelFactory.java deleted file mode 100644 index 80476e2e..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/InvoiceAndNoteOutputModelFactory.java +++ /dev/null @@ -1,342 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.factory; - -import io.github.project.openubl.xmlbuilderlib.clock.SystemClock; -import io.github.project.openubl.xmlbuilderlib.config.Config; -import io.github.project.openubl.xmlbuilderlib.factory.common.ClienteOutputModelFactory; -import io.github.project.openubl.xmlbuilderlib.factory.common.FirmanteOutputModelFactory; -import io.github.project.openubl.xmlbuilderlib.factory.common.FormaPagoOutputModelFactory; -import io.github.project.openubl.xmlbuilderlib.factory.common.ProveedorOutputModelFactory; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.*; -import io.github.project.openubl.xmlbuilderlib.models.input.common.CuotaDePagoInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.invoice.InvoiceInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.note.NoteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.note.creditNote.CreditNoteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.note.debitNote.DebitNoteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.FormaPagoOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.*; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.invoice.AnticipoOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.invoice.InvoiceOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.note.NoteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.note.creditNote.CreditNoteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.note.debitNote.DebitNoteOutputModel; - -import java.math.BigDecimal; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.TimeZone; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static io.github.project.openubl.xmlbuilderlib.utils.DateUtils.toGregorianCalendarDate; -import static io.github.project.openubl.xmlbuilderlib.utils.DateUtils.toGregorianCalendarTime; - -public class InvoiceAndNoteOutputModelFactory { - - private InvoiceAndNoteOutputModelFactory() { - // Only static methods - } - - public static InvoiceOutputModel getInvoiceOutput(InvoiceInputModel input, Config config, SystemClock systemClock) { - InvoiceOutputModel.Builder builder = InvoiceOutputModel.Builder.anInvoiceOutputModel(); - - if (input.getSerie().matches("^[F|b].*$")) { - builder.withTipoInvoice(Catalog1.FACTURA); - } else if (input.getSerie().matches("^[B|b].*$")) { - builder.withTipoInvoice(Catalog1.BOLETA); - } else { - throw new IllegalStateException("Invalid Serie"); - } - - enrichDocument(input, builder, config, systemClock); - - // Forma de pago - InvoiceOutputModel tmpOutput = builder.build(); - builder.withFormaPago(getFormaPago( - input.getCuotasDePago(), tmpOutput.getTotales(), systemClock.getTimeZone() - )); - - // Anticipos - builder.withAnticipos(input.getAnticipos() != null ? - input.getAnticipos().stream() - .map(anticipoInput -> { - AnticipoOutputModel anticipoOutput = new AnticipoOutputModel(); - anticipoOutput.setSerieNumero(anticipoInput.getSerieNumero()); - anticipoOutput.setTipoDocumento(Catalog.valueOfCode(Catalog12.class, anticipoInput.getTipoDocumento()).orElseThrow(Catalog.invalidCatalogValue)); - anticipoOutput.setMontoTotal(anticipoInput.getMontoTotal()); - return anticipoOutput; - }) - .collect(Collectors.toList()) - : Collections.emptyList() - ); - - InvoiceOutputModel tempOut = builder.build(); - BigDecimal anticiposTotal = tempOut.getAnticipos().stream().map(AnticipoOutputModel::getMontoTotal).reduce(BigDecimal.ZERO, BigDecimal::add); - if (anticiposTotal.compareTo(BigDecimal.ZERO) > 0) { - builder.withTotales( - DocumentMonetaryTotalOutputModel.Builder.aDocumentMonetaryTotalOutputModel() - .withValorVentaSinImpuestos(tempOut.getTotales().getValorVentaSinImpuestos()) - .withValorVentaConImpuestos(tempOut.getTotales().getValorVentaConImpuestos()) - .withAnticiposTotal(anticiposTotal) - .withImporteTotal(tempOut.getTotales().getImporteTotal().subtract(anticiposTotal)) - .build() - ); - } - - return builder.build(); - } - - public static CreditNoteOutputModel getCreditNoteOutput(CreditNoteInputModel input, Config config, SystemClock systemClock) { - CreditNoteOutputModel.Builder builder = CreditNoteOutputModel.Builder.aCreditNoteOutputModel() - .withTipoNota( - input.getTipoNota() != null - ? Catalog.valueOfCode(Catalog9.class, input.getTipoNota()).orElseThrow(Catalog.invalidCatalogValue) - : config.getDefaultTipoNotaCredito() - ); - - enrichNote(input, builder); - enrichDocument(input, builder, config, systemClock); - - // Forma de pago - CreditNoteOutputModel tmpOutput = builder.build(); - builder.withFormaPago(getFormaPago( - input.getCuotasDePago(), tmpOutput.getTotales(), systemClock.getTimeZone() - )); - - return builder.build(); - } - - public static DebitNoteOutputModel getDebitNoteOutput(DebitNoteInputModel input, Config config, SystemClock systemClock) { - DebitNoteOutputModel.Builder builder = DebitNoteOutputModel.Builder.aDebitNoteOutputModel() - .withTipoNota( - input.getTipoNota() != null - ? Catalog.valueOfCode(Catalog10.class, input.getTipoNota()).orElseThrow(Catalog.invalidCatalogValue) - : config.getDefaultTipoNotaDebito() - ); - - enrichNote(input, builder); - enrichDocument(input, builder, config, systemClock); - return builder.build(); - } - - // Enrich - - private static void enrichDocument(DocumentInputModel input, DocumentOutputModel.Builder builder, Config config, SystemClock systemClock) { - builder.withMoneda(config.getDefaultMoneda()) - .withSerieNumero(input.getSerie().toUpperCase() + "-" + input.getNumero()); - - // Fecha y hora de emision - long fechaEmision = input.getFechaEmision() != null ? input.getFechaEmision() : systemClock.getCalendarInstance().getTimeInMillis(); - builder.withFechaEmision(toGregorianCalendarDate(fechaEmision, systemClock.getTimeZone())) - .withHoraEmision(toGregorianCalendarTime(fechaEmision, systemClock.getTimeZone())); - - // Proveedor - builder.withProveedor(ProveedorOutputModelFactory.getProveedor(input.getProveedor())); - - // Cliente - builder.withCliente(ClienteOutputModelFactory.getCliente(input.getCliente())); - - // Firmante - builder.withFirmante( - input.getFirmante() != null - ? FirmanteOutputModelFactory.getFirmante(input.getFirmante()) - : FirmanteOutputModelFactory.getFirmante(input.getProveedor()) - ); - - // Guias de remisión relacionadas - builder.withGuiasRemisionRelacionadas(input.getGuiasRemisionRelacionadas() != null ? - input.getGuiasRemisionRelacionadas().stream() - .map(guiaRemisionInput -> { - GuiaRemisionRelacionadaOutputModel guiaRemisionOutput = new GuiaRemisionRelacionadaOutputModel(); - guiaRemisionOutput.setSerieNumero(guiaRemisionInput.getSerieNumero()); - guiaRemisionOutput.setTipoDocumento(Catalog.valueOfCode(Catalog1_Guia.class, guiaRemisionInput.getTipoDocumento()).orElseThrow(Catalog.invalidCatalogValue)); - return guiaRemisionOutput; - }) - .collect(Collectors.toList()) - : Collections.emptyList() - ); - - // Otros documentos tributarios relacionados - builder.withOtrosDocumentosTributariosRelacionados(input.getOtrosDocumentosTributariosRelacionados() != null ? - input.getOtrosDocumentosTributariosRelacionados().stream() - .map(docInput -> { - DocumentoTributarioRelacionadoOutputModel docOutput = new DocumentoTributarioRelacionadoOutputModel(); - docOutput.setSerieNumero(docInput.getSerieNumero()); - docOutput.setTipoDocumento(Catalog.valueOfCode(Catalog12.class, docInput.getTipoDocumento()).orElseThrow(Catalog.invalidCatalogValue)); - return docOutput; - }) - .collect(Collectors.toList()) - : Collections.emptyList() - ); - - // Detalle - List lineOutput = input.getDetalle().stream() - .map(f -> DocumentLineOutputModelFactory.getDocumentLineOutput(f, config, systemClock)) - .collect(Collectors.toList()); - builder.withDetalle(lineOutput); - - - DocumentImpuestosOutputModel.Builder impuestosBuilder = DocumentImpuestosOutputModel.Builder.aDocumentImpuestosOutputModel(); - - // Importe total de impuestos - BigDecimal importeTotalImpuestosIgv = lineOutput.stream() - .map(DocumentLineOutputModel::getImpuestos) - .filter(p -> p.getIgv().getCategoria().equals(Catalog5.IGV) || - p.getIgv().getCategoria().equals(Catalog5.IMPUESTO_ARROZ_PILADO) - ) - .map(m -> m.getIgv().getImporte()) - .reduce(BigDecimal.ZERO, BigDecimal::add); - BigDecimal importeTotalImpuestosIcb = lineOutput.stream() - .map(DocumentLineOutputModel::getImpuestos) - .map(DocumentLineImpuestosOutputModel::getIcb) - .filter(Objects::nonNull) - .map(ImpuestoOutputModel::getImporte) - .reduce(BigDecimal.ZERO, BigDecimal::add); - - impuestosBuilder.withImporteTotal( - importeTotalImpuestosIgv.add(importeTotalImpuestosIcb) - ); - - // Gravado - ImpuestoTotalOutputModel gravado = getImpuestoTotal(lineOutput, Catalog5.IGV); - if (gravado.getBaseImponible().compareTo(BigDecimal.ZERO) > 0) { - impuestosBuilder.withGravadas(gravado); - } - - // Exonerado - ImpuestoTotalOutputModel exonerado = getImpuestoTotal(lineOutput, Catalog5.EXONERADO); - if (exonerado.getBaseImponible().compareTo(BigDecimal.ZERO) > 0) { - impuestosBuilder.withExoneradas(exonerado); - } - - // Inafecto - ImpuestoTotalOutputModel inafecto = getImpuestoTotal(lineOutput, Catalog5.INAFECTO); - if (inafecto.getBaseImponible().compareTo(BigDecimal.ZERO) > 0) { - impuestosBuilder.withInafectas(inafecto); - } - - // Gratuito - ImpuestoTotalOutputModel gratuito = getImpuestoTotal(lineOutput, Catalog5.GRATUITO); - if (gratuito.getBaseImponible().compareTo(BigDecimal.ZERO) > 0) { - impuestosBuilder.withInafectas(gratuito); - } - - // IVAP - java.util.function.Supplier> ivapStream = () -> lineOutput.stream() - .filter(i -> i.getImpuestos().getIgv().getTipo().getTaxCategory().equals(Catalog5.IMPUESTO_ARROZ_PILADO)); - - BigDecimal ivapImporte = ivapStream.get() - .map(DocumentLineOutputModel::getImpuestos) - .map(DocumentLineImpuestosOutputModel::getIgv) - .map(ImpuestoOutputModel::getImporte) - .reduce(BigDecimal.ZERO, BigDecimal::add); - BigDecimal ivapBaseImponible = ivapStream.get() - .map(DocumentLineOutputModel::getImpuestos) - .map(DocumentLineImpuestosOutputModel::getIgv) - .map(ImpuestoDetalladoOutputModel::getBaseImponible) - .reduce(BigDecimal.ZERO, BigDecimal::add); - if (ivapImporte.compareTo(BigDecimal.ZERO) > 0) { - impuestosBuilder.withIvap(ImpuestoTotalOutputModel.Builder.anImpuestoTotalOutputModel() - .withCategoria(Catalog5.IMPUESTO_ARROZ_PILADO) - .withImporte(ivapImporte) - .withBaseImponible(ivapBaseImponible) - .build()); - } - - // ICB - BigDecimal icbImporte = lineOutput.stream() - .map(DocumentLineOutputModel::getImpuestos) - .map(DocumentLineImpuestosOutputModel::getIcb) - .filter(Objects::nonNull) - .map(ImpuestoOutputModel::getImporte) - .reduce(BigDecimal.ZERO, BigDecimal::add); - - if (icbImporte.compareTo(BigDecimal.ZERO) > 0) { - impuestosBuilder.withIcb(ImpuestoTotalICBOutputModel.Builder.anImpuestoTotalICBOutputModel() - .withCategoria(Catalog5.ICBPER) - .withImporte(icbImporte) - .build() - ); - } - - - builder.withImpuestos(impuestosBuilder.build()); - - - // Importe total - BigDecimal valorVentaSinImpuestos = lineOutput.stream() - .filter(p -> !p.getImpuestos().getIgv().getTipo().getTaxCategory().equals(Catalog5.GRATUITO)) - .map(DocumentLineOutputModel::getValorVentaSinImpuestos) - .reduce(BigDecimal.ZERO, BigDecimal::add); - BigDecimal valorVentaConImpuestos = lineOutput.stream() - .filter(p -> !p.getImpuestos().getIgv().getTipo().getTaxCategory().equals(Catalog5.GRATUITO)) - .map(f -> f.getImpuestos().getImporteTotal()) - .reduce(BigDecimal.ZERO, BigDecimal::add) - .add(valorVentaSinImpuestos); - - builder.withTotales(DocumentMonetaryTotalOutputModel.Builder.aDocumentMonetaryTotalOutputModel() - .withValorVentaSinImpuestos(valorVentaSinImpuestos) - .withValorVentaConImpuestos(valorVentaConImpuestos) - .withImporteTotal(valorVentaConImpuestos) - .build() - ); - } - - private static void enrichNote(NoteInputModel input, NoteOutputModel.Builder builder) { - builder.withSerieNumeroComprobanteAfectado(input.getSerieNumeroComprobanteAfectado()) - .withDescripcionSustentoDeNota(input.getDescripcionSustentoDeNota()); - - if (input.getSerieNumeroComprobanteAfectado().matches("^[F|b].*$")) { - builder.withTipoDocumentoComprobanteAfectado(Catalog1.FACTURA); - } else if (input.getSerie().matches("^[B|b].*$")) { - builder.withTipoDocumentoComprobanteAfectado(Catalog1.BOLETA); - } else { - throw new IllegalStateException("Invalid Serie"); - } - } - - private static ImpuestoTotalOutputModel getImpuestoTotal(List lineOutput, Catalog5 categoria) { - java.util.function.Supplier> stream = () -> lineOutput.stream() - .filter(i -> i.getImpuestos().getIgv().getTipo().getTaxCategory().equals(categoria)); - - BigDecimal importe = stream.get() - .map(DocumentLineOutputModel::getImpuestos) - .map(DocumentLineImpuestosOutputModel::getIgv) - .map(ImpuestoOutputModel::getImporte) - .reduce(BigDecimal.ZERO, BigDecimal::add); - BigDecimal baseImponible = stream.get() - .map(DocumentLineOutputModel::getImpuestos) - .map(DocumentLineImpuestosOutputModel::getIgv) - .map(ImpuestoDetalladoOutputModel::getBaseImponible) - .reduce(BigDecimal.ZERO, BigDecimal::add); - - return ImpuestoTotalOutputModel.Builder.anImpuestoTotalOutputModel() - .withCategoria(categoria) - .withImporte(importe) - .withBaseImponible(baseImponible) - .build(); - } - - private static FormaPagoOutputModel getFormaPago(List cuotas, DocumentMonetaryTotalOutputModel totales, TimeZone timeZone) { - return FormaPagoOutputModelFactory.getFormaPago( - cuotas, totales.getValorVentaConImpuestos(), timeZone - ); - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/PerceptionRetentionOutputModelFactory.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/PerceptionRetentionOutputModelFactory.java deleted file mode 100644 index 7a8336cd..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/PerceptionRetentionOutputModelFactory.java +++ /dev/null @@ -1,179 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.factory; - -import io.github.project.openubl.xmlbuilderlib.clock.SystemClock; -import io.github.project.openubl.xmlbuilderlib.config.Config; -import io.github.project.openubl.xmlbuilderlib.factory.common.ClienteOutputModelFactory; -import io.github.project.openubl.xmlbuilderlib.factory.common.FirmanteOutputModelFactory; -import io.github.project.openubl.xmlbuilderlib.factory.common.ProveedorOutputModelFactory; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog22; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog23; -import io.github.project.openubl.xmlbuilderlib.models.input.sunat.PerceptionInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.sunat.PerceptionRetentionInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.sunat.RetentionInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.sunat.*; - -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.util.List; -import java.util.stream.Collectors; - -import static io.github.project.openubl.xmlbuilderlib.utils.DateUtils.toGregorianCalendarDate; - -public class PerceptionRetentionOutputModelFactory { - - private PerceptionRetentionOutputModelFactory() { - // Only static methods - } - - public static PerceptionOutputModel getPerception(PerceptionInputModel input, Config config, SystemClock systemClock) { - Catalog22 regimen = Catalog.valueOfCode(Catalog22.class, input.getRegimen()).orElseThrow(Catalog.invalidCatalogValue); - - PerceptionOutputModel.Builder builder = PerceptionOutputModel.Builder.aPerceptionOutputModel() - .withSerieNumero(input.getSerie() + "-" + input.getNumero()) - .withRegimen(regimen); - - enrichPerceptionRetention(input, builder, config, systemClock); - - // Result - PerceptionOutputModel result = builder.build(); - - // Detalle regimen - result.getDetalle().forEach(f -> { - BigDecimal importePercibidoRetenido = f.getComprobante().getImporteTotal() - .multiply(regimen.getPercent()) - .divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_EVEN); - BigDecimal importeTotalCobradoPagado = f.getComprobante().getImporteTotal() - .add(importePercibidoRetenido); - - f.setImportePercibidoRetenido(importePercibidoRetenido); - f.setImporteTotalCobradoPagado(importeTotalCobradoPagado); - }); - - // Totales - BigDecimal importeTotalCobradoPagado = result.getDetalle() - .stream() - .map(PerceptionRetentionLineOutputModel::getImporteTotalCobradoPagado) - .reduce(BigDecimal.ZERO, BigDecimal::add); - BigDecimal importeTotalPercibidoRetenido = result.getDetalle() - .stream() - .map(PerceptionRetentionLineOutputModel::getImportePercibidoRetenido) - .reduce(BigDecimal.ZERO, BigDecimal::add); - - result.setImporteTotalCobradoPagado(importeTotalCobradoPagado); - result.setImporteTotalPercibidoRetenido(importeTotalPercibidoRetenido); - - return result; - } - - public static RetentionOutputModel getRetention(RetentionInputModel input, Config config, SystemClock systemClock) { - Catalog23 regimen = Catalog.valueOfCode(Catalog23.class, input.getRegimen()).orElseThrow(Catalog.invalidCatalogValue); - - RetentionOutputModel.Builder builder = RetentionOutputModel.Builder.aRetentionOutputModel() - .withSerieNumero(input.getSerie() + "-" + input.getNumero()) - .withRegimen(regimen); - - enrichPerceptionRetention(input, builder, config, systemClock); - - // Result - RetentionOutputModel result = builder.build(); - - // Detalle regimen - result.getDetalle().forEach(f -> { - BigDecimal importePercibidoRetenido = f.getComprobante().getImporteTotal() - .multiply(regimen.getPercent()) - .divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_EVEN); - BigDecimal importeTotalCobradoPagado = f.getComprobante().getImporteTotal() - .subtract(importePercibidoRetenido); - - f.setImportePercibidoRetenido(importePercibidoRetenido); - f.setImporteTotalCobradoPagado(importeTotalCobradoPagado); - }); - - // Totales - BigDecimal importeTotalCobradoPagado = result.getDetalle() - .stream() - .map(PerceptionRetentionLineOutputModel::getImporteTotalCobradoPagado) - .reduce(BigDecimal.ZERO, BigDecimal::add); - BigDecimal importeTotalPercibidoRetenido = result.getDetalle() - .stream() - .map(PerceptionRetentionLineOutputModel::getImportePercibidoRetenido) - .reduce(BigDecimal.ZERO, BigDecimal::add); - - result.setImporteTotalCobradoPagado(importeTotalCobradoPagado); - result.setImporteTotalPercibidoRetenido(importeTotalPercibidoRetenido); - - return result; - } - - // Enrich - - private static void enrichPerceptionRetention(PerceptionRetentionInputModel input, PerceptionRetentionOutputModel.Builder builder, Config config, SystemClock systemClock) { - builder - .withMoneda(config.getDefaultMoneda()) - .withObservacion(input.getObservacion()); - - // Fecha y hora de emision - long fechaEmision = input.getFechaEmision() != null ? input.getFechaEmision() : systemClock.getCalendarInstance().getTimeInMillis(); - builder.withFechaEmision(toGregorianCalendarDate(fechaEmision, systemClock.getTimeZone())); - - // Proveedor - builder.withProveedor(ProveedorOutputModelFactory.getProveedor(input.getProveedor())); - - // Cliente - builder.withCliente(ClienteOutputModelFactory.getCliente(input.getCliente())); - - // Firmante - builder.withFirmante( - input.getFirmante() != null - ? FirmanteOutputModelFactory.getFirmante(input.getFirmante()) - : FirmanteOutputModelFactory.getFirmante(input.getProveedor()) - ); - - // Detalle - List outputDetalle = input.getDetalle().stream() - .map(f -> PerceptionRetentionLineOutputModel.Builder.aPerceptionRetentionLineOutputModel() - .withFechaCobroPago(f.getFechaCobroPago() != null - ? toGregorianCalendarDate(f.getFechaCobroPago(), systemClock.getTimeZone()) - : toGregorianCalendarDate(fechaEmision, systemClock.getTimeZone()) - ) - .withNumeroCobroPago(f.getNumeroCobroPago() != null - ? f.getNumeroCobroPago() - : 1 - ) - .withImporteCobroPago(f.getImporteCobroPago() != null - ? f.getImporteCobroPago() - : f.getComprobante().getImporteTotal() - ) - .withComprobante(PerceptionRetentionComprobanteOutputModel.Builder.aPerceptionRetentionComprobanteOutputModel() - .withTipo(Catalog.valueOfCode(Catalog1.class, f.getComprobante().getTipo()).orElseThrow(Catalog.invalidCatalogValue)) - .withMoneda(f.getComprobante().getMoneda()) - .withSerieNumero(f.getComprobante().getSerieNumero()) - .withImporteTotal(f.getComprobante().getImporteTotal()) - .withFechaEmision(toGregorianCalendarDate(f.getComprobante().getFechaEmision(), systemClock.getTimeZone())) - .build() - ) - .build()) - .collect(Collectors.toList()); - - builder.withDetalle(outputDetalle); - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/SummaryDocumentOutputModelFactory.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/SummaryDocumentOutputModelFactory.java deleted file mode 100644 index 285e8c9f..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/SummaryDocumentOutputModelFactory.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.factory; - -import io.github.project.openubl.xmlbuilderlib.clock.SystemClock; -import io.github.project.openubl.xmlbuilderlib.config.Config; -import io.github.project.openubl.xmlbuilderlib.factory.common.ClienteOutputModelFactory; -import io.github.project.openubl.xmlbuilderlib.factory.common.FirmanteOutputModelFactory; -import io.github.project.openubl.xmlbuilderlib.factory.common.ProveedorOutputModelFactory; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.*; -import io.github.project.openubl.xmlbuilderlib.models.input.sunat.*; -import io.github.project.openubl.xmlbuilderlib.models.output.sunat.*; - -import java.text.MessageFormat; -import java.util.stream.Collectors; - -import static io.github.project.openubl.xmlbuilderlib.utils.DateUtils.toGregorianCalendarDate; - -public class SummaryDocumentOutputModelFactory { - - private SummaryDocumentOutputModelFactory() { - // Only static methods - } - - public static SummaryDocumentOutputModel getSummaryDocument(SummaryDocumentInputModel input, Config config, SystemClock systemClock) { - String fechaEmision = input.getFechaEmision() != null - ? toGregorianCalendarDate(input.getFechaEmision(), systemClock.getTimeZone()) - : toGregorianCalendarDate(systemClock.getCalendarInstance().getTimeInMillis(), systemClock.getTimeZone()); - String serieNumero = MessageFormat.format("RC-{0}-{1}", fechaEmision.replaceAll("-", ""), input.getNumero()); - - return SummaryDocumentOutputModel.Builder.aSummaryDocumentOutputModel() - .withMoneda(config.getDefaultMoneda()) - .withFechaEmision(fechaEmision) - .withSerieNumero(serieNumero) - .withFechaEmisionDeComprobantesAsociados( - toGregorianCalendarDate(input.getFechaEmisionDeComprobantesAsociados(), systemClock.getTimeZone()) - ) - .withProveedor(ProveedorOutputModelFactory.getProveedor(input.getProveedor())) - .withFirmante( - input.getFirmante() != null - ? FirmanteOutputModelFactory.getFirmante(input.getFirmante()) - : FirmanteOutputModelFactory.getFirmante(input.getProveedor()) - ) - .withDetalle(input.getDetalle().stream() - .map(SummaryDocumentOutputModelFactory::getDocumentLine) - .collect(Collectors.toList()) - ) - .build(); - } - - public static SummaryDocumentLineOutputModel getDocumentLine(SummaryDocumentLineInputModel documentLineInputModel) { - SummaryDocumentLineOutputModel.Builder builder = SummaryDocumentLineOutputModel.Builder.aSummaryDocumentLineOutputModel() - .withTipoOperacion( - Catalog.valueOfCode(Catalog19.class, documentLineInputModel.getTipoOperacion()).orElseThrow(Catalog.invalidCatalogValue) - ) - .withComprobante(getComprobante(documentLineInputModel.getComprobante())); - if (documentLineInputModel.getComprobanteAfectado() != null) { - builder.withComprobanteAfectado(SummaryDocumentComprobanteAfectadoOutputModel.Builder.aSummaryDocumentComprobanteAfectadoOutputModel() - .withSerieNumero(documentLineInputModel.getComprobanteAfectado().getSerieNumero()) - .withTipo( - Catalog.valueOfCode(Catalog1.class, documentLineInputModel.getComprobanteAfectado().getTipo()).orElseThrow(Catalog.invalidCatalogValue) - ) - .build() - ); - } - - return builder.build(); - } - - public static SummaryDocumentComprobanteOutputModel getComprobante(SummaryDocumentComprobanteInputModel inputComprobante) { - return SummaryDocumentComprobanteOutputModel.Builder.aSummaryDocumentComprobanteOutputModel() - .withTipo( - Catalog.valueOfCode(Catalog1.class, inputComprobante.getTipo()).orElseThrow(Catalog.invalidCatalogValue) - ) - .withSerieNumero(inputComprobante.getSerieNumero()) - .withCliente(ClienteOutputModelFactory.getCliente(inputComprobante.getCliente())) - .withImpuestos(getImpuestos(inputComprobante.getImpuestos())) - .withValorVenta(getValorVenta(inputComprobante.getValorVenta())) - .build(); - } - - public static SummaryDocumentComprobanteValorVentaOutputModel getValorVenta(SummaryDocumentComprobanteValorVentaInputModel inputValorVenta) { - SummaryDocumentComprobanteValorVentaOutputModel.Builder builder = SummaryDocumentComprobanteValorVentaOutputModel.Builder.aSummaryDocumentComprobanteValorVentaOutputModel() - .withImporteTotal(inputValorVenta.getImporteTotal()) - .withOtrosCargos(inputValorVenta.getOtrosCargos()); - if (inputValorVenta.getGravado() != null) { - builder.withGravado(TotalValorVentaOutputModel.Builder.aTotalValorVentaOutputModel() - .withTipo(Catalog7_1.GRAVADO) - .withImporte(inputValorVenta.getGravado()) - .build() - ); - } - if (inputValorVenta.getExonerado() != null) { - builder.withExonerado(TotalValorVentaOutputModel.Builder.aTotalValorVentaOutputModel() - .withTipo(Catalog7_1.EXONERADO) - .withImporte(inputValorVenta.getExonerado()) - .build() - ); - } - if (inputValorVenta.getInafecto() != null) { - builder.withInafecto(TotalValorVentaOutputModel.Builder.aTotalValorVentaOutputModel() - .withTipo(Catalog7_1.INAFECTO) - .withImporte(inputValorVenta.getInafecto()) - .build() - ); - } - if (inputValorVenta.getGratuito() != null) { - builder.withGratuito(TotalValorVentaOutputModel.Builder.aTotalValorVentaOutputModel() - .withTipo(Catalog7_1.GRATUITA) - .withImporte(inputValorVenta.getGratuito()) - .build() - ); - } - return builder.build(); - } - - private static SummaryDocumentImpuestosOutputModel getImpuestos(SummaryDocumentImpuestosInputModel inputImpuestos) { - SummaryDocumentImpuestosOutputModel.Builder builder = SummaryDocumentImpuestosOutputModel.Builder.aSummaryDocumentImpuestosOutputModel() - .withIgv(ImpuestoTotalResumenDiarioOutputModel.Builder.anImpuestoTotalResumenDiarioOutputModel() - .withImporte(inputImpuestos.getIgv()) - .withCategoria(Catalog5.IGV) - .build() - ); - if (inputImpuestos.getIcb() != null) { - builder.withIcb(ImpuestoTotalResumenDiarioOutputModel.Builder.anImpuestoTotalResumenDiarioOutputModel() - .withImporte(inputImpuestos.getIcb()) - .withCategoria(Catalog5.ICBPER) - .build() - ); - } - return builder.build(); - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/VoidedDocumentOutputModelFactory.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/VoidedDocumentOutputModelFactory.java deleted file mode 100644 index 2bee0ef2..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/VoidedDocumentOutputModelFactory.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.factory; - -import io.github.project.openubl.xmlbuilderlib.clock.SystemClock; -import io.github.project.openubl.xmlbuilderlib.config.Config; -import io.github.project.openubl.xmlbuilderlib.factory.common.FirmanteOutputModelFactory; -import io.github.project.openubl.xmlbuilderlib.factory.common.ProveedorOutputModelFactory; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1; -import io.github.project.openubl.xmlbuilderlib.models.input.sunat.VoidedDocumentInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.sunat.VoidedDocumentLineInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.sunat.VoidedDocumentLineOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.sunat.VoidedDocumentOutputModel; - -import java.text.MessageFormat; - -import static io.github.project.openubl.xmlbuilderlib.utils.DateUtils.toGregorianCalendarDate; - -public class VoidedDocumentOutputModelFactory { - - private VoidedDocumentOutputModelFactory() { - // Only static methods - } - - public static VoidedDocumentOutputModel getVoidedDocument(VoidedDocumentInputModel input, Config config, SystemClock systemClock) { - VoidedDocumentOutputModel.Builder builder = VoidedDocumentOutputModel.Builder.aVoidedDocumentOutputModel(); - - // datos generales - String fechaEmision = input.getFechaEmision() != null - ? toGregorianCalendarDate(input.getFechaEmision(), systemClock.getTimeZone()) - : toGregorianCalendarDate(systemClock.getCalendarInstance().getTimeInMillis(), systemClock.getTimeZone()); - - builder.withFechaEmision(fechaEmision) - .withDescripcionSustento(input.getDescripcionSustento()) - .withProveedor(ProveedorOutputModelFactory.getProveedor(input.getProveedor())) - .withFirmante( - input.getFirmante() != null - ? FirmanteOutputModelFactory.getFirmante(input.getFirmante()) - : FirmanteOutputModelFactory.getFirmante(input.getProveedor()) - ); - - // Comprobante - VoidedDocumentLineInputModel comprobanteAfectado = input.getComprobante(); - - String[] serieNumeroComprobanteAfectado = comprobanteAfectado.getSerieNumero().split("-"); - Catalog1 tipoComprobanteAfectado = Catalog.valueOfCode(Catalog1.class, comprobanteAfectado.getTipoComprobante()).orElseThrow(Catalog.invalidCatalogValue); - - builder.withComprobante(VoidedDocumentLineOutputModel.Builder.aVoidedDocumentLineOutputModel() - .withFechaEmision(toGregorianCalendarDate(comprobanteAfectado.getFechaEmision(), systemClock.getTimeZone())) - .withTipoComprobante(tipoComprobanteAfectado) - .withSerie(serieNumeroComprobanteAfectado[0]) - .withNumero(serieNumeroComprobanteAfectado[1]) - .build() - ); - - // Serie - String codigo; - switch (tipoComprobanteAfectado) { - case PERCEPCION: - case RETENCION: - case GUIA_REMISION_REMITENTE: - codigo = "RR"; - break; - default: - codigo = "RA"; - } - - builder.withSerieNumero( - MessageFormat.format("{0}-{1}-{2}", codigo, fechaEmision.replaceAll("-", ""), input.getNumero()) - ); - - return builder.build(); - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/common/ClienteOutputModelFactory.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/common/ClienteOutputModelFactory.java deleted file mode 100644 index 2a828cd7..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/common/ClienteOutputModelFactory.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.factory.common; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog6; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.ClienteOutputModel; - -public class ClienteOutputModelFactory { - - private ClienteOutputModelFactory() { - // Only static methods - } - - public static ClienteOutputModel getCliente(ClienteInputModel input) { - return ClienteOutputModel.Builder.aClienteOutputModel() - .withNombre(input.getNombre()) - .withNumeroDocumentoIdentidad(input.getNumeroDocumentoIdentidad()) - .withTipoDocumentoIdentidad(Catalog.valueOfCode(Catalog6.class, input.getTipoDocumentoIdentidad()).orElseThrow(Catalog.invalidCatalogValue)) - .withContacto(input.getContacto() != null ? ContactoOutputModelFactory.getContacto(input.getContacto()) : null) - .withDireccion(input.getDireccion() != null ? DireccionOutputModelFactory.getDireccion(input.getDireccion()) : null) - .build(); - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/common/ContactoOutputModelFactory.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/common/ContactoOutputModelFactory.java deleted file mode 100644 index 30752def..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/common/ContactoOutputModelFactory.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.factory.common; - -import io.github.project.openubl.xmlbuilderlib.models.input.common.ContactoInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.ContactoOutputModel; - -public class ContactoOutputModelFactory { - - private ContactoOutputModelFactory() { - // Only static methods - } - - public static ContactoOutputModel getContacto(ContactoInputModel input) { - return ContactoOutputModel.Builder.aContactoOutputModel() - .withEmail(input.getEmail()) - .withTelefono(input.getTelefono()) - .build(); - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/common/DireccionOutputModelFactory.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/common/DireccionOutputModelFactory.java deleted file mode 100644 index 48b62f5f..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/common/DireccionOutputModelFactory.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.factory.common; - -import io.github.project.openubl.xmlbuilderlib.models.input.common.DireccionInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.DireccionOutputModel; - -public class DireccionOutputModelFactory { - - private DireccionOutputModelFactory() { - // Only static methods - } - - public static DireccionOutputModel getDireccion(DireccionInputModel input) { - return DireccionOutputModel.Builder.aDireccionOutputModel() - .withUbigeo(input.getUbigeo()) - .withDireccion(input.getDireccion()) - .withDepartamento(input.getDepartamento()) - .withProvincia(input.getProvincia()) - .withDistrito(input.getDistrito()) - .withCodigoLocal(input.getCodigoLocal()) - .withUrbanizacion(input.getUrbanizacion()) - .withCodigoPais(input.getCodigoPais()) - .build(); - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/common/FirmanteOutputModelFactory.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/common/FirmanteOutputModelFactory.java deleted file mode 100644 index d1297696..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/common/FirmanteOutputModelFactory.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.factory.common; - -import io.github.project.openubl.xmlbuilderlib.models.input.common.FirmanteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.FirmanteOutputModel; - -public class FirmanteOutputModelFactory { - - private FirmanteOutputModelFactory() { - // Only static methods - } - - public static FirmanteOutputModel getFirmante(FirmanteInputModel input) { - return FirmanteOutputModel.Builder.aFirmanteOutputModel() - .withRuc(input.getRuc()) - .withRazonSocial(input.getRazonSocial()) - .build(); - } - - public static FirmanteOutputModel getFirmante(ProveedorInputModel input) { - return FirmanteOutputModel.Builder.aFirmanteOutputModel() - .withRuc(input.getRuc()) - .withRazonSocial(input.getRazonSocial()) - .build(); - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/common/FormaPagoOutputModelFactory.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/common/FormaPagoOutputModelFactory.java deleted file mode 100644 index 66d8d202..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/common/FormaPagoOutputModelFactory.java +++ /dev/null @@ -1,101 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.factory.common; - -import io.github.project.openubl.xmlbuilderlib.models.input.common.CuotaDePagoInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.FirmanteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.FirmanteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.FormaPagoCuotaOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.FormaPagoOutputModel; - -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.TimeZone; - -import static io.github.project.openubl.xmlbuilderlib.utils.DateUtils.toGregorianCalendarDate; - -public class FormaPagoOutputModelFactory { - - private FormaPagoOutputModelFactory() { - // Only static methods - } - - public static FirmanteOutputModel getFirmante(FirmanteInputModel input) { - return FirmanteOutputModel.Builder.aFirmanteOutputModel() - .withRuc(input.getRuc()) - .withRazonSocial(input.getRazonSocial()) - .build(); - } - - public static FirmanteOutputModel getFirmante(ProveedorInputModel input) { - return FirmanteOutputModel.Builder.aFirmanteOutputModel() - .withRuc(input.getRuc()) - .withRazonSocial(input.getRazonSocial()) - .build(); - } - - public static FormaPagoOutputModel getFormaPago(List cuotasDePago, BigDecimal montoTotal, TimeZone timeZone) { - FormaPagoOutputModel.Builder builder = FormaPagoOutputModel.Builder.aFormaPagoOutputModel() - .withMontoTotal(montoTotal); - - if (cuotasDePago == null || cuotasDePago.isEmpty()) { - builder - .withTipo(FormaPagoOutputModel.Tipo.Contado) - .withCuotas(Collections.emptyList()); - } else { - List cuotasOutput = new ArrayList<>(); - - builder - .withTipo(FormaPagoOutputModel.Tipo.Credito) - .withCuotas(cuotasOutput); - - BigDecimal subtotal = BigDecimal.ZERO; - for (int i = 0; i < cuotasDePago.size(); i++) { - CuotaDePagoInputModel item = cuotasDePago.get(i); - - BigDecimal monto; - if (item.getMonto() != null) { - monto = item.getMonto(); - } else if (item.getPorcentaje() != null) { - if (i != cuotasDePago.size() - 1) { - monto = montoTotal.multiply(item.getPorcentaje()).divide(new BigDecimal(100), 2, RoundingMode.HALF_EVEN); - } else { - monto = montoTotal.subtract(subtotal); - } - } else { - throw new IllegalStateException("Monto or porcentaje must be present"); - } - - subtotal = subtotal.add(monto); - - FormaPagoCuotaOutputModel output = FormaPagoCuotaOutputModel.Builder.aFormaPagoCuotaOutputModel() - .withId(String.format("%03d", i)) - .withMonto(monto) - .withFechaPago(toGregorianCalendarDate(item.getFechaPago(), timeZone)) - .build(); - - cuotasOutput.add(output); - } - } - - return builder.build(); - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/common/ProveedorOutputModelFactory.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/common/ProveedorOutputModelFactory.java deleted file mode 100644 index 696ddc55..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/factory/common/ProveedorOutputModelFactory.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.factory.common; - -import io.github.project.openubl.xmlbuilderlib.config.Constants; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.DireccionOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.ProveedorOutputModel; - -public class ProveedorOutputModelFactory { - - private ProveedorOutputModelFactory() { - // Only static methods - } - - public static ProveedorOutputModel getProveedor(ProveedorInputModel input) { - DireccionOutputModel direccionOutput = input.getDireccion() != null ? - DireccionOutputModelFactory.getDireccion(input.getDireccion()) : - new DireccionOutputModel(); - enrichDireccionOutput(direccionOutput); - - return ProveedorOutputModel.Builder.aProveedorOutputModel() - .withRuc(input.getRuc()) - .withRazonSocial(input.getRazonSocial()) - .withNombreComercial(input.getNombreComercial()) - .withDireccion(direccionOutput) - .withContacto(input.getContacto() != null ? ContactoOutputModelFactory.getContacto(input.getContacto()) : null) - .build(); - - } - - private static void enrichDireccionOutput(DireccionOutputModel direccionOutput) { - if (direccionOutput.getCodigoLocal() == null) { - direccionOutput.setCodigoLocal(Constants.DEFAULT_CODIGO_LOCAL); - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/freemarker/FreemarkerConstants.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/freemarker/FreemarkerConstants.java deleted file mode 100644 index 9aab2702..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/freemarker/FreemarkerConstants.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.freemarker; - -public class FreemarkerConstants { - public static final String INVOICE_TEMPLATE_2_1 = "io/github/project/openubl/xmlbuilderlib/templates/standard/invoice.ftl"; - public static final String CREDIT_NOTE_TEMPLATE_2_1 = "io/github/project/openubl/xmlbuilderlib/templates/standard/credit-note.ftl"; - public static final String DEBIT_NOTE_TEMPLATE_2_1 = "io/github/project/openubl/xmlbuilderlib/templates/standard/debit-note.ftl"; - public static final String DESPATCH_ADVICE_TEMPLATE_2_1 = "io/github/project/openubl/xmlbuilderlib/templates/standard/despatch-advice.ftl"; - - public static final String VOIDED_DOCUMENT_TEMPLATE_2_0 = "io/github/project/openubl/xmlbuilderlib/templates/sunat/voided-document.ftl"; - public static final String SUMMARY_DOCUMENT_TEMPLATE_2_0 = "io/github/project/openubl/xmlbuilderlib/templates/sunat/summary-document.ftl"; - public static final String PERCEPTION_TEMPLATE_2_0 = "io/github/project/openubl/xmlbuilderlib/templates/sunat/perception.ftl"; - public static final String RETENTION_TEMPLATE_2_0 = "io/github/project/openubl/xmlbuilderlib/templates/sunat/retention.ftl"; - - private FreemarkerConstants() { - // Just constants - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/freemarker/FreemarkerExecutor.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/freemarker/FreemarkerExecutor.java deleted file mode 100644 index a646e5ee..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/freemarker/FreemarkerExecutor.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.freemarker; - -import freemarker.template.Template; -import freemarker.template.TemplateException; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.despatchadvice.DespatchAdviceOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.invoice.InvoiceOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.note.creditNote.CreditNoteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.note.debitNote.DebitNoteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.sunat.PerceptionOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.sunat.RetentionOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.sunat.SummaryDocumentOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.sunat.VoidedDocumentOutputModel; - -import java.io.IOException; -import java.io.StringWriter; -import java.io.Writer; - -public class FreemarkerExecutor { - - private FreemarkerExecutor() { - // Only static methods - } - - - public static String createXML(InvoiceOutputModel output) { - return processTemplate(FreemarkerConstants.INVOICE_TEMPLATE_2_1, output); - } - - public static void createXML(InvoiceOutputModel output, Writer writer) { - processTemplate(FreemarkerConstants.INVOICE_TEMPLATE_2_1, output, writer); - } - - - public static String createXML(CreditNoteOutputModel output) { - return processTemplate(FreemarkerConstants.CREDIT_NOTE_TEMPLATE_2_1, output); - } - - public static void createXML(CreditNoteOutputModel output, Writer writer) { - processTemplate(FreemarkerConstants.CREDIT_NOTE_TEMPLATE_2_1, output, writer); - } - - - public static String createXML(DebitNoteOutputModel output) { - return processTemplate(FreemarkerConstants.DEBIT_NOTE_TEMPLATE_2_1, output); - } - - public static void createXML(DebitNoteOutputModel output, Writer writer) { - processTemplate(FreemarkerConstants.DEBIT_NOTE_TEMPLATE_2_1, output, writer); - } - - - public static String createXML(VoidedDocumentOutputModel output) { - return processTemplate(FreemarkerConstants.VOIDED_DOCUMENT_TEMPLATE_2_0, output); - } - - public static void createXML(VoidedDocumentOutputModel output, Writer writer) { - processTemplate(FreemarkerConstants.VOIDED_DOCUMENT_TEMPLATE_2_0, output, writer); - } - - - public static String createXML(SummaryDocumentOutputModel output) { - return processTemplate(FreemarkerConstants.SUMMARY_DOCUMENT_TEMPLATE_2_0, output); - } - - public static void createXML(SummaryDocumentOutputModel output, Writer writer) { - processTemplate(FreemarkerConstants.SUMMARY_DOCUMENT_TEMPLATE_2_0, output, writer); - } - - - public static String createXML(PerceptionOutputModel output) { - return processTemplate(FreemarkerConstants.PERCEPTION_TEMPLATE_2_0, output); - } - - public static void createXML(PerceptionOutputModel output, Writer writer) { - processTemplate(FreemarkerConstants.PERCEPTION_TEMPLATE_2_0, output, writer); - } - - - public static String createXML(RetentionOutputModel output) { - return processTemplate(FreemarkerConstants.RETENTION_TEMPLATE_2_0, output); - } - - public static void createXML(RetentionOutputModel output, Writer writer) { - processTemplate(FreemarkerConstants.RETENTION_TEMPLATE_2_0, output, writer); - } - - - public static String createXML(DespatchAdviceOutputModel output) { - return processTemplate(FreemarkerConstants.DESPATCH_ADVICE_TEMPLATE_2_1, output); - } - - public static void createXML(DespatchAdviceOutputModel output, Writer writer) { - processTemplate(FreemarkerConstants.DESPATCH_ADVICE_TEMPLATE_2_1, output, writer); - } - - - private static String processTemplate(String templateName, Object dataModel) { - StringWriter writer = new StringWriter(); - processTemplate(templateName, dataModel, writer); - return writer.toString(); - } - - private static void processTemplate(String templateName, Object dataModel, Writer writer) { - try { - Template template = FreemarkerGlobalConfiguration.getInstance().getConfiguration().getTemplate(templateName); - - template.process(dataModel, writer); - writer.flush(); - writer.close(); - } catch (IOException | TemplateException e) { - throw new IllegalStateException(e); - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/freemarker/FreemarkerGlobalConfiguration.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/freemarker/FreemarkerGlobalConfiguration.java deleted file mode 100644 index df0e9520..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/freemarker/FreemarkerGlobalConfiguration.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.freemarker; - -import freemarker.template.Configuration; - -public class FreemarkerGlobalConfiguration { - - private static volatile FreemarkerGlobalConfiguration instance; - - private Configuration configuration; - - private FreemarkerGlobalConfiguration() { - configuration = new Configuration(Configuration.VERSION_2_3_28); - configuration.setClassForTemplateLoading(FreemarkerGlobalConfiguration.class, "/"); - } - - public static FreemarkerGlobalConfiguration getInstance() { - if (instance == null) { - synchronized (FreemarkerGlobalConfiguration.class) { - if (instance == null) { - instance = new FreemarkerGlobalConfiguration(); - } - } - } - return instance; - } - - public Configuration getConfiguration() { - return configuration; - } - - public void setConfiguration(Configuration configuration) { - this.configuration = configuration; - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/hibernate/validator/ValidatorSingleton.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/hibernate/validator/ValidatorSingleton.java deleted file mode 100644 index 997c60f2..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/hibernate/validator/ValidatorSingleton.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.hibernate.validator; - -import io.github.project.openubl.xmlbuilderlib.clock.SystemClockSingleton; - -import javax.validation.Validation; -import javax.validation.Validator; -import javax.validation.ValidatorFactory; - -public class ValidatorSingleton { - - private static ValidatorSingleton instance; - - private final ValidatorFactory factory; - private final Validator validator; - - private ValidatorSingleton() { - factory = Validation.buildDefaultValidatorFactory(); - validator = factory.getValidator(); - } - - public static ValidatorSingleton getInstance() { - if (instance == null) { - synchronized (SystemClockSingleton.class) { - if (instance == null) { - instance = new ValidatorSingleton(); - } - } - } - return instance; - } - - public ValidatorFactory getFactory() { - return factory; - } - - public Validator getValidator() { - return validator; - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog53.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog53.java deleted file mode 100644 index e7cde970..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/Catalog53.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.catalogs; - -public enum Catalog53 implements Catalog { - - OTROS_DESCUENTOS("00"), - OTROS_CARGOS("50"), - PERCEPCION_VENTA_INTERNA("51"), - PERCEPCION_A_LA_ADQUISICION_DE_COMBUSTIBLE("52"), - PERCEPCION_REALIZADA_AL_AGENTE__DE_PERCEPCION_CON_TASA_ESPECIAL("53"), - OTROS_CARGOS_RELACIONADOS_AL_SERVICIO("54"), - OTROS_CARGOS_NO_RELACIONADOS_AL_SERVICIO("55"); - - 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/xmlbuilderlib/models/catalogs/constraints/CatalogConstraint.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/constraints/CatalogConstraint.java deleted file mode 100644 index b19d578b..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/constraints/CatalogConstraint.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.catalogs.constraints; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog; - -import javax.validation.Constraint; -import javax.validation.Payload; -import java.lang.annotation.Documented; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import static java.lang.annotation.ElementType.*; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -@Documented -@Constraint(validatedBy = {CatalogValidator.class}) -@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE}) -@Retention(RUNTIME) -public @interface CatalogConstraint { - String message() default ""; - - Class[] groups() default {}; - - Class[] payload() default {}; - - Class> value(); -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/constraints/CatalogValidator.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/constraints/CatalogValidator.java deleted file mode 100644 index d814295b..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/constraints/CatalogValidator.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.catalogs.constraints; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog; - -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -public class CatalogValidator implements ConstraintValidator { - - protected Class> catalog; - - @Override - public void initialize(CatalogConstraint catalogConstraint) { - catalog = catalogConstraint.value(); - } - - @Override - public boolean isValid(String value, ConstraintValidatorContext context) { - // null values are valid - if (value == null) { - return true; - } - - Enum[] enumConstants = catalog.getEnumConstants(); - List validValues = Arrays.stream(enumConstants).flatMap(f -> { - Catalog catalog = (Catalog) f; - return Stream.of(f.toString(), catalog.getCode()); - }).collect(Collectors.toList()); - - boolean isValid = validValues.stream().anyMatch(p -> p.equalsIgnoreCase(value)); - if (!isValid) { - context.disableDefaultConstraintViolation(); - context.buildConstraintViolationWithTemplate("Possible values: " + String.join(", ", validValues)) - .addConstraintViolation(); - } - - return isValid; - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/common/ClienteInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/common/ClienteInputModel.java deleted file mode 100644 index de86dc88..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/common/ClienteInputModel.java +++ /dev/null @@ -1,136 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.common; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog6; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.constraints.CatalogConstraint; - -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; - -public class ClienteInputModel { - - @NotNull - @NotBlank - @CatalogConstraint(value = Catalog6.class) - private String tipoDocumentoIdentidad; - - @NotNull - @NotBlank - private String numeroDocumentoIdentidad; - - @NotNull - @NotBlank - private String nombre; - - @Valid - private DireccionInputModel direccion; - - @Valid - private ContactoInputModel contacto; - - public String getTipoDocumentoIdentidad() { - return tipoDocumentoIdentidad; - } - - public void setTipoDocumentoIdentidad(String tipoDocumentoIdentidad) { - this.tipoDocumentoIdentidad = tipoDocumentoIdentidad; - } - - public String getNumeroDocumentoIdentidad() { - return numeroDocumentoIdentidad; - } - - public void setNumeroDocumentoIdentidad(String numeroDocumentoIdentidad) { - this.numeroDocumentoIdentidad = numeroDocumentoIdentidad; - } - - public String getNombre() { - return nombre; - } - - public void setNombre(String nombre) { - this.nombre = nombre; - } - - public DireccionInputModel getDireccion() { - return direccion; - } - - public void setDireccion(DireccionInputModel direccion) { - this.direccion = direccion; - } - - public ContactoInputModel getContacto() { - return contacto; - } - - public void setContacto(ContactoInputModel contacto) { - this.contacto = contacto; - } - - public static final class Builder { - private String tipoDocumentoIdentidad; - private String numeroDocumentoIdentidad; - private String nombre; - private DireccionInputModel direccion; - private ContactoInputModel contacto; - - private Builder() { - } - - public static Builder aClienteInputModel() { - return new Builder(); - } - - public Builder withTipoDocumentoIdentidad(String tipoDocumentoIdentidad) { - this.tipoDocumentoIdentidad = tipoDocumentoIdentidad; - return this; - } - - public Builder withNumeroDocumentoIdentidad(String numeroDocumentoIdentidad) { - this.numeroDocumentoIdentidad = numeroDocumentoIdentidad; - return this; - } - - public Builder withNombre(String nombre) { - this.nombre = nombre; - return this; - } - - public Builder withDireccion(DireccionInputModel direccion) { - this.direccion = direccion; - return this; - } - - public Builder withContacto(ContactoInputModel contacto) { - this.contacto = contacto; - return this; - } - - public ClienteInputModel build() { - ClienteInputModel clienteInputModel = new ClienteInputModel(); - clienteInputModel.setTipoDocumentoIdentidad(tipoDocumentoIdentidad); - clienteInputModel.setNumeroDocumentoIdentidad(numeroDocumentoIdentidad); - clienteInputModel.setNombre(nombre); - clienteInputModel.setDireccion(direccion); - clienteInputModel.setContacto(contacto); - return clienteInputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/common/ContactoInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/common/ContactoInputModel.java deleted file mode 100644 index fd7586cd..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/common/ContactoInputModel.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.common; - -import javax.validation.constraints.Email; - -public class ContactoInputModel { - - private String telefono; - - @Email - private String email; - - public String getTelefono() { - return telefono; - } - - public void setTelefono(String telefono) { - this.telefono = telefono; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public static final class Builder { - private String telefono; - private String email; - - private Builder() { - } - - public static Builder aContactoInputModel() { - return new Builder(); - } - - public Builder withTelefono(String telefono) { - this.telefono = telefono; - return this; - } - - public Builder withEmail(String email) { - this.email = email; - return this; - } - - public ContactoInputModel build() { - ContactoInputModel contactoInputModel = new ContactoInputModel(); - contactoInputModel.setTelefono(telefono); - contactoInputModel.setEmail(email); - return contactoInputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/common/CuotaDePagoInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/common/CuotaDePagoInputModel.java deleted file mode 100644 index 42b08fa3..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/common/CuotaDePagoInputModel.java +++ /dev/null @@ -1,99 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.common; - -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.CuotaDePagoInputModel_MontoPorcentajeConstraint; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.HighLevelGroupValidation; - -import javax.validation.constraints.Max; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Positive; -import java.math.BigDecimal; - -@CuotaDePagoInputModel_MontoPorcentajeConstraint(groups = HighLevelGroupValidation.class) -public class CuotaDePagoInputModel { - - @Positive - private BigDecimal monto; - - @Positive - @Max(100) - private BigDecimal porcentaje; - - @NotNull - private Long fechaPago; - - public BigDecimal getMonto() { - return monto; - } - - public void setMonto(BigDecimal monto) { - this.monto = monto; - } - - public BigDecimal getPorcentaje() { - return porcentaje; - } - - public void setPorcentaje(BigDecimal porcentaje) { - this.porcentaje = porcentaje; - } - - public Long getFechaPago() { - return fechaPago; - } - - public void setFechaPago(Long fechaPago) { - this.fechaPago = fechaPago; - } - - public static final class Builder { - private BigDecimal monto; - private BigDecimal porcentaje; - private Long fechaPago; - - private Builder() { - } - - public static Builder aFormaPagoCuotaInputModel() { - return new Builder(); - } - - public Builder withMonto(BigDecimal monto) { - this.monto = monto; - return this; - } - - public Builder withPorcentaje(BigDecimal porcentaje) { - this.porcentaje = porcentaje; - return this; - } - - public Builder withFechaPago(Long fechaPago) { - this.fechaPago = fechaPago; - return this; - } - - public CuotaDePagoInputModel build() { - CuotaDePagoInputModel cuotaDePagoInputModel = new CuotaDePagoInputModel(); - cuotaDePagoInputModel.setMonto(monto); - cuotaDePagoInputModel.setPorcentaje(porcentaje); - cuotaDePagoInputModel.setFechaPago(fechaPago); - return cuotaDePagoInputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/common/DireccionInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/common/DireccionInputModel.java deleted file mode 100644 index f17a9e31..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/common/DireccionInputModel.java +++ /dev/null @@ -1,174 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.common; - -import javax.validation.constraints.Size; - -public class DireccionInputModel { - - @Size(min = 6, max = 6) - private String ubigeo; - - private String codigoLocal; - - private String urbanizacion; - - private String provincia; - - private String departamento; - - private String distrito; - - private String direccion; - - private String codigoPais; - - public String getUbigeo() { - return ubigeo; - } - - public void setUbigeo(String ubigeo) { - this.ubigeo = ubigeo; - } - - public String getCodigoLocal() { - return codigoLocal; - } - - public void setCodigoLocal(String codigoLocal) { - this.codigoLocal = codigoLocal; - } - - public String getUrbanizacion() { - return urbanizacion; - } - - public void setUrbanizacion(String urbanizacion) { - this.urbanizacion = urbanizacion; - } - - public String getProvincia() { - return provincia; - } - - public void setProvincia(String provincia) { - this.provincia = provincia; - } - - public String getDepartamento() { - return departamento; - } - - public void setDepartamento(String departamento) { - this.departamento = departamento; - } - - public String getDistrito() { - return distrito; - } - - public void setDistrito(String distrito) { - this.distrito = distrito; - } - - public String getDireccion() { - return direccion; - } - - public void setDireccion(String direccion) { - this.direccion = direccion; - } - - public String getCodigoPais() { - return codigoPais; - } - - public void setCodigoPais(String codigoPais) { - this.codigoPais = codigoPais; - } - - public static final class Builder { - private String ubigeo; - private String codigoLocal; - private String urbanizacion; - private String provincia; - private String departamento; - private String distrito; - private String direccion; - private String codigoPais; - - private Builder() { - } - - public static Builder aDireccionInputModel() { - return new Builder(); - } - - public Builder withUbigeo(String ubigeo) { - this.ubigeo = ubigeo; - return this; - } - - public Builder withCodigoLocal(String codigoLocal) { - this.codigoLocal = codigoLocal; - return this; - } - - public Builder withUrbanizacion(String urbanizacion) { - this.urbanizacion = urbanizacion; - return this; - } - - public Builder withProvincia(String provincia) { - this.provincia = provincia; - return this; - } - - public Builder withDepartamento(String departamento) { - this.departamento = departamento; - return this; - } - - public Builder withDistrito(String distrito) { - this.distrito = distrito; - return this; - } - - public Builder withDireccion(String direccion) { - this.direccion = direccion; - return this; - } - - public Builder withCodigoPais(String codigoPais) { - this.codigoPais = codigoPais; - return this; - } - - public DireccionInputModel build() { - DireccionInputModel direccionInputModel = new DireccionInputModel(); - direccionInputModel.setUbigeo(ubigeo); - direccionInputModel.setCodigoLocal(codigoLocal); - direccionInputModel.setUrbanizacion(urbanizacion); - direccionInputModel.setProvincia(provincia); - direccionInputModel.setDepartamento(departamento); - direccionInputModel.setDistrito(distrito); - direccionInputModel.setDireccion(direccion); - direccionInputModel.setCodigoPais(codigoPais); - return direccionInputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/common/FirmanteInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/common/FirmanteInputModel.java deleted file mode 100644 index 026e21d4..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/common/FirmanteInputModel.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.common; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; - -public class FirmanteInputModel { - - @NotNull - @NotBlank - private String ruc; - - @NotNull - @NotBlank - private String razonSocial; - - public String getRuc() { - return ruc; - } - - public void setRuc(String ruc) { - this.ruc = ruc; - } - - public String getRazonSocial() { - return razonSocial; - } - - public void setRazonSocial(String razonSocial) { - this.razonSocial = razonSocial; - } - - public static final class Builder { - private String ruc; - private String razonSocial; - - private Builder() { - } - - public static Builder aFirmanteInputModel() { - return new Builder(); - } - - public Builder withRuc(String ruc) { - this.ruc = ruc; - return this; - } - - public Builder withRazonSocial(String razonSocial) { - this.razonSocial = razonSocial; - return this; - } - - public FirmanteInputModel build() { - FirmanteInputModel firmanteInputModel = new FirmanteInputModel(); - firmanteInputModel.setRuc(ruc); - firmanteInputModel.setRazonSocial(razonSocial); - return firmanteInputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/common/ProveedorInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/common/ProveedorInputModel.java deleted file mode 100644 index 168872c3..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/common/ProveedorInputModel.java +++ /dev/null @@ -1,132 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.common; - -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -public class ProveedorInputModel { - - @NotNull - @NotBlank - @Size(min = 11, max = 11) - private String ruc; - - private String nombreComercial; - - @NotNull - @NotBlank - private String razonSocial; - - @Valid - private DireccionInputModel direccion; - - @Valid - private ContactoInputModel contacto; - - public String getRuc() { - return ruc; - } - - public void setRuc(String ruc) { - this.ruc = ruc; - } - - public String getNombreComercial() { - return nombreComercial; - } - - public void setNombreComercial(String nombreComercial) { - this.nombreComercial = nombreComercial; - } - - public String getRazonSocial() { - return razonSocial; - } - - public void setRazonSocial(String razonSocial) { - this.razonSocial = razonSocial; - } - - public DireccionInputModel getDireccion() { - return direccion; - } - - public void setDireccion(DireccionInputModel direccion) { - this.direccion = direccion; - } - - public ContactoInputModel getContacto() { - return contacto; - } - - public void setContacto(ContactoInputModel contacto) { - this.contacto = contacto; - } - - public static final class Builder { - private String ruc; - private String nombreComercial; - private String razonSocial; - private DireccionInputModel direccion; - private ContactoInputModel contacto; - - private Builder() { - } - - public static Builder aProveedorInputModel() { - return new Builder(); - } - - public Builder withRuc(String ruc) { - this.ruc = ruc; - return this; - } - - public Builder withNombreComercial(String nombreComercial) { - this.nombreComercial = nombreComercial; - return this; - } - - public Builder withRazonSocial(String razonSocial) { - this.razonSocial = razonSocial; - return this; - } - - public Builder withDireccion(DireccionInputModel direccion) { - this.direccion = direccion; - return this; - } - - public Builder withContacto(ContactoInputModel contacto) { - this.contacto = contacto; - return this; - } - - public ProveedorInputModel build() { - ProveedorInputModel proveedorInputModel = new ProveedorInputModel(); - proveedorInputModel.setRuc(ruc); - proveedorInputModel.setNombreComercial(nombreComercial); - proveedorInputModel.setRazonSocial(razonSocial); - proveedorInputModel.setDireccion(direccion); - proveedorInputModel.setContacto(contacto); - return proveedorInputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/CompleteValidation.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/CompleteValidation.java deleted file mode 100644 index 10fb4f33..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/CompleteValidation.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.constraints; - -import javax.validation.GroupSequence; -import javax.validation.groups.Default; - -/** - * check both basic constraints and high level ones. - * high level constraints are not checked if basic constraints fail - */ -@GroupSequence({ - Default.class, - HighLevelGroupValidation.class, - DocumentInputModel_PuedeCrearComprobanteConSerieFGroupValidation.class, - NoteInputModel_SerieComprobanteAfectadoGroupValidation.class, - DocumentLineInputModel_CantidadValidaICBGroupValidation.class, - SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoGroupValidation.class -}) -public interface CompleteValidation { -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/CoutaDePagoInputModel_MontoPorcentajeValidator.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/CoutaDePagoInputModel_MontoPorcentajeValidator.java deleted file mode 100644 index 2f5b7415..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/CoutaDePagoInputModel_MontoPorcentajeValidator.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.constraints; - -import io.github.project.openubl.xmlbuilderlib.models.input.common.CuotaDePagoInputModel; - -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; - -public class CoutaDePagoInputModel_MontoPorcentajeValidator implements ConstraintValidator { - - public static final String message = "Se requiere monto o porcentaje"; - - @Override - public void initialize(CuotaDePagoInputModel_MontoPorcentajeConstraint constraintAnnotation) { - } - - @Override - public boolean isValid(CuotaDePagoInputModel value, ConstraintValidatorContext context) { - boolean isValid = (value.getMonto() != null || value.getPorcentaje() != null) - && (value.getMonto() == null || value.getPorcentaje() == null); - - if (!isValid) { - context.disableDefaultConstraintViolation(); - context.buildConstraintViolationWithTemplate(message) - .addConstraintViolation(); - } - - return isValid; - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/CoutaDePagoInputModel_Porcentaje100CollectionValidator.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/CoutaDePagoInputModel_Porcentaje100CollectionValidator.java deleted file mode 100644 index 3a90e001..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/CoutaDePagoInputModel_Porcentaje100CollectionValidator.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.constraints; - -import io.github.project.openubl.xmlbuilderlib.models.input.common.CuotaDePagoInputModel; - -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; -import java.math.BigDecimal; -import java.util.Collection; - -public class CoutaDePagoInputModel_Porcentaje100CollectionValidator implements ConstraintValidator> { - - public static final String message = "Sumatoria de porcentajes debe de ser 100"; - - @Override - public void initialize(CuotaDePagoInputModel_Porcentaje100CollectionConstraint constraintAnnotation) { - } - - @Override - public boolean isValid(Collection value, ConstraintValidatorContext context) { - if (value == null) { - return true; - } - - BigDecimal total = value.stream() - .map(f -> f.getPorcentaje() != null ? f.getPorcentaje() : BigDecimal.ZERO) - .reduce(BigDecimal.ZERO, BigDecimal::add); - boolean isValid = total.compareTo(new BigDecimal(100)) == 0 || total.compareTo(BigDecimal.ZERO) == 0; - - if (!isValid) { - context.disableDefaultConstraintViolation(); - context.buildConstraintViolationWithTemplate(message) - .addConstraintViolation(); - } - - return isValid; - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/CuotaDePagoInputModel_MontoPorcentajeConstraint.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/CuotaDePagoInputModel_MontoPorcentajeConstraint.java deleted file mode 100644 index e5c17170..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/CuotaDePagoInputModel_MontoPorcentajeConstraint.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.constraints; - -import javax.validation.Constraint; -import javax.validation.Payload; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -@Constraint(validatedBy = CoutaDePagoInputModel_MontoPorcentajeValidator.class) -@Target(TYPE) -@Retention(RUNTIME) -public @interface CuotaDePagoInputModel_MontoPorcentajeConstraint { - String message() default ""; - - Class[] groups() default {}; - - Class[] payload() default {}; -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/CuotaDePagoInputModel_Porcentaje100CollectionConstraint.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/CuotaDePagoInputModel_Porcentaje100CollectionConstraint.java deleted file mode 100644 index eca5d06a..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/CuotaDePagoInputModel_Porcentaje100CollectionConstraint.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.constraints; - -import javax.validation.Constraint; -import javax.validation.Payload; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -@Constraint(validatedBy = CoutaDePagoInputModel_Porcentaje100CollectionValidator.class) -@Target({TYPE, FIELD}) -@Retention(RUNTIME) -public @interface CuotaDePagoInputModel_Porcentaje100CollectionConstraint { - String message() default ""; - - Class[] groups() default {}; - - Class[] payload() default {}; -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/DocumentInputModel_PuedeCrearComprobanteConSerieFConstraint.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/DocumentInputModel_PuedeCrearComprobanteConSerieFConstraint.java deleted file mode 100644 index 2a54f77a..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/DocumentInputModel_PuedeCrearComprobanteConSerieFConstraint.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.constraints; - -import javax.validation.Constraint; -import javax.validation.Payload; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -@Constraint(validatedBy = DocumentInputModel_PuedeCrearComprobanteConSerieFValidator.class) -@Target(TYPE) -@Retention(RUNTIME) -public @interface DocumentInputModel_PuedeCrearComprobanteConSerieFConstraint { - String message() default ""; - - Class[] groups() default {}; - - Class[] payload() default {}; -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/DocumentInputModel_PuedeCrearComprobanteConSerieFValidator.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/DocumentInputModel_PuedeCrearComprobanteConSerieFValidator.java deleted file mode 100644 index 14e358a4..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/DocumentInputModel_PuedeCrearComprobanteConSerieFValidator.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.constraints; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog6; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentInputModel; -import io.github.project.openubl.xmlbuilderlib.utils.RegexUtils; - -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; - -public class DocumentInputModel_PuedeCrearComprobanteConSerieFValidator implements ConstraintValidator { - - public static final String message = "Comprobantes que empiecen con serie 'F' sólo pueden ser creados por proveedores con RUC"; - - @Override - public void initialize(DocumentInputModel_PuedeCrearComprobanteConSerieFConstraint constraintAnnotation) { - } - - @Override - public boolean isValid(DocumentInputModel value, ConstraintValidatorContext context) { - if (value.getSerie() == null || value.getCliente() == null || value.getCliente().getTipoDocumentoIdentidad() == null) { - throw new IllegalStateException("Values needed for validation are null. Make sure you call Default.clas validation group before calling this validator"); - } - - String serie = value.getSerie(); - Catalog6 catalog6 = Catalog.valueOfCode(Catalog6.class, value.getCliente().getTipoDocumentoIdentidad()) - .orElseThrow(Catalog.invalidCatalogValue); - - boolean isInvalid = RegexUtils.FACTURA_SERIE_REGEX.matcher(serie).find() && !catalog6.equals(Catalog6.RUC); - - if (isInvalid) { - context.disableDefaultConstraintViolation(); - context.buildConstraintViolationWithTemplate(message) - .addConstraintViolation(); - } - - return !isInvalid; - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/DocumentLineInputModel_CantidadValidaICBConstraint.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/DocumentLineInputModel_CantidadValidaICBConstraint.java deleted file mode 100644 index 0763625f..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/DocumentLineInputModel_CantidadValidaICBConstraint.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.constraints; - -import javax.validation.Constraint; -import javax.validation.Payload; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -@Constraint(validatedBy = DocumentLineInputModel_CantidadValidaICBValidator.class) -@Target(TYPE) -@Retention(RUNTIME) -public @interface DocumentLineInputModel_CantidadValidaICBConstraint { - String message() default ""; - - Class[] groups() default {}; - - Class[] payload() default {}; -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/DocumentLineInputModel_CantidadValidaICBValidator.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/DocumentLineInputModel_CantidadValidaICBValidator.java deleted file mode 100644 index 753ce255..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/DocumentLineInputModel_CantidadValidaICBValidator.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.constraints; - -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentLineInputModel; - -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; - -public class DocumentLineInputModel_CantidadValidaICBValidator implements ConstraintValidator { - - public static final String message = "Si ICB=true debes de indicar un número entero en Cantidad."; - - @Override - public void initialize(DocumentLineInputModel_CantidadValidaICBConstraint constraintAnnotation) { - } - - @Override - public boolean isValid(DocumentLineInputModel value, ConstraintValidatorContext context) { - if (!value.isIcb()) { - return true; - } - - boolean isInvalid = value.getCantidad().stripTrailingZeros().scale() > 0; - - if (isInvalid) { - context.disableDefaultConstraintViolation(); - context.buildConstraintViolationWithTemplate(message) - .addConstraintViolation(); - } - - return !isInvalid; - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/DocumentLineInputModel_PrecioConstraint.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/DocumentLineInputModel_PrecioConstraint.java deleted file mode 100644 index e1a488e1..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/DocumentLineInputModel_PrecioConstraint.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.constraints; - -import javax.validation.Constraint; -import javax.validation.Payload; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -@Constraint(validatedBy = DocumentLineInputModel_PrecioValidator.class) -@Target(TYPE) -@Retention(RUNTIME) -public @interface DocumentLineInputModel_PrecioConstraint { - String message() default ""; - - Class[] groups() default {}; - - Class[] payload() default {}; -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/DocumentLineInputModel_PrecioValidator.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/DocumentLineInputModel_PrecioValidator.java deleted file mode 100644 index 6629e21e..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/DocumentLineInputModel_PrecioValidator.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.constraints; - -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentLineInputModel; - -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; - -public class DocumentLineInputModel_PrecioValidator implements ConstraintValidator { - - public static final String message = "Se requiere precioUnitario o precioConIgv"; - - @Override - public void initialize(DocumentLineInputModel_PrecioConstraint constraintAnnotation) { - } - - @Override - public boolean isValid(DocumentLineInputModel value, ConstraintValidatorContext context) { - boolean isValid = value.getPrecioUnitario() != null || value.getPrecioConIgv() != null; - - if (!isValid) { - context.disableDefaultConstraintViolation(); - context.buildConstraintViolationWithTemplate(message) - .addConstraintViolation(); - } - - return isValid; - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/NoteInputModel_SerieComprobanteAfectadoConstraint.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/NoteInputModel_SerieComprobanteAfectadoConstraint.java deleted file mode 100644 index 80c8146e..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/NoteInputModel_SerieComprobanteAfectadoConstraint.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.constraints; - -import javax.validation.Constraint; -import javax.validation.Payload; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -@Constraint(validatedBy = NoteInputModel_SerieComprobanteAfectadoValidator.class) -@Target(TYPE) -@Retention(RUNTIME) -public @interface NoteInputModel_SerieComprobanteAfectadoConstraint { - String message() default ""; - - Class[] groups() default {}; - - Class[] payload() default {}; -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/NoteInputModel_SerieComprobanteAfectadoValidator.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/NoteInputModel_SerieComprobanteAfectadoValidator.java deleted file mode 100644 index cdbf3c33..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/NoteInputModel_SerieComprobanteAfectadoValidator.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.constraints; - -import io.github.project.openubl.xmlbuilderlib.models.input.standard.note.NoteInputModel; - -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; - -public class NoteInputModel_SerieComprobanteAfectadoValidator implements ConstraintValidator { - - public static final String message = "Primera letra de Nota y Comprobante Afectado deben de coincidir. Ej. Nota: FC01-1 => Comprobante Afectado: F001-1"; - - @Override - public void initialize(NoteInputModel_SerieComprobanteAfectadoConstraint constraintAnnotation) { - } - - @Override - public boolean isValid(NoteInputModel value, ConstraintValidatorContext context) { - if (value.getSerie() == null || value.getSerieNumeroComprobanteAfectado() == null) { - throw new IllegalStateException("Values needed for validation are null. Make sure you call Default.clas validation group before calling this validator"); - } - - boolean isValid = value.getSerie().toUpperCase().startsWith( - value.getSerieNumeroComprobanteAfectado().toUpperCase().substring(0, 1) - ); - - if (!isValid) { - context.disableDefaultConstraintViolation(); - context.buildConstraintViolationWithTemplate(message) - .addConstraintViolation(); - } - - return isValid; - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoConstraint.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoConstraint.java deleted file mode 100644 index e33d9844..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoConstraint.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.constraints; - -import javax.validation.Constraint; -import javax.validation.Payload; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -@Constraint(validatedBy = SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoValidator.class) -@Target(TYPE) -@Retention(RUNTIME) -public @interface SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoConstraint { - String message() default ""; - - Class[] groups() default {}; - - Class[] payload() default {}; -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoGroupValidation.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoGroupValidation.java deleted file mode 100644 index 4bf12fbf..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoGroupValidation.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.constraints; - -/** - * Validations that are executed after {@link javax.validation.groups.Default} group - */ -public interface SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoGroupValidation { -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoValidator.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoValidator.java deleted file mode 100644 index 404f7a75..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/constraints/SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoValidator.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.constraints; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1; -import io.github.project.openubl.xmlbuilderlib.models.input.sunat.SummaryDocumentLineInputModel; - -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; - -/** - * Validations that are executed after {@link javax.validation.groups.Default} group - */ -public class SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoValidator implements ConstraintValidator { - - public static final String message = "Si es Nota Crédito/Débito entonces debes de incluir el campo 'comprobanteAfectado'"; - - @Override - public boolean isValid(SummaryDocumentLineInputModel value, ConstraintValidatorContext context) { - if (value.getComprobante() == null || value.getComprobante().getTipo() == null) { - throw new IllegalStateException("Values needed for validation are null. Make sure you call Default.clas validation group before calling this validator"); - } - - Catalog1 catalog1 = Catalog.valueOfCode(Catalog1.class, value.getComprobante().getTipo()) - .orElseThrow(Catalog.invalidCatalogValue); - - boolean isInvalid = value.getComprobanteAfectado() == null - && (catalog1.equals(Catalog1.NOTA_CREDITO) || catalog1.equals(Catalog1.NOTA_DEBITO)); - - if (isInvalid) { - context.disableDefaultConstraintViolation(); - context.buildConstraintViolationWithTemplate(message) - .addConstraintViolation(); - } - - return !isInvalid; - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/DocTribRelacionadoInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/DocTribRelacionadoInputModel.java deleted file mode 100644 index 381fe4de..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/DocTribRelacionadoInputModel.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.standard; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog12; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.constraints.CatalogConstraint; - -import javax.validation.constraints.NotBlank; - -public abstract class DocTribRelacionadoInputModel { - - @NotBlank - protected String serieNumero; - - @CatalogConstraint(value = Catalog12.class) - protected String tipoDocumento; - - public String getSerieNumero() { - return serieNumero; - } - - public void setSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - } - - public String getTipoDocumento() { - return tipoDocumento; - } - - public void setTipoDocumento(String tipoDocumento) { - this.tipoDocumento = tipoDocumento; - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/DocumentInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/DocumentInputModel.java deleted file mode 100644 index 6a6d446f..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/DocumentInputModel.java +++ /dev/null @@ -1,129 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.standard; - -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.FirmanteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.DocumentInputModel_PuedeCrearComprobanteConSerieFConstraint; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.DocumentInputModel_PuedeCrearComprobanteConSerieFGroupValidation; - -import javax.validation.Valid; -import javax.validation.constraints.*; -import java.util.List; - -@DocumentInputModel_PuedeCrearComprobanteConSerieFConstraint(groups = DocumentInputModel_PuedeCrearComprobanteConSerieFGroupValidation.class) -public abstract class DocumentInputModel { - - @NotNull - @NotBlank - @Pattern(regexp = "^[F|f|B|b].*$") - @Size(min = 4, max = 4) - protected String serie; - - @NotNull - @Min(1) - @Max(99999999) - private Integer numero; - - private Long fechaEmision; - - @NotNull - @Valid - private ClienteInputModel cliente; - - @NotNull - @Valid - private ProveedorInputModel proveedor; - - @Valid - private FirmanteInputModel firmante; - - @NotNull - @NotEmpty - @Valid - private List detalle; - - @Valid - private List guiasRemisionRelacionadas; - - public abstract List getOtrosDocumentosTributariosRelacionados(); - - public String getSerie() { - return serie; - } - - public void setSerie(String serie) { - this.serie = serie; - } - - public Integer getNumero() { - return numero; - } - - public void setNumero(Integer numero) { - this.numero = numero; - } - - public Long getFechaEmision() { - return fechaEmision; - } - - public void setFechaEmision(Long fechaEmision) { - this.fechaEmision = fechaEmision; - } - - public ClienteInputModel getCliente() { - return cliente; - } - - public void setCliente(ClienteInputModel cliente) { - this.cliente = cliente; - } - - public ProveedorInputModel getProveedor() { - return proveedor; - } - - public void setProveedor(ProveedorInputModel proveedor) { - this.proveedor = proveedor; - } - - public FirmanteInputModel getFirmante() { - return firmante; - } - - public void setFirmante(FirmanteInputModel firmante) { - this.firmante = firmante; - } - - public List getDetalle() { - return detalle; - } - - public void setDetalle(List detalle) { - this.detalle = detalle; - } - - public List getGuiasRemisionRelacionadas() { - return guiasRemisionRelacionadas; - } - - public void setGuiasRemisionRelacionadas(List guiasRemisionRelacionadas) { - this.guiasRemisionRelacionadas = guiasRemisionRelacionadas; - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/DocumentLineInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/DocumentLineInputModel.java deleted file mode 100644 index e9ebbb10..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/DocumentLineInputModel.java +++ /dev/null @@ -1,186 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.standard; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog7; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.constraints.CatalogConstraint; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.DocumentLineInputModel_CantidadValidaICBConstraint; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.DocumentLineInputModel_CantidadValidaICBGroupValidation; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.DocumentLineInputModel_PrecioConstraint; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.HighLevelGroupValidation; - -import javax.validation.constraints.Digits; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Positive; -import java.math.BigDecimal; - -@DocumentLineInputModel_PrecioConstraint(groups = HighLevelGroupValidation.class) -@DocumentLineInputModel_CantidadValidaICBConstraint(groups = DocumentLineInputModel_CantidadValidaICBGroupValidation.class) -public class DocumentLineInputModel { - - @NotNull - @NotBlank - private String descripcion; - - private String unidadMedida; - - @NotNull - @Positive - @Digits(integer = 100, fraction = 3) - private BigDecimal cantidad; - - /** - * Precio sin impuestos - */ - @Positive - @Digits(integer = 100, fraction = 2) - private BigDecimal precioUnitario; - - /** - * Precio con impuestos - */ - @Positive - @Digits(integer = 100, fraction = 2) - private BigDecimal precioConIgv; - - @CatalogConstraint(value = Catalog7.class) - private String tipoIgv; - - private boolean icb; - - public String getDescripcion() { - return descripcion; - } - - public void setDescripcion(String descripcion) { - this.descripcion = descripcion; - } - - public String getUnidadMedida() { - return unidadMedida; - } - - public void setUnidadMedida(String unidadMedida) { - this.unidadMedida = unidadMedida; - } - - public BigDecimal getCantidad() { - return cantidad; - } - - public void setCantidad(BigDecimal cantidad) { - this.cantidad = cantidad; - } - - public BigDecimal getPrecioUnitario() { - return precioUnitario; - } - - public void setPrecioUnitario(BigDecimal precioUnitario) { - this.precioUnitario = precioUnitario; - } - - public BigDecimal getPrecioConIgv() { - return precioConIgv; - } - - public void setPrecioConIgv(BigDecimal precioConIgv) { - this.precioConIgv = precioConIgv; - } - - public String getTipoIgv() { - return tipoIgv; - } - - public void setTipoIgv(String tipoIgv) { - this.tipoIgv = tipoIgv; - } - - public boolean isIcb() { - return icb; - } - - public void setIcb(boolean icb) { - this.icb = icb; - } - - public static final class Builder { - private String descripcion; - private String unidadMedida; - private BigDecimal cantidad; - private BigDecimal precioUnitario; - private BigDecimal precioConIgv; - private String tipoIgv; - private boolean icb; - - private Builder() { - } - - public static Builder aDocumentLineInputModel() { - return new Builder(); - } - - public Builder withDescripcion(String descripcion) { - this.descripcion = descripcion; - return this; - } - - public Builder withUnidadMedida(String unidadMedida) { - this.unidadMedida = unidadMedida; - return this; - } - - public Builder withCantidad(BigDecimal cantidad) { - this.cantidad = cantidad; - return this; - } - - public Builder withPrecioUnitario(BigDecimal precioUnitario) { - this.precioUnitario = precioUnitario; - return this; - } - - public Builder withPrecioConIgv(BigDecimal precioConIgv) { - this.precioConIgv = precioConIgv; - return this; - } - - public Builder withTipoIgv(String tipoIgv) { - this.tipoIgv = tipoIgv; - return this; - } - - public Builder withIcb(boolean icb) { - this.icb = icb; - return this; - } - - public DocumentLineInputModel build() { - DocumentLineInputModel documentLineInputModel = new DocumentLineInputModel(); - documentLineInputModel.setDescripcion(descripcion); - documentLineInputModel.setUnidadMedida(unidadMedida); - documentLineInputModel.setCantidad(cantidad); - documentLineInputModel.setPrecioUnitario(precioUnitario); - documentLineInputModel.setPrecioConIgv(precioConIgv); - documentLineInputModel.setTipoIgv(tipoIgv); - documentLineInputModel.setIcb(icb); - return documentLineInputModel; - } - } -} - diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/GuiaRemisionRelacionadaInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/GuiaRemisionRelacionadaInputModel.java deleted file mode 100644 index 5d5f5cfd..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/GuiaRemisionRelacionadaInputModel.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.standard; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1_Guia; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.constraints.CatalogConstraint; - -import javax.validation.constraints.NotBlank; - -public class GuiaRemisionRelacionadaInputModel { - - @NotBlank - protected String serieNumero; - - @CatalogConstraint(value = Catalog1_Guia.class) - protected String tipoDocumento; - - public String getSerieNumero() { - return serieNumero; - } - - public void setSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - } - - public String getTipoDocumento() { - return tipoDocumento; - } - - public void setTipoDocumento(String tipoDocumento) { - this.tipoDocumento = tipoDocumento; - } - - public static final class Builder { - protected String serieNumero; - protected String tipoDocumento; - - private Builder() { - } - - public static Builder aGuiaRemisionRelacionadaInputModel() { - return new Builder(); - } - - public Builder withSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - return this; - } - - public Builder withTipoDocumento(String tipoDocumento) { - this.tipoDocumento = tipoDocumento; - return this; - } - - public GuiaRemisionRelacionadaInputModel build() { - GuiaRemisionRelacionadaInputModel guiaRemisionRelacionadaInputModel = new GuiaRemisionRelacionadaInputModel(); - guiaRemisionRelacionadaInputModel.setSerieNumero(serieNumero); - guiaRemisionRelacionadaInputModel.setTipoDocumento(tipoDocumento); - return guiaRemisionRelacionadaInputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/despatchadvice/DespatchAdviceInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/despatchadvice/DespatchAdviceInputModel.java deleted file mode 100644 index fd21ae98..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/despatchadvice/DespatchAdviceInputModel.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.standard.despatchadvice; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog21; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.constraints.CatalogConstraint; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.FirmanteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; - -import javax.validation.Valid; -import javax.validation.constraints.*; -import java.util.List; - -public class DespatchAdviceInputModel { - - @NotNull - @NotBlank - @Pattern(regexp = "^[T].*$") - @Size(min = 4, max = 4) - protected String serie; - - @Min(1) - @NotNull - private Integer numero; - - private Long fechaEmision; - private String observacion; - - @Valid - private DespatchAdviceInputModel.GuiaRemisionBajaInputModel guiaRemisionDadaDeBaja; - - @Valid - private DespatchAdviceInputModel.DocumentoAdicionalRelacionadoInputModel documentoAdicionalRelacionado; - - @Valid - private FirmanteInputModel firmante; - - @Valid - @NotNull - private ProveedorInputModel remitente; - - @Valid - @NotNull - private ClienteInputModel destinatario; - - @Valid - @NotNull - private DespatchAdviceTrasladoInputModel traslado; - - @Valid - private ClienteInputModel transportista; - - @Valid - private ClienteInputModel conductor; - - @Valid - private DespatchAdviceInputModel.VehiculoInputModel vehiculo; - - @Valid - @NotNull - @NotEmpty - private List detalle; - - public String getSerie() { - return serie; - } - - public void setSerie(String serie) { - this.serie = serie; - } - - public Integer getNumero() { - return numero; - } - - public void setNumero(Integer numero) { - this.numero = numero; - } - - public Long getFechaEmision() { - return fechaEmision; - } - - public void setFechaEmision(Long fechaEmision) { - this.fechaEmision = fechaEmision; - } - - public String getObservacion() { - return observacion; - } - - public void setObservacion(String observacion) { - this.observacion = observacion; - } - - public GuiaRemisionBajaInputModel getGuiaRemisionDadaDeBaja() { - return guiaRemisionDadaDeBaja; - } - - public void setGuiaRemisionDadaDeBaja(GuiaRemisionBajaInputModel guiaRemisionDadaDeBaja) { - this.guiaRemisionDadaDeBaja = guiaRemisionDadaDeBaja; - } - - public DocumentoAdicionalRelacionadoInputModel getDocumentoAdicionalRelacionado() { - return documentoAdicionalRelacionado; - } - - public void setDocumentoAdicionalRelacionado(DocumentoAdicionalRelacionadoInputModel documentoAdicionalRelacionado) { - this.documentoAdicionalRelacionado = documentoAdicionalRelacionado; - } - - public FirmanteInputModel getFirmante() { - return firmante; - } - - public void setFirmante(FirmanteInputModel firmante) { - this.firmante = firmante; - } - - public ProveedorInputModel getRemitente() { - return remitente; - } - - public void setRemitente(ProveedorInputModel remitente) { - this.remitente = remitente; - } - - public ClienteInputModel getDestinatario() { - return destinatario; - } - - public void setDestinatario(ClienteInputModel destinatario) { - this.destinatario = destinatario; - } - - public DespatchAdviceTrasladoInputModel getTraslado() { - return traslado; - } - - public void setTraslado(DespatchAdviceTrasladoInputModel traslado) { - this.traslado = traslado; - } - - public ClienteInputModel getTransportista() { - return transportista; - } - - public void setTransportista(ClienteInputModel transportista) { - this.transportista = transportista; - } - - public ClienteInputModel getConductor() { - return conductor; - } - - public void setConductor(ClienteInputModel conductor) { - this.conductor = conductor; - } - - public VehiculoInputModel getVehiculo() { - return vehiculo; - } - - public void setVehiculo(VehiculoInputModel vehiculo) { - this.vehiculo = vehiculo; - } - - public List getDetalle() { - return detalle; - } - - public void setDetalle(List detalle) { - this.detalle = detalle; - } - - public static class GuiaRemisionBajaInputModel { - @NotBlank - private String serieNumero; - - @NotBlank - @CatalogConstraint(value = Catalog1.class) - private String tipoDocumento; - - public String getSerieNumero() { - return serieNumero; - } - - public void setSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - } - - public String getTipoDocumento() { - return tipoDocumento; - } - - public void setTipoDocumento(String tipoDocumento) { - this.tipoDocumento = tipoDocumento; - } - } - - public static class DocumentoAdicionalRelacionadoInputModel { - @NotBlank - private String serieNumero; - - @NotBlank - @CatalogConstraint(value = Catalog21.class) - private String tipoDocumento; - - public String getSerieNumero() { - return serieNumero; - } - - public void setSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - } - - public String getTipoDocumento() { - return tipoDocumento; - } - - public void setTipoDocumento(String tipoDocumento) { - this.tipoDocumento = tipoDocumento; - } - } - - public static class VehiculoInputModel { - @NotBlank - private String placa; - - public String getPlaca() { - return placa; - } - - public void setPlaca(String placa) { - this.placa = placa; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/despatchadvice/DespatchAdviceLineDetalleInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/despatchadvice/DespatchAdviceLineDetalleInputModel.java deleted file mode 100644 index 04c38c77..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/despatchadvice/DespatchAdviceLineDetalleInputModel.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.standard.despatchadvice; - -import javax.validation.constraints.Min; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; - -public class DespatchAdviceLineDetalleInputModel { - - private String unidadMedida; - - @Min(0) - @NotNull - private BigDecimal cantidad; - - @NotBlank - private String descripcion; - - @NotBlank - private String codigo; - - public String getUnidadMedida() { - return unidadMedida; - } - - public void setUnidadMedida(String unidadMedida) { - this.unidadMedida = unidadMedida; - } - - public BigDecimal getCantidad() { - return cantidad; - } - - public void setCantidad(BigDecimal cantidad) { - this.cantidad = cantidad; - } - - public String getDescripcion() { - return descripcion; - } - - public void setDescripcion(String descripcion) { - this.descripcion = descripcion; - } - - public String getCodigo() { - return codigo; - } - - public void setCodigo(String codigo) { - this.codigo = codigo; - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/despatchadvice/DespatchAdviceTrasladoInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/despatchadvice/DespatchAdviceTrasladoInputModel.java deleted file mode 100644 index f17cba3f..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/despatchadvice/DespatchAdviceTrasladoInputModel.java +++ /dev/null @@ -1,186 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.standard.despatchadvice; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog18; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog20; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.constraints.CatalogConstraint; - -import javax.validation.Valid; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; -import java.math.BigDecimal; - -public class DespatchAdviceTrasladoInputModel { - - @NotNull - @CatalogConstraint(value = Catalog20.class) - private String motivo; - - private String descripcion; - - @NotBlank - private String pesoBrutoUnidadMedida; - - @Min(0) - @NotNull - private BigDecimal pesoBrutoTotal; - - @Min(0) - private Integer numeroBultos; - - private Boolean transbordoProgramado; - - @NotNull - @CatalogConstraint(value = Catalog18.class) - private String modalidad; - - @NotNull - private Long fechaInicio; - - private String codigoPuertoAeropuertoDeEmbarqueOdesembarque; - - @Valid - private DespatchAdviceTrasladoInputModel.PuntoInputModel puntoPartida; - - @NotNull - @Valid - private DespatchAdviceTrasladoInputModel.PuntoInputModel puntoLlegada; - - public String getMotivo() { - return motivo; - } - - public void setMotivo(String motivo) { - this.motivo = motivo; - } - - public String getDescripcion() { - return descripcion; - } - - public void setDescripcion(String descripcion) { - this.descripcion = descripcion; - } - - public String getPesoBrutoUnidadMedida() { - return pesoBrutoUnidadMedida; - } - - public void setPesoBrutoUnidadMedida(String pesoBrutoUnidadMedida) { - this.pesoBrutoUnidadMedida = pesoBrutoUnidadMedida; - } - - public BigDecimal getPesoBrutoTotal() { - return pesoBrutoTotal; - } - - public void setPesoBrutoTotal(BigDecimal pesoBrutoTotal) { - this.pesoBrutoTotal = pesoBrutoTotal; - } - - public Integer getNumeroBultos() { - return numeroBultos; - } - - public void setNumeroBultos(Integer numeroBultos) { - this.numeroBultos = numeroBultos; - } - - public Boolean getTransbordoProgramado() { - return transbordoProgramado; - } - - public void setTransbordoProgramado(Boolean transbordoProgramado) { - this.transbordoProgramado = transbordoProgramado; - } - - public String getModalidad() { - return modalidad; - } - - public void setModalidad(String modalidad) { - this.modalidad = modalidad; - } - - public Long getFechaInicio() { - return fechaInicio; - } - - public void setFechaInicio(Long fechaInicio) { - this.fechaInicio = fechaInicio; - } - - public String getCodigoPuertoAeropuertoDeEmbarqueOdesembarque() { - return codigoPuertoAeropuertoDeEmbarqueOdesembarque; - } - - public void setCodigoPuertoAeropuertoDeEmbarqueOdesembarque(String codigoPuertoAeropuertoDeEmbarqueOdesembarque) { - this.codigoPuertoAeropuertoDeEmbarqueOdesembarque = codigoPuertoAeropuertoDeEmbarqueOdesembarque; - } - - public PuntoInputModel getPuntoPartida() { - return puntoPartida; - } - - public void setPuntoPartida(PuntoInputModel puntoPartida) { - this.puntoPartida = puntoPartida; - } - - public PuntoInputModel getPuntoLlegada() { - return puntoLlegada; - } - - public void setPuntoLlegada(PuntoInputModel puntoLlegada) { - this.puntoLlegada = puntoLlegada; - } - - public static class PuntoInputModel { - @NotBlank - @Size(min = 6, max = 6) - private String codigoPostal; - - @NotBlank - private String direccion; - - public PuntoInputModel() { - } - - public PuntoInputModel(String codigoPostal, String direccion) { - this.codigoPostal = codigoPostal; - this.direccion = direccion; - } - - public String getCodigoPostal() { - return codigoPostal; - } - - public void setCodigoPostal(String codigoPostal) { - this.codigoPostal = codigoPostal; - } - - public String getDireccion() { - return direccion; - } - - public void setDireccion(String direccion) { - this.direccion = direccion; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/invoice/AnticipoInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/invoice/AnticipoInputModel.java deleted file mode 100644 index 38c631a1..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/invoice/AnticipoInputModel.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.standard.invoice; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog12_Anticipo; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.constraints.CatalogConstraint; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocTribRelacionadoInputModel; - -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; - -public class AnticipoInputModel extends DocTribRelacionadoInputModel { - - @CatalogConstraint(value = Catalog12_Anticipo.class) - protected String tipoDocumento; - - @Min(0) - @NotNull - private BigDecimal montoTotal; - - @Override - public String getTipoDocumento() { - return tipoDocumento; - } - - @Override - public void setTipoDocumento(String tipoDocumento) { - this.tipoDocumento = tipoDocumento; - } - - public BigDecimal getMontoTotal() { - return montoTotal; - } - - public void setMontoTotal(BigDecimal montoTotal) { - this.montoTotal = montoTotal; - } - - public static final class Builder { - protected String serieNumero; - protected String tipoDocumento; - private BigDecimal montoTotal; - - private Builder() { - } - - public static Builder anAnticipoInputModel() { - return new Builder(); - } - - public Builder withSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - return this; - } - - public Builder withTipoDocumento(String tipoDocumento) { - this.tipoDocumento = tipoDocumento; - return this; - } - - public Builder withMontoTotal(BigDecimal montoTotal) { - this.montoTotal = montoTotal; - return this; - } - - public AnticipoInputModel build() { - AnticipoInputModel anticipoInputModel = new AnticipoInputModel(); - anticipoInputModel.setSerieNumero(serieNumero); - anticipoInputModel.setTipoDocumento(tipoDocumento); - anticipoInputModel.setMontoTotal(montoTotal); - return anticipoInputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/invoice/CargoDescuentoInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/invoice/CargoDescuentoInputModel.java deleted file mode 100644 index 19008fe2..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/invoice/CargoDescuentoInputModel.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.standard.invoice; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog53; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.constraints.CatalogConstraint; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocTribRelacionadoInputModel; - -import java.math.BigDecimal; - -public class CargoDescuentoInputModel extends DocTribRelacionadoInputModel { - - @CatalogConstraint(value = Catalog53.class) - private String tipo; - - private BigDecimal monto; - private BigDecimal porcentaje; - - public String getTipo() { - return tipo; - } - - public void setTipo(String tipo) { - this.tipo = tipo; - } - - public BigDecimal getMonto() { - return monto; - } - - public void setMonto(BigDecimal monto) { - this.monto = monto; - } - - public BigDecimal getPorcentaje() { - return porcentaje; - } - - public void setPorcentaje(BigDecimal porcentaje) { - this.porcentaje = porcentaje; - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/invoice/DetraccionRelacionadaInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/invoice/DetraccionRelacionadaInputModel.java deleted file mode 100644 index 139e5d2a..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/invoice/DetraccionRelacionadaInputModel.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.standard.invoice; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog54; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog59; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.constraints.CatalogConstraint; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocTribRelacionadoInputModel; - -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; - -public class DetraccionRelacionadaInputModel extends DocTribRelacionadoInputModel { - - @CatalogConstraint(value = Catalog59.class) - private String medioDePago; - - @CatalogConstraint(value = Catalog54.class) - private String tipoBienServicio; - - @Min(0) - @NotNull - private BigDecimal porcentaje; - - private String numeroCuentaBancaria; - - public String getMedioDePago() { - return medioDePago; - } - - public void setMedioDePago(String medioDePago) { - this.medioDePago = medioDePago; - } - - public String getTipoBienServicio() { - return tipoBienServicio; - } - - public void setTipoBienServicio(String tipoBienServicio) { - this.tipoBienServicio = tipoBienServicio; - } - - public BigDecimal getPorcentaje() { - return porcentaje; - } - - public void setPorcentaje(BigDecimal porcentaje) { - this.porcentaje = porcentaje; - } - - public String getNumeroCuentaBancaria() { - return numeroCuentaBancaria; - } - - public void setNumeroCuentaBancaria(String numeroCuentaBancaria) { - this.numeroCuentaBancaria = numeroCuentaBancaria; - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/invoice/DocTribRelacionadoInputModel_Invoice.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/invoice/DocTribRelacionadoInputModel_Invoice.java deleted file mode 100644 index 7150effd..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/invoice/DocTribRelacionadoInputModel_Invoice.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.standard.invoice; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog12_Doc_Trib_Relacionado_Invoice; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.constraints.CatalogConstraint; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocTribRelacionadoInputModel; - -public class DocTribRelacionadoInputModel_Invoice extends DocTribRelacionadoInputModel { - - @CatalogConstraint(value = Catalog12_Doc_Trib_Relacionado_Invoice.class) - protected String tipoDocumento; - - public String getTipoDocumento() { - return tipoDocumento; - } - - public void setTipoDocumento(String tipoDocumento) { - this.tipoDocumento = tipoDocumento; - } - - public static final class Builder { - protected String serieNumero; - protected String tipoDocumento; - - private Builder() { - } - - public static Builder aDocTribRelacionadoInputModel_Invoice() { - return new Builder(); - } - - public Builder withSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - return this; - } - - public Builder withTipoDocumento(String tipoDocumento) { - this.tipoDocumento = tipoDocumento; - return this; - } - - public DocTribRelacionadoInputModel_Invoice build() { - DocTribRelacionadoInputModel_Invoice docTribRelacionadoInputModel_Invoice = new DocTribRelacionadoInputModel_Invoice(); - docTribRelacionadoInputModel_Invoice.setSerieNumero(serieNumero); - docTribRelacionadoInputModel_Invoice.setTipoDocumento(tipoDocumento); - return docTribRelacionadoInputModel_Invoice; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/invoice/InvoiceInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/invoice/InvoiceInputModel.java deleted file mode 100644 index 5a426fcf..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/invoice/InvoiceInputModel.java +++ /dev/null @@ -1,160 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.standard.invoice; - -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.CuotaDePagoInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.FirmanteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.CuotaDePagoInputModel_Porcentaje100CollectionConstraint; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.HighLevelGroupValidation; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentLineInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.GuiaRemisionRelacionadaInputModel; - -import javax.validation.Valid; -import java.util.List; - -public class InvoiceInputModel extends DocumentInputModel { - - @Valid - @CuotaDePagoInputModel_Porcentaje100CollectionConstraint(groups = HighLevelGroupValidation.class) - private List cuotasDePago; - - @Valid - private List otrosDocumentosTributariosRelacionados; - - @Valid - private List anticipos; - - public List getCuotasDePago() { - return cuotasDePago; - } - - public void setCuotasDePago(List cuotasDePago) { - this.cuotasDePago = cuotasDePago; - } - - @Override - public List getOtrosDocumentosTributariosRelacionados() { - return otrosDocumentosTributariosRelacionados; - } - - public void setOtrosDocumentosTributariosRelacionados(List otrosDocumentosTributariosRelacionados) { - this.otrosDocumentosTributariosRelacionados = otrosDocumentosTributariosRelacionados; - } - - public List getAnticipos() { - return anticipos; - } - - public void setAnticipos(List anticipos) { - this.anticipos = anticipos; - } - - public static final class Builder { - protected String serie; - private Integer numero; - private Long fechaEmision; - private ClienteInputModel cliente; - private ProveedorInputModel proveedor; - private FirmanteInputModel firmante; - private List detalle; - private List guiasRemisionRelacionadas; - private List cuotasDePago; - private List otrosDocumentosTributariosRelacionados; - private List anticipos; - - private Builder() { - } - - public static Builder anInvoiceInputModel() { - return new Builder(); - } - - public Builder withSerie(String serie) { - this.serie = serie; - return this; - } - - public Builder withNumero(Integer numero) { - this.numero = numero; - return this; - } - - public Builder withFechaEmision(Long fechaEmision) { - this.fechaEmision = fechaEmision; - return this; - } - - public Builder withCliente(ClienteInputModel cliente) { - this.cliente = cliente; - return this; - } - - public Builder withProveedor(ProveedorInputModel proveedor) { - this.proveedor = proveedor; - return this; - } - - public Builder withFirmante(FirmanteInputModel firmante) { - this.firmante = firmante; - return this; - } - - public Builder withDetalle(List detalle) { - this.detalle = detalle; - return this; - } - - public Builder withGuiasRemisionRelacionadas(List guiasRemisionRelacionadas) { - this.guiasRemisionRelacionadas = guiasRemisionRelacionadas; - return this; - } - - public Builder withCuotasDePago(List cuotasDePago) { - this.cuotasDePago = cuotasDePago; - return this; - } - - public Builder withOtrosDocumentosTributariosRelacionados(List otrosDocumentosTributariosRelacionados) { - this.otrosDocumentosTributariosRelacionados = otrosDocumentosTributariosRelacionados; - return this; - } - - public Builder withAnticipos(List anticipos) { - this.anticipos = anticipos; - return this; - } - - public InvoiceInputModel build() { - InvoiceInputModel invoiceInputModel = new InvoiceInputModel(); - invoiceInputModel.setSerie(serie); - invoiceInputModel.setNumero(numero); - invoiceInputModel.setFechaEmision(fechaEmision); - invoiceInputModel.setCliente(cliente); - invoiceInputModel.setProveedor(proveedor); - invoiceInputModel.setFirmante(firmante); - invoiceInputModel.setDetalle(detalle); - invoiceInputModel.setGuiasRemisionRelacionadas(guiasRemisionRelacionadas); - invoiceInputModel.setCuotasDePago(cuotasDePago); - invoiceInputModel.setOtrosDocumentosTributariosRelacionados(otrosDocumentosTributariosRelacionados); - invoiceInputModel.setAnticipos(anticipos); - return invoiceInputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/invoice/PercepcionRelacionadaInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/invoice/PercepcionRelacionadaInputModel.java deleted file mode 100644 index f23faf08..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/invoice/PercepcionRelacionadaInputModel.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.standard.invoice; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog53; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.constraints.CatalogConstraint; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocTribRelacionadoInputModel; - -import java.math.BigDecimal; - -public class PercepcionRelacionadaInputModel extends DocTribRelacionadoInputModel { - - @CatalogConstraint(value = Catalog53.class) - private String tipo; - - private BigDecimal monto; - private BigDecimal porcentaje; - - public String getTipo() { - return tipo; - } - - public void setTipo(String tipo) { - this.tipo = tipo; - } - - public BigDecimal getMonto() { - return monto; - } - - public void setMonto(BigDecimal monto) { - this.monto = monto; - } - - public BigDecimal getPorcentaje() { - return porcentaje; - } - - public void setPorcentaje(BigDecimal porcentaje) { - this.porcentaje = porcentaje; - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/note/NoteInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/note/NoteInputModel.java deleted file mode 100644 index 90b7c937..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/note/NoteInputModel.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.standard.note; - -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.NoteInputModel_SerieComprobanteAfectadoConstraint; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.NoteInputModel_SerieComprobanteAfectadoGroupValidation; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentInputModel; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; - -@NoteInputModel_SerieComprobanteAfectadoConstraint(groups = NoteInputModel_SerieComprobanteAfectadoGroupValidation.class) -public abstract class NoteInputModel extends DocumentInputModel { - - @NotNull - @NotBlank - @Pattern(regexp = "^([F|B][A-Z]?[0-9]{0,3})[\\-]([0-9]{1,8})$") - private String serieNumeroComprobanteAfectado; - - @NotNull - @NotBlank - private String descripcionSustentoDeNota; - - public String getSerieNumeroComprobanteAfectado() { - return serieNumeroComprobanteAfectado; - } - - public void setSerieNumeroComprobanteAfectado(String serieNumeroComprobanteAfectado) { - this.serieNumeroComprobanteAfectado = serieNumeroComprobanteAfectado; - } - - public String getDescripcionSustentoDeNota() { - return descripcionSustentoDeNota; - } - - public void setDescripcionSustentoDeNota(String descripcionSustentoDeNota) { - this.descripcionSustentoDeNota = descripcionSustentoDeNota; - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/note/creditNote/CreditNoteInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/note/creditNote/CreditNoteInputModel.java deleted file mode 100644 index e739135c..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/note/creditNote/CreditNoteInputModel.java +++ /dev/null @@ -1,175 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.standard.note.creditNote; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog9; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.constraints.CatalogConstraint; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.CuotaDePagoInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.FirmanteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.CuotaDePagoInputModel_Porcentaje100CollectionConstraint; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.HighLevelGroupValidation; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentLineInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.GuiaRemisionRelacionadaInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.note.NoteInputModel; - -import javax.validation.Valid; -import java.util.List; - -public class CreditNoteInputModel extends NoteInputModel { - - @CatalogConstraint(value = Catalog9.class) - private String tipoNota; - - @Valid - @CuotaDePagoInputModel_Porcentaje100CollectionConstraint(groups = HighLevelGroupValidation.class) - private List cuotasDePago; - - @Valid - private List otrosDocumentosTributariosRelacionados; - - public String getTipoNota() { - return tipoNota; - } - - public void setTipoNota(String tipoNota) { - this.tipoNota = tipoNota; - } - - public List getCuotasDePago() { - return cuotasDePago; - } - - public void setCuotasDePago(List cuotasDePago) { - this.cuotasDePago = cuotasDePago; - } - - public List getOtrosDocumentosTributariosRelacionados() { - return otrosDocumentosTributariosRelacionados; - } - - public void setOtrosDocumentosTributariosRelacionados(List otrosDocumentosTributariosRelacionados) { - this.otrosDocumentosTributariosRelacionados = otrosDocumentosTributariosRelacionados; - } - - public static final class Builder { - protected String serie; - private String serieNumeroComprobanteAfectado; - private String tipoNota; - private String descripcionSustento; - private Integer numero; - private Long fechaEmision; - private ClienteInputModel cliente; - private ProveedorInputModel proveedor; - private FirmanteInputModel firmante; - private List detalle; - private List cuotasDePago; - private List guiasRemisionRelacionadas; - private List otrosDocumentosTributariosRelacionados; - - private Builder() { - } - - public static Builder aCreditNoteInputModel() { - return new Builder(); - } - - public Builder withSerieNumeroComprobanteAfectado(String serieNumeroComprobanteAfectado) { - this.serieNumeroComprobanteAfectado = serieNumeroComprobanteAfectado; - return this; - } - - public Builder withTipoNota(String tipoNota) { - this.tipoNota = tipoNota; - return this; - } - - public Builder withDescripcionSustento(String descripcionSustento) { - this.descripcionSustento = descripcionSustento; - return this; - } - - public Builder withSerie(String serie) { - this.serie = serie; - return this; - } - - public Builder withNumero(Integer numero) { - this.numero = numero; - return this; - } - - public Builder withFechaEmision(Long fechaEmision) { - this.fechaEmision = fechaEmision; - return this; - } - - public Builder withCliente(ClienteInputModel cliente) { - this.cliente = cliente; - return this; - } - - public Builder withProveedor(ProveedorInputModel proveedor) { - this.proveedor = proveedor; - return this; - } - - public Builder withFirmante(FirmanteInputModel firmante) { - this.firmante = firmante; - return this; - } - - public Builder withDetalle(List detalle) { - this.detalle = detalle; - return this; - } - - public Builder withCuotasDePago(List cuotasDePago) { - this.cuotasDePago = cuotasDePago; - return this; - } - - public Builder withGuiasRemisionRelacionadas(List guiasRemisionRelacionadas) { - this.guiasRemisionRelacionadas = guiasRemisionRelacionadas; - return this; - } - - public Builder withOtrosDocumentosTributariosRelacionados(List otrosDocumentosTributariosRelacionados) { - this.otrosDocumentosTributariosRelacionados = otrosDocumentosTributariosRelacionados; - return this; - } - - public CreditNoteInputModel build() { - CreditNoteInputModel creditNoteInputModel = new CreditNoteInputModel(); - creditNoteInputModel.setSerieNumeroComprobanteAfectado(serieNumeroComprobanteAfectado); - creditNoteInputModel.setTipoNota(tipoNota); - creditNoteInputModel.setDescripcionSustentoDeNota(descripcionSustento); - creditNoteInputModel.setSerie(serie); - creditNoteInputModel.setNumero(numero); - creditNoteInputModel.setFechaEmision(fechaEmision); - creditNoteInputModel.setCliente(cliente); - creditNoteInputModel.setProveedor(proveedor); - creditNoteInputModel.setFirmante(firmante); - creditNoteInputModel.setDetalle(detalle); - creditNoteInputModel.setCuotasDePago(cuotasDePago); - creditNoteInputModel.setGuiasRemisionRelacionadas(guiasRemisionRelacionadas); - creditNoteInputModel.setOtrosDocumentosTributariosRelacionados(otrosDocumentosTributariosRelacionados); - return creditNoteInputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/note/creditNote/DocTribRelacionadoInputModel_CreditNote.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/note/creditNote/DocTribRelacionadoInputModel_CreditNote.java deleted file mode 100644 index 86c8544d..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/note/creditNote/DocTribRelacionadoInputModel_CreditNote.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.standard.note.creditNote; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog12_Doc_Trib_Relacionado_CreditNote; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.constraints.CatalogConstraint; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocTribRelacionadoInputModel; - -public class DocTribRelacionadoInputModel_CreditNote extends DocTribRelacionadoInputModel { - - @CatalogConstraint(value = Catalog12_Doc_Trib_Relacionado_CreditNote.class) - protected String tipoDocumento; - - public String getTipoDocumento() { - return tipoDocumento; - } - - public void setTipoDocumento(String tipoDocumento) { - this.tipoDocumento = tipoDocumento; - } - - public static final class Builder { - protected String serieNumero; - protected String tipoDocumento; - - private Builder() { - } - - public static Builder aDocTribRelacionadoInputModel_CreditNote() { - return new Builder(); - } - - public Builder withSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - return this; - } - - public Builder withTipoDocumento(String tipoDocumento) { - this.tipoDocumento = tipoDocumento; - return this; - } - - public DocTribRelacionadoInputModel_CreditNote build() { - DocTribRelacionadoInputModel_CreditNote docTribRelacionadoInputModel_CreditNote = new DocTribRelacionadoInputModel_CreditNote(); - docTribRelacionadoInputModel_CreditNote.setSerieNumero(serieNumero); - docTribRelacionadoInputModel_CreditNote.setTipoDocumento(tipoDocumento); - return docTribRelacionadoInputModel_CreditNote; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/note/debitNote/DebitNoteInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/note/debitNote/DebitNoteInputModel.java deleted file mode 100644 index 4f085fd1..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/note/debitNote/DebitNoteInputModel.java +++ /dev/null @@ -1,153 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.standard.note.debitNote; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog10; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.constraints.CatalogConstraint; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.FirmanteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentLineInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.GuiaRemisionRelacionadaInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.note.NoteInputModel; - -import javax.validation.Valid; -import java.util.List; - -public class DebitNoteInputModel extends NoteInputModel { - - @CatalogConstraint(value = Catalog10.class) - private String tipoNota; - - @Valid - private List otrosDocumentosTributariosRelacionados; - - public String getTipoNota() { - return tipoNota; - } - - public void setTipoNota(String tipoNota) { - this.tipoNota = tipoNota; - } - - public List getOtrosDocumentosTributariosRelacionados() { - return otrosDocumentosTributariosRelacionados; - } - - public void setOtrosDocumentosTributariosRelacionados(List otrosDocumentosTributariosRelacionados) { - this.otrosDocumentosTributariosRelacionados = otrosDocumentosTributariosRelacionados; - } - - public static final class Builder { - protected String serie; - private String serieNumeroComprobanteAfectado; - private String tipoNota; - private String descripcionSustento; - private Integer numero; - private Long fechaEmision; - private ClienteInputModel cliente; - private ProveedorInputModel proveedor; - private FirmanteInputModel firmante; - private List detalle; - private List guiasRemisionRelacionadas; - private List otrosDocumentosTributariosRelacionados; - - private Builder() { - } - - public static Builder aDebitNoteInputModel() { - return new Builder(); - } - - public Builder withSerieNumeroComprobanteAfectado(String serieNumeroComprobanteAfectado) { - this.serieNumeroComprobanteAfectado = serieNumeroComprobanteAfectado; - return this; - } - - public Builder withTipoNota(String tipoNota) { - this.tipoNota = tipoNota; - return this; - } - - public Builder withDescripcionSustento(String descripcionSustento) { - this.descripcionSustento = descripcionSustento; - return this; - } - - public Builder withSerie(String serie) { - this.serie = serie; - return this; - } - - public Builder withNumero(Integer numero) { - this.numero = numero; - return this; - } - - public Builder withFechaEmision(Long fechaEmision) { - this.fechaEmision = fechaEmision; - return this; - } - - public Builder withCliente(ClienteInputModel cliente) { - this.cliente = cliente; - return this; - } - - public Builder withProveedor(ProveedorInputModel proveedor) { - this.proveedor = proveedor; - return this; - } - - public Builder withFirmante(FirmanteInputModel firmante) { - this.firmante = firmante; - return this; - } - - public Builder withDetalle(List detalle) { - this.detalle = detalle; - return this; - } - - public Builder withGuiasRemisionRelacionadas(List guiasRemisionRelacionadas) { - this.guiasRemisionRelacionadas = guiasRemisionRelacionadas; - return this; - } - - public Builder withOtrosDocumentosTributariosRelacionados(List otrosDocumentosTributariosRelacionados) { - this.otrosDocumentosTributariosRelacionados = otrosDocumentosTributariosRelacionados; - return this; - } - - public DebitNoteInputModel build() { - DebitNoteInputModel debitNoteInputModel = new DebitNoteInputModel(); - debitNoteInputModel.setSerieNumeroComprobanteAfectado(serieNumeroComprobanteAfectado); - debitNoteInputModel.setTipoNota(tipoNota); - debitNoteInputModel.setDescripcionSustentoDeNota(descripcionSustento); - debitNoteInputModel.setSerie(serie); - debitNoteInputModel.setNumero(numero); - debitNoteInputModel.setFechaEmision(fechaEmision); - debitNoteInputModel.setCliente(cliente); - debitNoteInputModel.setProveedor(proveedor); - debitNoteInputModel.setFirmante(firmante); - debitNoteInputModel.setDetalle(detalle); - debitNoteInputModel.setGuiasRemisionRelacionadas(guiasRemisionRelacionadas); - debitNoteInputModel.setOtrosDocumentosTributariosRelacionados(otrosDocumentosTributariosRelacionados); - return debitNoteInputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/note/debitNote/DocTribRelacionadoInputModel_DebitNote.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/note/debitNote/DocTribRelacionadoInputModel_DebitNote.java deleted file mode 100644 index 1fc2276c..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/standard/note/debitNote/DocTribRelacionadoInputModel_DebitNote.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.standard.note.debitNote; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog12_Doc_Trib_Relacionado_DebitNote; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.constraints.CatalogConstraint; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocTribRelacionadoInputModel; - -public class DocTribRelacionadoInputModel_DebitNote extends DocTribRelacionadoInputModel { - - @CatalogConstraint(value = Catalog12_Doc_Trib_Relacionado_DebitNote.class) - protected String tipoDocumento; - - public String getTipoDocumento() { - return tipoDocumento; - } - - public void setTipoDocumento(String tipoDocumento) { - this.tipoDocumento = tipoDocumento; - } - - public static final class Builder { - protected String serieNumero; - protected String tipoDocumento; - - private Builder() { - } - - public static Builder aDocTribRelacionadoInputModel_DebitNote() { - return new Builder(); - } - - public Builder withSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - return this; - } - - public Builder withTipoDocumento(String tipoDocumento) { - this.tipoDocumento = tipoDocumento; - return this; - } - - public DocTribRelacionadoInputModel_DebitNote build() { - DocTribRelacionadoInputModel_DebitNote docTribRelacionadoInputModel_DebitNote = new DocTribRelacionadoInputModel_DebitNote(); - docTribRelacionadoInputModel_DebitNote.setSerieNumero(serieNumero); - docTribRelacionadoInputModel_DebitNote.setTipoDocumento(tipoDocumento); - return docTribRelacionadoInputModel_DebitNote; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/PerceptionInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/PerceptionInputModel.java deleted file mode 100644 index 146679a0..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/PerceptionInputModel.java +++ /dev/null @@ -1,135 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.sunat; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog22; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.constraints.CatalogConstraint; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.FirmanteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; -import javax.validation.constraints.Size; -import java.util.List; - -public class PerceptionInputModel extends PerceptionRetentionInputModel { - - @NotNull - @NotBlank - @Pattern(regexp = "^[P].*$") - @Size(min = 4, max = 4) - private String serie; - - @CatalogConstraint(value = Catalog22.class) - private String regimen; - - public String getSerie() { - return serie; - } - - public void setSerie(String serie) { - this.serie = serie; - } - - public String getRegimen() { - return regimen; - } - - public void setRegimen(String regimen) { - this.regimen = regimen; - } - - public static final class Builder { - private Integer numero; - private String serie; - private Long fechaEmision; - private String observacion; - private ProveedorInputModel proveedor; - private ClienteInputModel cliente; - private String regimen; - private FirmanteInputModel firmante; - private List detalle; - - private Builder() { - } - - public static Builder aPerceptionInputModel() { - return new Builder(); - } - - public Builder withNumero(Integer numero) { - this.numero = numero; - return this; - } - - public Builder withSerie(String serie) { - this.serie = serie; - return this; - } - - public Builder withFechaEmision(Long fechaEmision) { - this.fechaEmision = fechaEmision; - return this; - } - - public Builder withObservacion(String observacion) { - this.observacion = observacion; - return this; - } - - public Builder withProveedor(ProveedorInputModel proveedor) { - this.proveedor = proveedor; - return this; - } - - public Builder withCliente(ClienteInputModel cliente) { - this.cliente = cliente; - return this; - } - - public Builder withRegimen(String regimen) { - this.regimen = regimen; - return this; - } - - public Builder withFirmante(FirmanteInputModel firmante) { - this.firmante = firmante; - return this; - } - - public Builder withDetalle(List detalle) { - this.detalle = detalle; - return this; - } - - public PerceptionInputModel build() { - PerceptionInputModel perceptionInputModel = new PerceptionInputModel(); - perceptionInputModel.setNumero(numero); - perceptionInputModel.setSerie(serie); - perceptionInputModel.setFechaEmision(fechaEmision); - perceptionInputModel.setObservacion(observacion); - perceptionInputModel.setProveedor(proveedor); - perceptionInputModel.setCliente(cliente); - perceptionInputModel.setRegimen(regimen); - perceptionInputModel.setFirmante(firmante); - perceptionInputModel.setDetalle(detalle); - return perceptionInputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/PerceptionRetentionComprobanteInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/PerceptionRetentionComprobanteInputModel.java deleted file mode 100644 index 41e77b2e..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/PerceptionRetentionComprobanteInputModel.java +++ /dev/null @@ -1,137 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.sunat; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.constraints.CatalogConstraint; - -import javax.validation.constraints.*; -import java.math.BigDecimal; - -public class PerceptionRetentionComprobanteInputModel { - - @NotNull - @Size(min = 3, max = 3) - private String moneda; - - @NotNull - @CatalogConstraint(value = Catalog1.class) - private String tipo; - - @NotNull - @NotBlank - @Pattern(regexp = "^[F|B|0-9].*$") - private String serieNumero; - - @NotNull - private Long fechaEmision; - - @NotNull - @Positive - @Digits(integer = 100, fraction = 2) - private BigDecimal importeTotal; - - public String getMoneda() { - return moneda; - } - - public void setMoneda(String moneda) { - this.moneda = moneda; - } - - public String getTipo() { - return tipo; - } - - public void setTipo(String tipo) { - this.tipo = tipo; - } - - public String getSerieNumero() { - return serieNumero; - } - - public void setSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - } - - public Long getFechaEmision() { - return fechaEmision; - } - - public void setFechaEmision(Long fechaEmision) { - this.fechaEmision = fechaEmision; - } - - public BigDecimal getImporteTotal() { - return importeTotal; - } - - public void setImporteTotal(BigDecimal importeTotal) { - this.importeTotal = importeTotal; - } - - public static final class Builder { - private String moneda; - private String tipo; - private String serieNumero; - private Long fechaEmision; - private BigDecimal importeTotal; - - private Builder() { - } - - public static Builder aPerceptionRetentionComprobanteInputModel() { - return new Builder(); - } - - public Builder withMoneda(String moneda) { - this.moneda = moneda; - return this; - } - - public Builder withTipo(String tipo) { - this.tipo = tipo; - return this; - } - - public Builder withSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - return this; - } - - public Builder withFechaEmision(Long fechaEmision) { - this.fechaEmision = fechaEmision; - return this; - } - - public Builder withImporteTotal(BigDecimal importeTotal) { - this.importeTotal = importeTotal; - return this; - } - - public PerceptionRetentionComprobanteInputModel build() { - PerceptionRetentionComprobanteInputModel perceptionRetentionComprobanteInputModel = new PerceptionRetentionComprobanteInputModel(); - perceptionRetentionComprobanteInputModel.setMoneda(moneda); - perceptionRetentionComprobanteInputModel.setTipo(tipo); - perceptionRetentionComprobanteInputModel.setSerieNumero(serieNumero); - perceptionRetentionComprobanteInputModel.setFechaEmision(fechaEmision); - perceptionRetentionComprobanteInputModel.setImporteTotal(importeTotal); - return perceptionRetentionComprobanteInputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/PerceptionRetentionInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/PerceptionRetentionInputModel.java deleted file mode 100644 index e512b580..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/PerceptionRetentionInputModel.java +++ /dev/null @@ -1,113 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.sunat; - -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.FirmanteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; - -import javax.validation.Valid; -import javax.validation.constraints.Max; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.util.List; - -public abstract class PerceptionRetentionInputModel { - - @NotNull - @Min(1) - @Max(99999999) - private Integer numero; - - private Long fechaEmision; - - private String observacion; - - @NotNull - @Valid - private ProveedorInputModel proveedor; - - @NotNull - @Valid - private ClienteInputModel cliente; - - @Valid - private FirmanteInputModel firmante; - - @NotNull - @NotEmpty - @Valid - private List detalle; - - public Integer getNumero() { - return numero; - } - - public void setNumero(Integer numero) { - this.numero = numero; - } - - public Long getFechaEmision() { - return fechaEmision; - } - - public void setFechaEmision(Long fechaEmision) { - this.fechaEmision = fechaEmision; - } - - public String getObservacion() { - return observacion; - } - - public void setObservacion(String observacion) { - this.observacion = observacion; - } - - public ProveedorInputModel getProveedor() { - return proveedor; - } - - public void setProveedor(ProveedorInputModel proveedor) { - this.proveedor = proveedor; - } - - public ClienteInputModel getCliente() { - return cliente; - } - - public void setCliente(ClienteInputModel cliente) { - this.cliente = cliente; - } - - public FirmanteInputModel getFirmante() { - return firmante; - } - - public void setFirmante(FirmanteInputModel firmante) { - this.firmante = firmante; - } - - public List getDetalle() { - return detalle; - } - - public void setDetalle(List detalle) { - this.detalle = detalle; - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/PerceptionRetentionLineInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/PerceptionRetentionLineInputModel.java deleted file mode 100644 index 9e9531fe..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/PerceptionRetentionLineInputModel.java +++ /dev/null @@ -1,113 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.sunat; - -import javax.validation.Valid; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Positive; -import java.math.BigDecimal; - -public class PerceptionRetentionLineInputModel { - - @Min(1) - private Integer numeroCobroPago; - - private Long fechaCobroPago; - - @Positive - private BigDecimal importeCobroPago; - - @NotNull - @Valid - private PerceptionRetentionComprobanteInputModel comprobante; - - public Integer getNumeroCobroPago() { - return numeroCobroPago; - } - - public void setNumeroCobroPago(Integer numeroCobroPago) { - this.numeroCobroPago = numeroCobroPago; - } - - public Long getFechaCobroPago() { - return fechaCobroPago; - } - - public void setFechaCobroPago(Long fechaCobroPago) { - this.fechaCobroPago = fechaCobroPago; - } - - public BigDecimal getImporteCobroPago() { - return importeCobroPago; - } - - public void setImporteCobroPago(BigDecimal importeCobroPago) { - this.importeCobroPago = importeCobroPago; - } - - public PerceptionRetentionComprobanteInputModel getComprobante() { - return comprobante; - } - - public void setComprobante(PerceptionRetentionComprobanteInputModel comprobante) { - this.comprobante = comprobante; - } - - public static final class Builder { - private Integer numeroCobroPago; - private Long fechaCobroPago; - private BigDecimal importeCobroPago; - private PerceptionRetentionComprobanteInputModel comprobante; - - private Builder() { - } - - public static Builder aPerceptionRetentionLineInputModel() { - return new Builder(); - } - - public Builder withNumeroCobroPago(Integer numeroCobroPago) { - this.numeroCobroPago = numeroCobroPago; - return this; - } - - public Builder withFechaCobroPago(Long fechaCobroPago) { - this.fechaCobroPago = fechaCobroPago; - return this; - } - - public Builder withImporteCobroPago(BigDecimal importeCobroPago) { - this.importeCobroPago = importeCobroPago; - return this; - } - - public Builder withComprobante(PerceptionRetentionComprobanteInputModel comprobante) { - this.comprobante = comprobante; - return this; - } - - public PerceptionRetentionLineInputModel build() { - PerceptionRetentionLineInputModel perceptionRetentionLineInputModel = new PerceptionRetentionLineInputModel(); - perceptionRetentionLineInputModel.setNumeroCobroPago(numeroCobroPago); - perceptionRetentionLineInputModel.setFechaCobroPago(fechaCobroPago); - perceptionRetentionLineInputModel.setImporteCobroPago(importeCobroPago); - perceptionRetentionLineInputModel.setComprobante(comprobante); - return perceptionRetentionLineInputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/RetentionInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/RetentionInputModel.java deleted file mode 100644 index c32a8f54..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/RetentionInputModel.java +++ /dev/null @@ -1,135 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.sunat; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog23; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.constraints.CatalogConstraint; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.FirmanteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; -import javax.validation.constraints.Size; -import java.util.List; - -public class RetentionInputModel extends PerceptionRetentionInputModel { - - @NotNull - @NotBlank - @Pattern(regexp = "^[R].*$") - @Size(min = 4, max = 4) - private String serie; - - @CatalogConstraint(value = Catalog23.class) - private String regimen; - - public String getSerie() { - return serie; - } - - public void setSerie(String serie) { - this.serie = serie; - } - - public String getRegimen() { - return regimen; - } - - public void setRegimen(String regimen) { - this.regimen = regimen; - } - - public static final class Builder { - private Integer numero; - private String serie; - private Long fechaEmision; - private String observacion; - private String regimen; - private ProveedorInputModel proveedor; - private ClienteInputModel cliente; - private FirmanteInputModel firmante; - private List detalle; - - private Builder() { - } - - public static Builder aRetentionInputModel() { - return new Builder(); - } - - public Builder withNumero(Integer numero) { - this.numero = numero; - return this; - } - - public Builder withSerie(String serie) { - this.serie = serie; - return this; - } - - public Builder withFechaEmision(Long fechaEmision) { - this.fechaEmision = fechaEmision; - return this; - } - - public Builder withObservacion(String observacion) { - this.observacion = observacion; - return this; - } - - public Builder withRegimen(String regimen) { - this.regimen = regimen; - return this; - } - - public Builder withProveedor(ProveedorInputModel proveedor) { - this.proveedor = proveedor; - return this; - } - - public Builder withCliente(ClienteInputModel cliente) { - this.cliente = cliente; - return this; - } - - public Builder withFirmante(FirmanteInputModel firmante) { - this.firmante = firmante; - return this; - } - - public Builder withDetalle(List detalle) { - this.detalle = detalle; - return this; - } - - public RetentionInputModel build() { - RetentionInputModel retentionInputModel = new RetentionInputModel(); - retentionInputModel.setNumero(numero); - retentionInputModel.setSerie(serie); - retentionInputModel.setFechaEmision(fechaEmision); - retentionInputModel.setObservacion(observacion); - retentionInputModel.setRegimen(regimen); - retentionInputModel.setProveedor(proveedor); - retentionInputModel.setCliente(cliente); - retentionInputModel.setFirmante(firmante); - retentionInputModel.setDetalle(detalle); - return retentionInputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/SummaryDocumentComprobanteAfectadoInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/SummaryDocumentComprobanteAfectadoInputModel.java deleted file mode 100644 index f456e90f..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/SummaryDocumentComprobanteAfectadoInputModel.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.sunat; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.constraints.CatalogConstraint; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; - -public class SummaryDocumentComprobanteAfectadoInputModel { - - @NotNull - @CatalogConstraint(value = Catalog1.class) - private String tipo; - - @NotNull - @NotBlank - @Pattern(regexp = "^([A-Z]{1,3}[0-9]{1,3})[\\-]([0-9]{1,8})$") - private String serieNumero; - - public String getTipo() { - return tipo; - } - - public void setTipo(String tipo) { - this.tipo = tipo; - } - - public String getSerieNumero() { - return serieNumero; - } - - public void setSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - } - - public static final class Builder { - private String tipo; - private String serieNumero; - - private Builder() { - } - - public static Builder aSummaryDocumentComprobanteAfectadoInputModel() { - return new Builder(); - } - - public Builder withTipo(String tipo) { - this.tipo = tipo; - return this; - } - - public Builder withSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - return this; - } - - public SummaryDocumentComprobanteAfectadoInputModel build() { - SummaryDocumentComprobanteAfectadoInputModel summaryDocumentComprobanteAfectadoInputModel = new SummaryDocumentComprobanteAfectadoInputModel(); - summaryDocumentComprobanteAfectadoInputModel.setTipo(tipo); - summaryDocumentComprobanteAfectadoInputModel.setSerieNumero(serieNumero); - return summaryDocumentComprobanteAfectadoInputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/SummaryDocumentComprobanteInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/SummaryDocumentComprobanteInputModel.java deleted file mode 100644 index 2cc05dee..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/SummaryDocumentComprobanteInputModel.java +++ /dev/null @@ -1,139 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.sunat; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.constraints.CatalogConstraint; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; - -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; - -public class SummaryDocumentComprobanteInputModel { - - @NotNull - @CatalogConstraint(value = Catalog1.class) - private String tipo; - - @NotBlank - @Pattern(regexp = "^([A-Z]{1,3}[0-9]{1,3})[\\-]([0-9]{1,8})$") - private String serieNumero; - - @NotNull - @Valid - private ClienteInputModel cliente; - - @NotNull - @Valid - private SummaryDocumentComprobanteValorVentaInputModel valorVenta; - - @NotNull - @Valid - private SummaryDocumentImpuestosInputModel impuestos; - - public String getTipo() { - return tipo; - } - - public void setTipo(String tipo) { - this.tipo = tipo; - } - - public String getSerieNumero() { - return serieNumero; - } - - public void setSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - } - - public ClienteInputModel getCliente() { - return cliente; - } - - public void setCliente(ClienteInputModel cliente) { - this.cliente = cliente; - } - - public SummaryDocumentComprobanteValorVentaInputModel getValorVenta() { - return valorVenta; - } - - public void setValorVenta(SummaryDocumentComprobanteValorVentaInputModel valorVenta) { - this.valorVenta = valorVenta; - } - - public SummaryDocumentImpuestosInputModel getImpuestos() { - return impuestos; - } - - public void setImpuestos(SummaryDocumentImpuestosInputModel impuestos) { - this.impuestos = impuestos; - } - - public static final class Builder { - private String tipo; - private String serieNumero; - private ClienteInputModel cliente; - private SummaryDocumentComprobanteValorVentaInputModel valorVenta; - private SummaryDocumentImpuestosInputModel impuestos; - - private Builder() { - } - - public static Builder aSummaryDocumentComprobanteInputModel() { - return new Builder(); - } - - public Builder withTipo(String tipo) { - this.tipo = tipo; - return this; - } - - public Builder withSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - return this; - } - - public Builder withCliente(ClienteInputModel cliente) { - this.cliente = cliente; - return this; - } - - public Builder withValorVenta(SummaryDocumentComprobanteValorVentaInputModel valorVenta) { - this.valorVenta = valorVenta; - return this; - } - - public Builder withImpuestos(SummaryDocumentImpuestosInputModel impuestos) { - this.impuestos = impuestos; - return this; - } - - public SummaryDocumentComprobanteInputModel build() { - SummaryDocumentComprobanteInputModel summaryDocumentComprobanteInputModel = new SummaryDocumentComprobanteInputModel(); - summaryDocumentComprobanteInputModel.setTipo(tipo); - summaryDocumentComprobanteInputModel.setSerieNumero(serieNumero); - summaryDocumentComprobanteInputModel.setCliente(cliente); - summaryDocumentComprobanteInputModel.setValorVenta(valorVenta); - summaryDocumentComprobanteInputModel.setImpuestos(impuestos); - return summaryDocumentComprobanteInputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/SummaryDocumentComprobanteValorVentaInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/SummaryDocumentComprobanteValorVentaInputModel.java deleted file mode 100644 index 1275fd00..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/SummaryDocumentComprobanteValorVentaInputModel.java +++ /dev/null @@ -1,148 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.sunat; - -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; - -public class SummaryDocumentComprobanteValorVentaInputModel { - - @NotNull - @Min(0) - private BigDecimal importeTotal; - - @Min(0) - private BigDecimal otrosCargos; - - @Min(0) - private BigDecimal gravado; - - @Min(0) - private BigDecimal exonerado; - - @Min(0) - private BigDecimal inafecto; - - @Min(0) - private BigDecimal gratuito; - - public BigDecimal getImporteTotal() { - return importeTotal; - } - - public void setImporteTotal(BigDecimal importeTotal) { - this.importeTotal = importeTotal; - } - - public BigDecimal getOtrosCargos() { - return otrosCargos; - } - - public void setOtrosCargos(BigDecimal otrosCargos) { - this.otrosCargos = otrosCargos; - } - - public BigDecimal getGravado() { - return gravado; - } - - public void setGravado(BigDecimal gravado) { - this.gravado = gravado; - } - - public BigDecimal getExonerado() { - return exonerado; - } - - public void setExonerado(BigDecimal exonerado) { - this.exonerado = exonerado; - } - - public BigDecimal getInafecto() { - return inafecto; - } - - public void setInafecto(BigDecimal inafecto) { - this.inafecto = inafecto; - } - - public BigDecimal getGratuito() { - return gratuito; - } - - public void setGratuito(BigDecimal gratuito) { - this.gratuito = gratuito; - } - - public static final class Builder { - private BigDecimal importeTotal; - private BigDecimal otrosCargos; - private BigDecimal gravado; - private BigDecimal exonerado; - private BigDecimal inafecto; - private BigDecimal gratuito; - - private Builder() { - } - - public static Builder aSummaryDocumentComprobanteValorVentaInputModel() { - return new Builder(); - } - - public Builder withImporteTotal(BigDecimal importeTotal) { - this.importeTotal = importeTotal; - return this; - } - - public Builder withOtrosCargos(BigDecimal otrosCargos) { - this.otrosCargos = otrosCargos; - return this; - } - - public Builder withGravado(BigDecimal gravado) { - this.gravado = gravado; - return this; - } - - public Builder withExonerado(BigDecimal exonerado) { - this.exonerado = exonerado; - return this; - } - - public Builder withInafecto(BigDecimal inafecto) { - this.inafecto = inafecto; - return this; - } - - public Builder withGratuito(BigDecimal gratuito) { - this.gratuito = gratuito; - return this; - } - - public SummaryDocumentComprobanteValorVentaInputModel build() { - SummaryDocumentComprobanteValorVentaInputModel summaryDocumentComprobanteValorVentaInputModel = new SummaryDocumentComprobanteValorVentaInputModel(); - summaryDocumentComprobanteValorVentaInputModel.setImporteTotal(importeTotal); - summaryDocumentComprobanteValorVentaInputModel.setOtrosCargos(otrosCargos); - summaryDocumentComprobanteValorVentaInputModel.setGravado(gravado); - summaryDocumentComprobanteValorVentaInputModel.setExonerado(exonerado); - summaryDocumentComprobanteValorVentaInputModel.setInafecto(inafecto); - summaryDocumentComprobanteValorVentaInputModel.setGratuito(gratuito); - return summaryDocumentComprobanteValorVentaInputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/SummaryDocumentImpuestosInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/SummaryDocumentImpuestosInputModel.java deleted file mode 100644 index c69c4c14..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/SummaryDocumentImpuestosInputModel.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.sunat; - -import javax.validation.constraints.Digits; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; - -public class SummaryDocumentImpuestosInputModel { - - @NotNull - @Min(0) - @Digits(integer = 100, fraction = 2) - private BigDecimal igv; - - @Min(0) - @Digits(integer = 100, fraction = 2) - private BigDecimal icb; - - public BigDecimal getIgv() { - return igv; - } - - public void setIgv(BigDecimal igv) { - this.igv = igv; - } - - public BigDecimal getIcb() { - return icb; - } - - public void setIcb(BigDecimal icb) { - this.icb = icb; - } - - public static final class Builder { - private BigDecimal igv; - private BigDecimal icb; - - private Builder() { - } - - public static Builder aSummaryDocumentImpuestosInputModel() { - return new Builder(); - } - - public Builder withIgv(BigDecimal igv) { - this.igv = igv; - return this; - } - - public Builder withIcb(BigDecimal icb) { - this.icb = icb; - return this; - } - - public SummaryDocumentImpuestosInputModel build() { - SummaryDocumentImpuestosInputModel summaryDocumentImpuestosInputModel = new SummaryDocumentImpuestosInputModel(); - summaryDocumentImpuestosInputModel.setIgv(igv); - summaryDocumentImpuestosInputModel.setIcb(icb); - return summaryDocumentImpuestosInputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/SummaryDocumentInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/SummaryDocumentInputModel.java deleted file mode 100644 index b5023594..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/SummaryDocumentInputModel.java +++ /dev/null @@ -1,155 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.sunat; - -import io.github.project.openubl.xmlbuilderlib.models.input.common.FirmanteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; - -import javax.validation.Valid; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.util.List; - -public class SummaryDocumentInputModel { - - @Min(1) - @NotNull - private Integer numero; - - private Long fechaEmision; - - @NotNull - private Long fechaEmisionDeComprobantesAsociados; - - @Valid - private FirmanteInputModel firmante; - - @NotNull - @Valid - private ProveedorInputModel proveedor; - - @NotNull - @NotEmpty - @Valid - private List detalle; - - public Integer getNumero() { - return numero; - } - - public void setNumero(Integer numero) { - this.numero = numero; - } - - public Long getFechaEmision() { - return fechaEmision; - } - - public void setFechaEmision(Long fechaEmision) { - this.fechaEmision = fechaEmision; - } - - public Long getFechaEmisionDeComprobantesAsociados() { - return fechaEmisionDeComprobantesAsociados; - } - - public void setFechaEmisionDeComprobantesAsociados(Long fechaEmisionDeComprobantesAsociados) { - this.fechaEmisionDeComprobantesAsociados = fechaEmisionDeComprobantesAsociados; - } - - public FirmanteInputModel getFirmante() { - return firmante; - } - - public void setFirmante(FirmanteInputModel firmante) { - this.firmante = firmante; - } - - public ProveedorInputModel getProveedor() { - return proveedor; - } - - public void setProveedor(ProveedorInputModel proveedor) { - this.proveedor = proveedor; - } - - public List getDetalle() { - return detalle; - } - - public void setDetalle(List detalle) { - this.detalle = detalle; - } - - public static final class Builder { - private Integer numero; - private Long fechaEmision; - private Long fechaEmisionDeComprobantesAsociados; - private FirmanteInputModel firmante; - private ProveedorInputModel proveedor; - private List detalle; - - private Builder() { - } - - public static Builder aSummaryDocumentInputModel() { - return new Builder(); - } - - public Builder withNumero(Integer numero) { - this.numero = numero; - return this; - } - - public Builder withFechaEmision(Long fechaEmision) { - this.fechaEmision = fechaEmision; - return this; - } - - public Builder withFechaEmisionDeComprobantesAsociados(Long fechaEmisionDeComprobantesAsociados) { - this.fechaEmisionDeComprobantesAsociados = fechaEmisionDeComprobantesAsociados; - return this; - } - - public Builder withFirmante(FirmanteInputModel firmante) { - this.firmante = firmante; - return this; - } - - public Builder withProveedor(ProveedorInputModel proveedor) { - this.proveedor = proveedor; - return this; - } - - public Builder withDetalle(List detalle) { - this.detalle = detalle; - return this; - } - - public SummaryDocumentInputModel build() { - SummaryDocumentInputModel summaryDocumentInputModel = new SummaryDocumentInputModel(); - summaryDocumentInputModel.setNumero(numero); - summaryDocumentInputModel.setFechaEmision(fechaEmision); - summaryDocumentInputModel.setFechaEmisionDeComprobantesAsociados(fechaEmisionDeComprobantesAsociados); - summaryDocumentInputModel.setFirmante(firmante); - summaryDocumentInputModel.setProveedor(proveedor); - summaryDocumentInputModel.setDetalle(detalle); - return summaryDocumentInputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/SummaryDocumentLineInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/SummaryDocumentLineInputModel.java deleted file mode 100644 index 764dd64c..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/SummaryDocumentLineInputModel.java +++ /dev/null @@ -1,102 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.sunat; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog19; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.constraints.CatalogConstraint; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoConstraint; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoGroupValidation; - -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; - -@SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoConstraint(groups = SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoGroupValidation.class) -public class SummaryDocumentLineInputModel { - - @NotNull - @NotBlank - @CatalogConstraint(value = Catalog19.class) - private String tipoOperacion; - - @NotNull - @Valid - private SummaryDocumentComprobanteInputModel comprobante; - - @Valid - private SummaryDocumentComprobanteAfectadoInputModel comprobanteAfectado; - - public String getTipoOperacion() { - return tipoOperacion; - } - - public void setTipoOperacion(String tipoOperacion) { - this.tipoOperacion = tipoOperacion; - } - - public SummaryDocumentComprobanteInputModel getComprobante() { - return comprobante; - } - - public void setComprobante(SummaryDocumentComprobanteInputModel comprobante) { - this.comprobante = comprobante; - } - - public SummaryDocumentComprobanteAfectadoInputModel getComprobanteAfectado() { - return comprobanteAfectado; - } - - public void setComprobanteAfectado(SummaryDocumentComprobanteAfectadoInputModel comprobanteAfectado) { - this.comprobanteAfectado = comprobanteAfectado; - } - - public static final class Builder { - private String tipoOperacion; - private SummaryDocumentComprobanteInputModel comprobante; - private SummaryDocumentComprobanteAfectadoInputModel comprobanteAfectado; - - private Builder() { - } - - public static Builder aSummaryDocumentLineInputModel() { - return new Builder(); - } - - public Builder withTipoOperacion(String tipoOperacion) { - this.tipoOperacion = tipoOperacion; - return this; - } - - public Builder withComprobante(SummaryDocumentComprobanteInputModel comprobante) { - this.comprobante = comprobante; - return this; - } - - public Builder withComprobanteAfectado(SummaryDocumentComprobanteAfectadoInputModel comprobanteAfectado) { - this.comprobanteAfectado = comprobanteAfectado; - return this; - } - - public SummaryDocumentLineInputModel build() { - SummaryDocumentLineInputModel summaryDocumentLineInputModel = new SummaryDocumentLineInputModel(); - summaryDocumentLineInputModel.setTipoOperacion(tipoOperacion); - summaryDocumentLineInputModel.setComprobante(comprobante); - summaryDocumentLineInputModel.setComprobanteAfectado(comprobanteAfectado); - return summaryDocumentLineInputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/VoidedDocumentInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/VoidedDocumentInputModel.java deleted file mode 100644 index 9ce2a628..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/VoidedDocumentInputModel.java +++ /dev/null @@ -1,156 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.sunat; - -import io.github.project.openubl.xmlbuilderlib.models.input.common.FirmanteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; - -import javax.validation.Valid; -import javax.validation.constraints.Max; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; - -public class VoidedDocumentInputModel { - - @NotNull - @Min(1) - @Max(99999999) - private Integer numero; - - private Long fechaEmision; - - @Valid - private FirmanteInputModel firmante; - - @NotNull - @Valid - private ProveedorInputModel proveedor; - - @NotNull - @NotBlank - private String descripcionSustento; - - @NotNull - @Valid - private VoidedDocumentLineInputModel comprobante; - - public Integer getNumero() { - return numero; - } - - public void setNumero(Integer numero) { - this.numero = numero; - } - - public Long getFechaEmision() { - return fechaEmision; - } - - public void setFechaEmision(Long fechaEmision) { - this.fechaEmision = fechaEmision; - } - - public FirmanteInputModel getFirmante() { - return firmante; - } - - public void setFirmante(FirmanteInputModel firmante) { - this.firmante = firmante; - } - - public ProveedorInputModel getProveedor() { - return proveedor; - } - - public void setProveedor(ProveedorInputModel proveedor) { - this.proveedor = proveedor; - } - - public String getDescripcionSustento() { - return descripcionSustento; - } - - public void setDescripcionSustento(String descripcionSustento) { - this.descripcionSustento = descripcionSustento; - } - - public VoidedDocumentLineInputModel getComprobante() { - return comprobante; - } - - public void setComprobante(VoidedDocumentLineInputModel comprobante) { - this.comprobante = comprobante; - } - - public static final class Builder { - private Integer numero; - private Long fechaEmision; - private FirmanteInputModel firmante; - private ProveedorInputModel proveedor; - private String descripcionSustento; - private VoidedDocumentLineInputModel comprobante; - - private Builder() { - } - - public static Builder aVoidedDocumentInputModel() { - return new Builder(); - } - - public Builder withNumero(Integer numero) { - this.numero = numero; - return this; - } - - public Builder withFechaEmision(Long fechaEmision) { - this.fechaEmision = fechaEmision; - return this; - } - - public Builder withFirmante(FirmanteInputModel firmante) { - this.firmante = firmante; - return this; - } - - public Builder withProveedor(ProveedorInputModel proveedor) { - this.proveedor = proveedor; - return this; - } - - public Builder withDescripcionSustento(String descripcionSustento) { - this.descripcionSustento = descripcionSustento; - return this; - } - - public Builder withComprobante(VoidedDocumentLineInputModel comprobante) { - this.comprobante = comprobante; - return this; - } - - public VoidedDocumentInputModel build() { - VoidedDocumentInputModel voidedDocumentInputModel = new VoidedDocumentInputModel(); - voidedDocumentInputModel.setNumero(numero); - voidedDocumentInputModel.setFechaEmision(fechaEmision); - voidedDocumentInputModel.setFirmante(firmante); - voidedDocumentInputModel.setProveedor(proveedor); - voidedDocumentInputModel.setDescripcionSustento(descripcionSustento); - voidedDocumentInputModel.setComprobante(comprobante); - return voidedDocumentInputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/VoidedDocumentLineInputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/VoidedDocumentLineInputModel.java deleted file mode 100644 index 5bd00576..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/input/sunat/VoidedDocumentLineInputModel.java +++ /dev/null @@ -1,98 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.input.sunat; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.constraints.CatalogConstraint; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; - -public class VoidedDocumentLineInputModel { - - @NotBlank - @Pattern(regexp = "^([F|B|P|R|T][A-Z]?[0-9]{0,3})[\\-]([0-9]{1,8})$") - private String serieNumero; - - @NotBlank - @CatalogConstraint(value = Catalog1.class) - private String tipoComprobante; - - @NotNull - private Long fechaEmision; - - public String getSerieNumero() { - return serieNumero; - } - - public void setSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - } - - public String getTipoComprobante() { - return tipoComprobante; - } - - public void setTipoComprobante(String tipoComprobante) { - this.tipoComprobante = tipoComprobante; - } - - public Long getFechaEmision() { - return fechaEmision; - } - - public void setFechaEmision(Long fechaEmision) { - this.fechaEmision = fechaEmision; - } - - public static final class Builder { - private String serieNumero; - private String tipoComprobante; - private Long fechaEmision; - - private Builder() { - } - - public static Builder aVoidedDocumentLineInputModel() { - return new Builder(); - } - - public Builder withSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - return this; - } - - public Builder withTipoComprobante(String tipoComprobante) { - this.tipoComprobante = tipoComprobante; - return this; - } - - public Builder withFechaEmision(Long fechaEmision) { - this.fechaEmision = fechaEmision; - return this; - } - - public VoidedDocumentLineInputModel build() { - VoidedDocumentLineInputModel voidedDocumentLineInputModel = new VoidedDocumentLineInputModel(); - voidedDocumentLineInputModel.setSerieNumero(serieNumero); - voidedDocumentLineInputModel.setTipoComprobante(tipoComprobante); - voidedDocumentLineInputModel.setFechaEmision(fechaEmision); - return voidedDocumentLineInputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/common/ClienteOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/common/ClienteOutputModel.java deleted file mode 100644 index e23e6998..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/common/ClienteOutputModel.java +++ /dev/null @@ -1,131 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.common; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog6; - -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; - -public class ClienteOutputModel { - - @NotNull - private Catalog6 tipoDocumentoIdentidad; - - @NotBlank - private String numeroDocumentoIdentidad; - - @NotBlank - private String nombre; - - @Valid - private DireccionOutputModel direccion; - - @Valid - private ContactoOutputModel contacto; - - public Catalog6 getTipoDocumentoIdentidad() { - return tipoDocumentoIdentidad; - } - - public void setTipoDocumentoIdentidad(Catalog6 tipoDocumentoIdentidad) { - this.tipoDocumentoIdentidad = tipoDocumentoIdentidad; - } - - public String getNumeroDocumentoIdentidad() { - return numeroDocumentoIdentidad; - } - - public void setNumeroDocumentoIdentidad(String numeroDocumentoIdentidad) { - this.numeroDocumentoIdentidad = numeroDocumentoIdentidad; - } - - public String getNombre() { - return nombre; - } - - public void setNombre(String nombre) { - this.nombre = nombre; - } - - public DireccionOutputModel getDireccion() { - return direccion; - } - - public void setDireccion(DireccionOutputModel direccion) { - this.direccion = direccion; - } - - public ContactoOutputModel getContacto() { - return contacto; - } - - public void setContacto(ContactoOutputModel contacto) { - this.contacto = contacto; - } - - public static final class Builder { - private Catalog6 tipoDocumentoIdentidad; - private String numeroDocumentoIdentidad; - private String nombre; - private DireccionOutputModel direccion; - private ContactoOutputModel contacto; - - private Builder() { - } - - public static Builder aClienteOutputModel() { - return new Builder(); - } - - public Builder withTipoDocumentoIdentidad(Catalog6 tipoDocumentoIdentidad) { - this.tipoDocumentoIdentidad = tipoDocumentoIdentidad; - return this; - } - - public Builder withNumeroDocumentoIdentidad(String numeroDocumentoIdentidad) { - this.numeroDocumentoIdentidad = numeroDocumentoIdentidad; - return this; - } - - public Builder withNombre(String nombre) { - this.nombre = nombre; - return this; - } - - public Builder withDireccion(DireccionOutputModel direccion) { - this.direccion = direccion; - return this; - } - - public Builder withContacto(ContactoOutputModel contacto) { - this.contacto = contacto; - return this; - } - - public ClienteOutputModel build() { - ClienteOutputModel clienteOutputModel = new ClienteOutputModel(); - clienteOutputModel.setTipoDocumentoIdentidad(tipoDocumentoIdentidad); - clienteOutputModel.setNumeroDocumentoIdentidad(numeroDocumentoIdentidad); - clienteOutputModel.setNombre(nombre); - clienteOutputModel.setDireccion(direccion); - clienteOutputModel.setContacto(contacto); - return clienteOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/common/ContactoOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/common/ContactoOutputModel.java deleted file mode 100644 index c751854c..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/common/ContactoOutputModel.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.common; - -import javax.validation.constraints.Email; - -public class ContactoOutputModel { - - private String telefono; - - @Email - private String email; - - public String getTelefono() { - return telefono; - } - - public void setTelefono(String telefono) { - this.telefono = telefono; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public static final class Builder { - private String telefono; - private String email; - - private Builder() { - } - - public static Builder aContactoOutputModel() { - return new Builder(); - } - - public Builder withTelefono(String telefono) { - this.telefono = telefono; - return this; - } - - public Builder withEmail(String email) { - this.email = email; - return this; - } - - public ContactoOutputModel build() { - ContactoOutputModel contactoOutputModel = new ContactoOutputModel(); - contactoOutputModel.setTelefono(telefono); - contactoOutputModel.setEmail(email); - return contactoOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/common/DireccionOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/common/DireccionOutputModel.java deleted file mode 100644 index 55b7ce7a..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/common/DireccionOutputModel.java +++ /dev/null @@ -1,171 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.common; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.Size; - -public class DireccionOutputModel { - - @Size(min = 6, max = 6) - private String ubigeo; - - @NotBlank - @Size(min = 4, max = 4) - private String codigoLocal; - private String urbanizacion; - private String provincia; - private String departamento; - private String distrito; - private String direccion; - private String codigoPais; - - public String getUbigeo() { - return ubigeo; - } - - public void setUbigeo(String ubigeo) { - this.ubigeo = ubigeo; - } - - public String getCodigoLocal() { - return codigoLocal; - } - - public void setCodigoLocal(String codigoLocal) { - this.codigoLocal = codigoLocal; - } - - public String getUrbanizacion() { - return urbanizacion; - } - - public void setUrbanizacion(String urbanizacion) { - this.urbanizacion = urbanizacion; - } - - public String getProvincia() { - return provincia; - } - - public void setProvincia(String provincia) { - this.provincia = provincia; - } - - public String getDepartamento() { - return departamento; - } - - public void setDepartamento(String departamento) { - this.departamento = departamento; - } - - public String getDistrito() { - return distrito; - } - - public void setDistrito(String distrito) { - this.distrito = distrito; - } - - public String getDireccion() { - return direccion; - } - - public void setDireccion(String direccion) { - this.direccion = direccion; - } - - public String getCodigoPais() { - return codigoPais; - } - - public void setCodigoPais(String codigoPais) { - this.codigoPais = codigoPais; - } - - public static final class Builder { - private String ubigeo; - private String codigoLocal; - private String urbanizacion; - private String provincia; - private String departamento; - private String distrito; - private String direccion; - private String codigoPais; - - private Builder() { - } - - public static Builder aDireccionOutputModel() { - return new Builder(); - } - - public Builder withUbigeo(String ubigeo) { - this.ubigeo = ubigeo; - return this; - } - - public Builder withCodigoLocal(String codigoLocal) { - this.codigoLocal = codigoLocal; - return this; - } - - public Builder withUrbanizacion(String urbanizacion) { - this.urbanizacion = urbanizacion; - return this; - } - - public Builder withProvincia(String provincia) { - this.provincia = provincia; - return this; - } - - public Builder withDepartamento(String departamento) { - this.departamento = departamento; - return this; - } - - public Builder withDistrito(String distrito) { - this.distrito = distrito; - return this; - } - - public Builder withDireccion(String direccion) { - this.direccion = direccion; - return this; - } - - public Builder withCodigoPais(String codigoPais) { - this.codigoPais = codigoPais; - return this; - } - - public DireccionOutputModel build() { - DireccionOutputModel direccionOutputModel = new DireccionOutputModel(); - direccionOutputModel.setUbigeo(ubigeo); - direccionOutputModel.setCodigoLocal(codigoLocal); - direccionOutputModel.setUrbanizacion(urbanizacion); - direccionOutputModel.setProvincia(provincia); - direccionOutputModel.setDepartamento(departamento); - direccionOutputModel.setDistrito(distrito); - direccionOutputModel.setDireccion(direccion); - direccionOutputModel.setCodigoPais(codigoPais); - return direccionOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/common/FirmanteOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/common/FirmanteOutputModel.java deleted file mode 100644 index 37e9e971..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/common/FirmanteOutputModel.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.common; - -import javax.validation.constraints.NotBlank; - -public class FirmanteOutputModel { - - @NotBlank - private String ruc; - - @NotBlank - private String razonSocial; - - public String getRuc() { - return ruc; - } - - public void setRuc(String ruc) { - this.ruc = ruc; - } - - public String getRazonSocial() { - return razonSocial; - } - - public void setRazonSocial(String razonSocial) { - this.razonSocial = razonSocial; - } - - public static final class Builder { - private String ruc; - private String razonSocial; - - private Builder() { - } - - public static Builder aFirmanteOutputModel() { - return new Builder(); - } - - public Builder withRuc(String ruc) { - this.ruc = ruc; - return this; - } - - public Builder withRazonSocial(String razonSocial) { - this.razonSocial = razonSocial; - return this; - } - - public FirmanteOutputModel build() { - FirmanteOutputModel firmanteOutputModel = new FirmanteOutputModel(); - firmanteOutputModel.setRuc(ruc); - firmanteOutputModel.setRazonSocial(razonSocial); - return firmanteOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/common/FormaPagoCuotaOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/common/FormaPagoCuotaOutputModel.java deleted file mode 100644 index 797ac77f..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/common/FormaPagoCuotaOutputModel.java +++ /dev/null @@ -1,95 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.common; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; -import java.math.BigDecimal; - -public class FormaPagoCuotaOutputModel { - - @NotBlank - @Pattern(regexp = "[0-9]{3}") - private String id; - - @NotNull - private BigDecimal monto; - - @NotNull - private String fechaPago; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public BigDecimal getMonto() { - return monto; - } - - public void setMonto(BigDecimal monto) { - this.monto = monto; - } - - public String getFechaPago() { - return fechaPago; - } - - public void setFechaPago(String fechaPago) { - this.fechaPago = fechaPago; - } - - public static final class Builder { - private String id; - private BigDecimal monto; - private String fechaPago; - - private Builder() { - } - - public static Builder aFormaPagoCuotaOutputModel() { - return new Builder(); - } - - public Builder withId(String id) { - this.id = id; - return this; - } - - public Builder withMonto(BigDecimal monto) { - this.monto = monto; - return this; - } - - public Builder withFechaPago(String fechaPago) { - this.fechaPago = fechaPago; - return this; - } - - public FormaPagoCuotaOutputModel build() { - FormaPagoCuotaOutputModel formaPagoCuotaOutputModel = new FormaPagoCuotaOutputModel(); - formaPagoCuotaOutputModel.setId(id); - formaPagoCuotaOutputModel.setMonto(monto); - formaPagoCuotaOutputModel.setFechaPago(fechaPago); - return formaPagoCuotaOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/common/FormaPagoOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/common/FormaPagoOutputModel.java deleted file mode 100644 index 445a64d1..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/common/FormaPagoOutputModel.java +++ /dev/null @@ -1,99 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.common; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; -import java.util.List; - -public class FormaPagoOutputModel { - - public enum Tipo { - Contado, - Credito - } - - @NotNull - private Tipo tipo; - - @NotNull - private BigDecimal montoTotal; - - @Valid - private List cuotas; - - public Tipo getTipo() { - return tipo; - } - - public void setTipo(Tipo tipo) { - this.tipo = tipo; - } - - public BigDecimal getMontoTotal() { - return montoTotal; - } - - public void setMontoTotal(BigDecimal montoTotal) { - this.montoTotal = montoTotal; - } - - public List getCuotas() { - return cuotas; - } - - public void setCuotas(List cuotas) { - this.cuotas = cuotas; - } - - public static final class Builder { - private Tipo tipo; - private BigDecimal montoTotal; - private List cuotas; - - private Builder() { - } - - public static Builder aFormaPagoOutputModel() { - return new Builder(); - } - - public Builder withTipo(Tipo tipo) { - this.tipo = tipo; - return this; - } - - public Builder withMontoTotal(BigDecimal montoTotal) { - this.montoTotal = montoTotal; - return this; - } - - public Builder withCuotas(List cuotas) { - this.cuotas = cuotas; - return this; - } - - public FormaPagoOutputModel build() { - FormaPagoOutputModel formaPagoOutputModel = new FormaPagoOutputModel(); - formaPagoOutputModel.setTipo(tipo); - formaPagoOutputModel.setMontoTotal(montoTotal); - formaPagoOutputModel.setCuotas(cuotas); - return formaPagoOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/common/ProveedorOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/common/ProveedorOutputModel.java deleted file mode 100644 index 7f9adf57..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/common/ProveedorOutputModel.java +++ /dev/null @@ -1,131 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.common; - -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -public class ProveedorOutputModel { - - @NotBlank - @Size(min = 11, max = 11) - private String ruc; - - private String nombreComercial; - - @NotBlank - private String razonSocial; - - @NotNull - @Valid - private DireccionOutputModel direccion; - - @Valid - private ContactoOutputModel contacto; - - public String getRuc() { - return ruc; - } - - public void setRuc(String ruc) { - this.ruc = ruc; - } - - public String getNombreComercial() { - return nombreComercial; - } - - public void setNombreComercial(String nombreComercial) { - this.nombreComercial = nombreComercial; - } - - public String getRazonSocial() { - return razonSocial; - } - - public void setRazonSocial(String razonSocial) { - this.razonSocial = razonSocial; - } - - public DireccionOutputModel getDireccion() { - return direccion; - } - - public void setDireccion(DireccionOutputModel direccion) { - this.direccion = direccion; - } - - public ContactoOutputModel getContacto() { - return contacto; - } - - public void setContacto(ContactoOutputModel contacto) { - this.contacto = contacto; - } - - public static final class Builder { - private String ruc; - private String nombreComercial; - private String razonSocial; - private DireccionOutputModel direccion; - private ContactoOutputModel contacto; - - private Builder() { - } - - public static Builder aProveedorOutputModel() { - return new Builder(); - } - - public Builder withRuc(String ruc) { - this.ruc = ruc; - return this; - } - - public Builder withNombreComercial(String nombreComercial) { - this.nombreComercial = nombreComercial; - return this; - } - - public Builder withRazonSocial(String razonSocial) { - this.razonSocial = razonSocial; - return this; - } - - public Builder withDireccion(DireccionOutputModel direccion) { - this.direccion = direccion; - return this; - } - - public Builder withContacto(ContactoOutputModel contacto) { - this.contacto = contacto; - return this; - } - - public ProveedorOutputModel build() { - ProveedorOutputModel proveedorOutputModel = new ProveedorOutputModel(); - proveedorOutputModel.setRuc(ruc); - proveedorOutputModel.setNombreComercial(nombreComercial); - proveedorOutputModel.setRazonSocial(razonSocial); - proveedorOutputModel.setDireccion(direccion); - proveedorOutputModel.setContacto(contacto); - return proveedorOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/DocumentImpuestosOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/DocumentImpuestosOutputModel.java deleted file mode 100644 index 1a693563..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/DocumentImpuestosOutputModel.java +++ /dev/null @@ -1,169 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.standard; - -import javax.validation.Valid; -import javax.validation.constraints.Digits; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; - -public class DocumentImpuestosOutputModel { - - @Min(0) - @NotNull - @Digits(integer = 100, fraction = 2) - private BigDecimal importeTotal; - - @Valid - private ImpuestoTotalOutputModel ivap; - - @Valid - private ImpuestoTotalOutputModel gravadas; - - @Valid - private ImpuestoTotalOutputModel inafectas; - - @Valid - private ImpuestoTotalOutputModel exoneradas; - - @Valid - private ImpuestoTotalOutputModel gratuitas; - - @Valid - private ImpuestoTotalICBOutputModel icb; - - public BigDecimal getImporteTotal() { - return importeTotal; - } - - public void setImporteTotal(BigDecimal importeTotal) { - this.importeTotal = importeTotal; - } - - public ImpuestoTotalOutputModel getIvap() { - return ivap; - } - - public void setIvap(ImpuestoTotalOutputModel ivap) { - this.ivap = ivap; - } - - public ImpuestoTotalOutputModel getGravadas() { - return gravadas; - } - - public void setGravadas(ImpuestoTotalOutputModel gravadas) { - this.gravadas = gravadas; - } - - public ImpuestoTotalOutputModel getInafectas() { - return inafectas; - } - - public void setInafectas(ImpuestoTotalOutputModel inafectas) { - this.inafectas = inafectas; - } - - public ImpuestoTotalOutputModel getExoneradas() { - return exoneradas; - } - - public void setExoneradas(ImpuestoTotalOutputModel exoneradas) { - this.exoneradas = exoneradas; - } - - public ImpuestoTotalOutputModel getGratuitas() { - return gratuitas; - } - - public void setGratuitas(ImpuestoTotalOutputModel gratuitas) { - this.gratuitas = gratuitas; - } - - public ImpuestoTotalICBOutputModel getIcb() { - return icb; - } - - public void setIcb(ImpuestoTotalICBOutputModel icb) { - this.icb = icb; - } - - public static final class Builder { - private BigDecimal importeTotal; - private ImpuestoTotalOutputModel ivap; - private ImpuestoTotalOutputModel gravadas; - private ImpuestoTotalOutputModel inafectas; - private ImpuestoTotalOutputModel exoneradas; - private ImpuestoTotalOutputModel gratuitas; - private ImpuestoTotalICBOutputModel icb; - - private Builder() { - } - - public static Builder aDocumentImpuestosOutputModel() { - return new Builder(); - } - - public Builder withImporteTotal(BigDecimal importeTotal) { - this.importeTotal = importeTotal; - return this; - } - - public Builder withIvap(ImpuestoTotalOutputModel ivap) { - this.ivap = ivap; - return this; - } - - public Builder withGravadas(ImpuestoTotalOutputModel gravadas) { - this.gravadas = gravadas; - return this; - } - - public Builder withInafectas(ImpuestoTotalOutputModel inafectas) { - this.inafectas = inafectas; - return this; - } - - public Builder withExoneradas(ImpuestoTotalOutputModel exoneradas) { - this.exoneradas = exoneradas; - return this; - } - - public Builder withGratuitas(ImpuestoTotalOutputModel gratuitas) { - this.gratuitas = gratuitas; - return this; - } - - public Builder withIcb(ImpuestoTotalICBOutputModel icb) { - this.icb = icb; - return this; - } - - public DocumentImpuestosOutputModel build() { - DocumentImpuestosOutputModel documentImpuestosOutputModel = new DocumentImpuestosOutputModel(); - documentImpuestosOutputModel.setImporteTotal(importeTotal); - documentImpuestosOutputModel.setIvap(ivap); - documentImpuestosOutputModel.setGravadas(gravadas); - documentImpuestosOutputModel.setInafectas(inafectas); - documentImpuestosOutputModel.setExoneradas(exoneradas); - documentImpuestosOutputModel.setGratuitas(gratuitas); - documentImpuestosOutputModel.setIcb(icb); - return documentImpuestosOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/DocumentLineImpuestosOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/DocumentLineImpuestosOutputModel.java deleted file mode 100644 index 39512275..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/DocumentLineImpuestosOutputModel.java +++ /dev/null @@ -1,98 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.standard; - -import javax.validation.Valid; -import javax.validation.constraints.Digits; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; - -public class DocumentLineImpuestosOutputModel { - - @Min(0) - @NotNull - @Digits(integer = 100, fraction = 2) - private BigDecimal importeTotal; - - @Valid - @NotNull - private ImpuestoDetalladoIGVOutputModel igv; - - @Valid - private ImpuestoDetalladoICBOutputModel icb; - - public BigDecimal getImporteTotal() { - return importeTotal; - } - - public void setImporteTotal(BigDecimal importeTotal) { - this.importeTotal = importeTotal; - } - - public ImpuestoDetalladoIGVOutputModel getIgv() { - return igv; - } - - public void setIgv(ImpuestoDetalladoIGVOutputModel igv) { - this.igv = igv; - } - - public ImpuestoDetalladoICBOutputModel getIcb() { - return icb; - } - - public void setIcb(ImpuestoDetalladoICBOutputModel icb) { - this.icb = icb; - } - - public static final class Builder { - private BigDecimal importeTotal; - private ImpuestoDetalladoIGVOutputModel igv; - private ImpuestoDetalladoICBOutputModel icb; - - private Builder() { - } - - public static Builder aDocumentLineImpuestosOutputModel() { - return new Builder(); - } - - public Builder withImporteTotal(BigDecimal importeTotal) { - this.importeTotal = importeTotal; - return this; - } - - public Builder withIgv(ImpuestoDetalladoIGVOutputModel igv) { - this.igv = igv; - return this; - } - - public Builder withIcb(ImpuestoDetalladoICBOutputModel icb) { - this.icb = icb; - return this; - } - - public DocumentLineImpuestosOutputModel build() { - DocumentLineImpuestosOutputModel documentLineImpuestosOutputModel = new DocumentLineImpuestosOutputModel(); - documentLineImpuestosOutputModel.setImporteTotal(importeTotal); - documentLineImpuestosOutputModel.setIgv(igv); - documentLineImpuestosOutputModel.setIcb(icb); - return documentLineImpuestosOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/DocumentLineOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/DocumentLineOutputModel.java deleted file mode 100644 index cee27e62..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/DocumentLineOutputModel.java +++ /dev/null @@ -1,199 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.standard; - -import javax.validation.Valid; -import javax.validation.constraints.*; -import java.math.BigDecimal; - -public class DocumentLineOutputModel { - - @NotBlank - private String descripcion; - - @NotBlank - private String unidadMedida; - - @NotNull - @Positive - @Digits(integer = 100, fraction = 3) - private BigDecimal cantidad; - - /** - * Precio sin impuestos - */ - @Min(0) - @NotNull - @Digits(integer = 100, fraction = 2) - private BigDecimal precioUnitario; - - /** - * Precio con impuestos - */ - @Min(0) - @NotNull - @Digits(integer = 100, fraction = 2) - private BigDecimal precioConIgv; - - @Valid - @NotNull - private DocumentLinePrecioReferenciaOutputModel precioDeReferencia; - - @Min(0) - @NotNull - @Digits(integer = 100, fraction = 2) - private BigDecimal valorVentaSinImpuestos; - - @NotNull - @Valid - private DocumentLineImpuestosOutputModel impuestos; - - public String getDescripcion() { - return descripcion; - } - - public void setDescripcion(String descripcion) { - this.descripcion = descripcion; - } - - public String getUnidadMedida() { - return unidadMedida; - } - - public void setUnidadMedida(String unidadMedida) { - this.unidadMedida = unidadMedida; - } - - public BigDecimal getCantidad() { - return cantidad; - } - - public void setCantidad(BigDecimal cantidad) { - this.cantidad = cantidad; - } - - public BigDecimal getPrecioUnitario() { - return precioUnitario; - } - - public void setPrecioUnitario(BigDecimal precioUnitario) { - this.precioUnitario = precioUnitario; - } - - public BigDecimal getPrecioConIgv() { - return precioConIgv; - } - - public void setPrecioConIgv(BigDecimal precioConIgv) { - this.precioConIgv = precioConIgv; - } - - public DocumentLinePrecioReferenciaOutputModel getPrecioDeReferencia() { - return precioDeReferencia; - } - - public void setPrecioDeReferencia(DocumentLinePrecioReferenciaOutputModel precioDeReferencia) { - this.precioDeReferencia = precioDeReferencia; - } - - public BigDecimal getValorVentaSinImpuestos() { - return valorVentaSinImpuestos; - } - - public void setValorVentaSinImpuestos(BigDecimal valorVentaSinImpuestos) { - this.valorVentaSinImpuestos = valorVentaSinImpuestos; - } - - public DocumentLineImpuestosOutputModel getImpuestos() { - return impuestos; - } - - public void setImpuestos(DocumentLineImpuestosOutputModel impuestos) { - this.impuestos = impuestos; - } - - public static final class Builder { - private String descripcion; - private String unidadMedida; - private BigDecimal cantidad; - private BigDecimal precioUnitario; - private BigDecimal precioConIgv; - private DocumentLinePrecioReferenciaOutputModel precioDeReferencia; - private BigDecimal valorVentaSinImpuestos; - private DocumentLineImpuestosOutputModel impuestos; - - private Builder() { - } - - public static Builder aDocumentLineOutputModel() { - return new Builder(); - } - - public Builder withDescripcion(String descripcion) { - this.descripcion = descripcion; - return this; - } - - public Builder withUnidadMedida(String unidadMedida) { - this.unidadMedida = unidadMedida; - return this; - } - - public Builder withCantidad(BigDecimal cantidad) { - this.cantidad = cantidad; - return this; - } - - public Builder withPrecioUnitario(BigDecimal precioUnitario) { - this.precioUnitario = precioUnitario; - return this; - } - - public Builder withPrecioConIgv(BigDecimal precioConIgv) { - this.precioConIgv = precioConIgv; - return this; - } - - public Builder withPrecioDeReferencia(DocumentLinePrecioReferenciaOutputModel precioDeReferencia) { - this.precioDeReferencia = precioDeReferencia; - return this; - } - - public Builder withValorVentaSinImpuestos(BigDecimal valorVenta) { - this.valorVentaSinImpuestos = valorVenta; - return this; - } - - public Builder withImpuestos(DocumentLineImpuestosOutputModel impuestos) { - this.impuestos = impuestos; - return this; - } - - public DocumentLineOutputModel build() { - DocumentLineOutputModel documentLineOutputModel = new DocumentLineOutputModel(); - documentLineOutputModel.setDescripcion(descripcion); - documentLineOutputModel.setUnidadMedida(unidadMedida); - documentLineOutputModel.setCantidad(cantidad); - documentLineOutputModel.setPrecioUnitario(precioUnitario); - documentLineOutputModel.setPrecioConIgv(precioConIgv); - documentLineOutputModel.setPrecioDeReferencia(precioDeReferencia); - documentLineOutputModel.setValorVentaSinImpuestos(valorVentaSinImpuestos); - documentLineOutputModel.setImpuestos(impuestos); - return documentLineOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/DocumentLinePrecioReferenciaOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/DocumentLinePrecioReferenciaOutputModel.java deleted file mode 100644 index edd1c890..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/DocumentLinePrecioReferenciaOutputModel.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.standard; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog16; - -import javax.validation.constraints.Digits; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; - -public class DocumentLinePrecioReferenciaOutputModel { - - @Min(0) - @NotNull - @Digits(integer = 100, fraction = 2) - private BigDecimal precio; - - @NotNull - private Catalog16 tipoPrecio; - - public BigDecimal getPrecio() { - return precio; - } - - public void setPrecio(BigDecimal precio) { - this.precio = precio; - } - - public Catalog16 getTipoPrecio() { - return tipoPrecio; - } - - public void setTipoPrecio(Catalog16 tipoPrecio) { - this.tipoPrecio = tipoPrecio; - } - - public static final class Builder { - private BigDecimal precio; - private Catalog16 tipoPrecio; - - private Builder() { - } - - public static Builder aDetallePrecioReferenciaOutputModel() { - return new Builder(); - } - - public Builder withPrecio(BigDecimal precio) { - this.precio = precio; - return this; - } - - public Builder withTipoPrecio(Catalog16 tipoPrecio) { - this.tipoPrecio = tipoPrecio; - return this; - } - - public DocumentLinePrecioReferenciaOutputModel build() { - DocumentLinePrecioReferenciaOutputModel detallePrecioReferenciaOutputModel = new DocumentLinePrecioReferenciaOutputModel(); - detallePrecioReferenciaOutputModel.setPrecio(precio); - detallePrecioReferenciaOutputModel.setTipoPrecio(tipoPrecio); - return detallePrecioReferenciaOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/DocumentMonetaryTotalOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/DocumentMonetaryTotalOutputModel.java deleted file mode 100644 index c6a6a099..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/DocumentMonetaryTotalOutputModel.java +++ /dev/null @@ -1,119 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.standard; - -import javax.validation.constraints.Digits; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; - -public class DocumentMonetaryTotalOutputModel { - - @Min(0) - @NotNull - @Digits(integer = 100, fraction = 2) - private BigDecimal valorVentaSinImpuestos; - - @Min(0) - @NotNull - @Digits(integer = 100, fraction = 2) - private BigDecimal valorVentaConImpuestos; - - @Min(0) - @NotNull - @Digits(integer = 100, fraction = 2) - private BigDecimal importeTotal; - - @Min(0) - @Digits(integer = 100, fraction = 2) - private BigDecimal anticiposTotal; - - public BigDecimal getValorVentaSinImpuestos() { - return valorVentaSinImpuestos; - } - - public void setValorVentaSinImpuestos(BigDecimal valorVentaSinImpuestos) { - this.valorVentaSinImpuestos = valorVentaSinImpuestos; - } - - public BigDecimal getValorVentaConImpuestos() { - return valorVentaConImpuestos; - } - - public void setValorVentaConImpuestos(BigDecimal valorVentaConImpuestos) { - this.valorVentaConImpuestos = valorVentaConImpuestos; - } - - public BigDecimal getImporteTotal() { - return importeTotal; - } - - public void setImporteTotal(BigDecimal importeTotal) { - this.importeTotal = importeTotal; - } - - public BigDecimal getAnticiposTotal() { - return anticiposTotal; - } - - public void setAnticiposTotal(BigDecimal anticiposTotal) { - this.anticiposTotal = anticiposTotal; - } - - public static final class Builder { - private BigDecimal valorVentaSinImpuestos; - private BigDecimal valorVentaConImpuestos; - private BigDecimal importeTotal; - private BigDecimal anticiposTotal; - - private Builder() { - } - - public static Builder aDocumentMonetaryTotalOutputModel() { - return new Builder(); - } - - public Builder withValorVentaSinImpuestos(BigDecimal valorVentaSinImpuestos) { - this.valorVentaSinImpuestos = valorVentaSinImpuestos; - return this; - } - - public Builder withValorVentaConImpuestos(BigDecimal valorVentaConImpuestos) { - this.valorVentaConImpuestos = valorVentaConImpuestos; - return this; - } - - public Builder withImporteTotal(BigDecimal importeTotal) { - this.importeTotal = importeTotal; - return this; - } - - public Builder withAnticiposTotal(BigDecimal anticiposTotal) { - this.anticiposTotal = anticiposTotal; - return this; - } - - public DocumentMonetaryTotalOutputModel build() { - DocumentMonetaryTotalOutputModel documentMonetaryTotalOutputModel = new DocumentMonetaryTotalOutputModel(); - documentMonetaryTotalOutputModel.setValorVentaSinImpuestos(valorVentaSinImpuestos); - documentMonetaryTotalOutputModel.setValorVentaConImpuestos(valorVentaConImpuestos); - documentMonetaryTotalOutputModel.setImporteTotal(importeTotal); - documentMonetaryTotalOutputModel.setAnticiposTotal(anticiposTotal); - return documentMonetaryTotalOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/DocumentOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/DocumentOutputModel.java deleted file mode 100644 index 4ca2fdaa..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/DocumentOutputModel.java +++ /dev/null @@ -1,272 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.standard; - -import io.github.project.openubl.xmlbuilderlib.models.output.common.ClienteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.FirmanteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.FormaPagoOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.ProveedorOutputModel; - -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; -import java.util.List; - -public abstract class DocumentOutputModel { - - @NotBlank - @Size(min = 3, max = 3) - protected String moneda; - - @NotBlank - protected String serieNumero; - - @NotBlank - protected String horaEmision; - - @NotBlank - protected String fechaEmision; - - @Valid - @NotNull - protected ClienteOutputModel cliente; - - @Valid - @NotNull - protected FirmanteOutputModel firmante; - - @Valid - @NotNull - protected ProveedorOutputModel proveedor; - - @Valid - @NotNull - protected DocumentMonetaryTotalOutputModel totales; - - @Valid - @NotNull - protected DocumentImpuestosOutputModel impuestos; - - @Valid - @NotEmpty - protected List detalle; - - @Valid - protected FormaPagoOutputModel formaPago; - - @NotNull - @Valid - protected List guiasRemisionRelacionadas; - - @NotNull - @Valid - protected List otrosDocumentosTributariosRelacionados; - - public String getMoneda() { - return moneda; - } - - public void setMoneda(String moneda) { - this.moneda = moneda; - } - - public String getSerieNumero() { - return serieNumero; - } - - public void setSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - } - - public String getHoraEmision() { - return horaEmision; - } - - public void setHoraEmision(String horaEmision) { - this.horaEmision = horaEmision; - } - - public String getFechaEmision() { - return fechaEmision; - } - - public void setFechaEmision(String fechaEmision) { - this.fechaEmision = fechaEmision; - } - - public ClienteOutputModel getCliente() { - return cliente; - } - - public void setCliente(ClienteOutputModel cliente) { - this.cliente = cliente; - } - - public FirmanteOutputModel getFirmante() { - return firmante; - } - - public void setFirmante(FirmanteOutputModel firmante) { - this.firmante = firmante; - } - - public ProveedorOutputModel getProveedor() { - return proveedor; - } - - public void setProveedor(ProveedorOutputModel proveedor) { - this.proveedor = proveedor; - } - - public DocumentMonetaryTotalOutputModel getTotales() { - return totales; - } - - public void setTotales(DocumentMonetaryTotalOutputModel totales) { - this.totales = totales; - } - - public DocumentImpuestosOutputModel getImpuestos() { - return impuestos; - } - - public void setImpuestos(DocumentImpuestosOutputModel impuestos) { - this.impuestos = impuestos; - } - - public List getDetalle() { - return detalle; - } - - public void setDetalle(List detalle) { - this.detalle = detalle; - } - - public FormaPagoOutputModel getFormaPago() { - return formaPago; - } - - public void setFormaPago(FormaPagoOutputModel formaPago) { - this.formaPago = formaPago; - } - - public List getGuiasRemisionRelacionadas() { - return guiasRemisionRelacionadas; - } - - public void setGuiasRemisionRelacionadas(List guiasRemisionRelacionadas) { - this.guiasRemisionRelacionadas = guiasRemisionRelacionadas; - } - - public List getOtrosDocumentosTributariosRelacionados() { - return otrosDocumentosTributariosRelacionados; - } - - public void setOtrosDocumentosTributariosRelacionados(List otrosDocumentosTributariosRelacionados) { - this.otrosDocumentosTributariosRelacionados = otrosDocumentosTributariosRelacionados; - } - - public static class Builder { - protected String moneda; - protected String serieNumero; - protected String horaEmision; - protected String fechaEmision; - protected ClienteOutputModel cliente; - protected FirmanteOutputModel firmante; - protected ProveedorOutputModel proveedor; - protected DocumentMonetaryTotalOutputModel totales; - protected DocumentImpuestosOutputModel impuestos; - protected List detalle; - protected FormaPagoOutputModel formaPago; - protected List guiasRemisionRelacionadas; - protected List otrosDocumentosTributariosRelacionados; - - protected Builder() { - } - - public static Builder aDocumentOutputModel() { - return new Builder(); - } - - public Builder withMoneda(String moneda) { - this.moneda = moneda; - return this; - } - - public Builder withSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - return this; - } - - public Builder withHoraEmision(String horaEmision) { - this.horaEmision = horaEmision; - return this; - } - - public Builder withFechaEmision(String fechaEmision) { - this.fechaEmision = fechaEmision; - return this; - } - - public Builder withCliente(ClienteOutputModel cliente) { - this.cliente = cliente; - return this; - } - - public Builder withFirmante(FirmanteOutputModel firmante) { - this.firmante = firmante; - return this; - } - - public Builder withProveedor(ProveedorOutputModel proveedor) { - this.proveedor = proveedor; - return this; - } - - public Builder withTotales(DocumentMonetaryTotalOutputModel totales) { - this.totales = totales; - return this; - } - - public Builder withImpuestos(DocumentImpuestosOutputModel impuestos) { - this.impuestos = impuestos; - return this; - } - - public Builder withDetalle(List detalle) { - this.detalle = detalle; - return this; - } - - public Builder withFormaPago(FormaPagoOutputModel formaPago) { - this.formaPago = formaPago; - return this; - } - - public Builder withGuiasRemisionRelacionadas(List guiasRemisionRelacionadas) { - this.guiasRemisionRelacionadas = guiasRemisionRelacionadas; - return this; - } - - public Builder withOtrosDocumentosTributariosRelacionados(List otrosDocumentosTributariosRelacionados) { - this.otrosDocumentosTributariosRelacionados = otrosDocumentosTributariosRelacionados; - return this; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/DocumentoTributarioRelacionadoOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/DocumentoTributarioRelacionadoOutputModel.java deleted file mode 100644 index 5c4a4c0f..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/DocumentoTributarioRelacionadoOutputModel.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.standard; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog12; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; - -public class DocumentoTributarioRelacionadoOutputModel { - - @NotBlank - private String serieNumero; - - @NotNull - private Catalog12 tipoDocumento; - - public String getSerieNumero() { - return serieNumero; - } - - public void setSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - } - - public Catalog12 getTipoDocumento() { - return tipoDocumento; - } - - public void setTipoDocumento(Catalog12 tipoDocumento) { - this.tipoDocumento = tipoDocumento; - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/GuiaRemisionRelacionadaOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/GuiaRemisionRelacionadaOutputModel.java deleted file mode 100644 index 4977ea37..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/GuiaRemisionRelacionadaOutputModel.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.standard; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1_Guia; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; - -public class GuiaRemisionRelacionadaOutputModel { - - @NotBlank - protected String serieNumero; - - @NotNull - private Catalog1_Guia tipoDocumento; - - public String getSerieNumero() { - return serieNumero; - } - - public void setSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - } - - public Catalog1_Guia getTipoDocumento() { - return tipoDocumento; - } - - public void setTipoDocumento(Catalog1_Guia tipoDocumento) { - this.tipoDocumento = tipoDocumento; - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/ImpuestoDetalladoICBOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/ImpuestoDetalladoICBOutputModel.java deleted file mode 100644 index 7398e737..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/ImpuestoDetalladoICBOutputModel.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.standard; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog5; - -import javax.validation.constraints.Digits; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; - -public class ImpuestoDetalladoICBOutputModel extends ImpuestoOutputModel { - - @Min(0) - @NotNull - @Digits(integer = 100, fraction = 2) - private BigDecimal icbValor; - - public BigDecimal getIcbValor() { - return icbValor; - } - - public void setIcbValor(BigDecimal icbValor) { - this.icbValor = icbValor; - } - - public static final class Builder { - private BigDecimal importe; - private BigDecimal icbValor; - private Catalog5 categoria; - - private Builder() { - } - - public static Builder anImpuestoDetalladoICBOutputModel() { - return new Builder(); - } - - public Builder withImporte(BigDecimal importe) { - this.importe = importe; - return this; - } - - public Builder withIcbValor(BigDecimal icbValor) { - this.icbValor = icbValor; - return this; - } - - public Builder withCategoria(Catalog5 categoria) { - this.categoria = categoria; - return this; - } - - public ImpuestoDetalladoICBOutputModel build() { - ImpuestoDetalladoICBOutputModel impuestoDetalladoICBOutputModel = new ImpuestoDetalladoICBOutputModel(); - impuestoDetalladoICBOutputModel.setImporte(importe); - impuestoDetalladoICBOutputModel.setIcbValor(icbValor); - impuestoDetalladoICBOutputModel.setCategoria(categoria); - return impuestoDetalladoICBOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/ImpuestoDetalladoIGVOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/ImpuestoDetalladoIGVOutputModel.java deleted file mode 100644 index 25cf64e9..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/ImpuestoDetalladoIGVOutputModel.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.standard; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog5; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog7; - -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; - -public class ImpuestoDetalladoIGVOutputModel extends ImpuestoDetalladoOutputModel { - - @NotNull - private Catalog7 tipo; - - public Catalog7 getTipo() { - return tipo; - } - - public void setTipo(Catalog7 tipo) { - this.tipo = tipo; - } - - public static final class Builder { - private Catalog7 tipo; - private BigDecimal baseImponible; - private BigDecimal porcentaje; - private BigDecimal importe; - private Catalog5 categoria; - - private Builder() { - } - - public static Builder anImpuestoDetalladoIGVOutputModel() { - return new Builder(); - } - - public Builder withTipo(Catalog7 tipo) { - this.tipo = tipo; - return this; - } - - public Builder withBaseImponible(BigDecimal baseImponible) { - this.baseImponible = baseImponible; - return this; - } - - public Builder withPorcentaje(BigDecimal porcentaje) { - this.porcentaje = porcentaje; - return this; - } - - public Builder withImporte(BigDecimal importe) { - this.importe = importe; - return this; - } - - public Builder withCategoria(Catalog5 categoria) { - this.categoria = categoria; - return this; - } - - public ImpuestoDetalladoIGVOutputModel build() { - ImpuestoDetalladoIGVOutputModel impuestoDetalladoIGVOutputModel = new ImpuestoDetalladoIGVOutputModel(); - impuestoDetalladoIGVOutputModel.setTipo(tipo); - impuestoDetalladoIGVOutputModel.setBaseImponible(baseImponible); - impuestoDetalladoIGVOutputModel.setPorcentaje(porcentaje); - impuestoDetalladoIGVOutputModel.setImporte(importe); - impuestoDetalladoIGVOutputModel.setCategoria(categoria); - return impuestoDetalladoIGVOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/ImpuestoDetalladoISCOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/ImpuestoDetalladoISCOutputModel.java deleted file mode 100644 index 1e972472..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/ImpuestoDetalladoISCOutputModel.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.standard; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog5; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog8; - -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; - -public class ImpuestoDetalladoISCOutputModel extends ImpuestoDetalladoOutputModel { - - @NotNull - private Catalog8 tipo; - - public Catalog8 getTipo() { - return tipo; - } - - public void setTipo(Catalog8 tipo) { - this.tipo = tipo; - } - - public static final class Builder { - private Catalog8 tipo; - private BigDecimal baseImponible; - private BigDecimal porcentaje; - private BigDecimal importe; - private Catalog5 categoria; - - private Builder() { - } - - public static Builder anImpuestoDetalladoISCOutputModel() { - return new Builder(); - } - - public Builder withTipo(Catalog8 tipo) { - this.tipo = tipo; - return this; - } - - public Builder withBaseImponible(BigDecimal baseImponible) { - this.baseImponible = baseImponible; - return this; - } - - public Builder withPorcentaje(BigDecimal porcentaje) { - this.porcentaje = porcentaje; - return this; - } - - public Builder withImporte(BigDecimal importe) { - this.importe = importe; - return this; - } - - public Builder withCategoria(Catalog5 categoria) { - this.categoria = categoria; - return this; - } - - public ImpuestoDetalladoISCOutputModel build() { - ImpuestoDetalladoISCOutputModel impuestoDetalladoISCOutputModel = new ImpuestoDetalladoISCOutputModel(); - impuestoDetalladoISCOutputModel.setTipo(tipo); - impuestoDetalladoISCOutputModel.setBaseImponible(baseImponible); - impuestoDetalladoISCOutputModel.setPorcentaje(porcentaje); - impuestoDetalladoISCOutputModel.setImporte(importe); - impuestoDetalladoISCOutputModel.setCategoria(categoria); - return impuestoDetalladoISCOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/ImpuestoDetalladoOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/ImpuestoDetalladoOutputModel.java deleted file mode 100644 index e3e47398..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/ImpuestoDetalladoOutputModel.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.standard; - -import javax.validation.constraints.Max; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; - -public class ImpuestoDetalladoOutputModel extends ImpuestoOutputModel { - - @Min(0) - @NotNull - private BigDecimal baseImponible; - - @Min(0) - @Max(100) - @NotNull - private BigDecimal porcentaje; - - - public BigDecimal getBaseImponible() { - return baseImponible; - } - - public void setBaseImponible(BigDecimal baseImponible) { - this.baseImponible = baseImponible; - } - - public BigDecimal getPorcentaje() { - return porcentaje; - } - - public void setPorcentaje(BigDecimal porcentaje) { - this.porcentaje = porcentaje; - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/ImpuestoOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/ImpuestoOutputModel.java deleted file mode 100644 index 14aee939..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/ImpuestoOutputModel.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.standard; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog5; - -import javax.validation.constraints.Digits; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; - -public class ImpuestoOutputModel { - - @Min(0) - @NotNull - @Digits(integer = 100, fraction = 2) - private BigDecimal importe; - - @NotNull - private Catalog5 categoria; - - public BigDecimal getImporte() { - return importe; - } - - public void setImporte(BigDecimal importe) { - this.importe = importe; - } - - public Catalog5 getCategoria() { - return categoria; - } - - public void setCategoria(Catalog5 categoria) { - this.categoria = categoria; - } - - public static final class Builder { - private BigDecimal importe; - private Catalog5 categoria; - - private Builder() { - } - - public static Builder anImpuestoOutputModel() { - return new Builder(); - } - - public Builder withImporte(BigDecimal importe) { - this.importe = importe; - return this; - } - - public Builder withCategoria(Catalog5 categoria) { - this.categoria = categoria; - return this; - } - - public ImpuestoOutputModel build() { - ImpuestoOutputModel impuestoOutputModel = new ImpuestoOutputModel(); - impuestoOutputModel.setImporte(importe); - impuestoOutputModel.setCategoria(categoria); - return impuestoOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/ImpuestoTotalICBOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/ImpuestoTotalICBOutputModel.java deleted file mode 100644 index 43d13a39..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/ImpuestoTotalICBOutputModel.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.standard; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog5; - -import java.math.BigDecimal; - -public class ImpuestoTotalICBOutputModel extends ImpuestoOutputModel { - - public static final class Builder { - private BigDecimal importe; - private Catalog5 categoria; - - private Builder() { - } - - public static Builder anImpuestoTotalICBOutputModel() { - return new Builder(); - } - - public Builder withImporte(BigDecimal importe) { - this.importe = importe; - return this; - } - - public Builder withCategoria(Catalog5 categoria) { - this.categoria = categoria; - return this; - } - - public ImpuestoTotalICBOutputModel build() { - ImpuestoTotalICBOutputModel impuestoTotalICBOutputModel = new ImpuestoTotalICBOutputModel(); - impuestoTotalICBOutputModel.setImporte(importe); - impuestoTotalICBOutputModel.setCategoria(categoria); - return impuestoTotalICBOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/ImpuestoTotalOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/ImpuestoTotalOutputModel.java deleted file mode 100644 index b95874c9..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/ImpuestoTotalOutputModel.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.standard; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog5; - -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; - -public class ImpuestoTotalOutputModel extends ImpuestoOutputModel { - - @NotNull - @Min(0) - private BigDecimal baseImponible; - - public BigDecimal getBaseImponible() { - return baseImponible; - } - - public void setBaseImponible(BigDecimal baseImponible) { - this.baseImponible = baseImponible; - } - - public static final class Builder { - private BigDecimal baseImponible; - private BigDecimal importe; - private Catalog5 categoria; - - private Builder() { - } - - public static Builder anImpuestoTotalOutputModel() { - return new Builder(); - } - - public Builder withBaseImponible(BigDecimal baseImponible) { - this.baseImponible = baseImponible; - return this; - } - - public Builder withImporte(BigDecimal importe) { - this.importe = importe; - return this; - } - - public Builder withCategoria(Catalog5 categoria) { - this.categoria = categoria; - return this; - } - - public ImpuestoTotalOutputModel build() { - ImpuestoTotalOutputModel impuestoTotalOutputModel = new ImpuestoTotalOutputModel(); - impuestoTotalOutputModel.setBaseImponible(baseImponible); - impuestoTotalOutputModel.setImporte(importe); - impuestoTotalOutputModel.setCategoria(categoria); - return impuestoTotalOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/despatchadvice/DespatchAdviceLineDetalleOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/despatchadvice/DespatchAdviceLineDetalleOutputModel.java deleted file mode 100644 index 52cfa6d7..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/despatchadvice/DespatchAdviceLineDetalleOutputModel.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.standard.despatchadvice; - -import javax.validation.constraints.Min; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; - -public class DespatchAdviceLineDetalleOutputModel { - - private String unidadMedida; - - @Min(0) - @NotNull - private BigDecimal cantidad; - - @NotBlank - private String descripcion; - - @NotBlank - private String codigo; - - public String getUnidadMedida() { - return unidadMedida; - } - - public void setUnidadMedida(String unidadMedida) { - this.unidadMedida = unidadMedida; - } - - public BigDecimal getCantidad() { - return cantidad; - } - - public void setCantidad(BigDecimal cantidad) { - this.cantidad = cantidad; - } - - public String getDescripcion() { - return descripcion; - } - - public void setDescripcion(String descripcion) { - this.descripcion = descripcion; - } - - public String getCodigo() { - return codigo; - } - - public void setCodigo(String codigo) { - this.codigo = codigo; - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/despatchadvice/DespatchAdviceOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/despatchadvice/DespatchAdviceOutputModel.java deleted file mode 100644 index 049fe18c..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/despatchadvice/DespatchAdviceOutputModel.java +++ /dev/null @@ -1,221 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.standard.despatchadvice; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog21; -import io.github.project.openubl.xmlbuilderlib.models.output.common.ClienteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.FirmanteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.ProveedorOutputModel; - -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; -import java.util.List; - -public class DespatchAdviceOutputModel { - - @NotBlank - @Pattern(regexp = "^[T].*$") - private String serieNumero; - - @NotBlank - private String fechaEmision; - - private String observacion; - - @Valid - private DespatchAdviceOutputModel.DocumentoRelacionadoOutputModel guiaRemisionDadaDeBaja; - - @Valid - private DespatchAdviceOutputModel.DocumentoRelacionadoOutputModel documentoAdicionalRelacionado; - - @Valid - @NotNull - private FirmanteOutputModel firmante; - - @Valid - @NotNull - private ProveedorOutputModel remitente; - - @Valid - @NotNull - private ClienteOutputModel destinatario; - - @Valid - @NotNull - private DespatchAdviceTrasladoOutputModel traslado; - - @Valid - private ClienteOutputModel transportista; - - @Valid - private ClienteOutputModel conductor; - - @Valid - private DespatchAdviceOutputModel.VehiculoOutputModel vehiculo; - - @Valid - @NotNull - @NotEmpty - private List detalle; - - public String getSerieNumero() { - return serieNumero; - } - - public void setSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - } - - public String getFechaEmision() { - return fechaEmision; - } - - public void setFechaEmision(String fechaEmision) { - this.fechaEmision = fechaEmision; - } - - public String getObservacion() { - return observacion; - } - - public void setObservacion(String observacion) { - this.observacion = observacion; - } - - public DocumentoRelacionadoOutputModel getGuiaRemisionDadaDeBaja() { - return guiaRemisionDadaDeBaja; - } - - public void setGuiaRemisionDadaDeBaja(DocumentoRelacionadoOutputModel guiaRemisionDadaDeBaja) { - this.guiaRemisionDadaDeBaja = guiaRemisionDadaDeBaja; - } - - public DocumentoRelacionadoOutputModel getDocumentoAdicionalRelacionado() { - return documentoAdicionalRelacionado; - } - - public void setDocumentoAdicionalRelacionado(DocumentoRelacionadoOutputModel documentoAdicionalRelacionado) { - this.documentoAdicionalRelacionado = documentoAdicionalRelacionado; - } - - public FirmanteOutputModel getFirmante() { - return firmante; - } - - public void setFirmante(FirmanteOutputModel firmante) { - this.firmante = firmante; - } - - public ProveedorOutputModel getRemitente() { - return remitente; - } - - public void setRemitente(ProveedorOutputModel remitente) { - this.remitente = remitente; - } - - public ClienteOutputModel getDestinatario() { - return destinatario; - } - - public void setDestinatario(ClienteOutputModel destinatario) { - this.destinatario = destinatario; - } - - public DespatchAdviceTrasladoOutputModel getTraslado() { - return traslado; - } - - public void setTraslado(DespatchAdviceTrasladoOutputModel traslado) { - this.traslado = traslado; - } - - public ClienteOutputModel getTransportista() { - return transportista; - } - - public void setTransportista(ClienteOutputModel transportista) { - this.transportista = transportista; - } - - public ClienteOutputModel getConductor() { - return conductor; - } - - public void setConductor(ClienteOutputModel conductor) { - this.conductor = conductor; - } - - public VehiculoOutputModel getVehiculo() { - return vehiculo; - } - - public void setVehiculo(VehiculoOutputModel vehiculo) { - this.vehiculo = vehiculo; - } - - public List getDetalle() { - return detalle; - } - - public void setDetalle(List detalle) { - this.detalle = detalle; - } - - public static class DocumentoRelacionadoOutputModel { - @NotBlank - private String serieNumero; - - @NotNull - private T tipoDocumento; - - public String getSerieNumero() { - return serieNumero; - } - - public void setSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - } - - public T getTipoDocumento() { - return tipoDocumento; - } - - public void setTipoDocumento(T tipoDocumento) { - this.tipoDocumento = tipoDocumento; - } - } - - public static class VehiculoOutputModel { - @NotBlank - private String placa; - - public String getPlaca() { - return placa; - } - - public void setPlaca(String placa) { - this.placa = placa; - } - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/despatchadvice/DespatchAdviceTrasladoOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/despatchadvice/DespatchAdviceTrasladoOutputModel.java deleted file mode 100644 index 0e4f608b..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/despatchadvice/DespatchAdviceTrasladoOutputModel.java +++ /dev/null @@ -1,177 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.standard.despatchadvice; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog18; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog20; - -import javax.validation.Valid; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; -import java.math.BigDecimal; - -public class DespatchAdviceTrasladoOutputModel { - - @NotNull - private Catalog20 motivo; - - private String descripcion; - - @NotBlank - private String pesoBrutoUnidadMedida; - - @Min(0) - @NotNull - private BigDecimal pesoBrutoTotal; - - @Min(0) - private Integer numeroBultos; - - @NotNull - private String transbordoProgramado; - - @NotNull - private Catalog18 modalidad; - - @NotNull - private String fechaInicio; - - private String codigoPuertoAeropuertoDeEmbarqueOdesembarque; - - @Valid - private DespatchAdviceTrasladoOutputModel.PuntoOutputModel puntoPartida; - - @Valid - @NotNull - private DespatchAdviceTrasladoOutputModel.PuntoOutputModel puntoLlegada; - - public Catalog20 getMotivo() { - return motivo; - } - - public void setMotivo(Catalog20 motivo) { - this.motivo = motivo; - } - - public String getDescripcion() { - return descripcion; - } - - public void setDescripcion(String descripcion) { - this.descripcion = descripcion; - } - - public String getPesoBrutoUnidadMedida() { - return pesoBrutoUnidadMedida; - } - - public void setPesoBrutoUnidadMedida(String pesoBrutoUnidadMedida) { - this.pesoBrutoUnidadMedida = pesoBrutoUnidadMedida; - } - - public BigDecimal getPesoBrutoTotal() { - return pesoBrutoTotal; - } - - public void setPesoBrutoTotal(BigDecimal pesoBrutoTotal) { - this.pesoBrutoTotal = pesoBrutoTotal; - } - - public Integer getNumeroBultos() { - return numeroBultos; - } - - public void setNumeroBultos(Integer numeroBultos) { - this.numeroBultos = numeroBultos; - } - - public String getTransbordoProgramado() { - return transbordoProgramado; - } - - public void setTransbordoProgramado(String transbordoProgramado) { - this.transbordoProgramado = transbordoProgramado; - } - - public Catalog18 getModalidad() { - return modalidad; - } - - public void setModalidad(Catalog18 modalidad) { - this.modalidad = modalidad; - } - - public String getFechaInicio() { - return fechaInicio; - } - - public void setFechaInicio(String fechaInicio) { - this.fechaInicio = fechaInicio; - } - - public String getCodigoPuertoAeropuertoDeEmbarqueOdesembarque() { - return codigoPuertoAeropuertoDeEmbarqueOdesembarque; - } - - public void setCodigoPuertoAeropuertoDeEmbarqueOdesembarque(String codigoPuertoAeropuertoDeEmbarqueOdesembarque) { - this.codigoPuertoAeropuertoDeEmbarqueOdesembarque = codigoPuertoAeropuertoDeEmbarqueOdesembarque; - } - - public PuntoOutputModel getPuntoPartida() { - return puntoPartida; - } - - public void setPuntoPartida(PuntoOutputModel puntoPartida) { - this.puntoPartida = puntoPartida; - } - - public PuntoOutputModel getPuntoLlegada() { - return puntoLlegada; - } - - public void setPuntoLlegada(PuntoOutputModel puntoLlegada) { - this.puntoLlegada = puntoLlegada; - } - - public static class PuntoOutputModel { - @NotBlank - @Size(min = 6, max = 6) - private String codigoPostal; - - @NotBlank - private String direccion; - - public String getCodigoPostal() { - return codigoPostal; - } - - public void setCodigoPostal(String codigoPostal) { - this.codigoPostal = codigoPostal; - } - - public String getDireccion() { - return direccion; - } - - public void setDireccion(String direccion) { - this.direccion = direccion; - } - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/invoice/AnticipoOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/invoice/AnticipoOutputModel.java deleted file mode 100644 index bad63fcc..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/invoice/AnticipoOutputModel.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.standard.invoice; - -import io.github.project.openubl.xmlbuilderlib.models.output.standard.DocumentoTributarioRelacionadoOutputModel; - -import javax.validation.constraints.Min; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; - -public class AnticipoOutputModel extends DocumentoTributarioRelacionadoOutputModel { - - @Min(0) - @NotNull - private BigDecimal montoTotal; - - public BigDecimal getMontoTotal() { - return montoTotal; - } - - public void setMontoTotal(BigDecimal montoTotal) { - this.montoTotal = montoTotal; - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/invoice/CargoDescuentoOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/invoice/CargoDescuentoOutputModel.java deleted file mode 100644 index f00874da..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/invoice/CargoDescuentoOutputModel.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.standard.invoice; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog53; - -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; - -public class CargoDescuentoOutputModel { - - @NotNull - private Catalog53 tipo; - - @NotNull - private BigDecimal monto; - - @NotNull - private BigDecimal porcentaje; - - public Catalog53 getTipo() { - return tipo; - } - - public void setTipo(Catalog53 tipo) { - this.tipo = tipo; - } - - public BigDecimal getMonto() { - return monto; - } - - public void setMonto(BigDecimal monto) { - this.monto = monto; - } - - public BigDecimal getPorcentaje() { - return porcentaje; - } - - public void setPorcentaje(BigDecimal porcentaje) { - this.porcentaje = porcentaje; - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/invoice/DetraccionRelacionadaOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/invoice/DetraccionRelacionadaOutputModel.java deleted file mode 100644 index f59aaf9e..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/invoice/DetraccionRelacionadaOutputModel.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.standard.invoice; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog54; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog59; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.DocumentoTributarioRelacionadoOutputModel; - -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; - -public class DetraccionRelacionadaOutputModel extends DocumentoTributarioRelacionadoOutputModel { - - @NotNull - private Catalog59 medioDePago; - - @NotNull - private Catalog54 tipoBienServicio; - - @Min(0) - @NotNull - private BigDecimal porcentaje; - - private String numeroCuentaBancaria; - - public Catalog59 getMedioDePago() { - return medioDePago; - } - - public void setMedioDePago(Catalog59 medioDePago) { - this.medioDePago = medioDePago; - } - - public Catalog54 getTipoBienServicio() { - return tipoBienServicio; - } - - public void setTipoBienServicio(Catalog54 tipoBienServicio) { - this.tipoBienServicio = tipoBienServicio; - } - - public BigDecimal getPorcentaje() { - return porcentaje; - } - - public void setPorcentaje(BigDecimal porcentaje) { - this.porcentaje = porcentaje; - } - - public String getNumeroCuentaBancaria() { - return numeroCuentaBancaria; - } - - public void setNumeroCuentaBancaria(String numeroCuentaBancaria) { - this.numeroCuentaBancaria = numeroCuentaBancaria; - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/invoice/InvoiceOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/invoice/InvoiceOutputModel.java deleted file mode 100644 index e4822711..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/invoice/InvoiceOutputModel.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.standard.invoice; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.DocumentOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.DocumentoTributarioRelacionadoOutputModel; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import java.util.List; - -public class InvoiceOutputModel extends DocumentOutputModel { - - @NotNull - private Catalog1 tipoInvoice; - - @NotNull - @Valid - private List anticipos; - - public Catalog1 getTipoInvoice() { - return tipoInvoice; - } - - public void setTipoInvoice(Catalog1 tipoInvoice) { - this.tipoInvoice = tipoInvoice; - } - - public List getAnticipos() { - return anticipos; - } - - public void setAnticipos(List anticipos) { - this.anticipos = anticipos; - } - - public static final class Builder extends DocumentOutputModel.Builder { - private Catalog1 tipoInvoice; - private List anticipos; - - private Builder() { - } - - public static Builder anInvoiceOutputModel() { - return new Builder(); - } - - public Builder withTipoInvoice(Catalog1 tipoInvoice) { - this.tipoInvoice = tipoInvoice; - return this; - } - - public Builder withAnticipos(List anticipos) { - this.anticipos = anticipos; - return this; - } - - public InvoiceOutputModel build() { - InvoiceOutputModel invoiceOutputModel = new InvoiceOutputModel(); - invoiceOutputModel.setMoneda(moneda); - invoiceOutputModel.setSerieNumero(serieNumero); - invoiceOutputModel.setHoraEmision(horaEmision); - invoiceOutputModel.setFechaEmision(fechaEmision); - invoiceOutputModel.setCliente(cliente); - invoiceOutputModel.setFirmante(firmante); - invoiceOutputModel.setProveedor(proveedor); - invoiceOutputModel.setTotales(totales); - invoiceOutputModel.setImpuestos(impuestos); - invoiceOutputModel.setDetalle(detalle); - invoiceOutputModel.setTipoInvoice(tipoInvoice); - invoiceOutputModel.setFormaPago(formaPago); - invoiceOutputModel.setGuiasRemisionRelacionadas(guiasRemisionRelacionadas); - invoiceOutputModel.setOtrosDocumentosTributariosRelacionados(otrosDocumentosTributariosRelacionados); - invoiceOutputModel.setAnticipos(anticipos); - return invoiceOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/invoice/PercepcionRelacionadaOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/invoice/PercepcionRelacionadaOutputModel.java deleted file mode 100644 index fc8371fa..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/invoice/PercepcionRelacionadaOutputModel.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.standard.invoice; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog53; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.DocumentoTributarioRelacionadoOutputModel; - -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; - -public class PercepcionRelacionadaOutputModel extends DocumentoTributarioRelacionadoOutputModel { - - @NotNull - private Catalog53 tipo; - - @NotNull - private BigDecimal monto; - - @NotNull - private BigDecimal porcentaje; - - public Catalog53 getTipo() { - return tipo; - } - - public void setTipo(Catalog53 tipo) { - this.tipo = tipo; - } - - public BigDecimal getMonto() { - return monto; - } - - public void setMonto(BigDecimal monto) { - this.monto = monto; - } - - public BigDecimal getPorcentaje() { - return porcentaje; - } - - public void setPorcentaje(BigDecimal porcentaje) { - this.porcentaje = porcentaje; - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/note/NoteOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/note/NoteOutputModel.java deleted file mode 100644 index cac13d56..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/note/NoteOutputModel.java +++ /dev/null @@ -1,154 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.standard.note; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1; -import io.github.project.openubl.xmlbuilderlib.models.output.common.ClienteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.FirmanteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.ProveedorOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.DocumentImpuestosOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.DocumentLineOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.DocumentMonetaryTotalOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.DocumentOutputModel; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import java.util.List; - -public abstract class NoteOutputModel extends DocumentOutputModel { - - @NotBlank - protected String serieNumeroComprobanteAfectado; - - @NotBlank - protected String descripcionSustentoDeNota; - - @NotNull - protected Catalog1 tipoDocumentoComprobanteAfectado; - - public String getSerieNumeroComprobanteAfectado() { - return serieNumeroComprobanteAfectado; - } - - public void setSerieNumeroComprobanteAfectado(String serieNumeroComprobanteAfectado) { - this.serieNumeroComprobanteAfectado = serieNumeroComprobanteAfectado; - } - - public String getDescripcionSustentoDeNota() { - return descripcionSustentoDeNota; - } - - public void setDescripcionSustentoDeNota(String descripcionSustentoDeNota) { - this.descripcionSustentoDeNota = descripcionSustentoDeNota; - } - - public Catalog1 getTipoDocumentoComprobanteAfectado() { - return tipoDocumentoComprobanteAfectado; - } - - public void setTipoDocumentoComprobanteAfectado(Catalog1 tipoDocumentoComprobanteAfectado) { - this.tipoDocumentoComprobanteAfectado = tipoDocumentoComprobanteAfectado; - } - - public static class Builder extends DocumentOutputModel.Builder { - protected String moneda; - protected String serieNumero; - protected String horaEmision; - protected String fechaEmision; - protected String serieNumeroComprobanteAfectado; - protected ClienteOutputModel cliente; - protected String descripcionSustentoDeNota; - protected FirmanteOutputModel firmante; - protected Catalog1 tipoDocumentoComprobanteAfectado; - protected ProveedorOutputModel proveedor; - protected DocumentMonetaryTotalOutputModel totales; - protected DocumentImpuestosOutputModel impuestos; - protected List detalle; - - protected Builder() { - } - - public static Builder aNoteOutputModel() { - return new Builder(); - } - - public Builder withMoneda(String moneda) { - this.moneda = moneda; - return this; - } - - public Builder withSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - return this; - } - - public Builder withHoraEmision(String horaEmision) { - this.horaEmision = horaEmision; - return this; - } - - public Builder withFechaEmision(String fechaEmision) { - this.fechaEmision = fechaEmision; - return this; - } - - public Builder withSerieNumeroComprobanteAfectado(String serieNumeroComprobanteAfectado) { - this.serieNumeroComprobanteAfectado = serieNumeroComprobanteAfectado; - return this; - } - - public Builder withCliente(ClienteOutputModel cliente) { - this.cliente = cliente; - return this; - } - - public Builder withDescripcionSustentoDeNota(String descripcionSustentoDeNota) { - this.descripcionSustentoDeNota = descripcionSustentoDeNota; - return this; - } - - public Builder withFirmante(FirmanteOutputModel firmante) { - this.firmante = firmante; - return this; - } - - public Builder withTipoDocumentoComprobanteAfectado(Catalog1 tipoDocumentoComprobanteAfectado) { - this.tipoDocumentoComprobanteAfectado = tipoDocumentoComprobanteAfectado; - return this; - } - - public Builder withProveedor(ProveedorOutputModel proveedor) { - this.proveedor = proveedor; - return this; - } - - public Builder withTotales(DocumentMonetaryTotalOutputModel totales) { - this.totales = totales; - return this; - } - - public Builder withImpuestos(DocumentImpuestosOutputModel impuestos) { - this.impuestos = impuestos; - return this; - } - - public Builder withDetalle(List detalle) { - this.detalle = detalle; - return this; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/note/creditNote/CreditNoteOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/note/creditNote/CreditNoteOutputModel.java deleted file mode 100644 index be7eadfc..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/note/creditNote/CreditNoteOutputModel.java +++ /dev/null @@ -1,167 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.standard.note.creditNote; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog9; -import io.github.project.openubl.xmlbuilderlib.models.output.common.ClienteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.FirmanteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.FormaPagoOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.ProveedorOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.DocumentImpuestosOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.DocumentLineOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.DocumentMonetaryTotalOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.note.NoteOutputModel; - -import javax.validation.constraints.NotNull; -import java.util.List; - -public class CreditNoteOutputModel extends NoteOutputModel { - - @NotNull - protected Catalog9 tipoNota; - - public Catalog9 getTipoNota() { - return tipoNota; - } - - public void setTipoNota(Catalog9 tipoNota) { - this.tipoNota = tipoNota; - } - - public static final class Builder extends NoteOutputModel.Builder { - protected String serieNumeroComprobanteAfectado; - protected String descripcionSustentoDeNota; - protected Catalog1 tipoDocumentoComprobanteAfectado; - protected String moneda; - protected String serieNumero; - protected String horaEmision; - protected String fechaEmision; - protected ClienteOutputModel cliente; - protected FirmanteOutputModel firmante; - protected ProveedorOutputModel proveedor; - protected DocumentMonetaryTotalOutputModel totales; - protected DocumentImpuestosOutputModel impuestos; - protected List detalle; - protected Catalog9 tipoNota; - protected FormaPagoOutputModel formaPago; - - private Builder() { - } - - public static Builder aCreditNoteOutputModel() { - return new Builder(); - } - - public Builder withTipoNota(Catalog9 tipoNota) { - this.tipoNota = tipoNota; - return this; - } - - public Builder withSerieNumeroComprobanteAfectado(String serieNumeroComprobanteAfectado) { - this.serieNumeroComprobanteAfectado = serieNumeroComprobanteAfectado; - return this; - } - - public Builder withDescripcionSustentoDeNota(String descripcionSustentoDeNota) { - this.descripcionSustentoDeNota = descripcionSustentoDeNota; - return this; - } - - public Builder withTipoDocumentoComprobanteAfectado(Catalog1 tipoDocumentoComprobanteAfectado) { - this.tipoDocumentoComprobanteAfectado = tipoDocumentoComprobanteAfectado; - return this; - } - - public Builder withMoneda(String moneda) { - this.moneda = moneda; - return this; - } - - public Builder withSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - return this; - } - - public Builder withHoraEmision(String horaEmision) { - this.horaEmision = horaEmision; - return this; - } - - public Builder withFechaEmision(String fechaEmision) { - this.fechaEmision = fechaEmision; - return this; - } - - public Builder withCliente(ClienteOutputModel cliente) { - this.cliente = cliente; - return this; - } - - public Builder withFirmante(FirmanteOutputModel firmante) { - this.firmante = firmante; - return this; - } - - public Builder withProveedor(ProveedorOutputModel proveedor) { - this.proveedor = proveedor; - return this; - } - - public Builder withTotales(DocumentMonetaryTotalOutputModel totales) { - this.totales = totales; - return this; - } - - public Builder withImpuestos(DocumentImpuestosOutputModel impuestos) { - this.impuestos = impuestos; - return this; - } - - public Builder withDetalle(List detalle) { - this.detalle = detalle; - return this; - } - - public Builder withFormaPago(FormaPagoOutputModel formaPago) { - this.formaPago = formaPago; - return this; - } - - public CreditNoteOutputModel build() { - CreditNoteOutputModel creditNoteOutputModel = new CreditNoteOutputModel(); - creditNoteOutputModel.setTipoNota(tipoNota); - creditNoteOutputModel.setSerieNumeroComprobanteAfectado(serieNumeroComprobanteAfectado); - creditNoteOutputModel.setDescripcionSustentoDeNota(descripcionSustentoDeNota); - creditNoteOutputModel.setTipoDocumentoComprobanteAfectado(tipoDocumentoComprobanteAfectado); - creditNoteOutputModel.setMoneda(moneda); - creditNoteOutputModel.setSerieNumero(serieNumero); - creditNoteOutputModel.setHoraEmision(horaEmision); - creditNoteOutputModel.setFechaEmision(fechaEmision); - creditNoteOutputModel.setCliente(cliente); - creditNoteOutputModel.setFirmante(firmante); - creditNoteOutputModel.setProveedor(proveedor); - creditNoteOutputModel.setTotales(totales); - creditNoteOutputModel.setImpuestos(impuestos); - creditNoteOutputModel.setDetalle(detalle); - creditNoteOutputModel.setFormaPago(formaPago); - creditNoteOutputModel.setGuiasRemisionRelacionadas(guiasRemisionRelacionadas); - creditNoteOutputModel.setOtrosDocumentosTributariosRelacionados(otrosDocumentosTributariosRelacionados); - return creditNoteOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/note/debitNote/DebitNoteOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/note/debitNote/DebitNoteOutputModel.java deleted file mode 100644 index e7af51d0..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/standard/note/debitNote/DebitNoteOutputModel.java +++ /dev/null @@ -1,167 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.standard.note.debitNote; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog10; -import io.github.project.openubl.xmlbuilderlib.models.output.common.ClienteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.FirmanteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.FormaPagoOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.ProveedorOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.DocumentImpuestosOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.DocumentLineOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.DocumentMonetaryTotalOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.note.NoteOutputModel; - -import javax.validation.constraints.NotNull; -import java.util.List; - -public class DebitNoteOutputModel extends NoteOutputModel { - - @NotNull - protected Catalog10 tipoNota; - - public Catalog10 getTipoNota() { - return tipoNota; - } - - public void setTipoNota(Catalog10 tipoNota) { - this.tipoNota = tipoNota; - } - - public static final class Builder extends NoteOutputModel.Builder { - protected String moneda; - protected String serieNumero; - protected String horaEmision; - protected String fechaEmision; - protected String serieNumeroComprobanteAfectado; - protected Catalog10 tipoNota; - protected ClienteOutputModel cliente; - protected String descripcionSustentoDeNota; - protected FirmanteOutputModel firmante; - protected Catalog1 tipoDocumentoComprobanteAfectado; - protected ProveedorOutputModel proveedor; - protected DocumentMonetaryTotalOutputModel totales; - protected DocumentImpuestosOutputModel impuestos; - protected List detalle; - protected FormaPagoOutputModel formaPago; - - private Builder() { - } - - public static Builder aDebitNoteOutputModel() { - return new Builder(); - } - - public Builder withMoneda(String moneda) { - this.moneda = moneda; - return this; - } - - public Builder withSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - return this; - } - - public Builder withHoraEmision(String horaEmision) { - this.horaEmision = horaEmision; - return this; - } - - public Builder withFechaEmision(String fechaEmision) { - this.fechaEmision = fechaEmision; - return this; - } - - public Builder withSerieNumeroComprobanteAfectado(String serieNumeroComprobanteAfectado) { - this.serieNumeroComprobanteAfectado = serieNumeroComprobanteAfectado; - return this; - } - - public Builder withTipoNota(Catalog10 tipoNota) { - this.tipoNota = tipoNota; - return this; - } - - public Builder withCliente(ClienteOutputModel cliente) { - this.cliente = cliente; - return this; - } - - public Builder withDescripcionSustentoDeNota(String descripcionSustentoDeNota) { - this.descripcionSustentoDeNota = descripcionSustentoDeNota; - return this; - } - - public Builder withFirmante(FirmanteOutputModel firmante) { - this.firmante = firmante; - return this; - } - - public Builder withTipoDocumentoComprobanteAfectado(Catalog1 tipoDocumentoComprobanteAfectado) { - this.tipoDocumentoComprobanteAfectado = tipoDocumentoComprobanteAfectado; - return this; - } - - public Builder withProveedor(ProveedorOutputModel proveedor) { - this.proveedor = proveedor; - return this; - } - - public Builder withTotales(DocumentMonetaryTotalOutputModel totales) { - this.totales = totales; - return this; - } - - public Builder withImpuestos(DocumentImpuestosOutputModel impuestos) { - this.impuestos = impuestos; - return this; - } - - public Builder withDetalle(List detalle) { - this.detalle = detalle; - return this; - } - - public Builder withFormaPago(FormaPagoOutputModel formaPago) { - this.formaPago = formaPago; - return this; - } - - public DebitNoteOutputModel build() { - DebitNoteOutputModel debitNoteOutputModel = new DebitNoteOutputModel(); - debitNoteOutputModel.setMoneda(moneda); - debitNoteOutputModel.setSerieNumero(serieNumero); - debitNoteOutputModel.setHoraEmision(horaEmision); - debitNoteOutputModel.setFechaEmision(fechaEmision); - debitNoteOutputModel.setSerieNumeroComprobanteAfectado(serieNumeroComprobanteAfectado); - debitNoteOutputModel.setTipoNota(tipoNota); - debitNoteOutputModel.setCliente(cliente); - debitNoteOutputModel.setDescripcionSustentoDeNota(descripcionSustentoDeNota); - debitNoteOutputModel.setFirmante(firmante); - debitNoteOutputModel.setTipoDocumentoComprobanteAfectado(tipoDocumentoComprobanteAfectado); - debitNoteOutputModel.setProveedor(proveedor); - debitNoteOutputModel.setTotales(totales); - debitNoteOutputModel.setImpuestos(impuestos); - debitNoteOutputModel.setDetalle(detalle); - debitNoteOutputModel.setFormaPago(formaPago); - debitNoteOutputModel.setGuiasRemisionRelacionadas(guiasRemisionRelacionadas); - debitNoteOutputModel.setOtrosDocumentosTributariosRelacionados(otrosDocumentosTributariosRelacionados); - return debitNoteOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/ImpuestoTotalResumenDiarioOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/ImpuestoTotalResumenDiarioOutputModel.java deleted file mode 100644 index 5cf22763..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/ImpuestoTotalResumenDiarioOutputModel.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.sunat; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog5; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.ImpuestoOutputModel; - -import java.math.BigDecimal; - -public class ImpuestoTotalResumenDiarioOutputModel extends ImpuestoOutputModel { - - public static final class Builder { - private BigDecimal importe; - private Catalog5 categoria; - - private Builder() { - } - - public static Builder anImpuestoTotalResumenDiarioOutputModel() { - return new Builder(); - } - - public Builder withImporte(BigDecimal importe) { - this.importe = importe; - return this; - } - - public Builder withCategoria(Catalog5 categoria) { - this.categoria = categoria; - return this; - } - - public ImpuestoTotalResumenDiarioOutputModel build() { - ImpuestoTotalResumenDiarioOutputModel impuestoTotalResumenDiarioOutputModel = new ImpuestoTotalResumenDiarioOutputModel(); - impuestoTotalResumenDiarioOutputModel.setImporte(importe); - impuestoTotalResumenDiarioOutputModel.setCategoria(categoria); - return impuestoTotalResumenDiarioOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/PerceptionOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/PerceptionOutputModel.java deleted file mode 100644 index eef6f480..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/PerceptionOutputModel.java +++ /dev/null @@ -1,132 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.sunat; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog22; -import io.github.project.openubl.xmlbuilderlib.models.output.common.ClienteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.FirmanteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.ProveedorOutputModel; - -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; -import java.util.List; - -public class PerceptionOutputModel extends PerceptionRetentionOutputModel { - - @NotNull - private Catalog22 regimen; - - public Catalog22 getRegimen() { - return regimen; - } - - public void setRegimen(Catalog22 regimen) { - this.regimen = regimen; - } - - public static final class Builder extends PerceptionRetentionOutputModel.Builder { - private Catalog22 regimen; - private String serieNumero; - private String fechaEmision; - private String observacion; - private String moneda; - private BigDecimal importeTotalPercibidoRetenido; - private BigDecimal importeTotalCobradoPagado; - private ProveedorOutputModel proveedor; - private ClienteOutputModel cliente; - private FirmanteOutputModel firmante; - private List detalle; - - private Builder() { - } - - public static Builder aPerceptionOutputModel() { - return new Builder(); - } - - public Builder withRegimen(Catalog22 regimen) { - this.regimen = regimen; - return this; - } - - public Builder withSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - return this; - } - - public Builder withFechaEmision(String fechaEmision) { - this.fechaEmision = fechaEmision; - return this; - } - - public Builder withObservacion(String observacion) { - this.observacion = observacion; - return this; - } - - public Builder withMoneda(String moneda) { - this.moneda = moneda; - return this; - } - - public Builder withImporteTotalPercibidoRetenido(BigDecimal importeTotalPercibidoRetenido) { - this.importeTotalPercibidoRetenido = importeTotalPercibidoRetenido; - return this; - } - - public Builder withImporteTotalCobradoPagado(BigDecimal importeTotalCobradoPagado) { - this.importeTotalCobradoPagado = importeTotalCobradoPagado; - return this; - } - - public Builder withProveedor(ProveedorOutputModel proveedor) { - this.proveedor = proveedor; - return this; - } - - public Builder withCliente(ClienteOutputModel cliente) { - this.cliente = cliente; - return this; - } - - public Builder withFirmante(FirmanteOutputModel firmante) { - this.firmante = firmante; - return this; - } - - public Builder withDetalle(List detalle) { - this.detalle = detalle; - return this; - } - - public PerceptionOutputModel build() { - PerceptionOutputModel perceptionOutputModel = new PerceptionOutputModel(); - perceptionOutputModel.setRegimen(regimen); - perceptionOutputModel.setSerieNumero(serieNumero); - perceptionOutputModel.setFechaEmision(fechaEmision); - perceptionOutputModel.setObservacion(observacion); - perceptionOutputModel.setMoneda(moneda); - perceptionOutputModel.setImporteTotalPercibidoRetenido(importeTotalPercibidoRetenido); - perceptionOutputModel.setImporteTotalCobradoPagado(importeTotalCobradoPagado); - perceptionOutputModel.setProveedor(proveedor); - perceptionOutputModel.setCliente(cliente); - perceptionOutputModel.setFirmante(firmante); - perceptionOutputModel.setDetalle(detalle); - return perceptionOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/PerceptionRetentionComprobanteOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/PerceptionRetentionComprobanteOutputModel.java deleted file mode 100644 index b165ae0c..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/PerceptionRetentionComprobanteOutputModel.java +++ /dev/null @@ -1,133 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.sunat; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1; - -import javax.validation.constraints.*; -import java.math.BigDecimal; - -public class PerceptionRetentionComprobanteOutputModel { - - @NotBlank - @Size(min = 3, max = 3) - private String moneda; - - @NotNull - private Catalog1 tipo; - - @NotBlank - @Pattern(regexp = "^[F|B|0-9].*$") - private String serieNumero; - - @NotBlank - private String fechaEmision; - - @Min(0) - @NotNull - private BigDecimal importeTotal; - - public String getMoneda() { - return moneda; - } - - public void setMoneda(String moneda) { - this.moneda = moneda; - } - - public Catalog1 getTipo() { - return tipo; - } - - public void setTipo(Catalog1 tipo) { - this.tipo = tipo; - } - - public String getSerieNumero() { - return serieNumero; - } - - public void setSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - } - - public String getFechaEmision() { - return fechaEmision; - } - - public void setFechaEmision(String fechaEmision) { - this.fechaEmision = fechaEmision; - } - - public BigDecimal getImporteTotal() { - return importeTotal; - } - - public void setImporteTotal(BigDecimal importeTotal) { - this.importeTotal = importeTotal; - } - - public static final class Builder { - private String moneda; - private Catalog1 tipo; - private String serieNumero; - private String fechaEmision; - private BigDecimal importeTotal; - - private Builder() { - } - - public static Builder aPerceptionRetentionComprobanteOutputModel() { - return new Builder(); - } - - public Builder withMoneda(String moneda) { - this.moneda = moneda; - return this; - } - - public Builder withTipo(Catalog1 tipo) { - this.tipo = tipo; - return this; - } - - public Builder withSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - return this; - } - - public Builder withFechaEmision(String fechaEmision) { - this.fechaEmision = fechaEmision; - return this; - } - - public Builder withImporteTotal(BigDecimal importeTotal) { - this.importeTotal = importeTotal; - return this; - } - - public PerceptionRetentionComprobanteOutputModel build() { - PerceptionRetentionComprobanteOutputModel perceptionRetentionComprobanteOutputModel = new PerceptionRetentionComprobanteOutputModel(); - perceptionRetentionComprobanteOutputModel.setMoneda(moneda); - perceptionRetentionComprobanteOutputModel.setTipo(tipo); - perceptionRetentionComprobanteOutputModel.setSerieNumero(serieNumero); - perceptionRetentionComprobanteOutputModel.setFechaEmision(fechaEmision); - perceptionRetentionComprobanteOutputModel.setImporteTotal(importeTotal); - return perceptionRetentionComprobanteOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/PerceptionRetentionLineOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/PerceptionRetentionLineOutputModel.java deleted file mode 100644 index f9f94853..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/PerceptionRetentionLineOutputModel.java +++ /dev/null @@ -1,163 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.sunat; - -import javax.validation.Valid; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; - -public class PerceptionRetentionLineOutputModel { - - @NotNull - @Valid - private PerceptionRetentionComprobanteOutputModel comprobante; - - - // - - @Min(1) - @NotNull - private Integer numeroCobroPago; - - @NotNull - @NotBlank - private String fechaCobroPago; - - @Min(0) - @NotNull - private BigDecimal importeCobroPago; - - - // - - - @Min(0) - @NotNull - private BigDecimal importePercibidoRetenido; - - @Min(0) - @NotNull - private BigDecimal importeTotalCobradoPagado; - - - public PerceptionRetentionComprobanteOutputModel getComprobante() { - return comprobante; - } - - public void setComprobante(PerceptionRetentionComprobanteOutputModel comprobante) { - this.comprobante = comprobante; - } - - public Integer getNumeroCobroPago() { - return numeroCobroPago; - } - - public void setNumeroCobroPago(Integer numeroCobroPago) { - this.numeroCobroPago = numeroCobroPago; - } - - public String getFechaCobroPago() { - return fechaCobroPago; - } - - public void setFechaCobroPago(String fechaCobroPago) { - this.fechaCobroPago = fechaCobroPago; - } - - public BigDecimal getImporteCobroPago() { - return importeCobroPago; - } - - public void setImporteCobroPago(BigDecimal importeCobroPago) { - this.importeCobroPago = importeCobroPago; - } - - public BigDecimal getImportePercibidoRetenido() { - return importePercibidoRetenido; - } - - public void setImportePercibidoRetenido(BigDecimal importePercibidoRetenido) { - this.importePercibidoRetenido = importePercibidoRetenido; - } - - public BigDecimal getImporteTotalCobradoPagado() { - return importeTotalCobradoPagado; - } - - public void setImporteTotalCobradoPagado(BigDecimal importeTotalCobradoPagado) { - this.importeTotalCobradoPagado = importeTotalCobradoPagado; - } - - public static final class Builder { - private PerceptionRetentionComprobanteOutputModel comprobante; - private Integer numeroCobroPago; - private String fechaCobroPago; - private BigDecimal importeCobroPago; - private BigDecimal importePercibidoRetenido; - private BigDecimal importeTotalCobradoPagado; - - private Builder() { - } - - public static Builder aPerceptionRetentionLineOutputModel() { - return new Builder(); - } - - public Builder withComprobante(PerceptionRetentionComprobanteOutputModel comprobante) { - this.comprobante = comprobante; - return this; - } - - public Builder withNumeroCobroPago(Integer numeroCobroPago) { - this.numeroCobroPago = numeroCobroPago; - return this; - } - - public Builder withFechaCobroPago(String fechaCobroPago) { - this.fechaCobroPago = fechaCobroPago; - return this; - } - - public Builder withImporteCobroPago(BigDecimal importeCobroPago) { - this.importeCobroPago = importeCobroPago; - return this; - } - - public Builder withImportePercibidoRetenido(BigDecimal importePercibidoRetenido) { - this.importePercibidoRetenido = importePercibidoRetenido; - return this; - } - - public Builder withImporteTotalCobradoPagado(BigDecimal importeTotalCobradoPagado) { - this.importeTotalCobradoPagado = importeTotalCobradoPagado; - return this; - } - - public PerceptionRetentionLineOutputModel build() { - PerceptionRetentionLineOutputModel perceptionRetentionLineOutputModel = new PerceptionRetentionLineOutputModel(); - perceptionRetentionLineOutputModel.setComprobante(comprobante); - perceptionRetentionLineOutputModel.setNumeroCobroPago(numeroCobroPago); - perceptionRetentionLineOutputModel.setFechaCobroPago(fechaCobroPago); - perceptionRetentionLineOutputModel.setImporteCobroPago(importeCobroPago); - perceptionRetentionLineOutputModel.setImportePercibidoRetenido(importePercibidoRetenido); - perceptionRetentionLineOutputModel.setImporteTotalCobradoPagado(importeTotalCobradoPagado); - return perceptionRetentionLineOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/PerceptionRetentionOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/PerceptionRetentionOutputModel.java deleted file mode 100644 index 4740d6c2..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/PerceptionRetentionOutputModel.java +++ /dev/null @@ -1,211 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.sunat; - -import io.github.project.openubl.xmlbuilderlib.models.output.common.ClienteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.FirmanteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.ProveedorOutputModel; - -import javax.validation.Valid; -import javax.validation.constraints.*; -import java.math.BigDecimal; -import java.util.List; - -public abstract class PerceptionRetentionOutputModel { - - @NotNull - @NotBlank - protected String serieNumero; - - @NotNull - @NotBlank - protected String fechaEmision; - - protected String observacion; - - @NotNull - @Size(min = 3, max = 3) - protected String moneda; - - @NotNull - @Min(0) - protected BigDecimal importeTotalPercibidoRetenido; - - @NotNull - @Min(0) - protected BigDecimal importeTotalCobradoPagado; - - @NotNull - @Valid - protected ProveedorOutputModel proveedor; - - @NotNull - @Valid - protected ClienteOutputModel cliente; - - @NotNull - @Valid - protected FirmanteOutputModel firmante; - - @NotNull - @NotEmpty - @Valid - protected List detalle; - - public String getSerieNumero() { - return serieNumero; - } - - public void setSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - } - - public String getFechaEmision() { - return fechaEmision; - } - - public void setFechaEmision(String fechaEmision) { - this.fechaEmision = fechaEmision; - } - - public String getMoneda() { - return moneda; - } - - public void setMoneda(String moneda) { - this.moneda = moneda; - } - - public String getObservacion() { - return observacion; - } - - public void setObservacion(String observacion) { - this.observacion = observacion; - } - - public BigDecimal getImporteTotalPercibidoRetenido() { - return importeTotalPercibidoRetenido; - } - - public void setImporteTotalPercibidoRetenido(BigDecimal importeTotalPercibidoRetenido) { - this.importeTotalPercibidoRetenido = importeTotalPercibidoRetenido; - } - - public ProveedorOutputModel getProveedor() { - return proveedor; - } - - public void setProveedor(ProveedorOutputModel proveedor) { - this.proveedor = proveedor; - } - - public ClienteOutputModel getCliente() { - return cliente; - } - - public void setCliente(ClienteOutputModel cliente) { - this.cliente = cliente; - } - - public FirmanteOutputModel getFirmante() { - return firmante; - } - - public void setFirmante(FirmanteOutputModel firmante) { - this.firmante = firmante; - } - - public List getDetalle() { - return detalle; - } - - public void setDetalle(List detalle) { - this.detalle = detalle; - } - - public BigDecimal getImporteTotalCobradoPagado() { - return importeTotalCobradoPagado; - } - - public void setImporteTotalCobradoPagado(BigDecimal importeTotalCobradoPagado) { - this.importeTotalCobradoPagado = importeTotalCobradoPagado; - } - - public static abstract class Builder { - protected String serieNumero; - protected String fechaEmision; - protected String observacion; - protected String moneda; - protected BigDecimal importeTotalPercibidoRetenido; - protected BigDecimal importeTotalCobradoPagado; - protected ProveedorOutputModel proveedor; - protected ClienteOutputModel cliente; - protected FirmanteOutputModel firmante; - protected List detalle; - - public Builder withSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - return this; - } - - public Builder withFechaEmision(String fechaEmision) { - this.fechaEmision = fechaEmision; - return this; - } - - public Builder withObservacion(String observacion) { - this.observacion = observacion; - return this; - } - - public Builder withMoneda(String moneda) { - this.moneda = moneda; - return this; - } - - public Builder withImporteTotalPercibidoRetenido(BigDecimal importeTotalPercibidoRetenido) { - this.importeTotalPercibidoRetenido = importeTotalPercibidoRetenido; - return this; - } - - public Builder withImporteTotalCobradoPagado(BigDecimal importeTotalCobradoPagado) { - this.importeTotalCobradoPagado = importeTotalCobradoPagado; - return this; - } - - public Builder withProveedor(ProveedorOutputModel proveedor) { - this.proveedor = proveedor; - return this; - } - - public Builder withCliente(ClienteOutputModel cliente) { - this.cliente = cliente; - return this; - } - - public Builder withFirmante(FirmanteOutputModel firmante) { - this.firmante = firmante; - return this; - } - - public Builder withDetalle(List detalle) { - this.detalle = detalle; - return this; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/RetentionOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/RetentionOutputModel.java deleted file mode 100644 index 52e3cdcc..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/RetentionOutputModel.java +++ /dev/null @@ -1,132 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.sunat; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog23; -import io.github.project.openubl.xmlbuilderlib.models.output.common.ClienteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.FirmanteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.ProveedorOutputModel; - -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; -import java.util.List; - -public class RetentionOutputModel extends PerceptionRetentionOutputModel { - - @NotNull - private Catalog23 regimen; - - public Catalog23 getRegimen() { - return regimen; - } - - public void setRegimen(Catalog23 regimen) { - this.regimen = regimen; - } - - public static final class Builder extends PerceptionRetentionOutputModel.Builder { - private Catalog23 regimen; - private String serieNumero; - private String fechaEmision; - private String observacion; - private String moneda; - private BigDecimal importeTotalPercibidoRetenido; - private BigDecimal importeTotalCobradoPagado; - private ProveedorOutputModel proveedor; - private ClienteOutputModel cliente; - private FirmanteOutputModel firmante; - private List detalle; - - private Builder() { - } - - public static Builder aRetentionOutputModel() { - return new Builder(); - } - - public Builder withRegimen(Catalog23 regimen) { - this.regimen = regimen; - return this; - } - - public Builder withSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - return this; - } - - public Builder withFechaEmision(String fechaEmision) { - this.fechaEmision = fechaEmision; - return this; - } - - public Builder withObservacion(String observacion) { - this.observacion = observacion; - return this; - } - - public Builder withMoneda(String moneda) { - this.moneda = moneda; - return this; - } - - public Builder withImporteTotalPercibidoRetenido(BigDecimal importeTotalPercibidoRetenido) { - this.importeTotalPercibidoRetenido = importeTotalPercibidoRetenido; - return this; - } - - public Builder withImporteTotalCobradoPagado(BigDecimal importeTotalCobradoPagado) { - this.importeTotalCobradoPagado = importeTotalCobradoPagado; - return this; - } - - public Builder withProveedor(ProveedorOutputModel proveedor) { - this.proveedor = proveedor; - return this; - } - - public Builder withCliente(ClienteOutputModel cliente) { - this.cliente = cliente; - return this; - } - - public Builder withFirmante(FirmanteOutputModel firmante) { - this.firmante = firmante; - return this; - } - - public Builder withDetalle(List detalle) { - this.detalle = detalle; - return this; - } - - public RetentionOutputModel build() { - RetentionOutputModel retentionOutputModel = new RetentionOutputModel(); - retentionOutputModel.setRegimen(regimen); - retentionOutputModel.setSerieNumero(serieNumero); - retentionOutputModel.setFechaEmision(fechaEmision); - retentionOutputModel.setObservacion(observacion); - retentionOutputModel.setMoneda(moneda); - retentionOutputModel.setImporteTotalPercibidoRetenido(importeTotalPercibidoRetenido); - retentionOutputModel.setImporteTotalCobradoPagado(importeTotalCobradoPagado); - retentionOutputModel.setProveedor(proveedor); - retentionOutputModel.setCliente(cliente); - retentionOutputModel.setFirmante(firmante); - retentionOutputModel.setDetalle(detalle); - return retentionOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/SummaryDocumentComprobanteAfectadoOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/SummaryDocumentComprobanteAfectadoOutputModel.java deleted file mode 100644 index c55f325b..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/SummaryDocumentComprobanteAfectadoOutputModel.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.sunat; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; - -public class SummaryDocumentComprobanteAfectadoOutputModel { - - @NotNull - private Catalog1 tipo; - - @NotBlank - private String serieNumero; - - public Catalog1 getTipo() { - return tipo; - } - - public void setTipo(Catalog1 tipo) { - this.tipo = tipo; - } - - public String getSerieNumero() { - return serieNumero; - } - - public void setSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - } - - public static final class Builder { - private Catalog1 tipo; - private String serieNumero; - - private Builder() { - } - - public static Builder aSummaryDocumentComprobanteAfectadoOutputModel() { - return new Builder(); - } - - public Builder withTipo(Catalog1 tipo) { - this.tipo = tipo; - return this; - } - - public Builder withSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - return this; - } - - public SummaryDocumentComprobanteAfectadoOutputModel build() { - SummaryDocumentComprobanteAfectadoOutputModel summaryDocumentComprobanteAfectadoOutputModel = new SummaryDocumentComprobanteAfectadoOutputModel(); - summaryDocumentComprobanteAfectadoOutputModel.setTipo(tipo); - summaryDocumentComprobanteAfectadoOutputModel.setSerieNumero(serieNumero); - return summaryDocumentComprobanteAfectadoOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/SummaryDocumentComprobanteOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/SummaryDocumentComprobanteOutputModel.java deleted file mode 100644 index 27a0caa8..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/SummaryDocumentComprobanteOutputModel.java +++ /dev/null @@ -1,135 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.sunat; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1; -import io.github.project.openubl.xmlbuilderlib.models.output.common.ClienteOutputModel; - -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; - -public class SummaryDocumentComprobanteOutputModel { - - @NotNull - private Catalog1 tipo; - - @NotBlank - private String serieNumero; - - @NotNull - @Valid - private ClienteOutputModel cliente; - - @NotNull - @Valid - private SummaryDocumentComprobanteValorVentaOutputModel valorVenta; - - @NotNull - @Valid - private SummaryDocumentImpuestosOutputModel impuestos; - - public Catalog1 getTipo() { - return tipo; - } - - public void setTipo(Catalog1 tipo) { - this.tipo = tipo; - } - - public String getSerieNumero() { - return serieNumero; - } - - public void setSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - } - - public ClienteOutputModel getCliente() { - return cliente; - } - - public void setCliente(ClienteOutputModel cliente) { - this.cliente = cliente; - } - - public SummaryDocumentComprobanteValorVentaOutputModel getValorVenta() { - return valorVenta; - } - - public void setValorVenta(SummaryDocumentComprobanteValorVentaOutputModel valorVenta) { - this.valorVenta = valorVenta; - } - - public SummaryDocumentImpuestosOutputModel getImpuestos() { - return impuestos; - } - - public void setImpuestos(SummaryDocumentImpuestosOutputModel impuestos) { - this.impuestos = impuestos; - } - - public static final class Builder { - private Catalog1 tipo; - private String serieNumero; - private ClienteOutputModel cliente; - private SummaryDocumentComprobanteValorVentaOutputModel valorVenta; - private SummaryDocumentImpuestosOutputModel impuestos; - - private Builder() { - } - - public static Builder aSummaryDocumentComprobanteOutputModel() { - return new Builder(); - } - - public Builder withTipo(Catalog1 tipo) { - this.tipo = tipo; - return this; - } - - public Builder withSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - return this; - } - - public Builder withCliente(ClienteOutputModel cliente) { - this.cliente = cliente; - return this; - } - - public Builder withValorVenta(SummaryDocumentComprobanteValorVentaOutputModel valorVenta) { - this.valorVenta = valorVenta; - return this; - } - - public Builder withImpuestos(SummaryDocumentImpuestosOutputModel impuestos) { - this.impuestos = impuestos; - return this; - } - - public SummaryDocumentComprobanteOutputModel build() { - SummaryDocumentComprobanteOutputModel summaryDocumentComprobanteOutputModel = new SummaryDocumentComprobanteOutputModel(); - summaryDocumentComprobanteOutputModel.setTipo(tipo); - summaryDocumentComprobanteOutputModel.setSerieNumero(serieNumero); - summaryDocumentComprobanteOutputModel.setCliente(cliente); - summaryDocumentComprobanteOutputModel.setValorVenta(valorVenta); - summaryDocumentComprobanteOutputModel.setImpuestos(impuestos); - return summaryDocumentComprobanteOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/SummaryDocumentComprobanteValorVentaOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/SummaryDocumentComprobanteValorVentaOutputModel.java deleted file mode 100644 index 67b3b11c..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/SummaryDocumentComprobanteValorVentaOutputModel.java +++ /dev/null @@ -1,149 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.sunat; - -import javax.validation.Valid; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; - -public class SummaryDocumentComprobanteValorVentaOutputModel { - - @NotNull - @Min(0) - private BigDecimal importeTotal; - - @Min(0) - private BigDecimal otrosCargos; - - @Valid - private TotalValorVentaOutputModel gravado; - - @Valid - private TotalValorVentaOutputModel exonerado; - - @Valid - private TotalValorVentaOutputModel inafecto; - - @Valid - private TotalValorVentaOutputModel gratuito; - - public BigDecimal getImporteTotal() { - return importeTotal; - } - - public void setImporteTotal(BigDecimal importeTotal) { - this.importeTotal = importeTotal; - } - - public BigDecimal getOtrosCargos() { - return otrosCargos; - } - - public void setOtrosCargos(BigDecimal otrosCargos) { - this.otrosCargos = otrosCargos; - } - - public TotalValorVentaOutputModel getGravado() { - return gravado; - } - - public void setGravado(TotalValorVentaOutputModel gravado) { - this.gravado = gravado; - } - - public TotalValorVentaOutputModel getExonerado() { - return exonerado; - } - - public void setExonerado(TotalValorVentaOutputModel exonerado) { - this.exonerado = exonerado; - } - - public TotalValorVentaOutputModel getInafecto() { - return inafecto; - } - - public void setInafecto(TotalValorVentaOutputModel inafecto) { - this.inafecto = inafecto; - } - - public TotalValorVentaOutputModel getGratuito() { - return gratuito; - } - - public void setGratuito(TotalValorVentaOutputModel gratuito) { - this.gratuito = gratuito; - } - - public static final class Builder { - private BigDecimal importeTotal; - private BigDecimal otrosCargos; - private TotalValorVentaOutputModel gravado; - private TotalValorVentaOutputModel exonerado; - private TotalValorVentaOutputModel inafecto; - private TotalValorVentaOutputModel gratuito; - - private Builder() { - } - - public static Builder aSummaryDocumentComprobanteValorVentaOutputModel() { - return new Builder(); - } - - public Builder withImporteTotal(BigDecimal importeTotal) { - this.importeTotal = importeTotal; - return this; - } - - public Builder withOtrosCargos(BigDecimal otrosCargos) { - this.otrosCargos = otrosCargos; - return this; - } - - public Builder withGravado(TotalValorVentaOutputModel gravado) { - this.gravado = gravado; - return this; - } - - public Builder withExonerado(TotalValorVentaOutputModel exonerado) { - this.exonerado = exonerado; - return this; - } - - public Builder withInafecto(TotalValorVentaOutputModel inafecto) { - this.inafecto = inafecto; - return this; - } - - public Builder withGratuito(TotalValorVentaOutputModel gratuito) { - this.gratuito = gratuito; - return this; - } - - public SummaryDocumentComprobanteValorVentaOutputModel build() { - SummaryDocumentComprobanteValorVentaOutputModel summaryDocumentComprobanteValorVentaOutputModel = new SummaryDocumentComprobanteValorVentaOutputModel(); - summaryDocumentComprobanteValorVentaOutputModel.setImporteTotal(importeTotal); - summaryDocumentComprobanteValorVentaOutputModel.setOtrosCargos(otrosCargos); - summaryDocumentComprobanteValorVentaOutputModel.setGravado(gravado); - summaryDocumentComprobanteValorVentaOutputModel.setExonerado(exonerado); - summaryDocumentComprobanteValorVentaOutputModel.setInafecto(inafecto); - summaryDocumentComprobanteValorVentaOutputModel.setGratuito(gratuito); - return summaryDocumentComprobanteValorVentaOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/SummaryDocumentImpuestosOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/SummaryDocumentImpuestosOutputModel.java deleted file mode 100644 index fefc98cf..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/SummaryDocumentImpuestosOutputModel.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.sunat; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - -public class SummaryDocumentImpuestosOutputModel { - - @NotNull - @Valid - private ImpuestoTotalResumenDiarioOutputModel igv; - - @Valid - private ImpuestoTotalResumenDiarioOutputModel icb; - - public ImpuestoTotalResumenDiarioOutputModel getIgv() { - return igv; - } - - public void setIgv(ImpuestoTotalResumenDiarioOutputModel igv) { - this.igv = igv; - } - - public ImpuestoTotalResumenDiarioOutputModel getIcb() { - return icb; - } - - public void setIcb(ImpuestoTotalResumenDiarioOutputModel icb) { - this.icb = icb; - } - - public static final class Builder { - private ImpuestoTotalResumenDiarioOutputModel igv; - private ImpuestoTotalResumenDiarioOutputModel icb; - - private Builder() { - } - - public static Builder aSummaryDocumentImpuestosOutputModel() { - return new Builder(); - } - - public Builder withIgv(ImpuestoTotalResumenDiarioOutputModel igv) { - this.igv = igv; - return this; - } - - public Builder withIcb(ImpuestoTotalResumenDiarioOutputModel icb) { - this.icb = icb; - return this; - } - - public SummaryDocumentImpuestosOutputModel build() { - SummaryDocumentImpuestosOutputModel summaryDocumentImpuestosOutputModel = new SummaryDocumentImpuestosOutputModel(); - summaryDocumentImpuestosOutputModel.setIgv(igv); - summaryDocumentImpuestosOutputModel.setIcb(icb); - return summaryDocumentImpuestosOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/SummaryDocumentLineOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/SummaryDocumentLineOutputModel.java deleted file mode 100644 index d486c0dc..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/SummaryDocumentLineOutputModel.java +++ /dev/null @@ -1,95 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.sunat; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog19; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - -public class SummaryDocumentLineOutputModel { - - @NotNull - private Catalog19 tipoOperacion; - - @NotNull - @Valid - private SummaryDocumentComprobanteOutputModel comprobante; - - @Valid - private SummaryDocumentComprobanteAfectadoOutputModel comprobanteAfectado; - - public Catalog19 getTipoOperacion() { - return tipoOperacion; - } - - public void setTipoOperacion(Catalog19 tipoOperacion) { - this.tipoOperacion = tipoOperacion; - } - - public SummaryDocumentComprobanteOutputModel getComprobante() { - return comprobante; - } - - public void setComprobante(SummaryDocumentComprobanteOutputModel comprobante) { - this.comprobante = comprobante; - } - - public SummaryDocumentComprobanteAfectadoOutputModel getComprobanteAfectado() { - return comprobanteAfectado; - } - - public void setComprobanteAfectado(SummaryDocumentComprobanteAfectadoOutputModel comprobanteAfectado) { - this.comprobanteAfectado = comprobanteAfectado; - } - - public static final class Builder { - private Catalog19 tipoOperacion; - private SummaryDocumentComprobanteOutputModel comprobante; - private SummaryDocumentComprobanteAfectadoOutputModel comprobanteAfectado; - - private Builder() { - } - - public static Builder aSummaryDocumentLineOutputModel() { - return new Builder(); - } - - public Builder withTipoOperacion(Catalog19 tipoOperacion) { - this.tipoOperacion = tipoOperacion; - return this; - } - - public Builder withComprobante(SummaryDocumentComprobanteOutputModel comprobante) { - this.comprobante = comprobante; - return this; - } - - public Builder withComprobanteAfectado(SummaryDocumentComprobanteAfectadoOutputModel comprobanteAfectado) { - this.comprobanteAfectado = comprobanteAfectado; - return this; - } - - public SummaryDocumentLineOutputModel build() { - SummaryDocumentLineOutputModel summaryDocumentLineOutputModel = new SummaryDocumentLineOutputModel(); - summaryDocumentLineOutputModel.setTipoOperacion(tipoOperacion); - summaryDocumentLineOutputModel.setComprobante(comprobante); - summaryDocumentLineOutputModel.setComprobanteAfectado(comprobanteAfectado); - return summaryDocumentLineOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/SummaryDocumentOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/SummaryDocumentOutputModel.java deleted file mode 100644 index 2c6a4794..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/SummaryDocumentOutputModel.java +++ /dev/null @@ -1,174 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.sunat; - -import io.github.project.openubl.xmlbuilderlib.models.output.common.FirmanteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.ProveedorOutputModel; - -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.util.List; - -public class SummaryDocumentOutputModel { - - @NotBlank - private String serieNumero; - - @NotBlank - private String moneda; - - @NotBlank - private String fechaEmision; - - @NotBlank - private String fechaEmisionDeComprobantesAsociados; - - @NotNull - @Valid - private FirmanteOutputModel firmante; - - @NotNull - @Valid - private ProveedorOutputModel proveedor; - - @NotNull - @NotEmpty - @Valid - private List detalle; - - public String getSerieNumero() { - return serieNumero; - } - - public void setSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - } - - public String getMoneda() { - return moneda; - } - - public void setMoneda(String moneda) { - this.moneda = moneda; - } - - public String getFechaEmision() { - return fechaEmision; - } - - public void setFechaEmision(String fechaEmision) { - this.fechaEmision = fechaEmision; - } - - public String getFechaEmisionDeComprobantesAsociados() { - return fechaEmisionDeComprobantesAsociados; - } - - public void setFechaEmisionDeComprobantesAsociados(String fechaEmisionDeComprobantesAsociados) { - this.fechaEmisionDeComprobantesAsociados = fechaEmisionDeComprobantesAsociados; - } - - public FirmanteOutputModel getFirmante() { - return firmante; - } - - public void setFirmante(FirmanteOutputModel firmante) { - this.firmante = firmante; - } - - public ProveedorOutputModel getProveedor() { - return proveedor; - } - - public void setProveedor(ProveedorOutputModel proveedor) { - this.proveedor = proveedor; - } - - public List getDetalle() { - return detalle; - } - - public void setDetalle(List detalle) { - this.detalle = detalle; - } - - public static final class Builder { - private String serieNumero; - private String moneda; - private String fechaEmision; - private String fechaEmisionDeComprobantesAsociados; - private FirmanteOutputModel firmante; - private ProveedorOutputModel proveedor; - private List detalle; - - private Builder() { - } - - public static Builder aSummaryDocumentOutputModel() { - return new Builder(); - } - - public Builder withSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - return this; - } - - public Builder withMoneda(String moneda) { - this.moneda = moneda; - return this; - } - - public Builder withFechaEmision(String fechaEmision) { - this.fechaEmision = fechaEmision; - return this; - } - - public Builder withFechaEmisionDeComprobantesAsociados(String fechaEmisionDeComprobantesAsociados) { - this.fechaEmisionDeComprobantesAsociados = fechaEmisionDeComprobantesAsociados; - return this; - } - - public Builder withFirmante(FirmanteOutputModel firmante) { - this.firmante = firmante; - return this; - } - - public Builder withProveedor(ProveedorOutputModel proveedor) { - this.proveedor = proveedor; - return this; - } - - public Builder withDetalle(List detalle) { - this.detalle = detalle; - return this; - } - - public SummaryDocumentOutputModel build() { - SummaryDocumentOutputModel summaryDocumentOutputModel = new SummaryDocumentOutputModel(); - summaryDocumentOutputModel.setSerieNumero(serieNumero); - summaryDocumentOutputModel.setMoneda(moneda); - summaryDocumentOutputModel.setFechaEmision(fechaEmision); - summaryDocumentOutputModel.setFechaEmisionDeComprobantesAsociados(fechaEmisionDeComprobantesAsociados); - summaryDocumentOutputModel.setFirmante(firmante); - summaryDocumentOutputModel.setProveedor(proveedor); - summaryDocumentOutputModel.setDetalle(detalle); - return summaryDocumentOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/TotalValorVentaOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/TotalValorVentaOutputModel.java deleted file mode 100644 index da0323db..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/TotalValorVentaOutputModel.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.sunat; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog7_1; - -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; - -public class TotalValorVentaOutputModel { - - @NotNull - @Min(0) - private BigDecimal importe; - - @NotNull - private Catalog7_1 tipo; - - public BigDecimal getImporte() { - return importe; - } - - public void setImporte(BigDecimal importe) { - this.importe = importe; - } - - public Catalog7_1 getTipo() { - return tipo; - } - - public void setTipo(Catalog7_1 tipo) { - this.tipo = tipo; - } - - public static final class Builder { - private BigDecimal importe; - private Catalog7_1 tipo; - - private Builder() { - } - - public static Builder aTotalValorVentaOutputModel() { - return new Builder(); - } - - public Builder withImporte(BigDecimal importe) { - this.importe = importe; - return this; - } - - public Builder withTipo(Catalog7_1 tipo) { - this.tipo = tipo; - return this; - } - - public TotalValorVentaOutputModel build() { - TotalValorVentaOutputModel totalValorVentaOutputModel = new TotalValorVentaOutputModel(); - totalValorVentaOutputModel.setImporte(importe); - totalValorVentaOutputModel.setTipo(tipo); - return totalValorVentaOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/VoidedDocumentLineOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/VoidedDocumentLineOutputModel.java deleted file mode 100644 index fea181b4..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/VoidedDocumentLineOutputModel.java +++ /dev/null @@ -1,115 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.sunat; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; - -public class VoidedDocumentLineOutputModel { - - @NotBlank - @Pattern(regexp = "^([F|B|P|T|R][A-Z]?[0-9]{1,3})$") - private String serie; - - @NotBlank - @Pattern(regexp = "^([0-9]{1,8})$") - private String numero; - - @NotBlank - private String fechaEmision; - - @NotNull - private Catalog1 tipoComprobante; - - public String getSerie() { - return serie; - } - - public void setSerie(String serie) { - this.serie = serie; - } - - public String getNumero() { - return numero; - } - - public void setNumero(String numero) { - this.numero = numero; - } - - public String getFechaEmision() { - return fechaEmision; - } - - public void setFechaEmision(String fechaEmision) { - this.fechaEmision = fechaEmision; - } - - public Catalog1 getTipoComprobante() { - return tipoComprobante; - } - - public void setTipoComprobante(Catalog1 tipoComprobante) { - this.tipoComprobante = tipoComprobante; - } - - public static final class Builder { - private String serie; - private String numero; - private String fechaEmision; - private Catalog1 tipoComprobante; - - private Builder() { - } - - public static Builder aVoidedDocumentLineOutputModel() { - return new Builder(); - } - - public Builder withSerie(String serie) { - this.serie = serie; - return this; - } - - public Builder withNumero(String numero) { - this.numero = numero; - return this; - } - - public Builder withFechaEmision(String fechaEmision) { - this.fechaEmision = fechaEmision; - return this; - } - - public Builder withTipoComprobante(Catalog1 tipoComprobante) { - this.tipoComprobante = tipoComprobante; - return this; - } - - public VoidedDocumentLineOutputModel build() { - VoidedDocumentLineOutputModel voidedDocumentLineOutputModel = new VoidedDocumentLineOutputModel(); - voidedDocumentLineOutputModel.setSerie(serie); - voidedDocumentLineOutputModel.setNumero(numero); - voidedDocumentLineOutputModel.setFechaEmision(fechaEmision); - voidedDocumentLineOutputModel.setTipoComprobante(tipoComprobante); - return voidedDocumentLineOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/VoidedDocumentOutputModel.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/VoidedDocumentOutputModel.java deleted file mode 100644 index 88cf0876..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/models/output/sunat/VoidedDocumentOutputModel.java +++ /dev/null @@ -1,155 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.output.sunat; - -import io.github.project.openubl.xmlbuilderlib.models.output.common.FirmanteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.common.ProveedorOutputModel; - -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; - -public class VoidedDocumentOutputModel { - - @NotBlank - @Pattern(regexp = "^([R][A|R])[-]([0-9]{8})[-]([0-9]{1,8})$") - private String serieNumero; - - @NotBlank - private String fechaEmision; - - @NotNull - @Valid - private FirmanteOutputModel firmante; - - @NotNull - @Valid - private ProveedorOutputModel proveedor; - - @NotBlank - private String descripcionSustento; - - @NotNull - @Valid - private VoidedDocumentLineOutputModel comprobante; - - public String getSerieNumero() { - return serieNumero; - } - - public void setSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - } - - public String getFechaEmision() { - return fechaEmision; - } - - public void setFechaEmision(String fechaEmision) { - this.fechaEmision = fechaEmision; - } - - public FirmanteOutputModel getFirmante() { - return firmante; - } - - public void setFirmante(FirmanteOutputModel firmante) { - this.firmante = firmante; - } - - public ProveedorOutputModel getProveedor() { - return proveedor; - } - - public void setProveedor(ProveedorOutputModel proveedor) { - this.proveedor = proveedor; - } - - public String getDescripcionSustento() { - return descripcionSustento; - } - - public void setDescripcionSustento(String descripcionSustento) { - this.descripcionSustento = descripcionSustento; - } - - public VoidedDocumentLineOutputModel getComprobante() { - return comprobante; - } - - public void setComprobante(VoidedDocumentLineOutputModel comprobante) { - this.comprobante = comprobante; - } - - public static final class Builder { - private String serieNumero; - private String fechaEmision; - private FirmanteOutputModel firmante; - private ProveedorOutputModel proveedor; - private String descripcionSustento; - private VoidedDocumentLineOutputModel comprobante; - - private Builder() { - } - - public static Builder aVoidedDocumentOutputModel() { - return new Builder(); - } - - public Builder withSerieNumero(String serieNumero) { - this.serieNumero = serieNumero; - return this; - } - - public Builder withFechaEmision(String fechaEmision) { - this.fechaEmision = fechaEmision; - return this; - } - - public Builder withFirmante(FirmanteOutputModel firmante) { - this.firmante = firmante; - return this; - } - - public Builder withProveedor(ProveedorOutputModel proveedor) { - this.proveedor = proveedor; - return this; - } - - public Builder withDescripcionSustento(String descripcionSustento) { - this.descripcionSustento = descripcionSustento; - return this; - } - - public Builder withComprobante(VoidedDocumentLineOutputModel comprobante) { - this.comprobante = comprobante; - return this; - } - - public VoidedDocumentOutputModel build() { - VoidedDocumentOutputModel voidedDocumentOutputModel = new VoidedDocumentOutputModel(); - voidedDocumentOutputModel.setSerieNumero(serieNumero); - voidedDocumentOutputModel.setFechaEmision(fechaEmision); - voidedDocumentOutputModel.setFirmante(firmante); - voidedDocumentOutputModel.setProveedor(proveedor); - voidedDocumentOutputModel.setDescripcionSustento(descripcionSustento); - voidedDocumentOutputModel.setComprobante(comprobante); - return voidedDocumentOutputModel; - } - } -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/utils/DateUtils.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/utils/DateUtils.java deleted file mode 100644 index b18320fc..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/utils/DateUtils.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.utils; - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; - -public class DateUtils { - - private DateUtils() { - // Just static methods - } - - public static String toGregorianCalendarDate(long time, TimeZone timeZone) { - Date date = new Date(time); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - sdf.setTimeZone(timeZone); - return sdf.format(date); - } - - public static String toGregorianCalendarTime(long time, TimeZone timeZone) { - Date date = new Date(time); - SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); - sdf.setTimeZone(timeZone); - return sdf.format(date); - } - -} diff --git a/src/main/java/io/github/project/openubl/xmlbuilderlib/utils/InputToOutput.java b/src/main/java/io/github/project/openubl/xmlbuilderlib/utils/InputToOutput.java deleted file mode 100644 index 0f7e4b8f..00000000 --- a/src/main/java/io/github/project/openubl/xmlbuilderlib/utils/InputToOutput.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.utils; - -import io.github.project.openubl.xmlbuilderlib.clock.SystemClock; -import io.github.project.openubl.xmlbuilderlib.config.Config; -import io.github.project.openubl.xmlbuilderlib.factory.InvoiceAndNoteOutputModelFactory; -import io.github.project.openubl.xmlbuilderlib.factory.PerceptionRetentionOutputModelFactory; -import io.github.project.openubl.xmlbuilderlib.factory.SummaryDocumentOutputModelFactory; -import io.github.project.openubl.xmlbuilderlib.factory.VoidedDocumentOutputModelFactory; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.invoice.InvoiceInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.note.creditNote.CreditNoteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.note.debitNote.DebitNoteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.sunat.PerceptionInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.sunat.RetentionInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.sunat.SummaryDocumentInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.sunat.VoidedDocumentInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.invoice.InvoiceOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.note.creditNote.CreditNoteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.note.debitNote.DebitNoteOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.sunat.PerceptionOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.sunat.RetentionOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.sunat.SummaryDocumentOutputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.sunat.VoidedDocumentOutputModel; - -public class InputToOutput { - - private InputToOutput() { - // Only static methods - } - - public static InvoiceOutputModel toOutput(InvoiceInputModel input, Config config, SystemClock systemClock) { - return InvoiceAndNoteOutputModelFactory.getInvoiceOutput(input, config, systemClock); - } - - public static CreditNoteOutputModel toOutput(CreditNoteInputModel input, Config config, SystemClock systemClock) { - return InvoiceAndNoteOutputModelFactory.getCreditNoteOutput(input, config, systemClock); - } - - public static DebitNoteOutputModel toOutput(DebitNoteInputModel input, Config config, SystemClock systemClock) { - return InvoiceAndNoteOutputModelFactory.getDebitNoteOutput(input, config, systemClock); - } - - public static VoidedDocumentOutputModel toOutput(VoidedDocumentInputModel input, Config config, SystemClock systemClock) { - return VoidedDocumentOutputModelFactory.getVoidedDocument(input, config, systemClock); - } - - public static SummaryDocumentOutputModel toOutput(SummaryDocumentInputModel input, Config config, SystemClock systemClock) { - return SummaryDocumentOutputModelFactory.getSummaryDocument(input, config, systemClock); - } - - public static PerceptionOutputModel toOutput(PerceptionInputModel input, Config config, SystemClock systemClock) { - return PerceptionRetentionOutputModelFactory.getPerception(input, config, systemClock); - } - - public static RetentionOutputModel toOutput(RetentionInputModel input, Config config, SystemClock systemClock) { - return PerceptionRetentionOutputModelFactory.getRetention(input, config, systemClock); - } -} diff --git a/src/main/resources/META-INF/beans.xml b/src/main/resources/META-INF/beans.xml deleted file mode 100644 index e69de29b..00000000 diff --git a/src/main/resources/META-INF/services/io.github.project.openubl.xbuilder.enricher.kie.RuleFactory b/src/main/resources/META-INF/services/io.github.project.openubl.xbuilder.enricher.kie.RuleFactory new file mode 100644 index 00000000..8f7e7dc0 --- /dev/null +++ b/src/main/resources/META-INF/services/io.github.project.openubl.xbuilder.enricher.kie.RuleFactory @@ -0,0 +1,53 @@ +# Header +## Enrich - commons +io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.MonedaRule +io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.TasaIgvRule +io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.TasaIcbRule +io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.FechaEmisionRule +io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.FirmanteRule +io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.ClienteTipoDocumentoRule +io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.ProveedorDireccionRule + +## Enrich - Invoice +io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.invoice.FormaDePagoRule +io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.invoice.FormaDePagoTipoRule +io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.invoice.FormaDePagoTotalRule +io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.invoice.TipoComprobanteRule +io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.invoice.DireccionDeEntregaRule +io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.invoice.DetraccionRule +io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.invoice.TipoOperacionRule +io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.invoice.PercepcionRule + +## Enrich - Note +io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.note.ComprobanteAfectadoTipoRule +io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.note.creditnote.TipoNotaCreditoRule +io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.header.note.debitnote.TipoNotaDebitoRule + +## Summary - Invoice +io.github.project.openubl.xbuilder.enricher.kie.rules.summary.header.invoice.TotalImporteRule +io.github.project.openubl.xbuilder.enricher.kie.rules.summary.header.invoice.TotalImpuestosRule +io.github.project.openubl.xbuilder.enricher.kie.rules.summary.header.invoice.DetraccionRule +io.github.project.openubl.xbuilder.enricher.kie.rules.summary.header.invoice.PercepcionRule + +## Summary - Note +io.github.project.openubl.xbuilder.enricher.kie.rules.summary.header.note.TotalImporteRule +io.github.project.openubl.xbuilder.enricher.kie.rules.summary.header.note.TotalImpuestosRule + + +# Body +## Enrich - Detalle +io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.detalle.UnidadDeMedidaRule +io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.detalle.IgvTipoRule +io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.detalle.PrecioDeReferenciaTipoRule + +## Enrich - Anticipos +io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.anticipo.TipoAnticipoRule +io.github.project.openubl.xbuilder.enricher.kie.rules.enrich.body.anticipo.ComprobanteTipoRule + +## Process - Detalle +io.github.project.openubl.xbuilder.enricher.kie.rules.process.body.detalle.PrecioDeReferenciaRule +io.github.project.openubl.xbuilder.enricher.kie.rules.process.body.detalle.IcbRule +io.github.project.openubl.xbuilder.enricher.kie.rules.process.body.detalle.IcbAplicaRule +io.github.project.openubl.xbuilder.enricher.kie.rules.process.body.detalle.IgvBaseImponibleRule +io.github.project.openubl.xbuilder.enricher.kie.rules.process.body.detalle.IgvRule +io.github.project.openubl.xbuilder.enricher.kie.rules.process.body.detalle.TotalImpuestosRule diff --git a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/additional-document-reference.ftl b/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/additional-document-reference.ftl deleted file mode 100644 index 851b1bcf..00000000 --- a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/additional-document-reference.ftl +++ /dev/null @@ -1,6 +0,0 @@ - <#list otrosDocumentosTributariosRelacionados as item> - - ${item.serieNumero} - ${item.tipoDocumento.code} - - diff --git a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/address.ftl b/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/address.ftl deleted file mode 100644 index 2b8b80ca..00000000 --- a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/address.ftl +++ /dev/null @@ -1,18 +0,0 @@ -<#macro macroAddress address> - <#if address.ubigeo??>${address.ubigeo} - <#if address.codigoLocal??>${address.codigoLocal} - <#if address.urbanizacion??>${address.urbanizacion} - <#if address.provincia??>${address.provincia} - <#if address.departamento??>${address.departamento} - <#if address.distrito??>${address.distrito} - <#if address.direccion??> - - - - - <#if address.codigoPais??> - - ${address.codigoPais} - - - diff --git a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/contact.ftl b/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/contact.ftl deleted file mode 100644 index 1e4fdd45..00000000 --- a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/contact.ftl +++ /dev/null @@ -1,10 +0,0 @@ -<#macro macroContact contact> - - <#if contact.telefono??> - ${contact.telefono} - - <#if contact.email??> - ${contact.email} - - - diff --git a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/customer.ftl b/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/customer.ftl deleted file mode 100644 index 3a0d875c..00000000 --- a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/customer.ftl +++ /dev/null @@ -1,20 +0,0 @@ - <#import "address.ftl" as adressMacro/> - <#import "contact.ftl" as contactMacro/> - - - - ${cliente.numeroDocumentoIdentidad} - - - - <#if cliente.direccion??> - - <@adressMacro.macroAddress address=cliente.direccion /> - - - - <#if cliente.contacto??> - <@contactMacro.macroContact contact=cliente.contacto /> - - - diff --git a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/despatch-document-reference.ftl b/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/despatch-document-reference.ftl deleted file mode 100644 index b0bc6667..00000000 --- a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/despatch-document-reference.ftl +++ /dev/null @@ -1,6 +0,0 @@ - <#list guiasRemisionRelacionadas as item> - - ${item.serieNumero} - ${item.tipoDocumento.code} - - diff --git a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/document-line.ftl b/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/document-line.ftl deleted file mode 100644 index cd4ee05b..00000000 --- a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/document-line.ftl +++ /dev/null @@ -1,91 +0,0 @@ - ${item.valorVentaSinImpuestos} - - - ${item.precioDeReferencia.precio} - ${item.precioDeReferencia.tipoPrecio.code} - - -<#-- <#list item.cargos as cargo>--> -<#-- --> -<#-- true--> -<#-- ${cargo.tipo.code}--> -<#-- ${cargo.factor}--> -<#-- ${cargo.monto}--> -<#-- ${cargo.montoBase}--> -<#-- --> -<#-- --> -<#-- <#list item.descuentos as descuento>--> -<#-- --> -<#-- false--> -<#-- ${descuento.tipo.code}--> -<#-- ${descuento.factor}--> -<#-- ${descuento.monto}--> -<#-- ${descuento.montoBase}--> -<#-- --> -<#-- --> - - ${item.impuestos.importeTotal} -<#-- <#if item.isc??>--> -<#-- --> -<#-- ${item.isc.baseImponible}--> -<#-- ${item.isc.importe}--> -<#-- --> -<#-- ${item.isc.porcentaje}--> -<#-- ${item.isc.tipo.code}--> -<#-- --> -<#-- ${item.igv.categoria.code}--> -<#-- ${item.isc.categoria.nombre}--> -<#-- ${item.isc.categoria.tipo}--> -<#-- --> -<#-- --> -<#-- --> -<#-- --> - - ${item.impuestos.igv.baseImponible} - ${item.impuestos.igv.importe} - - ${item.impuestos.igv.categoria.categoria} - ${item.impuestos.igv.porcentaje} - ${item.impuestos.igv.tipo.code} - - ${item.impuestos.igv.categoria.code} - ${item.impuestos.igv.categoria.nombre} - ${item.impuestos.igv.categoria.tipo} - - - -<#-- <#if item.otroTributo??>--> -<#-- --> -<#-- ${item.otroTributo.baseImponible}--> -<#-- ${item.otroTributo.importe}--> -<#-- --> -<#-- ${item.otroTributo.porcentaje}--> -<#-- --> -<#-- ${item.otroTributo.categoria.code}--> -<#-- ${item.otroTributo.categoria.nombre}--> -<#-- ${item.otroTributo.categoria.tipo}--> -<#-- --> -<#-- --> -<#-- --> -<#-- --> - <#if item.impuestos.icb??> - - ${item.impuestos.icb.importe} - ${item.cantidad} - - ${item.impuestos.icb.icbValor} - - ${item.impuestos.icb.categoria.code} - ${item.impuestos.icb.categoria.nombre} - ${item.impuestos.icb.categoria.tipo} - - - - - - - - - - ${item.precioUnitario} - diff --git a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/general-data.ftl b/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/general-data.ftl deleted file mode 100644 index 350bd998..00000000 --- a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/general-data.ftl +++ /dev/null @@ -1,5 +0,0 @@ - 2.1 - 2.0 - ${serieNumero} - ${fechaEmision} - ${horaEmision} diff --git a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/legends.ftl b/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/legends.ftl deleted file mode 100644 index 147e91a6..00000000 --- a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/legends.ftl +++ /dev/null @@ -1,5 +0,0 @@ - <#list leyendas as item> - - - <#if observacion??> - diff --git a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/monetary-total.ftl b/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/monetary-total.ftl deleted file mode 100644 index c8ffb3d8..00000000 --- a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/monetary-total.ftl +++ /dev/null @@ -1,41 +0,0 @@ - <#--PUNTO1--> - <#----------> - <#--TOTAL VALOR DE VENTA--> - <#--A través de este elemento se debe indicar el valor de venta total de la operación. Es decir--> - <#--el importe total de la venta sin considerar los descuentos, impuestos u otros tributos a que--> - <#--se refiere el numeral anterior, pero que incluye cualquier monto de redondeo aplicable.--> - ${totales.valorVentaSinImpuestos} - <#----------> - <#--PUNTO2--> - <#----------> - <#--TOTAL PRECIO DE VENTA--> - <#--A través de este elemento se debe indicar el valor de venta total de la operación incluido--> - <#--los impuestos.--> - ${totales.valorVentaConImpuestos} - <#----------> - <#--PUNTO3--> - <#----------> - <#--TOTAL DE DESCUENTOS--> - <#--A través de este elemento se debe indicar el valor total de los descuentos globales--> - <#--realizados de ser el caso.--> - <#--Su propósito es permitir consignar en el comprobante de pago:--> - <#--* La sumatoria de los descuentos de cada línea (descuentos por ítem), ó--> - <#--* La sumatoria de los descuentos de cada línea (ítem) + descuentos globales--> -<#-- <#if totalDescuentos??>${totalDescuentos}--> - <#----------> - <#--PUNTO4--> - <#----------> - <#--SUMATORIA OTROS CARGOS--> - <#--Corresponde al total de otros cargos cobrados al adquirente o usuario y que no forman--> - <#--parte de la operación que se factura, es decir no forman parte del(os) valor(es) de ventas--> - <#--señaladas anteriormente, pero sí forman parte del importe total de la Venta (Ejemplo:--> - <#--propinas, garantías para devolución de envases, etc.)--> - <#if totales.anticiposTotal??>${totales.anticiposTotal} - <#----------> - <#--PUNTO5--> - <#----------> - <#--IMPORTE TOTAL DE LA VENTA, DE LA CESION EN USO O DEL SERVICIO PRESTADO--> - <#--Corresponde al importe total de la venta, de la cesión en uso o del servicio prestado. Es el--> - <#--resultado de la suma y/o resta (Según corresponda) de los siguientes puntos: PUNTO2-PUNTO3+PUNTO4--> - <#--menos los anticipos que hubieran sido recibidos.--> - ${totales.importeTotal} diff --git a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/namespaces.ftl b/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/namespaces.ftl deleted file mode 100644 index 9477dff6..00000000 --- a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/namespaces.ftl +++ /dev/null @@ -1,11 +0,0 @@ - xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" - xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" - xmlns:ccts="urn:un:unece:uncefact:documentation:2" - xmlns:cec="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" - xmlns:ds="http://www.w3.org/2000/09/xmldsig#" - xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" - xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" - xmlns:sac="urn:sunat:names:specification:ubl:peru:schema:xsd:SunatAggregateComponents-1" - xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" - xmlns:xs="http://www.w3.org/2001/XMLSchema" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/note/invoice-reference.ftl b/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/note/invoice-reference.ftl deleted file mode 100644 index 8da675c5..00000000 --- a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/note/invoice-reference.ftl +++ /dev/null @@ -1,16 +0,0 @@ - - ${serieNumeroComprobanteAfectado} - ${tipoDocumentoComprobanteAfectado.code} - - -<#-- <#if orderCompra??>--> -<#-- --> -<#-- ${orderCompra}--> -<#-- --> -<#-- --> - - - ${serieNumeroComprobanteAfectado} - ${tipoDocumentoComprobanteAfectado.code} - - diff --git a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/supplier.ftl b/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/supplier.ftl deleted file mode 100644 index 0456910d..00000000 --- a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/supplier.ftl +++ /dev/null @@ -1,25 +0,0 @@ - <#import "address.ftl" as adressMacro/> - <#import "contact.ftl" as contactMacro/> - - - - ${proveedor.ruc} - - <#if proveedor.nombreComercial??> - - ${proveedor.nombreComercial} - - - - - <#if proveedor.direccion??> - - <@adressMacro.macroAddress address=proveedor.direccion /> - - - - <#if proveedor.contacto??> - <@contactMacro.macroContact contact=proveedor.contacto /> - - - diff --git a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/tax-total.ftl b/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/tax-total.ftl deleted file mode 100644 index 10e7e7a5..00000000 --- a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/tax-total.ftl +++ /dev/null @@ -1,99 +0,0 @@ - - ${impuestos.importeTotal} - <#if impuestos.gravadas??> - - ${impuestos.gravadas.baseImponible} - ${impuestos.gravadas.importe} - - ${impuestos.gravadas.categoria.categoria} - - ${impuestos.gravadas.categoria.code} - ${impuestos.gravadas.categoria.nombre} - ${impuestos.gravadas.categoria.tipo} - - - - - <#if impuestos.inafectas??> - - ${impuestos.inafectas.baseImponible} - ${impuestos.inafectas.importe} - - ${impuestos.inafectas.categoria.categoria} - - ${impuestos.inafectas.categoria.code} - ${impuestos.inafectas.categoria.nombre} - ${impuestos.inafectas.categoria.tipo} - - - - - <#if impuestos.exoneradas??> - - ${impuestos.exoneradas.baseImponible} - ${impuestos.exoneradas.importe} - - ${impuestos.exoneradas.categoria.categoria} - - ${impuestos.exoneradas.categoria.code} - ${impuestos.exoneradas.categoria.nombre} - ${impuestos.exoneradas.categoria.tipo} - - - - - <#if impuestos.gratuitas??> - - ${impuestos.gratuitas.baseImponible} - ${impuestos.gratuitas.importe} - - ${impuestos.gratuitas.categoria.categoria} - - ${impuestos.gratuitas.categoria.code} - ${impuestos.gratuitas.categoria.nombre} - ${impuestos.gratuitas.categoria.tipo} - - - - - <#if impuestos.ivap??> - - ${impuestos.ivap.baseImponible} - ${impuestos.ivap.importe} - - ${impuestos.ivap.categoria.categoria} - - ${impuestos.ivap.categoria.code} - ${impuestos.ivap.categoria.nombre} - ${impuestos.ivap.categoria.tipo} - - - - - <#if impuestos.icb??> - - ${impuestos.icb.importe} - - ${impuestos.icb.categoria.categoria} - - ${impuestos.icb.categoria.code} - ${impuestos.icb.categoria.nombre} - ${impuestos.icb.categoria.tipo} - - - - -<#-- <#list totalImpuestosIcb as impuesto>--> -<#-- --> -<#-- ${impuesto.importe}--> -<#-- --> -<#-- ${impuesto.categoria.categoria}--> -<#-- --> -<#-- ${impuesto.categoria.code}--> -<#-- ${impuesto.categoria.nombre}--> -<#-- ${impuesto.categoria.tipo}--> -<#-- --> -<#-- --> -<#-- --> -<#-- --> - diff --git a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/credit-note.ftl b/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/credit-note.ftl deleted file mode 100644 index 8979bbcc..00000000 --- a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/credit-note.ftl +++ /dev/null @@ -1,44 +0,0 @@ -<@compress single_line=true> -<#setting number_format="computer"> - - -> - <#include "common/ubl-extensions.ftl"> - <#include "common/general-data.ftl"> -<#-- <#include "./common/legends.ftl">--> - ${moneda} - <#include "common/note/invoice-reference.ftl"> - <#include "common/despatch-document-reference.ftl"> - <#include "common/additional-document-reference.ftl"> - <#include "../signature.ftl"> - <#include "common/supplier.ftl"> - <#include "common/customer.ftl"> - <#if formaPago.cuotas?has_content> - - FormaPago - ${formaPago.tipo} - ${formaPago.montoTotal} - - - <#list formaPago.cuotas as item> - - FormaPago - Cuota${item.id} - ${item.monto} - ${item.fechaPago} - - - <#include "common/tax-total.ftl"> - - <#include "common/monetary-total.ftl"> - - <#list detalle as item> - - ${item?index + 1} - ${item.cantidad} - <#include "common/document-line.ftl"> - - - - diff --git a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/debit-note.ftl b/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/debit-note.ftl deleted file mode 100644 index 59f9bff4..00000000 --- a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/debit-note.ftl +++ /dev/null @@ -1,29 +0,0 @@ -<@compress single_line=true> -<#setting number_format="computer"> - - -> - <#include "common/ubl-extensions.ftl"> - <#include "common/general-data.ftl"> -<#-- <#include "./common/legends.ftl">--> - ${moneda} - <#include "common/note/invoice-reference.ftl"> - <#include "common/despatch-document-reference.ftl"> - <#include "common/additional-document-reference.ftl"> - <#include "../signature.ftl"> - <#include "common/supplier.ftl"> - <#include "common/customer.ftl"> - <#include "common/tax-total.ftl"> - - <#include "common/monetary-total.ftl"> - - <#list detalle as item> - - ${item?index + 1} - ${item.cantidad} - <#include "common/document-line.ftl"> - - - - diff --git a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/invoice.ftl b/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/invoice.ftl deleted file mode 100644 index 536237ed..00000000 --- a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/invoice.ftl +++ /dev/null @@ -1,123 +0,0 @@ -<@compress single_line=true> -<#setting number_format="computer"> - - -> - <#include "common/ubl-extensions.ftl"> - <#include "common/general-data.ftl"> -<#-- <#if fechaVencimiento??>${fechaVencimiento}--> - ${tipoInvoice.code} -<#-- <#include "./common/legends.ftl">--> - ${moneda} -<#-- <#if orderCompra??>--> -<#-- --> -<#-- ${orderCompra}--> -<#-- --> -<#-- --> - <#include "common/despatch-document-reference.ftl"> - <#include "common/additional-document-reference.ftl"> - <#list anticipos as item> - - ${item.serieNumero} - ${item.tipoDocumento.code} - ${item?index + 1} - - - ${proveedor.ruc} - - - - - <#include "../signature.ftl"> - <#include "common/supplier.ftl"> - <#include "common/customer.ftl"> -<#-- <#if direccionDeEntrega>--> -<#-- --> -<#-- --> -<#-- --> -<#-- <#import "./common/address.ftl" as adressMacro/>--> -<#-- <@adressMacro address=direccionDeEntrega/>--> -<#-- --> -<#-- --> -<#-- --> -<#-- --> -<#-- <#if detraccion>--> -<#-- --> -<#-- ${detraccion.medioDePago.code}--> -<#-- <#if detraccion.numeroCuentaBanco>--> -<#-- --> -<#-- ${detraccion.numeroCuentaBanco}--> -<#-- --> -<#-- --> -<#-- --> -<#-- --> -<#-- ${detraccion.tipoBienServicio.code}--> -<#-- ${detraccion.porcentaje}--> -<#-- ${detraccion.montoTotal}--> -<#-- --> -<#-- --> -<#-- <#if percepcion>--> -<#-- --> -<#-- ${percepcion.tipoBienServicio.code}--> -<#-- ${percepcion.montoTotal}--> -<#-- --> - - FormaPago - ${formaPago.tipo} - ${formaPago.montoTotal} - - <#list formaPago.cuotas as item> - - FormaPago - Cuota${item.id} - ${item.monto} - ${item.fechaPago} - - - <#list anticipos as item> - - ${item?index + 1} - ${item.montoTotal} - - -<#-- <#list cargos as item>--> -<#-- --> -<#-- true--> -<#-- ${item.tipo.code}--> -<#-- ${item.factor}--> -<#-- ${item.monto}--> -<#-- ${item.montoBase}--> -<#-- --> -<#-- --> -<#-- <#list descuentos as item>--> -<#-- --> -<#-- false--> -<#-- ${item.tipo.code}--> -<#-- ${item.factor}--> -<#-- ${item.monto}--> -<#-- ${item.montoBase}--> -<#-- --> -<#-- --> -<#-- <#if percepcion>--> -<#-- --> -<#-- true--> -<#-- ${percepcion.tipo.code}--> -<#-- ${percepcion.factor}--> -<#-- ${percepcion.monto}--> -<#-- ${percepcion.montoBase}--> -<#-- --> -<#-- --> - <#include "common/tax-total.ftl"> - - <#include "common/monetary-total.ftl"> - - <#list detalle as item> - - ${item?index + 1} - ${item.cantidad} - <#include "common/document-line.ftl"> - - - - diff --git a/src/main/resources/templates/Renderer/creditNote.xml b/src/main/resources/templates/Renderer/creditNote.xml new file mode 100644 index 00000000..56b60c67 --- /dev/null +++ b/src/main/resources/templates/Renderer/creditNote.xml @@ -0,0 +1,26 @@ + + + {#include ubl/standard/include/ubl-extensions.xml /} + {#include ubl/standard/include/general-data.xml item=this /} + {#for key in leyendas.keySet} + + {/for} + {moneda} + {#include "ubl/standard/include/note/invoice-reference.xml" item=this /} + {#include ubl/common/signature.xml firmante=this.firmante /} + {#include ubl/standard/include/supplier.xml proveedor=this.proveedor /} + {#include ubl/standard/include/customer.xml cliente=this.cliente /} + {#include ubl/standard/include/tax-total.xml totalImpuestos=this.totalImpuestos /} + + {#include ubl/standard/include/monetary-total.xml totalImporte=this.totalImporte /} + + {#each detalles.orEmpty} + + {it_index.add(1)} + {it.cantidad} + {#include ubl/standard/include/document-line.xml item=it /} + + {/each} + diff --git a/src/main/resources/templates/Renderer/debitNote.xml b/src/main/resources/templates/Renderer/debitNote.xml new file mode 100644 index 00000000..b96d9170 --- /dev/null +++ b/src/main/resources/templates/Renderer/debitNote.xml @@ -0,0 +1,26 @@ + + + {#include ubl/standard/include/ubl-extensions.xml /} + {#include ubl/standard/include/general-data.xml item=this /} + {#for key in leyendas.keySet} + + {/for} + {moneda} + {#include "ubl/standard/include/note/invoice-reference.xml" item=this /} + {#include ubl/common/signature.xml firmante=this.firmante /} + {#include ubl/standard/include/supplier.xml proveedor=this.proveedor /} + {#include ubl/standard/include/customer.xml cliente=this.cliente /} + {#include ubl/standard/include/tax-total.xml totalImpuestos=this.totalImpuestos /} + + {#include ubl/standard/include/monetary-total.xml totalImporte=this.totalImporte /} + + {#each detalles.orEmpty} + + {it_index.add(1)} + {it.cantidad} + {#include ubl/standard/include/document-line.xml item=it /} + + {/each} + diff --git a/src/main/resources/templates/Renderer/invoice.xml b/src/main/resources/templates/Renderer/invoice.xml new file mode 100644 index 00000000..26b60c77 --- /dev/null +++ b/src/main/resources/templates/Renderer/invoice.xml @@ -0,0 +1,99 @@ + + + {#include ubl/standard/include/ubl-extensions.xml /} + {#include ubl/standard/include/general-data.xml item=this /} + {#if fechaVencimiento} + {fechaVencimiento} + {/if} + {tipoComprobante} + {#for key in leyendas.keySet} + + {/for} + {moneda} + {#each anticipos.orEmpty} + + {it.comprobanteSerieNumero} + {it.comprobanteTipo} + {it_index.add(1)} + + + {proveedor.ruc} + + + + {/each} + {#include ubl/common/signature.xml firmante=this.firmante /} + {#include ubl/standard/include/supplier.xml proveedor=this.proveedor /} + {#include ubl/standard/include/customer.xml cliente=this.cliente /} + {#if direccionEntrega} + + + + {#include ubl/standard/include/address.xml direccion=direccionEntrega /} + + + + {/if} + {#if detraccion} + + Detraccion + {detraccion.medioDePago} + + {detraccion.cuentaBancaria} + + + + Detraccion + {detraccion.tipoBienDetraido} + {detraccion.porcentaje.multiply(100).scale(2)} + {detraccion.monto.scale(2)} + + {/if} + {#if percepcion} + + Percepcion + {percepcion.montoTotal.scale(2)} + + {/if} + {#include ubl/standard/include/payment-terms.xml item=this.formaDePago /} + {#each anticipos.orEmpty} + + {it_index.add(1)} + {it.monto} + + {/each} + {#each anticipos.orEmpty} + + false + {it.tipo} + 1 + {it.monto} + {it.monto} + + {/each} + {#if percepcion} + + true + {percepcion.tipo} + {percepcion.porcentaje.scale(2)} + {percepcion.monto.scale(2)} + {percepcion.montoBase.scale(2)} + + {/if} + {#include ubl/standard/include/tax-total.xml totalImpuestos=this.totalImpuestos /} + + {totalImporte.importeSinImpuestos.scale(2)} + {totalImporte.importeConImpuestos.scale(2)} + {totalImporte.anticipos} + {totalImporte.importe.scale(2)} + + {#each detalles.orEmpty} + + {it_index.add(1)} + {it.cantidad} + {#include ubl/standard/include/document-line.xml item=it /} + + {/each} + diff --git a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/signature.ftl b/src/main/resources/templates/ubl/common/signature.xml similarity index 69% rename from src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/signature.ftl rename to src/main/resources/templates/ubl/common/signature.xml index 05f1711e..96109f95 100644 --- a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/signature.ftl +++ b/src/main/resources/templates/ubl/common/signature.xml @@ -1,12 +1,11 @@ - <#if firmante??> - ${firmante.ruc} + {firmante.ruc} - ${firmante.ruc} + {firmante.ruc} - + @@ -14,5 +13,4 @@ #PROJECT-OPENUBL-SIGN - diff --git a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/despatch-advice.ftl b/src/main/resources/templates/ubl/standard/guia/despatch-advice.ftl similarity index 100% rename from src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/despatch-advice.ftl rename to src/main/resources/templates/ubl/standard/guia/despatch-advice.ftl diff --git a/src/main/resources/templates/ubl/standard/include/address.xml b/src/main/resources/templates/ubl/standard/include/address.xml new file mode 100644 index 00000000..d9866108 --- /dev/null +++ b/src/main/resources/templates/ubl/standard/include/address.xml @@ -0,0 +1,28 @@ + {#if direccion.ubigeo} + {direccion.ubigeo} + {/if} + {#if direccion.codigoLocal} + {direccion.codigoLocal} + {/if} + {#if direccion.urbanizacion} + {direccion.urbanizacion} + {/if} + {#if direccion.provincia} + {direccion.provincia} + {/if} + {#if direccion.departamento} + {direccion.departamento} + {/if} + {#if direccion.distrito} + {direccion.distrito} + {/if} + {#if direccion.direccion} + + + + {/if} + {#if direccion.codigoPais} + + {direccion.codigoPais} + + {/if} diff --git a/src/main/resources/templates/ubl/standard/include/contact.xml b/src/main/resources/templates/ubl/standard/include/contact.xml new file mode 100644 index 00000000..e71119c1 --- /dev/null +++ b/src/main/resources/templates/ubl/standard/include/contact.xml @@ -0,0 +1,8 @@ + + {#if contacto.telefono} + {contacto.telefono} + {/if} + {#if contacto.email} + {contacto.email} + {/if} + diff --git a/src/main/resources/templates/ubl/standard/include/customer.xml b/src/main/resources/templates/ubl/standard/include/customer.xml new file mode 100644 index 00000000..ae7bb59c --- /dev/null +++ b/src/main/resources/templates/ubl/standard/include/customer.xml @@ -0,0 +1,18 @@ + + + + {cliente.numeroDocumentoIdentidad} + + + + {#if cliente.direccion} + + {#include ubl/standard/include/address.xml direccion=cliente.direccion /} + + {/if} + + {#if cliente.contacto} + {#include ubl/standard/include/contact.xml contacto=cliente.contacto /} + {/if} + + diff --git a/src/main/resources/templates/ubl/standard/include/document-line.xml b/src/main/resources/templates/ubl/standard/include/document-line.xml new file mode 100644 index 00000000..81155f49 --- /dev/null +++ b/src/main/resources/templates/ubl/standard/include/document-line.xml @@ -0,0 +1,44 @@ + {item.igvBaseImponible.scale(2)} + + + {item.precioConImpuestos ? item.precio.scale(2) : item.precioReferencia.scale(2)} + {item.precioReferenciaTipo} + + + + {item.totalImpuestos.scale(2)} + + {item.igvBaseImponible.scale(2)} + {item.igv.scale(2)} + + {item.igvTipo.toCatalog7.taxCategory.categoria} + {tasaIgv.multiply(100)} + {item.igvTipo.toCatalog7.code} + + {item.igvTipo.toCatalog7.taxCategory.code} + {item.igvTipo.toCatalog7.taxCategory.nombre} + {item.igvTipo.toCatalog7.taxCategory.tipo} + + + + {#if item.icb} + + {item.icb.scale(2)} + {item.cantidad} + + {tasaIcb.scale(2)} + + 7152 + ICBPER + OTH + + + + {/if} + + + + + + {item.precioConImpuestos ? item.precioReferencia.scale(2) : item.precio.scale(2)} + diff --git a/src/main/resources/templates/ubl/standard/include/general-data.xml b/src/main/resources/templates/ubl/standard/include/general-data.xml new file mode 100644 index 00000000..3ab314c0 --- /dev/null +++ b/src/main/resources/templates/ubl/standard/include/general-data.xml @@ -0,0 +1,7 @@ + 2.1 + 2.0 + {item.serie}-{item.numero} + {item.fechaEmision} + {#if item.horaEmision} + {item.horaEmision.format('HH:mm:ss')} + {/if} diff --git a/src/main/resources/templates/ubl/standard/include/monetary-total.xml b/src/main/resources/templates/ubl/standard/include/monetary-total.xml new file mode 100644 index 00000000..5f5d2846 --- /dev/null +++ b/src/main/resources/templates/ubl/standard/include/monetary-total.xml @@ -0,0 +1,3 @@ + {totalImporte.importeSinImpuestos.scale(2)} + {totalImporte.importe.scale(2)} + {totalImporte.importe.scale(2)} diff --git a/src/main/resources/templates/ubl/standard/include/namespaces.xml b/src/main/resources/templates/ubl/standard/include/namespaces.xml new file mode 100644 index 00000000..5923169e --- /dev/null +++ b/src/main/resources/templates/ubl/standard/include/namespaces.xml @@ -0,0 +1,10 @@ + xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" + xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" + xmlns:ccts="urn:un:unece:uncefact:documentation:2" + xmlns:cec="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" + xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" + xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" + xmlns:sac="urn:sunat:names:specification:ubl:peru:schema:xsd:SunatAggregateComponents-1" + xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" + xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/src/main/resources/templates/ubl/standard/include/note/invoice-reference.xml b/src/main/resources/templates/ubl/standard/include/note/invoice-reference.xml new file mode 100644 index 00000000..d979819e --- /dev/null +++ b/src/main/resources/templates/ubl/standard/include/note/invoice-reference.xml @@ -0,0 +1,11 @@ + + {item.comprobanteAfectadoSerieNumero} + {item.comprobanteAfectadoTipo} + + + + + {item.comprobanteAfectadoSerieNumero} + {item.comprobanteAfectadoTipo} + + diff --git a/src/main/resources/templates/ubl/standard/include/payment-terms.xml b/src/main/resources/templates/ubl/standard/include/payment-terms.xml new file mode 100644 index 00000000..f10deb1b --- /dev/null +++ b/src/main/resources/templates/ubl/standard/include/payment-terms.xml @@ -0,0 +1,15 @@ + + FormaPago + {item.tipo} + {#if item.tipo == 'Credito'} + {item.total.scale(2)} + {/if} + + {#each item.cuotas.orEmpty} + + FormaPago + Cuota{it_index.add(1).format('%03d')} + {it.importe.scale(2)} + {it.fechaPago} + + {/each} diff --git a/src/main/resources/templates/ubl/standard/include/supplier.xml b/src/main/resources/templates/ubl/standard/include/supplier.xml new file mode 100644 index 00000000..da6265ac --- /dev/null +++ b/src/main/resources/templates/ubl/standard/include/supplier.xml @@ -0,0 +1,23 @@ + + + + {proveedor.ruc} + + {#if proveedor.nombreComercial} + + {proveedor.nombreComercial} + + {/if} + + + {#if proveedor.direccion} + + {#include ubl/standard/include/address.xml direccion=proveedor.direccion /} + + {/if} + + {#if proveedor.contacto} + {#include ubl/standard/include/contact.xml contacto=proveedor.contacto /} + {/if} + + diff --git a/src/main/resources/templates/ubl/standard/include/tax-total.xml b/src/main/resources/templates/ubl/standard/include/tax-total.xml new file mode 100644 index 00000000..5b6e6c46 --- /dev/null +++ b/src/main/resources/templates/ubl/standard/include/tax-total.xml @@ -0,0 +1,86 @@ + + {totalImpuestos.total.scale(2)} + {#if totalImpuestos.gravadoImporte} + + {totalImpuestos.gravadoBaseImponible.scale(2)} + {totalImpuestos.gravadoImporte.scale(2)} + + S + + 1000 + IGV + VAT + + + + {/if} + {#if totalImpuestos.inafectoImporte} + + {totalImpuestos.inafectoBaseImponible.scale(2)} + {totalImpuestos.inafectoImporte.scale(2)} + + S + + 9998 + INA + FRE + + + + {/if} + {#if totalImpuestos.exoneradoImporte} + + {totalImpuestos.exoneradoBaseImponible.scale(2)} + {totalImpuestos.exoneradoImporte.scale(2)} + + S + + 9997 + EXO + VAT + + + + {/if} + {#if totalImpuestos.gratuitoImporte} + + {totalImpuestos.gratuitoBaseImponible.scale(2)} + {totalImpuestos.gratuitoImporte.scale(2)} + + S + + 9996 + GRA + FRE + + + + {/if} + {#if totalImpuestos.ivapImporte} + + {totalImpuestos.ivapBaseImponible.scale(2)} + {totalImpuestos.ivapImporte.scale(2)} + + S + + 1016 + IVAP + VAT + + + + {/if} + {#if totalImpuestos.icbImporte} + + {totalImpuestos.icbImporte.scale(2)} + + S + + 7152 + ICBPER + OTH + + + + {/if} + diff --git a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/ubl-extensions.ftl b/src/main/resources/templates/ubl/standard/include/ubl-extensions.xml similarity index 100% rename from src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/standard/common/ubl-extensions.ftl rename to src/main/resources/templates/ubl/standard/include/ubl-extensions.xml diff --git a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/sunat/common/agent-party.ftl b/src/main/resources/templates/ubl/sunat/include/agent-party.ftl similarity index 100% rename from src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/sunat/common/agent-party.ftl rename to src/main/resources/templates/ubl/sunat/include/agent-party.ftl diff --git a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/sunat/common/receiver-party.ftl b/src/main/resources/templates/ubl/sunat/include/receiver-party.ftl similarity index 100% rename from src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/sunat/common/receiver-party.ftl rename to src/main/resources/templates/ubl/sunat/include/receiver-party.ftl diff --git a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/sunat/common/supplier.ftl b/src/main/resources/templates/ubl/sunat/include/supplier.ftl similarity index 60% rename from src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/sunat/common/supplier.ftl rename to src/main/resources/templates/ubl/sunat/include/supplier.ftl index c9f29c43..80a05571 100644 --- a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/sunat/common/supplier.ftl +++ b/src/main/resources/templates/ubl/sunat/include/supplier.ftl @@ -1,19 +1,19 @@ - ${proveedor.ruc} + {proveedor.ruc} 6 <#if proveedor.nombreComercial??> - + <#if proveedor.codigoPostal??> - ${proveedor.codigoPostal} + {proveedor.codigoPostal} - + diff --git a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/sunat/perception.ftl b/src/main/resources/templates/ubl/sunat/perception.ftl similarity index 100% rename from src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/sunat/perception.ftl rename to src/main/resources/templates/ubl/sunat/perception.ftl diff --git a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/sunat/retention.ftl b/src/main/resources/templates/ubl/sunat/retention.ftl similarity index 100% rename from src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/sunat/retention.ftl rename to src/main/resources/templates/ubl/sunat/retention.ftl diff --git a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/sunat/summary-document.ftl b/src/main/resources/templates/ubl/sunat/summary-document.ftl similarity index 100% rename from src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/sunat/summary-document.ftl rename to src/main/resources/templates/ubl/sunat/summary-document.ftl diff --git a/src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/sunat/voided-document.ftl b/src/main/resources/templates/ubl/sunat/voided-document.ftl similarity index 100% rename from src/main/resources/io/github/project/openubl/xmlbuilderlib/templates/sunat/voided-document.ftl rename to src/main/resources/templates/ubl/sunat/voided-document.ftl diff --git a/src/test/java/e2e/AbstractTest.java b/src/test/java/e2e/AbstractTest.java new file mode 100644 index 00000000..717f2d50 --- /dev/null +++ b/src/test/java/e2e/AbstractTest.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 e2e; + +import io.github.project.openubl.xbuilder.enricher.config.DateProvider; +import io.github.project.openubl.xbuilder.enricher.config.Defaults; +import java.math.BigDecimal; +import java.time.LocalDate; + +public class AbstractTest { + + protected static final Defaults defaults = Defaults + .builder() + .moneda("PEN") + .unidadMedida("NIU") + .icbTasa(new BigDecimal("0.2")) + .igvTasa(new BigDecimal("0.18")) + .build(); + + protected static final DateProvider dateProvider = () -> LocalDate.of(2019, 12, 24); +} diff --git a/src/test/java/e2e/enricher/enrich/DetalleTest.java b/src/test/java/e2e/enricher/enrich/DetalleTest.java new file mode 100644 index 00000000..9ff6fba1 --- /dev/null +++ b/src/test/java/e2e/enricher/enrich/DetalleTest.java @@ -0,0 +1,144 @@ +/* + * 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 e2e.enricher.enrich; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import e2e.AbstractTest; +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.content.models.standard.general.Invoice; +import io.github.project.openubl.xbuilder.enricher.ContentEnricher; +import org.junit.jupiter.api.Test; + +public class DetalleTest extends AbstractTest { + + @Test + public void testEnrichUnidadMedida() { + // Given + Invoice input = Invoice.builder().detalle(DocumentoDetalle.builder().build()).build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + input + .getDetalles() + .forEach(detalle -> { + assertEquals(defaults.getUnidadMedida(), detalle.getUnidadMedida()); + }); + } + + @Test + public void testDontEnrichUnidadMedida() { + // Given + Invoice input = Invoice.builder().detalle(DocumentoDetalle.builder().unidadMedida("KG").build()).build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + input + .getDetalles() + .forEach(detalle -> { + assertEquals("KG", detalle.getUnidadMedida()); + }); + } + + @Test + public void testEnrichIgvTipo() { + // Given + Invoice input = Invoice.builder().detalle(DocumentoDetalle.builder().build()).build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + input + .getDetalles() + .forEach(detalle -> { + assertEquals(Catalog7.GRAVADO_OPERACION_ONEROSA.getCode(), detalle.getIgvTipo()); + }); + } + + @Test + public void testDontEnrichIgvTipo() { + // Given + Invoice input = Invoice + .builder() + .detalle(DocumentoDetalle.builder().igvTipo(Catalog7.INAFECTO_RETIRO.getCode()).build()) + .build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + input + .getDetalles() + .forEach(detalle -> { + assertEquals(Catalog7.INAFECTO_RETIRO.getCode(), detalle.getIgvTipo()); + }); + } + + @Test + public void testEnrichPrecioReferenciaTipo_PrecioConIgv() { + // Given + Invoice input = Invoice + .builder() + .detalle(DocumentoDetalle.builder().igvTipo(Catalog7.GRAVADO_OPERACION_ONEROSA.getCode()).build()) + .build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + input + .getDetalles() + .forEach(detalle -> { + assertEquals(Catalog16.PRECIO_UNITARIO_INCLUYE_IGV.getCode(), detalle.getPrecioReferenciaTipo()); + }); + } + + @Test + public void testEnrichPrecioReferenciaTipo_ValorReferencial() { + // Given + Invoice input = Invoice + .builder() + .detalle(DocumentoDetalle.builder().igvTipo(Catalog7.GRAVADO_RETIRO_POR_DONACION.getCode()).build()) + .build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + input + .getDetalles() + .forEach(detalle -> { + assertEquals( + Catalog16.VALOR_REFERENCIAL_UNITARIO_EN_OPERACIONES_NO_ONEROSAS.getCode(), + detalle.getPrecioReferenciaTipo() + ); + }); + } +} diff --git a/src/test/java/e2e/enricher/enrich/GeneralDocumentTest.java b/src/test/java/e2e/enricher/enrich/GeneralDocumentTest.java new file mode 100644 index 00000000..02a57205 --- /dev/null +++ b/src/test/java/e2e/enricher/enrich/GeneralDocumentTest.java @@ -0,0 +1,201 @@ +/* + * 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 e2e.enricher.enrich; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import e2e.AbstractTest; +import io.github.project.openubl.xbuilder.content.catalogs.CatalogContadoCredito; +import io.github.project.openubl.xbuilder.content.models.common.Firmante; +import io.github.project.openubl.xbuilder.content.models.common.Proveedor; +import io.github.project.openubl.xbuilder.content.models.standard.general.CuotaDePago; +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.ContentEnricher; +import java.math.BigDecimal; +import java.time.LocalDate; +import org.junit.jupiter.api.Test; + +public class GeneralDocumentTest extends AbstractTest { + + @Test + public void testEnrichMoneda() { + // Given + Invoice input = Invoice.builder().build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + assertEquals(defaults.getMoneda(), input.getMoneda()); + } + + @Test + public void testDontEnrichMoneda() { + // Given + Invoice input = Invoice.builder().moneda("USD").build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + assertEquals("USD", input.getMoneda()); + } + + @Test + public void testEnrichFechaEmision() { + // Given + Invoice input = Invoice.builder().build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + assertEquals(dateProvider.now(), input.getFechaEmision()); + } + + @Test + public void testDontEnrichFechaEmision() { + // Given + LocalDate fechaEmision = LocalDate.of(1991, 1, 30); + Invoice input = Invoice.builder().fechaEmision(fechaEmision).build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + assertEquals(fechaEmision, input.getFechaEmision()); + } + + @Test + public void testEnrichFormaPagoTipo_Contado() { + // Given + Invoice input = Invoice.builder().build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + assertEquals(CatalogContadoCredito.CONTADO.getCode(), input.getFormaDePago().getTipo()); + } + + @Test + public void testEnrichFormaPagoTipo_Credito() { + // Given + Invoice input = Invoice + .builder() + .formaDePago( + FormaDePago + .builder() + .cuota(CuotaDePago.builder().fechaPago(LocalDate.now()).importe(BigDecimal.TEN).build()) + .build() + ) + .build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + assertEquals(CatalogContadoCredito.CREDITO.getCode(), input.getFormaDePago().getTipo()); + } + + @Test + public void testEnrichFormaPagoTipo_CorrectWrongUserDefinedValue() { + // Given + + // Invoice with no "cuotas" has "formaDePago" CREDITO. It must be corrected + Invoice input1 = Invoice + .builder() + .formaDePago(FormaDePago.builder().tipo(CatalogContadoCredito.CREDITO.getCode()).build()) + .build(); + + // Invoice with "cuotas" has "formaDePago" CONTADO. It must be corrected + Invoice input2 = Invoice + .builder() + .formaDePago( + FormaDePago + .builder() + .tipo(CatalogContadoCredito.CONTADO.getCode()) + .cuota(CuotaDePago.builder().fechaPago(LocalDate.now()).importe(BigDecimal.TEN).build()) + .build() + ) + .build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input1); + enricher.enrich(input2); + + // Then + assertEquals(CatalogContadoCredito.CONTADO.getCode(), input1.getFormaDePago().getTipo()); + assertEquals(CatalogContadoCredito.CREDITO.getCode(), input2.getFormaDePago().getTipo()); + } + + @Test + public void testEnrichFirmante() { + // Given + Invoice input = Invoice + .builder() + .proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Mi razón social").build()) + .build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + assertEquals(input.getProveedor().getRuc(), input.getFirmante().getRuc()); + assertEquals(input.getProveedor().getRazonSocial(), input.getFirmante().getRazonSocial()); + } + + @Test + public void testEnrichFirmante_whenFirmanteIsPartiallyFilled() { + // Given + Invoice input = Invoice + .builder() + .proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Mi razón social").build()) + .firmante(Firmante.builder().ruc("12345678912").build()) + .build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + assertEquals(input.getProveedor().getRuc(), input.getFirmante().getRuc()); + assertEquals(input.getProveedor().getRazonSocial(), input.getFirmante().getRazonSocial()); + } + + @Test + public void testEnrichProveedorDireccionCodigoLocal() { + // Given + Invoice input = Invoice.builder().proveedor(Proveedor.builder().build()).build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + assertEquals("0000", input.getProveedor().getDireccion().getCodigoLocal()); + } +} diff --git a/src/test/java/e2e/enricher/enrich/InvoiceTest.java b/src/test/java/e2e/enricher/enrich/InvoiceTest.java new file mode 100644 index 00000000..af00402c --- /dev/null +++ b/src/test/java/e2e/enricher/enrich/InvoiceTest.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 e2e.enricher.enrich; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import e2e.AbstractTest; +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.ContentEnricher; +import org.junit.jupiter.api.Test; + +public class InvoiceTest extends AbstractTest { + + @Test + public void testEnrichTipoComprobante() { + // Given + Invoice input = Invoice + .builder() + .serie("F001-1") + .tipoComprobante(Catalog1_Invoice.BOLETA.getCode()) // This should be overwritten + .build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + assertEquals(Catalog1_Invoice.FACTURA.getCode(), input.getTipoComprobante()); + } +} diff --git a/src/test/java/e2e/enricher/process/DetalleTest.java b/src/test/java/e2e/enricher/process/DetalleTest.java new file mode 100644 index 00000000..c5170dc4 --- /dev/null +++ b/src/test/java/e2e/enricher/process/DetalleTest.java @@ -0,0 +1,379 @@ +/* + * 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 e2e.enricher.process; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import e2e.AbstractTest; +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.content.models.standard.general.Invoice; +import io.github.project.openubl.xbuilder.enricher.ContentEnricher; +import java.math.BigDecimal; +import org.junit.jupiter.api.Test; + +public class DetalleTest extends AbstractTest { + + @Test + public void testEnrichPrecioDeReferencia_precioConImpuestos_OperacionOnerosa() { + // Given + Invoice input = Invoice + .builder() + .detalle( + DocumentoDetalle + .builder() + .precio(BigDecimal.TEN) + .precioConImpuestos(false) + .igvTipo(Catalog7.GRAVADO_OPERACION_ONEROSA.getCode()) + .build() + ) + .build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + input + .getDetalles() + .forEach(detalle -> { + assertEquals(new BigDecimal("11.80"), detalle.getPrecioReferencia()); + }); + } + + @Test + public void testEnrichPrecioDeReferencia_precioConImpuestos_OperacionNoOnerosa() { + // Given + Invoice input = Invoice + .builder() + .detalle( + DocumentoDetalle + .builder() + .precio(BigDecimal.TEN) + .precioConImpuestos(false) + .igvTipo(Catalog7.GRAVADO_RETIRO.getCode()) + .build() + ) + .build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + input + .getDetalles() + .forEach(detalle -> { + assertEquals(BigDecimal.TEN, detalle.getPrecioReferencia()); + }); + } + + @Test + public void testEnrichPrecioDeReferencia_precioSinImpuestos_OperacionOnerosa() { + // Given + Invoice input = Invoice + .builder() + .detalle( + DocumentoDetalle + .builder() + .precio(new BigDecimal("11.80")) + .precioConImpuestos(true) + .igvTipo(Catalog7.GRAVADO_OPERACION_ONEROSA.getCode()) + .build() + ) + .build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + input + .getDetalles() + .forEach(detalle -> { + assertEquals(0, BigDecimal.TEN.compareTo(detalle.getPrecioReferencia())); + }); + } + + @Test + public void testEnrichPrecioDeReferencia_precioSinImpuestos_OperacionNoOnerosa() { + // Given + Invoice input = Invoice + .builder() + .detalle( + DocumentoDetalle + .builder() + .precio(new BigDecimal("11.80")) + .precioConImpuestos(true) + .igvTipo(Catalog7.GRAVADO_RETIRO.getCode()) + .build() + ) + .build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + input + .getDetalles() + .forEach(detalle -> { + assertEquals(new BigDecimal("11.80"), detalle.getPrecioReferencia()); + }); + } + + @Test + public void testEnrichIcb() { + // Given + Invoice input = Invoice.builder().detalle(DocumentoDetalle.builder().build()).build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + input + .getDetalles() + .forEach(detalle -> { + assertEquals(BigDecimal.ZERO, detalle.getIcb()); + }); + } + + @Test + public void testDontEnrichIcb() { + // Given + Invoice input = Invoice + .builder() + .detalle(DocumentoDetalle.builder().icb(BigDecimal.TEN).icbAplica(false).build()) + .build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + input + .getDetalles() + .forEach(detalle -> { + assertEquals(BigDecimal.TEN, detalle.getIcb()); + }); + } + + @Test + public void testEnrichIcbAplica() { + // Given + Invoice input = Invoice + .builder() + .detalle( + DocumentoDetalle + .builder() + .icb(BigDecimal.TEN) + .icbAplica(false) // this should be corrected + .build() + ) + .build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + input + .getDetalles() + .forEach(detalle -> { + assertTrue(detalle.isIcbAplica()); + }); + } + + @Test + public void testEnrichBaseImponible_whenPrecioConImpuestos() { + // Given + Invoice input = Invoice + .builder() + .detalle( + DocumentoDetalle + .builder() + .cantidad(new BigDecimal(2)) + .precio(BigDecimal.TEN) + .precioConImpuestos(false) + .build() + ) + .build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + input + .getDetalles() + .forEach(detalle -> { + assertEquals(0, detalle.getIgvBaseImponible().compareTo(new BigDecimal(20))); + }); + } + + @Test + public void testEnrichBaseImponible_whenPrecioSinImpuestos() { + // Given + Invoice input = Invoice + .builder() + .detalle( + DocumentoDetalle + .builder() + .cantidad(new BigDecimal(2)) + .precio(new BigDecimal("11.8")) + .precioConImpuestos(true) + .build() + ) + .build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + input + .getDetalles() + .forEach(detalle -> { + assertEquals(0, detalle.getIgvBaseImponible().compareTo(new BigDecimal(20))); + }); + } + + @Test + public void testDontEnrichBaseImponible() { + // Given + Invoice input = Invoice + .builder() + .detalle( + DocumentoDetalle + .builder() + .cantidad(new BigDecimal(2)) + .precio(new BigDecimal("10")) + .precioConImpuestos(false) + .igvBaseImponible(new BigDecimal(999)) // This user defined value should not be altered + .build() + ) + .build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + input + .getDetalles() + .forEach(detalle -> { + assertEquals(0, detalle.getIgvBaseImponible().compareTo(new BigDecimal(999))); + }); + } + + @Test + public void testEnrichIgv() { + // Given + Invoice input = Invoice + .builder() + .tasaIgv(new BigDecimal("0.18")) + .detalle(DocumentoDetalle.builder().igvBaseImponible(new BigDecimal("10")).build()) + .build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + input + .getDetalles() + .forEach(detalle -> { + assertEquals(0, detalle.getIgv().compareTo(new BigDecimal("1.8"))); + }); + } + + @Test + public void testDontEnrichIgv() { + // Given + Invoice input = Invoice + .builder() + .tasaIgv(new BigDecimal("0.18")) + .detalle( + DocumentoDetalle + .builder() + .igvBaseImponible(new BigDecimal("10")) + .igv(new BigDecimal("999")) // Dont change user defined value + .build() + ) + .build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + input + .getDetalles() + .forEach(detalle -> { + assertEquals(0, detalle.getIgv().compareTo(new BigDecimal("999"))); + }); + } + + @Test + public void testEnrichTotalImpuestos() { + // Given + Invoice input = Invoice + .builder() + .detalle(DocumentoDetalle.builder().igv(new BigDecimal("10")).icb(new BigDecimal("2")).build()) + .build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + input + .getDetalles() + .forEach(detalle -> { + assertEquals(0, detalle.getTotalImpuestos().compareTo(new BigDecimal("12"))); + }); + } + + @Test + public void testDontEnrichTotalImpuestos() { + // Given + Invoice input = Invoice + .builder() + .detalle( + DocumentoDetalle + .builder() + .igv(new BigDecimal("10")) + .icb(new BigDecimal("2")) + .totalImpuestos(new BigDecimal("999")) // Dont change user defined value + .build() + ) + .build(); + + // When + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // Then + input + .getDetalles() + .forEach(detalle -> { + assertEquals(0, detalle.getTotalImpuestos().compareTo(new BigDecimal("999"))); + }); + } +} diff --git a/src/test/java/e2e/renderer/XMLAssertUtils.java b/src/test/java/e2e/renderer/XMLAssertUtils.java new file mode 100644 index 00000000..e05276c2 --- /dev/null +++ b/src/test/java/e2e/renderer/XMLAssertUtils.java @@ -0,0 +1,190 @@ +/* + * 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 e2e.renderer; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import io.github.project.openubl.xbuilder.signature.CertificateDetails; +import io.github.project.openubl.xbuilder.signature.CertificateDetailsFactory; +import io.github.project.openubl.xbuilder.signature.XMLSigner; +import io.github.project.openubl.xbuilder.signature.XmlSignatureHelper; +import io.github.project.openubl.xmlsenderws.webservices.managers.smart.SmartBillServiceConfig; +import io.github.project.openubl.xmlsenderws.webservices.managers.smart.SmartBillServiceManager; +import io.github.project.openubl.xmlsenderws.webservices.managers.smart.SmartBillServiceModel; +import io.github.project.openubl.xmlsenderws.webservices.providers.BillServiceModel; +import io.github.project.openubl.xmlsenderws.webservices.xml.DocumentType; +import io.github.project.openubl.xmlsenderws.webservices.xml.XmlContentModel; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import org.w3c.dom.Document; +import org.xmlunit.builder.DiffBuilder; +import org.xmlunit.diff.Diff; + +public class XMLAssertUtils { + + private static final String SUNAT_BETA_USERNAME = "MODDATOS"; + private static final String SUNAT_BETA_PASSWORD = "MODDATOS"; + + private static final String SIGN_REFERENCE_ID = "PROJECT-OPENUBL"; + private static final String KEYSTORE = "LLAMA-PE-CERTIFICADO-DEMO-10467793549.pfx"; + private static final String KEYSTORE_PASSWORD = "password"; + private static final CertificateDetails CERTIFICATE; + + static { + InputStream ksInputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(KEYSTORE); + try { + CERTIFICATE = CertificateDetailsFactory.create(ksInputStream, KEYSTORE_PASSWORD); + SmartBillServiceConfig + .getInstance() + .withInvoiceAndNoteDeliveryURL("https://e-beta.sunat.gob.pe/ol-ti-itcpfegem-beta/billService") + .withPerceptionAndRetentionDeliveryURL( + "https://e-beta.sunat.gob.pe/ol-ti-itemision-otroscpe-gem-beta/billService" + ) + .withDespatchAdviceDeliveryURL("https://e-beta.sunat.gob.pe/ol-ti-itemision-guia-gem-beta/billService"); + } catch (Exception e) { + throw new IllegalStateException(e); + } + } + + public static void assertSnapshot(String expected, Class clasz, String snapshotFile) { + String rootDir = clasz.getName().replaceAll("\\.", "/"); + + // Update snapshots and if updated do not verify since it doesn't make sense anymore + Boolean updateSnapshots = Boolean.valueOf(System.getProperty("xbuilder.snapshot.update", "false")); + if (updateSnapshots) { + try { + Path directoryPath = Paths.get("src", "test", "resources").resolve(rootDir); + Files.createDirectories(directoryPath); + + Path filePath = directoryPath.resolve(snapshotFile); + Files.write(filePath, expected.getBytes()); + + return; + } catch (Exception e) { + throw new IllegalStateException(e); + } + } + + InputStream snapshotInputStream = Thread + .currentThread() + .getContextClassLoader() + .getResourceAsStream(rootDir + "/" + snapshotFile); + assertNotNull(snapshotInputStream, "Could not find snapshot file " + snapshotFile); + + Diff myDiff = DiffBuilder + .compare(snapshotInputStream) + .withTest(expected) + .ignoreComments() + .ignoreWhitespace() + .build(); + + assertFalse(myDiff.hasDifferences(), expected + "\n" + myDiff.toString()); + } + + public static void assertSendSunat(String xmlWithoutSignature, String... allowedNotes) throws Exception { + String skipSunat = System.getProperty("skipSunat", "false"); + if (skipSunat != null && skipSunat.equals("false")) { + Document signedXML = XMLSigner.signXML( + xmlWithoutSignature, + SIGN_REFERENCE_ID, + CERTIFICATE.getX509Certificate(), + CERTIFICATE.getPrivateKey() + ); + sendFileToSunat(signedXML, xmlWithoutSignature, allowedNotes); + } + } + + // + + private static void sendFileToSunat(Document document, String xmlWithoutSignature, String... allowedNotes) + throws Exception { + byte[] bytesFromDocument = XmlSignatureHelper.getBytesFromDocument(document); + SmartBillServiceModel smartBillServiceModel = SmartBillServiceManager.send( + bytesFromDocument, + SUNAT_BETA_USERNAME, + SUNAT_BETA_PASSWORD + ); + XmlContentModel xmlContentModel = smartBillServiceModel.getXmlContentModel(); + BillServiceModel billServiceModel = smartBillServiceModel.getBillServiceModel(); + + if (billServiceModel.getNotes() != null) { + List allowedNotesList = Arrays.asList(allowedNotes); + + List notesToCheck = billServiceModel + .getNotes() + .stream() + .filter(f -> allowedNotesList.stream().noneMatch(f::startsWith)) + .collect(Collectors.toList()); + notesToCheck.forEach(f -> System.out.println("WARNING:" + f)); + + assertTrue(notesToCheck.isEmpty(), "Notes fom SUNAT:\n" + String.join("\n", notesToCheck)); + } + + // Check ticket + if ( + !xmlContentModel.getDocumentType().equals(DocumentType.VOIDED_DOCUMENT.getType()) && + !xmlContentModel.getDocumentType().equals(DocumentType.SUMMARY_DOCUMENT.getType()) + ) { + assertEquals( + BillServiceModel.Status.ACEPTADO, + billServiceModel.getStatus(), + xmlWithoutSignature + + " \n sunat [codigo=" + + billServiceModel.getCode() + + "], [descripcion=" + + billServiceModel.getDescription() + + "]" + ); + } else { + assertNotNull(billServiceModel.getTicket()); + + BillServiceModel statusModel = SmartBillServiceManager.getStatus( + billServiceModel.getTicket(), + xmlContentModel, + SUNAT_BETA_USERNAME, + SUNAT_BETA_PASSWORD + ); + assertEquals( + BillServiceModel.Status.ACEPTADO, + statusModel.getStatus(), + xmlWithoutSignature + + " sunat [status=" + + statusModel.getStatus() + + "], [descripcion=" + + statusModel.getDescription() + + "]" + ); + assertNotNull( + statusModel.getCdr(), + xmlWithoutSignature + + " sunat [codigo=" + + billServiceModel.getCode() + + "], [descripcion=" + + billServiceModel.getDescription() + + "]" + ); + } + } +} diff --git a/src/test/java/e2e/renderer/creditnote/CreditNoteTest.java b/src/test/java/e2e/renderer/creditnote/CreditNoteTest.java new file mode 100644 index 00000000..c798bcae --- /dev/null +++ b/src/test/java/e2e/renderer/creditnote/CreditNoteTest.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 e2e.renderer.creditnote; + +import static e2e.renderer.XMLAssertUtils.assertSendSunat; +import static e2e.renderer.XMLAssertUtils.assertSnapshot; + +import e2e.AbstractTest; +import io.github.project.openubl.xbuilder.content.catalogs.Catalog6; +import io.github.project.openubl.xbuilder.content.models.common.Cliente; +import io.github.project.openubl.xbuilder.content.models.common.Proveedor; +import io.github.project.openubl.xbuilder.content.models.standard.general.CreditNote; +import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoDetalle; +import io.github.project.openubl.xbuilder.enricher.ContentEnricher; +import io.github.project.openubl.xbuilder.renderer.TemplateProducer; +import io.quarkus.qute.Template; +import java.math.BigDecimal; +import org.junit.jupiter.api.Test; + +public class CreditNoteTest extends AbstractTest { + + @Test + public void testInvoiceWithCustomUnidadMedida() throws Exception { + // Given + CreditNote input = CreditNote + .builder() + .serie("FC01") + .numero(1) + .comprobanteAfectadoSerieNumero("F001-1") + .sustentoDescripcion("mi sustento") + .proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Softgreen S.A.C.").build()) + .cliente( + Cliente + .builder() + .nombre("Carlos Feria") + .numeroDocumentoIdentidad("12121212121") + .tipoDocumentoIdentidad(Catalog6.RUC.toString()) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item1") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("100")) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item2") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("100")) + .build() + ) + .build(); + + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // When + Template template = TemplateProducer.getInstance().getCreditNote(); + String xml = template.data(input).render(); + + // Then + assertSnapshot(xml, getClass(), "MinData_RUC.xml"); + assertSendSunat(xml); + } +} diff --git a/src/test/java/e2e/renderer/debitnote/DebitNoteTest.java b/src/test/java/e2e/renderer/debitnote/DebitNoteTest.java new file mode 100644 index 00000000..f062cc91 --- /dev/null +++ b/src/test/java/e2e/renderer/debitnote/DebitNoteTest.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 e2e.renderer.debitnote; + +import static e2e.renderer.XMLAssertUtils.assertSendSunat; +import static e2e.renderer.XMLAssertUtils.assertSnapshot; + +import e2e.AbstractTest; +import io.github.project.openubl.xbuilder.content.catalogs.Catalog6; +import io.github.project.openubl.xbuilder.content.models.common.Cliente; +import io.github.project.openubl.xbuilder.content.models.common.Proveedor; +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.enricher.ContentEnricher; +import io.github.project.openubl.xbuilder.renderer.TemplateProducer; +import io.quarkus.qute.Template; +import java.math.BigDecimal; +import org.junit.jupiter.api.Test; + +public class DebitNoteTest extends AbstractTest { + + @Test + public void testInvoiceWithCustomUnidadMedida() throws Exception { + // Given + DebitNote input = DebitNote + .builder() + .serie("FD01") + .numero(1) + .comprobanteAfectadoSerieNumero("F001-1") + .sustentoDescripcion("mi sustento") + .proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Softgreen S.A.C.").build()) + .cliente( + Cliente + .builder() + .nombre("Carlos Feria") + .numeroDocumentoIdentidad("12121212121") + .tipoDocumentoIdentidad(Catalog6.RUC.toString()) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item1") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("100")) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item2") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("100")) + .build() + ) + .build(); + + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // When + Template template = TemplateProducer.getInstance().getDebitNote(); + String xml = template.data(input).render(); + + // Then + assertSnapshot(xml, getClass(), "MinData_RUC.xml"); + assertSendSunat(xml); + } +} diff --git a/src/test/java/e2e/renderer/invoice/InvoiceAnticiposTest.java b/src/test/java/e2e/renderer/invoice/InvoiceAnticiposTest.java new file mode 100644 index 00000000..54bc8734 --- /dev/null +++ b/src/test/java/e2e/renderer/invoice/InvoiceAnticiposTest.java @@ -0,0 +1,81 @@ +/* + * 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 e2e.renderer.invoice; + +import e2e.AbstractTest; +import e2e.renderer.XMLAssertUtils; +import io.github.project.openubl.xbuilder.content.catalogs.Catalog6; +import io.github.project.openubl.xbuilder.content.models.common.Cliente; +import io.github.project.openubl.xbuilder.content.models.common.Proveedor; +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.enricher.ContentEnricher; +import io.github.project.openubl.xbuilder.renderer.TemplateProducer; +import io.quarkus.qute.Template; +import java.math.BigDecimal; +import org.junit.jupiter.api.Test; + +public class InvoiceAnticiposTest extends AbstractTest { + + @Test + public void testFechaVencimiento() throws Exception { + // Given + Invoice input = Invoice + .builder() + .serie("F001") + .numero(1) + .proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Softgreen S.A.C.").build()) + .cliente( + Cliente + .builder() + .nombre("Carlos Feria") + .numeroDocumentoIdentidad("12121212121") + .tipoDocumentoIdentidad(Catalog6.RUC.toString()) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item1") + .cantidad(new BigDecimal("2")) + .precio(new BigDecimal("100")) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item2") + .cantidad(new BigDecimal("2")) + .precio(new BigDecimal("100")) + .build() + ) + .anticipo(Anticipo.builder().comprobanteSerieNumero("F001-2").monto(new BigDecimal("100")).build()) + .build(); + + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // When + Template template = TemplateProducer.getInstance().getInvoice(); + String xml = template.data(input).render(); + + // Then + XMLAssertUtils.assertSnapshot(xml, getClass(), "minAnticipos.xml"); + XMLAssertUtils.assertSendSunat(xml); + } +} diff --git a/src/test/java/e2e/renderer/invoice/InvoiceDetraccionTest.java b/src/test/java/e2e/renderer/invoice/InvoiceDetraccionTest.java new file mode 100644 index 00000000..ce1cb306 --- /dev/null +++ b/src/test/java/e2e/renderer/invoice/InvoiceDetraccionTest.java @@ -0,0 +1,85 @@ +/* + * 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 e2e.renderer.invoice; + +import e2e.AbstractTest; +import e2e.renderer.XMLAssertUtils; +import io.github.project.openubl.xbuilder.content.catalogs.Catalog54; +import io.github.project.openubl.xbuilder.content.catalogs.Catalog59; +import io.github.project.openubl.xbuilder.content.catalogs.Catalog6; +import io.github.project.openubl.xbuilder.content.models.common.Cliente; +import io.github.project.openubl.xbuilder.content.models.common.Proveedor; +import io.github.project.openubl.xbuilder.content.models.standard.general.Anticipo; +import io.github.project.openubl.xbuilder.content.models.standard.general.Detraccion; +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.enricher.ContentEnricher; +import io.github.project.openubl.xbuilder.renderer.TemplateProducer; +import io.quarkus.qute.Template; +import java.math.BigDecimal; +import org.junit.jupiter.api.Test; + +public class InvoiceDetraccionTest extends AbstractTest { + + @Test + public void testFechaVencimiento() throws Exception { + // Given + Invoice input = Invoice + .builder() + .serie("F001") + .numero(1) + .proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Softgreen S.A.C.").build()) + .cliente( + Cliente + .builder() + .nombre("Carlos Feria") + .numeroDocumentoIdentidad("12121212121") + .tipoDocumentoIdentidad(Catalog6.RUC.toString()) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item1") + .cantidad(new BigDecimal("4")) + .precio(new BigDecimal("200")) + .build() + ) + .detraccion( + Detraccion + .builder() + .medioDePago(Catalog59.DEPOSITO_EN_CUENTA.getCode()) + .cuentaBancaria("0004-3342343243") + .tipoBienDetraido("014") + .porcentaje(new BigDecimal("0.04")) + .monto(new BigDecimal(100)) + .build() + ) + .build(); + + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // When + Template template = TemplateProducer.getInstance().getInvoice(); + String xml = template.data(input).render(); + + // Then + XMLAssertUtils.assertSnapshot(xml, getClass(), "detraccion.xml"); + XMLAssertUtils.assertSendSunat(xml); + } +} diff --git a/src/test/java/e2e/renderer/invoice/InvoiceDireccionEntregaTest.java b/src/test/java/e2e/renderer/invoice/InvoiceDireccionEntregaTest.java new file mode 100644 index 00000000..eb8aeb3c --- /dev/null +++ b/src/test/java/e2e/renderer/invoice/InvoiceDireccionEntregaTest.java @@ -0,0 +1,141 @@ +/* + * 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 e2e.renderer.invoice; + +import e2e.AbstractTest; +import e2e.renderer.XMLAssertUtils; +import io.github.project.openubl.xbuilder.content.catalogs.Catalog6; +import io.github.project.openubl.xbuilder.content.models.common.Cliente; +import io.github.project.openubl.xbuilder.content.models.common.Direccion; +import io.github.project.openubl.xbuilder.content.models.common.Proveedor; +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.enricher.ContentEnricher; +import io.github.project.openubl.xbuilder.renderer.TemplateProducer; +import io.quarkus.qute.Template; +import java.math.BigDecimal; +import org.junit.jupiter.api.Test; + +public class InvoiceDireccionEntregaTest extends AbstractTest { + + @Test + public void testDireccionEntregaMin() throws Exception { + // Given + Invoice input = Invoice + .builder() + .serie("F001") + .numero(1) + .direccionEntrega(Direccion.builder().direccion("Jr. las flores 123").build()) + .proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Softgreen S.A.C.").build()) + .cliente( + Cliente + .builder() + .nombre("Carlos Feria") + .numeroDocumentoIdentidad("12121212121") + .tipoDocumentoIdentidad(Catalog6.RUC.toString()) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item1") + .cantidad(new BigDecimal("2")) + .precio(new BigDecimal("100")) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item2") + .cantidad(new BigDecimal("2")) + .precio(new BigDecimal("100")) + .build() + ) + .build(); + + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // When + Template template = TemplateProducer.getInstance().getInvoice(); + String xml = template.data(input).render(); + + // Then + XMLAssertUtils.assertSnapshot(xml, getClass(), "direccionEntregaMin.xml"); + XMLAssertUtils.assertSendSunat(xml); + } + + @Test + public void testDireccionEntregaFull() throws Exception { + // Given + Invoice input = Invoice + .builder() + .serie("F001") + .numero(1) + .direccionEntrega( + Direccion + .builder() + .ubigeo("050101") + .departamento("Ayacucho") + .provincia("Huamanga") + .distrito("Jesus Nazareno") + .codigoLocal("0101") + .urbanizacion("000000") + .direccion("Jr. Las piedras 123") + .codigoPais("PE") + .build() + ) + .proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Softgreen S.A.C.").build()) + .cliente( + Cliente + .builder() + .nombre("Carlos Feria") + .numeroDocumentoIdentidad("12121212121") + .tipoDocumentoIdentidad(Catalog6.RUC.toString()) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item1") + .cantidad(new BigDecimal("2")) + .precio(new BigDecimal("100")) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item2") + .cantidad(new BigDecimal("2")) + .precio(new BigDecimal("100")) + .build() + ) + .build(); + + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // When + Template template = TemplateProducer.getInstance().getInvoice(); + String xml = template.data(input).render(); + + // Then + XMLAssertUtils.assertSnapshot(xml, getClass(), "direccionEntregaFull.xml"); + XMLAssertUtils.assertSendSunat(xml); + } +} diff --git a/src/test/java/e2e/renderer/invoice/InvoiceFechaVencimientoTest.java b/src/test/java/e2e/renderer/invoice/InvoiceFechaVencimientoTest.java new file mode 100644 index 00000000..012efdd9 --- /dev/null +++ b/src/test/java/e2e/renderer/invoice/InvoiceFechaVencimientoTest.java @@ -0,0 +1,81 @@ +/* + * 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 e2e.renderer.invoice; + +import e2e.AbstractTest; +import e2e.renderer.XMLAssertUtils; +import io.github.project.openubl.xbuilder.content.catalogs.Catalog6; +import io.github.project.openubl.xbuilder.content.models.common.Cliente; +import io.github.project.openubl.xbuilder.content.models.common.Proveedor; +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.enricher.ContentEnricher; +import io.github.project.openubl.xbuilder.renderer.TemplateProducer; +import io.quarkus.qute.Template; +import java.math.BigDecimal; +import java.time.LocalDate; +import org.junit.jupiter.api.Test; + +public class InvoiceFechaVencimientoTest extends AbstractTest { + + @Test + public void testFechaVencimiento() throws Exception { + // Given + Invoice input = Invoice + .builder() + .serie("F001") + .numero(1) + .fechaVencimiento(LocalDate.of(2022, 1, 1)) + .proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Softgreen S.A.C.").build()) + .cliente( + Cliente + .builder() + .nombre("Carlos Feria") + .numeroDocumentoIdentidad("12121212121") + .tipoDocumentoIdentidad(Catalog6.RUC.toString()) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item1") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("100")) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item2") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("100")) + .build() + ) + .build(); + + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // When + Template template = TemplateProducer.getInstance().getInvoice(); + String xml = template.data(input).render(); + + // Then + XMLAssertUtils.assertSnapshot(xml, getClass(), "conFechaVencimiento.xml"); + XMLAssertUtils.assertSendSunat(xml); + } +} diff --git a/src/test/java/e2e/renderer/invoice/InvoiceFormaPagoTest.java b/src/test/java/e2e/renderer/invoice/InvoiceFormaPagoTest.java new file mode 100644 index 00000000..d4ceeadc --- /dev/null +++ b/src/test/java/e2e/renderer/invoice/InvoiceFormaPagoTest.java @@ -0,0 +1,148 @@ +/* + * 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 e2e.renderer.invoice; + +import e2e.AbstractTest; +import e2e.renderer.XMLAssertUtils; +import io.github.project.openubl.xbuilder.content.catalogs.Catalog6; +import io.github.project.openubl.xbuilder.content.models.common.Cliente; +import io.github.project.openubl.xbuilder.content.models.common.Proveedor; +import io.github.project.openubl.xbuilder.content.models.standard.general.CuotaDePago; +import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoDetalle; +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.ContentEnricher; +import io.github.project.openubl.xbuilder.renderer.TemplateProducer; +import io.quarkus.qute.Template; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.Month; +import org.junit.jupiter.api.Test; + +public class InvoiceFormaPagoTest extends AbstractTest { + + @Test + public void testInvoiceWithFormaPagoContadoPorDefecto() throws Exception { + // Given + Invoice input = Invoice + .builder() + .serie("F001") + .numero(1) + .proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Softgreen S.A.C.").build()) + .cliente( + Cliente + .builder() + .nombre("Carlos Feria") + .numeroDocumentoIdentidad("12121212121") + .tipoDocumentoIdentidad(Catalog6.RUC.toString()) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item1") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("100")) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item2") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("100")) + .build() + ) + .build(); + + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // When + Template template = TemplateProducer.getInstance().getInvoice(); + String xml = template.data(input).render(); + + // Then + XMLAssertUtils.assertSnapshot(xml, getClass(), "sinFormaPago.xml"); + XMLAssertUtils.assertSendSunat(xml); + } + + @Test + public void testInvoiceWithFormaPagoCredito() throws Exception { + // Given + Invoice input = Invoice + .builder() + .serie("F001") + .numero(1) + .proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Softgreen S.A.C.").build()) + .cliente( + Cliente + .builder() + .nombre("Carlos Feria") + .numeroDocumentoIdentidad("12121212121") + .tipoDocumentoIdentidad(Catalog6.RUC.toString()) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item1") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("100")) + .build() + ) + .formaDePago( + FormaDePago + .builder() + .cuota( + CuotaDePago + .builder() + .importe(new BigDecimal("10")) + .fechaPago(LocalDate.of(2022, Month.JANUARY, 20)) + .build() + ) + .cuota( + CuotaDePago + .builder() + .importe(new BigDecimal("20")) + .fechaPago(LocalDate.of(2022, Month.FEBRUARY, 20)) + .build() + ) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item2") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("100")) + .build() + ) + .build(); + + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // When + Template template = TemplateProducer.getInstance().getInvoice(); + String xml = template.data(input).render(); + + // Then + XMLAssertUtils.assertSnapshot(xml, getClass(), "conFormaPago.xml"); + XMLAssertUtils.assertSendSunat(xml); + } +} diff --git a/src/test/java/e2e/renderer/invoice/InvoiceIssue30Test.java b/src/test/java/e2e/renderer/invoice/InvoiceIssue30Test.java new file mode 100644 index 00000000..3f950868 --- /dev/null +++ b/src/test/java/e2e/renderer/invoice/InvoiceIssue30Test.java @@ -0,0 +1,189 @@ +/* + * 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 e2e.renderer.invoice; + +import e2e.AbstractTest; +import e2e.renderer.XMLAssertUtils; +import io.github.project.openubl.xbuilder.content.catalogs.Catalog6; +import io.github.project.openubl.xbuilder.content.models.common.Cliente; +import io.github.project.openubl.xbuilder.content.models.common.Proveedor; +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.enricher.ContentEnricher; +import io.github.project.openubl.xbuilder.renderer.TemplateProducer; +import io.quarkus.qute.Template; +import java.math.BigDecimal; +import org.junit.jupiter.api.Test; + +public class InvoiceIssue30Test extends AbstractTest { + + @Test + public void testInvoice_withPrecioUnitario() throws Exception { + // Given + Invoice input = Invoice + .builder() + .serie("F001") + .numero(1) + .proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Project OpenUBL S.A.C.").build()) + .cliente( + Cliente + .builder() + .nombre("Carlos Feria") + .numeroDocumentoIdentidad("12121212121") + .tipoDocumentoIdentidad(Catalog6.RUC.toString()) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item1") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("6.68")) + .build() + ) + .build(); + + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // When + Template template = TemplateProducer.getInstance().getInvoice(); + String xml = template.data(input).render(); + + // Then + XMLAssertUtils.assertSnapshot(xml, getClass(), "with-precioUnitario.xml"); + XMLAssertUtils.assertSendSunat(xml); + } + + @Test + public void testInvoice_withPrecioConIgv() throws Exception { + // Given + Invoice input = Invoice + .builder() + .serie("F001") + .numero(1) + .proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Project OpenUBL S.A.C.").build()) + .cliente( + Cliente + .builder() + .nombre("Carlos Feria") + .numeroDocumentoIdentidad("12121212121") + .tipoDocumentoIdentidad(Catalog6.RUC.toString()) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item1") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("7.88")) + .precioConImpuestos(true) + .build() + ) + .build(); + + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // When + Template template = TemplateProducer.getInstance().getInvoice(); + String xml = template.data(input).render(); + + // Then + XMLAssertUtils.assertSnapshot(xml, getClass(), "with-precioUnitarioConImpuestos.xml"); + XMLAssertUtils.assertSendSunat(xml); + } + + @Test + public void testInvoice_withPrecioUnitario_andICB() throws Exception { + // Given + Invoice input = Invoice + .builder() + .serie("F001") + .numero(1) + .proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Project OpenUBL S.A.C.").build()) + .cliente( + Cliente + .builder() + .nombre("Carlos Feria") + .numeroDocumentoIdentidad("12121212121") + .tipoDocumentoIdentidad(Catalog6.RUC.toString()) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item1") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("6.68")) + .icbAplica(true) + .build() + ) + .build(); + + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // When + Template template = TemplateProducer.getInstance().getInvoice(); + String xml = template.data(input).render(); + + // Then + XMLAssertUtils.assertSnapshot(xml, getClass(), "with-precioUnitario-ICB.xml"); + XMLAssertUtils.assertSendSunat(xml); + } + + @Test + public void testInvoice_withPrecioConIgv_andICB() throws Exception { + // Given + Invoice input = Invoice + .builder() + .serie("F001") + .numero(1) + .proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Project OpenUBL S.A.C.").build()) + .cliente( + Cliente + .builder() + .nombre("Carlos Feria") + .numeroDocumentoIdentidad("12121212121") + .tipoDocumentoIdentidad(Catalog6.RUC.toString()) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item1") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("7.88")) + .precioConImpuestos(true) + .icbAplica(true) + .build() + ) + .build(); + + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // When + Template template = TemplateProducer.getInstance().getInvoice(); + String xml = template.data(input).render(); + + // Then + XMLAssertUtils.assertSnapshot(xml, getClass(), "with-precioUnitario-conImpuestos-ICB.xml"); + XMLAssertUtils.assertSendSunat(xml); + } +} diff --git a/src/test/java/e2e/renderer/invoice/InvoicePercepcionTest.java b/src/test/java/e2e/renderer/invoice/InvoicePercepcionTest.java new file mode 100644 index 00000000..cb048fb3 --- /dev/null +++ b/src/test/java/e2e/renderer/invoice/InvoicePercepcionTest.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 e2e.renderer.invoice; + +import e2e.AbstractTest; +import e2e.renderer.XMLAssertUtils; +import io.github.project.openubl.xbuilder.content.catalogs.Catalog59; +import io.github.project.openubl.xbuilder.content.catalogs.Catalog6; +import io.github.project.openubl.xbuilder.content.models.common.Cliente; +import io.github.project.openubl.xbuilder.content.models.common.Proveedor; +import io.github.project.openubl.xbuilder.content.models.standard.general.Detraccion; +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.Percepcion; +import io.github.project.openubl.xbuilder.enricher.ContentEnricher; +import io.github.project.openubl.xbuilder.renderer.TemplateProducer; +import io.quarkus.qute.Template; +import java.math.BigDecimal; +import org.junit.jupiter.api.Test; + +public class InvoicePercepcionTest extends AbstractTest { + + @Test + public void testFechaVencimiento() throws Exception { + // Given + Invoice input = Invoice + .builder() + .serie("F001") + .numero(1) + .proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Softgreen S.A.C.").build()) + .cliente( + Cliente + .builder() + .nombre("Carlos Feria") + .numeroDocumentoIdentidad("12121212121") + .tipoDocumentoIdentidad(Catalog6.RUC.toString()) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item1") + .cantidad(new BigDecimal("4")) + .precio(new BigDecimal("200")) + .build() + ) + .percepcion(Percepcion.builder().tipo("51").porcentaje(new BigDecimal("0.02")).build()) + .build(); + + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // When + Template template = TemplateProducer.getInstance().getInvoice(); + String xml = template.data(input).render(); + + // Then + XMLAssertUtils.assertSnapshot(xml, getClass(), "percepcion.xml"); + XMLAssertUtils.assertSendSunat(xml); + } +} diff --git a/src/test/java/e2e/renderer/invoice/InvoiceTest.java b/src/test/java/e2e/renderer/invoice/InvoiceTest.java new file mode 100644 index 00000000..6c4864b2 --- /dev/null +++ b/src/test/java/e2e/renderer/invoice/InvoiceTest.java @@ -0,0 +1,464 @@ +/* + * 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 e2e.renderer.invoice; + +import static e2e.renderer.XMLAssertUtils.assertSendSunat; +import static e2e.renderer.XMLAssertUtils.assertSnapshot; + +import e2e.AbstractTest; +import io.github.project.openubl.xbuilder.content.catalogs.Catalog6; +import io.github.project.openubl.xbuilder.content.models.common.Cliente; +import io.github.project.openubl.xbuilder.content.models.common.Contacto; +import io.github.project.openubl.xbuilder.content.models.common.Direccion; +import io.github.project.openubl.xbuilder.content.models.common.Firmante; +import io.github.project.openubl.xbuilder.content.models.common.Proveedor; +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.enricher.ContentEnricher; +import io.github.project.openubl.xbuilder.renderer.TemplateProducer; +import io.quarkus.qute.Template; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalTime; +import java.time.Month; +import org.junit.jupiter.api.Test; + +public class InvoiceTest extends AbstractTest { + + @Test + public void testInvoiceWithCustomUnidadMedida() throws Exception { + // Given + Invoice input = Invoice + .builder() + .serie("F001") + .numero(1) + .proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Softgreen S.A.C.").build()) + .cliente( + Cliente + .builder() + .nombre("Carlos Feria") + .numeroDocumentoIdentidad("12121212121") + .tipoDocumentoIdentidad(Catalog6.RUC.toString()) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item1") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("100")) + .unidadMedida("KGM") + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item2") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("100")) + .unidadMedida("KGM") + .build() + ) + .build(); + + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // When + Template template = TemplateProducer.getInstance().getInvoice(); + String xml = template.data(input).render(); + + // Then + assertSnapshot(xml, getClass(), "customUnidadMedida.xml"); + assertSendSunat(xml); + } + + @Test + public void testInvoiceWithCustomFechaEmision() throws Exception { + LocalDate fechaEmision = LocalDate.of(2019, Month.JANUARY, 6); + LocalTime horaEmision = LocalTime.of(0, 0); + + // Given + Invoice input = Invoice + .builder() + .serie("F001") + .numero(1) + .fechaEmision(fechaEmision) + .horaEmision(horaEmision) + .proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Softgreen S.A.C.").build()) + .cliente( + Cliente + .builder() + .nombre("Carlos Feria") + .numeroDocumentoIdentidad("12121212121") + .tipoDocumentoIdentidad(Catalog6.RUC.toString()) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item1") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("100")) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item2") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("100")) + .build() + ) + .build(); + + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // When + Template template = TemplateProducer.getInstance().getInvoice(); + String xml = template.data(input).render(); + + // Then + assertSnapshot(xml, getClass(), "customFechaEmision.xml"); + assertSendSunat(xml); + } + + @Test + public void testInvoiceWithCustomClienteDireccionAndContacto() throws Exception { + // Given + Invoice input = Invoice + .builder() + .serie("F001") + .numero(1) + .proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Softgreen S.A.C.").build()) + .cliente( + Cliente + .builder() + .nombre("Carlos Feria") + .numeroDocumentoIdentidad("12121212121") + .tipoDocumentoIdentidad(Catalog6.RUC.toString()) + .contacto(Contacto.builder().email("carlos@gmail.com").telefono("+123456789").build()) + .direccion( + Direccion + .builder() + .ubigeo("050101") + .departamento("Ayacucho") + .provincia("Huamanga") + .distrito("Jesus Nazareno") + .codigoLocal("0101") + .urbanizacion("000000") + .direccion("Jr. Las piedras 123") + .codigoPais("PE") + .build() + ) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item1") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("100")) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item2") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("100")) + .build() + ) + .build(); + + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // When + Template template = TemplateProducer.getInstance().getInvoice(); + String xml = template.data(input).render(); + + // Then + assertSnapshot(xml, getClass(), "customClienteDireccionAndContacto.xml"); + assertSendSunat(xml); + } + + @Test + public void testInvoiceWithCustomProveedorDireccionAndContacto() throws Exception { + // Given + Invoice input = Invoice + .builder() + .serie("F001") + .numero(1) + .proveedor( + Proveedor + .builder() + .ruc("12345678912") + .razonSocial("Softgreen S.A.C.") + .contacto(Contacto.builder().email("carlos@gmail.com").telefono("+123456789").build()) + .direccion( + Direccion + .builder() + .ubigeo("050101") + .departamento("Ayacucho") + .provincia("Huamanga") + .distrito("Jesus Nazareno") + .codigoLocal("0101") + .urbanizacion("000000") + .direccion("Jr. Las piedras 123") + .codigoPais("PE") + .build() + ) + .build() + ) + .cliente( + Cliente + .builder() + .nombre("Carlos Feria") + .numeroDocumentoIdentidad("12121212121") + .tipoDocumentoIdentidad(Catalog6.RUC.toString()) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item1") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("100")) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item2") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("100")) + .build() + ) + .build(); + + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // When + Template template = TemplateProducer.getInstance().getInvoice(); + String xml = template.data(input).render(); + + // Then + assertSnapshot(xml, getClass(), "customProveedorDireccionAndContacto.xml"); + assertSendSunat(xml); + } + + @Test + public void testInvoiceWithCustomFirmante() throws Exception { + // Given + Invoice input = Invoice + .builder() + .serie("F001") + .numero(1) + .proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Softgreen S.A.C.").build()) + .cliente( + Cliente + .builder() + .nombre("Carlos Feria") + .numeroDocumentoIdentidad("12121212121") + .tipoDocumentoIdentidad(Catalog6.RUC.toString()) + .build() + ) + .firmante(Firmante.builder().ruc("000000000000").razonSocial("Wolsnut4 S.A.C.").build()) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item1") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("100")) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item2") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("100")) + .build() + ) + .build(); + + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // When + Template template = TemplateProducer.getInstance().getInvoice(); + String xml = template.data(input).render(); + + // Then + assertSnapshot(xml, getClass(), "customFirmante.xml"); + assertSendSunat(xml); + } + + @Test + public void testInvoiceWithICB_precioUnitario() throws Exception { + // Given + Invoice input = Invoice + .builder() + .serie("F001") + .numero(1) + .proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Softgreen S.A.C.").build()) + .cliente( + Cliente + .builder() + .nombre("Carlos Feria") + .numeroDocumentoIdentidad("12121212121") + .tipoDocumentoIdentidad(Catalog6.RUC.toString()) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item1") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("100")) + .icbAplica(true) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item2") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("100")) + .icbAplica(true) + .build() + ) + .build(); + + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // When + Template template = TemplateProducer.getInstance().getInvoice(); + String xml = template.data(input).render(); + + // Then + assertSnapshot(xml, getClass(), "icb.xml"); + assertSendSunat(xml); + } + + @Test + public void testInvoiceWithICB_precioConIgv() throws Exception { + // Given + Invoice input = Invoice + .builder() + .serie("F001") + .numero(1) + .proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Softgreen S.A.C.").build()) + .cliente( + Cliente + .builder() + .nombre("Carlos Feria") + .numeroDocumentoIdentidad("12121212121") + .tipoDocumentoIdentidad(Catalog6.RUC.toString()) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item1") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("118")) + .precioConImpuestos(true) + .icbAplica(true) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item2") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("118")) + .precioConImpuestos(true) + .icbAplica(true) + .build() + ) + .build(); + + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // When + Template template = TemplateProducer.getInstance().getInvoice(); + String xml = template.data(input).render(); + + // Then + assertSnapshot(xml, getClass(), "icb.xml"); + assertSendSunat(xml); + } + + @Test + public void testInvoiceWithCustomProveedor_direccionNotNullAndCodigoLocalNull() throws Exception { + // Given + Invoice input = Invoice + .builder() + .serie("F001") + .numero(1) + .proveedor( + Proveedor + .builder() + .ruc("12345678912") + .razonSocial("Softgreen S.A.C.") + .direccion(Direccion.builder().direccion("Jr. las flores 123").build()) + .build() + ) + .cliente( + Cliente + .builder() + .nombre("Carlos Feria") + .numeroDocumentoIdentidad("12121212121") + .tipoDocumentoIdentidad(Catalog6.RUC.toString()) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item1") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("118")) + .build() + ) + .detalle( + DocumentoDetalle + .builder() + .descripcion("Item2") + .cantidad(new BigDecimal("10")) + .precio(new BigDecimal("118")) + .build() + ) + .build(); + + ContentEnricher enricher = new ContentEnricher(defaults, dateProvider); + enricher.enrich(input); + + // When + Template template = TemplateProducer.getInstance().getInvoice(); + String xml = template.data(input).render(); + + // Then + assertSnapshot(xml, getClass(), "customCodigoLocal.xml"); + assertSendSunat(xml); + } +} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/input/constraints/CoutaDePagoInputModel_MontoPorcentajeValidatorTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/input/constraints/CoutaDePagoInputModel_MontoPorcentajeValidatorTest.java deleted file mode 100644 index 7bbfdd54..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/input/constraints/CoutaDePagoInputModel_MontoPorcentajeValidatorTest.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.input.constraints; - -import io.github.project.openubl.xmlbuilderlib.models.input.common.CuotaDePagoInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.CoutaDePagoInputModel_MontoPorcentajeValidator; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.HighLevelGroupValidation; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import javax.validation.ConstraintViolation; -import javax.validation.Validation; -import javax.validation.Validator; -import javax.validation.ValidatorFactory; -import java.math.BigDecimal; -import java.util.Set; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -public class CoutaDePagoInputModel_MontoPorcentajeValidatorTest { - - private static Validator validator; - - @BeforeAll - public static void setUpValidator() { - ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); - validator = factory.getValidator(); - } - - @Test - void monto_isValid() { - CuotaDePagoInputModel input = CuotaDePagoInputModel.Builder.aFormaPagoCuotaInputModel() - .withMonto(BigDecimal.ONE) - .build(); - - Set> violations = validator.validate(input, HighLevelGroupValidation.class); - assertTrue(violations.isEmpty()); - } - - @Test - void porcentaje_isValid() { - CuotaDePagoInputModel input = CuotaDePagoInputModel.Builder.aFormaPagoCuotaInputModel() - .withPorcentaje(BigDecimal.ONE) - .build(); - - Set> violations = validator.validate(input, HighLevelGroupValidation.class); - assertTrue(violations.isEmpty()); - } - - @Test - void noMontoNeitherPorcentaje_isInvalid() { - CuotaDePagoInputModel input = CuotaDePagoInputModel.Builder.aFormaPagoCuotaInputModel() - .build(); - - Set> violations = validator.validate(input, HighLevelGroupValidation.class); - assertTrue( - violations.stream().anyMatch(p -> p.getMessage().equals(CoutaDePagoInputModel_MontoPorcentajeValidator.message)) - ); - } - - @Test - void bothMontoAndPorcentaje_isInvalid() { - CuotaDePagoInputModel input = CuotaDePagoInputModel.Builder.aFormaPagoCuotaInputModel() - .withMonto(BigDecimal.ONE) - .withPorcentaje(BigDecimal.ONE) - .build(); - - Set> violations = validator.validate(input, HighLevelGroupValidation.class); - assertTrue( - violations.stream().anyMatch(p -> p.getMessage().equals(CoutaDePagoInputModel_MontoPorcentajeValidator.message)) - ); - } -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/input/constraints/CoutaDePagoInputModel_Porcentaje100CollectionValidatorTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/input/constraints/CoutaDePagoInputModel_Porcentaje100CollectionValidatorTest.java deleted file mode 100644 index 310722e7..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/input/constraints/CoutaDePagoInputModel_Porcentaje100CollectionValidatorTest.java +++ /dev/null @@ -1,138 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.input.constraints; - -import io.github.project.openubl.xmlbuilderlib.models.input.common.CuotaDePagoInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.CoutaDePagoInputModel_Porcentaje100CollectionValidator; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.CuotaDePagoInputModel_Porcentaje100CollectionConstraint; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.HighLevelGroupValidation; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import javax.validation.ConstraintViolation; -import javax.validation.Validation; -import javax.validation.Validator; -import javax.validation.ValidatorFactory; -import java.math.BigDecimal; -import java.util.Arrays; -import java.util.List; -import java.util.Set; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -public class CoutaDePagoInputModel_Porcentaje100CollectionValidatorTest { - - private static Validator validator; - - static class Bean { - @CuotaDePagoInputModel_Porcentaje100CollectionConstraint(groups = HighLevelGroupValidation.class) - private List cuotasDePago; - } - - @BeforeAll - public static void setUpValidator() { - ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); - validator = factory.getValidator(); - } - - @Test - void nullCollectionIsValid() { - Bean bean = new Bean(); - - Set> violations = validator.validate(bean, HighLevelGroupValidation.class); - assertTrue(violations.isEmpty()); - } - - @Test - void sumPercentaje_is100() { - List cuotas = Arrays.asList( - CuotaDePagoInputModel.Builder.aFormaPagoCuotaInputModel() - .withPorcentaje(new BigDecimal(40)) - .build(), - CuotaDePagoInputModel.Builder.aFormaPagoCuotaInputModel() - .withPorcentaje(new BigDecimal(60)) - .build() - ); - - Bean bean = new Bean(); - bean.cuotasDePago = cuotas; - - Set> violations = validator.validate(bean, HighLevelGroupValidation.class); - assertTrue(violations.isEmpty()); - } - - @Test - void sumPercentaje_is60() { - List cuotas = Arrays.asList( - CuotaDePagoInputModel.Builder.aFormaPagoCuotaInputModel() - .withPorcentaje(new BigDecimal(40)) - .build(), - CuotaDePagoInputModel.Builder.aFormaPagoCuotaInputModel() - .withPorcentaje(new BigDecimal(20)) - .build() - ); - - Bean bean = new Bean(); - bean.cuotasDePago = cuotas; - - Set> violations = validator.validate(bean, HighLevelGroupValidation.class); - assertTrue( - violations.stream().anyMatch(p -> p.getMessage().equals(CoutaDePagoInputModel_Porcentaje100CollectionValidator.message)) - ); - } - - @Test - void sumPercentaje_isGreaterThan100() { - List cuotas = Arrays.asList( - CuotaDePagoInputModel.Builder.aFormaPagoCuotaInputModel() - .withPorcentaje(new BigDecimal(40)) - .build(), - CuotaDePagoInputModel.Builder.aFormaPagoCuotaInputModel() - .withPorcentaje(new BigDecimal(100)) - .build() - ); - - Bean bean = new Bean(); - bean.cuotasDePago = cuotas; - - Set> violations = validator.validate(bean, HighLevelGroupValidation.class); - assertTrue( - violations.stream().anyMatch(p -> p.getMessage().equals(CoutaDePagoInputModel_Porcentaje100CollectionValidator.message)) - ); - } - - @Test - void noMontoNeitherPorcentaje_isNegative() { - List cuotas = Arrays.asList( - CuotaDePagoInputModel.Builder.aFormaPagoCuotaInputModel() - .withPorcentaje(new BigDecimal(-40)) - .build(), - CuotaDePagoInputModel.Builder.aFormaPagoCuotaInputModel() - .withPorcentaje(new BigDecimal(-100)) - .build() - ); - - Bean bean = new Bean(); - bean.cuotasDePago = cuotas; - - Set> violations = validator.validate(bean, HighLevelGroupValidation.class); - assertTrue( - violations.stream().anyMatch(p -> p.getMessage().equals(CoutaDePagoInputModel_Porcentaje100CollectionValidator.message)) - ); - } - -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/input/constraints/DocumentInputModel_PuedeCrearComprobanteConSerieFValidatorTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/input/constraints/DocumentInputModel_PuedeCrearComprobanteConSerieFValidatorTest.java deleted file mode 100644 index fcac037e..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/input/constraints/DocumentInputModel_PuedeCrearComprobanteConSerieFValidatorTest.java +++ /dev/null @@ -1,222 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.input.constraints; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog6; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.DocumentInputModel_PuedeCrearComprobanteConSerieFGroupValidation; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.DocumentInputModel_PuedeCrearComprobanteConSerieFValidator; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.invoice.InvoiceInputModel; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import javax.validation.ConstraintViolation; -import javax.validation.Validation; -import javax.validation.Validator; -import javax.validation.ValidatorFactory; -import java.util.Set; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -public class DocumentInputModel_PuedeCrearComprobanteConSerieFValidatorTest { - - private static Validator validator; - - @BeforeAll - public static void setUpValidator() { - ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); - validator = factory.getValidator(); - } - - @Test - void serieFacturaAndDocTribNoDomSinRUC_isInvalid() { - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withTipoDocumentoIdentidad(Catalog6.DOC_TRIB_NO_DOM_SIN_RUC.toString()) - .build() - ) - .build(); - - Set> violations = validator.validate(input, DocumentInputModel_PuedeCrearComprobanteConSerieFGroupValidation.class); - assertTrue( - violations.stream().anyMatch(p -> p.getMessage().equals(DocumentInputModel_PuedeCrearComprobanteConSerieFValidator.message)) - ); - } - - @Test - void serieFacturaAndDNI_isInvalid() { - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withTipoDocumentoIdentidad(Catalog6.DNI.toString()) - .build() - ) - .build(); - - Set> violations = validator.validate(input, DocumentInputModel_PuedeCrearComprobanteConSerieFGroupValidation.class); - assertTrue( - violations.stream().anyMatch(p -> p.getMessage().equals(DocumentInputModel_PuedeCrearComprobanteConSerieFValidator.message)) - ); - } - - @Test - void serieFacturaAndExtranjeria_isInvalid() { - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withTipoDocumentoIdentidad(Catalog6.EXTRANJERIA.toString()) - .build() - ) - .build(); - - Set> violations = validator.validate(input, DocumentInputModel_PuedeCrearComprobanteConSerieFGroupValidation.class); - assertTrue( - violations.stream().anyMatch(p -> p.getMessage().equals(DocumentInputModel_PuedeCrearComprobanteConSerieFValidator.message)) - ); - } - - @Test - void serieFacturaAndRUC_isValid() { - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .build(); - - Set> violations = validator.validate(input, DocumentInputModel_PuedeCrearComprobanteConSerieFGroupValidation.class); - assertTrue(violations.isEmpty()); - } - - @Test - void serieFacturaAndPasaporte_isInvalid() { - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withTipoDocumentoIdentidad(Catalog6.PASAPORTE.toString()) - .build() - ) - .build(); - - Set> violations = validator.validate(input, DocumentInputModel_PuedeCrearComprobanteConSerieFGroupValidation.class); - assertTrue( - violations.stream().anyMatch(p -> p.getMessage().equals(DocumentInputModel_PuedeCrearComprobanteConSerieFValidator.message)) - ); - } - - @Test - void serieFacturaAndDecDiplomatica_isInvalid() { - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withTipoDocumentoIdentidad(Catalog6.DEC_DIPLOMATICA.toString()) - .build() - ) - .build(); - - Set> violations = validator.validate(input, DocumentInputModel_PuedeCrearComprobanteConSerieFGroupValidation.class); - assertTrue( - violations.stream().anyMatch(p -> p.getMessage().equals(DocumentInputModel_PuedeCrearComprobanteConSerieFValidator.message)) - ); - } - - @Test - void serieBoletaAndDocTribNoDomSinRUC_isValid() { - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("B001") - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withTipoDocumentoIdentidad(Catalog6.DOC_TRIB_NO_DOM_SIN_RUC.toString()) - .build() - ) - .build(); - - Set> violations = validator.validate(input, DocumentInputModel_PuedeCrearComprobanteConSerieFGroupValidation.class); - assertTrue(violations.isEmpty()); - } - - @Test - void serieBoletaAndDNI_isValid() { - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("B001") - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withTipoDocumentoIdentidad(Catalog6.DNI.toString()) - .build() - ) - .build(); - - Set> violations = validator.validate(input, DocumentInputModel_PuedeCrearComprobanteConSerieFGroupValidation.class); - assertTrue(violations.isEmpty()); - } - - @Test - void serieBoletaAndExtranjeria_isValid() { - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("B001") - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withTipoDocumentoIdentidad(Catalog6.EXTRANJERIA.toString()) - .build() - ) - .build(); - - Set> violations = validator.validate(input, DocumentInputModel_PuedeCrearComprobanteConSerieFGroupValidation.class); - assertTrue(violations.isEmpty()); - } - - @Test - void serieBoletaAndRUC_isValid() { - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("B001") - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .build(); - - Set> violations = validator.validate(input, DocumentInputModel_PuedeCrearComprobanteConSerieFGroupValidation.class); - assertTrue(violations.isEmpty()); - } - - @Test - void serieBoletaAndPasaporte_isValid() { - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("B001") - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withTipoDocumentoIdentidad(Catalog6.PASAPORTE.toString()) - .build() - ) - .build(); - - Set> violations = validator.validate(input, DocumentInputModel_PuedeCrearComprobanteConSerieFGroupValidation.class); - assertTrue(violations.isEmpty()); - } - - @Test - void serieBoletaAndDecDiplomatica_isValid() { - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("B001") - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withTipoDocumentoIdentidad(Catalog6.PASAPORTE.toString()) - .build() - ) - .build(); - - Set> violations = validator.validate(input, DocumentInputModel_PuedeCrearComprobanteConSerieFGroupValidation.class); - assertTrue(violations.isEmpty()); - } -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/input/constraints/DocumentLineInputModel_CantidadValidaICBValidatorTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/input/constraints/DocumentLineInputModel_CantidadValidaICBValidatorTest.java deleted file mode 100644 index a08432e8..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/input/constraints/DocumentLineInputModel_CantidadValidaICBValidatorTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.input.constraints; - -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.DocumentLineInputModel_CantidadValidaICBGroupValidation; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.DocumentLineInputModel_CantidadValidaICBValidator; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentLineInputModel; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import javax.validation.ConstraintViolation; -import javax.validation.Validation; -import javax.validation.Validator; -import javax.validation.ValidatorFactory; -import java.math.BigDecimal; -import java.util.Set; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -class DocumentLineInputModel_CantidadValidaICBValidatorTest { - - private static Validator validator; - - @BeforeAll - public static void setUpValidator() { - ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); - validator = factory.getValidator(); - } - - @Test - void cantidadICBFalse_isValid() { - DocumentLineInputModel input = DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withIcb(false) - .build(); - - Set> violations = validator.validate(input, DocumentLineInputModel_CantidadValidaICBGroupValidation.class); - assertTrue(violations.isEmpty()); - } - - @Test - void cantidadICBTrueAndCantidadEntera_isValid() { - DocumentLineInputModel input = DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withIcb(true) - .withCantidad(new BigDecimal("10.0")) - .build(); - - Set> violations = validator.validate(input, DocumentLineInputModel_CantidadValidaICBGroupValidation.class); - assertTrue(violations.isEmpty()); - } - - @Test - void cantidadICBTrueAndCantidadNoEntera_isValid() { - DocumentLineInputModel input = DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withIcb(true) - .withCantidad(new BigDecimal("10.1")) - .build(); - - Set> violations = validator.validate(input, DocumentLineInputModel_CantidadValidaICBGroupValidation.class); - assertTrue( - violations.stream().anyMatch(p -> p.getMessage().equals(DocumentLineInputModel_CantidadValidaICBValidator.message)) - ); - } - -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/input/constraints/DocumentLineInputModel_PrecioValidatorTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/input/constraints/DocumentLineInputModel_PrecioValidatorTest.java deleted file mode 100644 index c9521a72..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/input/constraints/DocumentLineInputModel_PrecioValidatorTest.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.input.constraints; - -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.DocumentLineInputModel_PrecioValidator; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.HighLevelGroupValidation; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentLineInputModel; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import javax.validation.ConstraintViolation; -import javax.validation.Validation; -import javax.validation.Validator; -import javax.validation.ValidatorFactory; -import java.math.BigDecimal; -import java.util.Set; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -public class DocumentLineInputModel_PrecioValidatorTest { - - private static Validator validator; - - @BeforeAll - public static void setUpValidator() { - ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); - validator = factory.getValidator(); - } - - @Test - void precioConIgv_isValid() { - DocumentLineInputModel input = DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withPrecioConIgv(BigDecimal.ONE) - .build(); - - Set> violations = validator.validate(input, HighLevelGroupValidation.class); - assertTrue(violations.isEmpty()); - } - - @Test - void precioUnitario_isValid() { - DocumentLineInputModel input = DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withPrecioUnitario(BigDecimal.ONE) - .build(); - - Set> violations = validator.validate(input, HighLevelGroupValidation.class); - assertTrue(violations.isEmpty()); - } - - @Test - void noPrecioConSinImpuestos_isInvalid() { - DocumentLineInputModel input = DocumentLineInputModel.Builder.aDocumentLineInputModel() - .build(); - - Set> violations = validator.validate(input, HighLevelGroupValidation.class); - assertTrue( - violations.stream().anyMatch(p -> p.getMessage().equals(DocumentLineInputModel_PrecioValidator.message)) - ); - } -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/input/constraints/NoteInputModel_SerieComprobanteAfectadoValidatorTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/input/constraints/NoteInputModel_SerieComprobanteAfectadoValidatorTest.java deleted file mode 100644 index e1e4ef59..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/input/constraints/NoteInputModel_SerieComprobanteAfectadoValidatorTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.input.constraints; - -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.NoteInputModel_SerieComprobanteAfectadoGroupValidation; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.NoteInputModel_SerieComprobanteAfectadoValidator; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.note.creditNote.CreditNoteInputModel; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import javax.validation.ConstraintViolation; -import javax.validation.Validation; -import javax.validation.Validator; -import javax.validation.ValidatorFactory; -import java.util.Set; - -import static org.junit.jupiter.api.Assertions.assertTrue; - - -public class NoteInputModel_SerieComprobanteAfectadoValidatorTest { - - private static Validator validator; - - @BeforeAll - public static void setUpValidator() { - ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); - validator = factory.getValidator(); - } - - @Test - void documentoConSerieByComprobanteAfectadoB_isValid() { - CreditNoteInputModel input = CreditNoteInputModel.Builder.aCreditNoteInputModel() - .withSerie("BC01") - .withSerieNumeroComprobanteAfectado("B001-1") - .build(); - - Set> violations = validator.validate(input, NoteInputModel_SerieComprobanteAfectadoGroupValidation.class); - assertTrue(violations.isEmpty()); - } - - @Test - void documentoConSerieFyComprobanteAfectadoF_isValid() { - CreditNoteInputModel input = CreditNoteInputModel.Builder.aCreditNoteInputModel() - .withSerie("FC01") - .withSerieNumeroComprobanteAfectado("F001-1") - .build(); - - Set> violations = validator.validate(input, NoteInputModel_SerieComprobanteAfectadoGroupValidation.class); - assertTrue(violations.isEmpty()); - } - - @Test - void documentoConSerieFyComprobanteAfectadoB_isInvalid() { - CreditNoteInputModel input = CreditNoteInputModel.Builder.aCreditNoteInputModel() - .withSerie("FC01") - .withSerieNumeroComprobanteAfectado("B001-1") - .build(); - - Set> violations = validator.validate(input, NoteInputModel_SerieComprobanteAfectadoGroupValidation.class); - assertTrue( - violations.stream().anyMatch(p -> p.getMessage().equals(NoteInputModel_SerieComprobanteAfectadoValidator.message)) - ); - } - - @Test - void documentoConSerieByComprobanteAfectadoF_isInvalid() { - CreditNoteInputModel input = CreditNoteInputModel.Builder.aCreditNoteInputModel() - .withSerie("BC01") - .withSerieNumeroComprobanteAfectado("F001-1") - .build(); - - Set> violations = validator.validate(input, NoteInputModel_SerieComprobanteAfectadoGroupValidation.class); - assertTrue( - violations.stream().anyMatch(p -> p.getMessage().equals(NoteInputModel_SerieComprobanteAfectadoValidator.message)) - ); - } -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/input/constraints/SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoValidatorTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/input/constraints/SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoValidatorTest.java deleted file mode 100644 index 5b514791..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/input/constraints/SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoValidatorTest.java +++ /dev/null @@ -1,120 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.input.constraints; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoGroupValidation; -import io.github.project.openubl.xmlbuilderlib.models.input.constraints.SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoValidator; -import io.github.project.openubl.xmlbuilderlib.models.input.sunat.SummaryDocumentComprobanteAfectadoInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.sunat.SummaryDocumentComprobanteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.sunat.SummaryDocumentLineInputModel; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import javax.validation.ConstraintViolation; -import javax.validation.Validation; -import javax.validation.Validator; -import javax.validation.ValidatorFactory; -import java.util.Set; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -public class SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoValidatorTest { - - private static Validator validator; - - @BeforeAll - public static void setUpValidator() { - ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); - validator = factory.getValidator(); - } - - @Test - void comprobanteEsBoleta_comprobanteAfectadoNull_isValid() { - SummaryDocumentLineInputModel input = SummaryDocumentLineInputModel.Builder.aSummaryDocumentLineInputModel() - .withComprobante(SummaryDocumentComprobanteInputModel.Builder.aSummaryDocumentComprobanteInputModel() - .withTipo(Catalog1.BOLETA.toString()) - .build() - ) - .build(); - - Set> violations = validator.validate(input, SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoGroupValidation.class); - assertTrue(violations.isEmpty()); - } - - @Test - void comprobanteEsNotaCredito_comprobanteAfectadoNotnull_isValid() { - SummaryDocumentLineInputModel input = SummaryDocumentLineInputModel.Builder.aSummaryDocumentLineInputModel() - .withComprobante(SummaryDocumentComprobanteInputModel.Builder.aSummaryDocumentComprobanteInputModel() - .withTipo(Catalog1.NOTA_CREDITO.toString()) - .build() - ) - .withComprobanteAfectado(SummaryDocumentComprobanteAfectadoInputModel.Builder.aSummaryDocumentComprobanteAfectadoInputModel() - .build() - ) - .build(); - - Set> violations = validator.validate(input, SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoGroupValidation.class); - assertTrue(violations.isEmpty()); - } - - @Test - void comprobanteEsNotaDebito_comprobanteAfectadoNotnull_isValid() { - SummaryDocumentLineInputModel input = SummaryDocumentLineInputModel.Builder.aSummaryDocumentLineInputModel() - .withComprobante(SummaryDocumentComprobanteInputModel.Builder.aSummaryDocumentComprobanteInputModel() - .withTipo(Catalog1.NOTA_DEBITO.toString()) - .build() - ) - .withComprobanteAfectado(SummaryDocumentComprobanteAfectadoInputModel.Builder.aSummaryDocumentComprobanteAfectadoInputModel() - .build() - ) - .build(); - - Set> violations = validator.validate(input, SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoGroupValidation.class); - assertTrue(violations.isEmpty()); - } - - @Test - void comprobanteEsNotaCredito_comprobanteAfectadoNull_isInvalid() { - SummaryDocumentLineInputModel input = SummaryDocumentLineInputModel.Builder.aSummaryDocumentLineInputModel() - .withComprobante(SummaryDocumentComprobanteInputModel.Builder.aSummaryDocumentComprobanteInputModel() - .withTipo(Catalog1.NOTA_CREDITO.toString()) - .build() - ) - .build(); - - Set> violations = validator.validate(input, SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoGroupValidation.class); - assertTrue( - violations.stream().anyMatch(p -> p.getMessage().equals(SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoValidator.message)) - ); - } - - @Test - void comprobanteEsNotaDebito_comprobanteAfectadoNull_isInvalid() { - SummaryDocumentLineInputModel input = SummaryDocumentLineInputModel.Builder.aSummaryDocumentLineInputModel() - .withComprobante(SummaryDocumentComprobanteInputModel.Builder.aSummaryDocumentComprobanteInputModel() - .withTipo(Catalog1.NOTA_DEBITO.toString()) - .build() - ) - .build(); - - Set> violations = validator.validate(input, SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoGroupValidation.class); - assertTrue( - violations.stream().anyMatch(p -> p.getMessage().equals(SummaryDocumentLineInputModel_ComprobanteAfectadoRequeridoValidator.message)) - ); - } -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/AbstractUBLTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/AbstractUBLTest.java deleted file mode 100644 index 6cc27db5..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/AbstractUBLTest.java +++ /dev/null @@ -1,196 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.integrationtest; - -import io.github.project.openubl.xmlbuilderlib.clock.SystemClock; -import io.github.project.openubl.xmlbuilderlib.config.Config; -import io.github.project.openubl.xmlbuilderlib.config.DefaultConfig; -import io.github.project.openubl.xmlbuilderlib.utils.CertificateDetails; -import io.github.project.openubl.xmlbuilderlib.utils.CertificateDetailsFactory; -import io.github.project.openubl.xmlbuilderlib.xml.XMLSigner; -import io.github.project.openubl.xmlbuilderlib.xml.XmlSignatureHelper; -import io.github.project.openubl.xmlsenderws.webservices.managers.smart.SmartBillServiceConfig; -import io.github.project.openubl.xmlsenderws.webservices.managers.smart.SmartBillServiceManager; -import io.github.project.openubl.xmlsenderws.webservices.managers.smart.SmartBillServiceModel; -import io.github.project.openubl.xmlsenderws.webservices.providers.BillServiceModel; -import io.github.project.openubl.xmlsenderws.webservices.xml.DocumentType; -import io.github.project.openubl.xmlsenderws.webservices.xml.XmlContentModel; -import org.w3c.dom.Document; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xmlunit.builder.DiffBuilder; -import org.xmlunit.diff.Diff; - -import javax.validation.ConstraintViolation; -import javax.validation.Validation; -import javax.validation.Validator; -import javax.validation.ValidatorFactory; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathFactory; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.*; -import java.util.stream.Collectors; - -import static org.junit.jupiter.api.Assertions.*; - -public abstract class AbstractUBLTest { - - static final String SUNAT_BETA_USERNAME = "MODDATOS"; - static final String SUNAT_BETA_PASSWORD = "MODDATOS"; - - - static String SIGN_REFERENCE_ID = "PROJECT-OPENUBL"; - static final String KEYSTORE = "LLAMA-PE-CERTIFICADO-DEMO-10467793549.pfx"; - static final String KEYSTORE_PASSWORD = "password"; - static CertificateDetails CERTIFICATE; - - - protected XPath xPath; - protected Validator validator; - - - protected Config config; - protected TimeZone timeZone; - protected SystemClock systemClock; - - protected String DOCUMENT_WITHOUT_2007_LEGEND = "4264 - El XML no contiene el codigo de leyenda 2007 para el tipo de operación IVAP"; - - public AbstractUBLTest() throws Exception { - xPath = XPathFactory.newInstance().newXPath(); - xPath.setNamespaceContext(SunatNamespacesSingleton.getInstance()); - - ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); - validator = factory.getValidator(); - - SmartBillServiceConfig.getInstance() - .withInvoiceAndNoteDeliveryURL("https://e-beta.sunat.gob.pe/ol-ti-itcpfegem-beta/billService") - .withPerceptionAndRetentionDeliveryURL("https://e-beta.sunat.gob.pe/ol-ti-itemision-otroscpe-gem-beta/billService") - .withDespatchAdviceDeliveryURL("https://e-beta.sunat.gob.pe/ol-ti-itemision-guia-gem-beta/billService"); - - - InputStream ksInputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(KEYSTORE); - CERTIFICATE = CertificateDetailsFactory.create(ksInputStream, KEYSTORE_PASSWORD); - - config = new DefaultConfig(); - timeZone = TimeZone.getTimeZone("America/Lima"); - systemClock = new SystemClock() { - @Override - public TimeZone getTimeZone() { - return timeZone; - } - - @Override - public Calendar getCalendarInstance() { - Calendar calendar = Calendar.getInstance(); - calendar.setTimeZone(timeZone); - calendar.set(2019, Calendar.DECEMBER, 24, 20, 30, 59); - return calendar; - } - }; - } - - protected static void assertOutputHasNoConstraintViolations(Validator validator, Object output) { - Set> violations = validator.validate(output); - assertTrue(violations.isEmpty()); - } - - public void assertSnapshot(String expected, String snapshotFile) { - InputStream snapshotInputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(snapshotFile); - assertNotNull(snapshotInputStream, "Could not find snapshot file " + snapshotFile); - - Diff myDiff = DiffBuilder - .compare(snapshotInputStream) - .withTest(expected) - .ignoreComments() - .ignoreWhitespace() - .build(); - - assertFalse(myDiff.hasDifferences(), expected + "\n" + myDiff.toString()); - } - - public void assertSendSunat(String xmlWithoutSignature, String... allowedNotes) throws Exception { - String skipSunat = System.getProperty("skipSunat", "false"); - if (skipSunat != null && skipSunat.equals("false")) { - Document signedXML = XMLSigner.signXML(xmlWithoutSignature, SIGN_REFERENCE_ID, CERTIFICATE.getX509Certificate(), CERTIFICATE.getPrivateKey()); - sendFileToSunat(signedXML, xmlWithoutSignature, allowedNotes); - } - } - - private void sendFileToSunat(Document document, String xmlWithoutSignature, String... allowedNotes) throws Exception { - SmartBillServiceModel smartBillServiceModel = SmartBillServiceManager.send(XmlSignatureHelper.getBytesFromDocument(document), SUNAT_BETA_USERNAME, SUNAT_BETA_PASSWORD); - XmlContentModel xmlContentModel = smartBillServiceModel.getXmlContentModel(); - BillServiceModel billServiceModel = smartBillServiceModel.getBillServiceModel(); - - if (billServiceModel.getNotes() != null) { - List allowedNotesList = Arrays.asList(allowedNotes); - - List notesToCheck = billServiceModel.getNotes().stream().filter(f -> allowedNotesList.stream().noneMatch(f::startsWith)).collect(Collectors.toList()); - notesToCheck.forEach(f -> System.out.println("WARNING:" + f)); - - assertTrue(notesToCheck.isEmpty(), "Notes fom SUNAT:\n" + String.join("\n", notesToCheck)); - } - - // Check ticket - if (!xmlContentModel.getDocumentType().equals(DocumentType.VOIDED_DOCUMENT.getType()) && !xmlContentModel.getDocumentType().equals(DocumentType.SUMMARY_DOCUMENT.getType())) { - assertEquals( - BillServiceModel.Status.ACEPTADO, - billServiceModel.getStatus(), - xmlWithoutSignature + " \n sunat [codigo=" + billServiceModel.getCode() + "], [descripcion=" + billServiceModel.getDescription() + "]" - ); - } else { - assertNotNull(billServiceModel.getTicket()); - -// BillServiceModel statusModel = SmartBillServiceManager.getStatus(billServiceModel.getTicket(), xmlContentModel, SUNAT_BETA_USERNAME, SUNAT_BETA_PASSWORD); -// assertEquals( -// BillServiceModel.Status.ACEPTADO, -// statusModel.getStatus(), -// xmlWithoutSignature + " sunat [status=" + statusModel.getStatus() + "], [descripcion=" + statusModel.getDescription() + "]" -// ); -// assertNotNull( -// statusModel.getCdr(), -// xmlWithoutSignature + " sunat [codigo=" + billServiceModel.getCode() + "], [descripcion=" + billServiceModel.getDescription() + "]" -// ); - } - } - - private byte[] documentToBytes(Document document) throws TransformerException { - TransformerFactory transFactory = TransformerFactory.newInstance(); - Transformer transformer = transFactory.newTransformer(); - - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - StreamResult result = new StreamResult(bos); - transformer.transform(new DOMSource(document), result); - return bos.toByteArray(); - } - - private Document inputStreamToDocument(InputStream in) throws ParserConfigurationException, IOException, SAXException { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - DocumentBuilder builder = factory.newDocumentBuilder(); - return builder.parse(new InputSource(in)); - } - -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/SunatNamespaces.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/SunatNamespaces.java deleted file mode 100644 index 1ba4df6d..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/SunatNamespaces.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.integrationtest; - -import javax.xml.namespace.NamespaceContext; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -public class SunatNamespaces implements NamespaceContext { - - private final Map prefixes; - - public SunatNamespaces() { - prefixes = new HashMap<>(); - prefixes.put("cac", "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"); - prefixes.put("cbc", "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"); - prefixes.put("ccts", "urn:un:unece:uncefact:documentation:2"); - prefixes.put("cec", "urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2"); - prefixes.put("ds", "http://www.w3.org/2000/09/xmldsig#"); - prefixes.put("ext", "urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2"); - prefixes.put("qdt", "urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2"); - prefixes.put("sac", "urn:sunat:names:specification:ubl:peru:schema:xsd:SunatAggregateComponents-1"); - prefixes.put("udt", "urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2"); - prefixes.put("xs", "http://www.w3.org/2001/XMLSchema"); - prefixes.put("xsi", "http://www.w3.org/2001/XMLSchema-instance"); - } - - public Map getPrefixes() { - return prefixes; - } - - @Override - public String getNamespaceURI(String prefix) { - return prefixes.get(prefix); - } - - @Override - public String getPrefix(String s) { - return null; - } - - @Override - public Iterator getPrefixes(String s) { - return null; - } - -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/SpecialCharactersTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/SpecialCharactersTest.java deleted file mode 100644 index 7c91843a..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/SpecialCharactersTest.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.integrationtest.ubl; - -import io.github.project.openubl.xmlbuilderlib.facade.DocumentManager; -import io.github.project.openubl.xmlbuilderlib.facade.DocumentWrapper; -import io.github.project.openubl.xmlbuilderlib.integrationtest.AbstractUBLTest; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog6; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentLineInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.invoice.InvoiceInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.invoice.InvoiceOutputModel; -import org.junit.jupiter.api.Test; - -import java.math.BigDecimal; -import java.util.Arrays; - -public class SpecialCharactersTest extends AbstractUBLTest { - - public SpecialCharactersTest() throws Exception { - } - - @Test - void testVoidedDocument_Factura_MinData() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Project OpenUBL S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Ñoño Álvarez") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice_specialCharacters.xml"); - assertSendSunat(xml); - } -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/creditnote/formapago/CreditNoteFormaPagoTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/creditnote/formapago/CreditNoteFormaPagoTest.java deleted file mode 100644 index 7e2b4ecd..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/creditnote/formapago/CreditNoteFormaPagoTest.java +++ /dev/null @@ -1,261 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.integrationtest.ubl.creditnote.formapago; - -import io.github.project.openubl.xmlbuilderlib.facade.DocumentManager; -import io.github.project.openubl.xmlbuilderlib.facade.DocumentWrapper; -import io.github.project.openubl.xmlbuilderlib.integrationtest.AbstractUBLTest; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog6; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.CuotaDePagoInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentLineInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.note.creditNote.CreditNoteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.note.creditNote.CreditNoteOutputModel; -import org.junit.jupiter.api.Test; - -import java.math.BigDecimal; -import java.util.Arrays; -import java.util.Calendar; - -public class CreditNoteFormaPagoTest extends AbstractUBLTest { - - public CreditNoteFormaPagoTest() throws Exception { - } - - @Test - public void testCreditNoteSinFormaPago_afectaFactura() throws Exception { - // Given - CreditNoteInputModel input = CreditNoteInputModel.Builder.aCreditNoteInputModel() - .withSerie("FC01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("F001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - CreditNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/creditnote/formapago/sinFormaPago_afectaFactura.xml"); - assertSendSunat(xml); - } - - @Test - public void testCreditNoteSinFormaPago_afectaBoleta() throws Exception { - // Given - CreditNoteInputModel input = CreditNoteInputModel.Builder.aCreditNoteInputModel() - .withSerie("BC01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("B001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.DNI.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - CreditNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/creditnote/formapago/sinFormaPago_afectaBoleta.xml"); - assertSendSunat(xml); - } - - @Test - public void testCreditNoteConFormaPago_afectaFactura() throws Exception { - Calendar calendar = Calendar.getInstance(); - calendar.set(2019, Calendar.JANUARY, 6, 0, 0, 0); - calendar.setTimeZone(timeZone); - - long fechaEmision = calendar.getTimeInMillis(); - - calendar.add(Calendar.DAY_OF_MONTH, 1); - long fechaCuota1 = calendar.getTimeInMillis(); - - calendar.add(Calendar.DAY_OF_MONTH, 1); - long fechaCuota2 = calendar.getTimeInMillis(); - - // Given - CreditNoteInputModel input = CreditNoteInputModel.Builder.aCreditNoteInputModel() - .withSerie("FC01") - .withNumero(1) - .withFechaEmision(fechaEmision) - .withSerieNumeroComprobanteAfectado("F001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .withCuotasDePago(Arrays.asList( - CuotaDePagoInputModel.Builder.aFormaPagoCuotaInputModel() - .withMonto(new BigDecimal(2000)) - .withFechaPago(fechaCuota1) - .build(), - CuotaDePagoInputModel.Builder.aFormaPagoCuotaInputModel() - .withMonto(new BigDecimal(360)) - .withFechaPago(fechaCuota2) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - CreditNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/creditnote/formapago/conFormaPago_afectaFactura.xml"); - assertSendSunat(xml); - } - - @Test - public void testCreditNoteConFormaPago_afectaBoleta() throws Exception { - Calendar calendar = Calendar.getInstance(); - calendar.set(2019, Calendar.JANUARY, 6, 0, 0, 0); - calendar.setTimeZone(timeZone); - - long fechaEmision = calendar.getTimeInMillis(); - - calendar.add(Calendar.DAY_OF_MONTH, 1); - long fechaCuota1 = calendar.getTimeInMillis(); - - calendar.add(Calendar.DAY_OF_MONTH, 1); - long fechaCuota2 = calendar.getTimeInMillis(); - - // Given - CreditNoteInputModel input = CreditNoteInputModel.Builder.aCreditNoteInputModel() - .withSerie("BC01") - .withNumero(1) - .withFechaEmision(fechaEmision) - .withSerieNumeroComprobanteAfectado("B001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.DNI.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .withCuotasDePago(Arrays.asList( - CuotaDePagoInputModel.Builder.aFormaPagoCuotaInputModel() - .withMonto(new BigDecimal(2000)) - .withFechaPago(fechaCuota1) - .build(), - CuotaDePagoInputModel.Builder.aFormaPagoCuotaInputModel() - .withMonto(new BigDecimal(360)) - .withFechaPago(fechaCuota2) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - CreditNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/creditnote/formapago/conFormaPago_afectaBoleta.xml"); - assertSendSunat(xml); - } -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/creditnote/guiaremisionrelacionada/GuiaRemisionRelacionadaTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/creditnote/guiaremisionrelacionada/GuiaRemisionRelacionadaTest.java deleted file mode 100644 index c7eab87c..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/creditnote/guiaremisionrelacionada/GuiaRemisionRelacionadaTest.java +++ /dev/null @@ -1,148 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.integrationtest.ubl.creditnote.guiaremisionrelacionada; - -import io.github.project.openubl.xmlbuilderlib.facade.DocumentManager; -import io.github.project.openubl.xmlbuilderlib.facade.DocumentWrapper; -import io.github.project.openubl.xmlbuilderlib.integrationtest.AbstractUBLTest; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1_Guia; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog6; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentLineInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.GuiaRemisionRelacionadaInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.note.creditNote.CreditNoteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.note.creditNote.CreditNoteOutputModel; -import org.junit.jupiter.api.Test; - -import java.math.BigDecimal; -import java.util.Arrays; - -public class GuiaRemisionRelacionadaTest extends AbstractUBLTest { - - public GuiaRemisionRelacionadaTest() throws Exception { - } - - @Test - void testGuiaRemisionRemitente() throws Exception { - // Given - CreditNoteInputModel input = CreditNoteInputModel.Builder.aCreditNoteInputModel() - .withSerie("FC01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("F001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .withGuiasRemisionRelacionadas(Arrays.asList( - GuiaRemisionRelacionadaInputModel.Builder.aGuiaRemisionRelacionadaInputModel() - .withSerieNumero("0001-002020") - .withTipoDocumento(Catalog1_Guia.GUIA_REMISION_REMITENTE.toString()) - .build(), - GuiaRemisionRelacionadaInputModel.Builder.aGuiaRemisionRelacionadaInputModel() - .withSerieNumero("0002-002020") - .withTipoDocumento(Catalog1_Guia.GUIA_REMISION_REMITENTE.toString()) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - CreditNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/creditnote/guiaremisionrelacionada/guiaRemisionRemitente.xml"); - assertSendSunat(xml); - } - - @Test - void testGuiaRemisionTransportista() throws Exception { - // Given - CreditNoteInputModel input = CreditNoteInputModel.Builder.aCreditNoteInputModel() - .withSerie("FC01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("F001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .withGuiasRemisionRelacionadas(Arrays.asList( - GuiaRemisionRelacionadaInputModel.Builder.aGuiaRemisionRelacionadaInputModel() - .withSerieNumero("0001-002020") - .withTipoDocumento(Catalog1_Guia.GUIA_REMISION_TRANSPORTISTA.toString()) - .build(), - GuiaRemisionRelacionadaInputModel.Builder.aGuiaRemisionRelacionadaInputModel() - .withSerieNumero("0002-002020") - .withTipoDocumento(Catalog1_Guia.GUIA_REMISION_TRANSPORTISTA.toString()) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - CreditNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/creditnote/guiaremisionrelacionada/guiaRemisionTransportista.xml"); - assertSendSunat(xml); - } - -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/creditnote/mindata/CreditNoteMinDataTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/creditnote/mindata/CreditNoteMinDataTest.java deleted file mode 100644 index 135c9b29..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/creditnote/mindata/CreditNoteMinDataTest.java +++ /dev/null @@ -1,477 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.integrationtest.ubl.creditnote.mindata; - -import io.github.project.openubl.xmlbuilderlib.facade.DocumentManager; -import io.github.project.openubl.xmlbuilderlib.facade.DocumentWrapper; -import io.github.project.openubl.xmlbuilderlib.integrationtest.AbstractUBLTest; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog6; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentLineInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.note.creditNote.CreditNoteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.note.creditNote.CreditNoteOutputModel; -import org.junit.jupiter.api.Test; - -import java.math.BigDecimal; -import java.util.Arrays; - -public class CreditNoteMinDataTest extends AbstractUBLTest { - - public CreditNoteMinDataTest() throws Exception { - } - - @Test - public void testCreditNoteWithMinDataSent_customerWithRuc() throws Exception { - // Given - CreditNoteInputModel input = CreditNoteInputModel.Builder.aCreditNoteInputModel() - .withSerie("FC01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("F001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - CreditNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/creditnote/mindata/MinData_RUC.xml"); - assertSendSunat(xml); - } - - @Test - void testCreditNoteWithMinDataSent_customerWithDni() throws Exception { - // Given - CreditNoteInputModel input = CreditNoteInputModel.Builder.aCreditNoteInputModel() - .withSerie("BC01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("B001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.DNI.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - CreditNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/creditnote/mindata/MinData_DNI.xml"); - assertSendSunat(xml); - } - - @Test - void testCreditNoteWithMinDataSent_customerWithDocTribNoDomSinRuc() throws Exception { - // Given - CreditNoteInputModel input = CreditNoteInputModel.Builder.aCreditNoteInputModel() - .withSerie("BC01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("B001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.DOC_TRIB_NO_DOM_SIN_RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - CreditNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/creditnote/mindata/MinData_DocTribNoDomSinRuc.xml"); - assertSendSunat(xml); - } - - @Test - void testCreditNoteWithMinDataSent_customerWithExtranjeria() throws Exception { - // Given - CreditNoteInputModel input = CreditNoteInputModel.Builder.aCreditNoteInputModel() - .withSerie("BC01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("B001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.EXTRANJERIA.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - CreditNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/creditnote/mindata/MinData_Extranjeria.xml"); - assertSendSunat(xml); - } - - @Test - void testCreditNoteWithMinDataSent_customerWithPasaporte() throws Exception { - // Given - CreditNoteInputModel input = CreditNoteInputModel.Builder.aCreditNoteInputModel() - .withSerie("BC01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("B001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.PASAPORTE.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - CreditNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/creditnote/mindata/MinData_Pasaporte.xml"); - assertSendSunat(xml); - } - - @Test - void testCreditNoteWithMinDataSent_customerWithDecDiplomatica() throws Exception { - // Given - CreditNoteInputModel input = CreditNoteInputModel.Builder.aCreditNoteInputModel() - .withSerie("BC01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("B001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.DEC_DIPLOMATICA.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - CreditNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/creditnote/mindata/MinData_DecDiplomatica.xml"); - assertSendSunat(xml); - } - - @Test - void testCreditNoteWithMinDataSent_usePrecioUnitario() throws Exception { - // Given - CreditNoteInputModel input = CreditNoteInputModel.Builder.aCreditNoteInputModel() - .withSerie("FC01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("F001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - CreditNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/creditnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgv.xml"); - assertSendSunat(xml); - } - - @Test - void testCreditNoteWithMinDataSent_usePrecioConIgv() throws Exception { - // Given - CreditNoteInputModel input = CreditNoteInputModel.Builder.aCreditNoteInputModel() - .withSerie("FC01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("F001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(118)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(118)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - CreditNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/creditnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgv.xml"); - assertSendSunat(xml); - } - - @Test - void testCreditNoteWithMinDataSent_usePrecioUnitarioAndCantidadThreeDecimals() throws Exception { - // Given - CreditNoteInputModel input = CreditNoteInputModel.Builder.aCreditNoteInputModel() - .withSerie("FC01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("F001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal("10.123")) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal("10.123")) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - CreditNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/creditnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgvAndCantidadThreeDecimals.xml"); - assertSendSunat(xml); - } - - @Test - void testCreditNoteWithMinDataSent_usePrecioConIgvAndCantidadThreeDecimals() throws Exception { - // Given - CreditNoteInputModel input = CreditNoteInputModel.Builder.aCreditNoteInputModel() - .withSerie("FC01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("F001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal("10.123")) - .withPrecioConIgv(new BigDecimal(118)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal("10.123")) - .withPrecioConIgv(new BigDecimal(118)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - CreditNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/creditnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgvAndCantidadThreeDecimals.xml"); - assertSendSunat(xml); - } -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/creditnote/otrosdocumentostributariosrelacionados/OtrosDocumentosTributariosRelacionadosTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/creditnote/otrosdocumentostributariosrelacionados/OtrosDocumentosTributariosRelacionadosTest.java deleted file mode 100644 index 2ac0e066..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/creditnote/otrosdocumentostributariosrelacionados/OtrosDocumentosTributariosRelacionadosTest.java +++ /dev/null @@ -1,255 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.integrationtest.ubl.creditnote.otrosdocumentostributariosrelacionados; - -import io.github.project.openubl.xmlbuilderlib.facade.DocumentManager; -import io.github.project.openubl.xmlbuilderlib.facade.DocumentWrapper; -import io.github.project.openubl.xmlbuilderlib.integrationtest.AbstractUBLTest; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog12_Doc_Trib_Relacionado_CreditNote; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog6; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentLineInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.note.creditNote.CreditNoteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.note.creditNote.DocTribRelacionadoInputModel_CreditNote; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.note.creditNote.CreditNoteOutputModel; -import org.junit.jupiter.api.Test; - -import java.math.BigDecimal; -import java.util.Arrays; - -public class OtrosDocumentosTributariosRelacionadosTest extends AbstractUBLTest { - - public OtrosDocumentosTributariosRelacionadosTest() throws Exception { - } - - @Test - void testFacturaEmitidaParaCorregirErrorEnElRuc() throws Exception { - // Given - CreditNoteInputModel input = CreditNoteInputModel.Builder.aCreditNoteInputModel() - .withSerie("FC01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("F001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .withOtrosDocumentosTributariosRelacionados(Arrays.asList( - DocTribRelacionadoInputModel_CreditNote.Builder.aDocTribRelacionadoInputModel_CreditNote() - .withSerieNumero("F001-1") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_CreditNote.FACTURA_EMITIDA_PARA_CORREGIR_ERROR_EN_EL_RUC.toString()) - .build(), - DocTribRelacionadoInputModel_CreditNote.Builder.aDocTribRelacionadoInputModel_CreditNote() - .withSerieNumero("F002-2") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_CreditNote.FACTURA_EMITIDA_PARA_CORREGIR_ERROR_EN_EL_RUC.toString()) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - CreditNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/creditnote/otrosdocumentostributariosrelacionados/facturaEmitidaParaCorregirErrorEnElRuc.xml"); - assertSendSunat(xml); - } - - @Test - void testTicketDeSalida() throws Exception { - // Given - CreditNoteInputModel input = CreditNoteInputModel.Builder.aCreditNoteInputModel() - .withSerie("FC01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("F001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .withOtrosDocumentosTributariosRelacionados(Arrays.asList( - DocTribRelacionadoInputModel_CreditNote.Builder.aDocTribRelacionadoInputModel_CreditNote() - .withSerieNumero("F001-1") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_CreditNote.TICKET_DE_SALIDA.toString()) - .build(), - DocTribRelacionadoInputModel_CreditNote.Builder.aDocTribRelacionadoInputModel_CreditNote() - .withSerieNumero("F002-2") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_CreditNote.TICKET_DE_SALIDA.toString()) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - CreditNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/creditnote/otrosdocumentostributariosrelacionados/ticketDeSalida.xml"); - assertSendSunat(xml); - } - - @Test - void testCodigoScop() throws Exception { - // Given - CreditNoteInputModel input = CreditNoteInputModel.Builder.aCreditNoteInputModel() - .withSerie("FC01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("F001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .withOtrosDocumentosTributariosRelacionados(Arrays.asList( - DocTribRelacionadoInputModel_CreditNote.Builder.aDocTribRelacionadoInputModel_CreditNote() - .withSerieNumero("F001-1") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_CreditNote.CODIGO_SCOP.toString()) - .build(), - DocTribRelacionadoInputModel_CreditNote.Builder.aDocTribRelacionadoInputModel_CreditNote() - .withSerieNumero("F002-2") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_CreditNote.CODIGO_SCOP.toString()) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - CreditNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/creditnote/otrosdocumentostributariosrelacionados/codigoScop.xml"); - assertSendSunat(xml); - } - - @Test - void testOtros() throws Exception { - // Given - CreditNoteInputModel input = CreditNoteInputModel.Builder.aCreditNoteInputModel() - .withSerie("FC01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("F001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .withOtrosDocumentosTributariosRelacionados(Arrays.asList( - DocTribRelacionadoInputModel_CreditNote.Builder.aDocTribRelacionadoInputModel_CreditNote() - .withSerieNumero("F001-1") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_CreditNote.OTROS.toString()) - .build(), - DocTribRelacionadoInputModel_CreditNote.Builder.aDocTribRelacionadoInputModel_CreditNote() - .withSerieNumero("F002-2") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_CreditNote.OTROS.toString()) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - CreditNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/creditnote/otrosdocumentostributariosrelacionados/otros.xml"); - assertSendSunat(xml); - } -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/creditnote/tiponota/CreditNoteTipoNotaTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/creditnote/tiponota/CreditNoteTipoNotaTest.java deleted file mode 100644 index 29ac959c..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/creditnote/tiponota/CreditNoteTipoNotaTest.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.integrationtest.ubl.creditnote.tiponota; - -import io.github.project.openubl.xmlbuilderlib.facade.DocumentManager; -import io.github.project.openubl.xmlbuilderlib.facade.DocumentWrapper; -import io.github.project.openubl.xmlbuilderlib.integrationtest.AbstractUBLTest; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog6; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog9; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentLineInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.note.creditNote.CreditNoteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.note.creditNote.CreditNoteOutputModel; -import org.junit.jupiter.api.Test; - -import java.math.BigDecimal; -import java.util.Arrays; - -public class CreditNoteTipoNotaTest extends AbstractUBLTest { - - public CreditNoteTipoNotaTest() throws Exception { - } - - @Test - void testCreditNoteTipoNota_GravadoOnerosa_precioUnitario() throws Exception { - // Given - CreditNoteInputModel input = CreditNoteInputModel.Builder.aCreditNoteInputModel() - .withSerie("FC01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("F001-1") - .withDescripcionSustento("mi sustento") - .withTipoNota(Catalog9.DESCUENTO_POR_ITEM.toString()) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - CreditNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/creditnote/tiponota/descuentoPorItem.xml"); - assertSendSunat(xml); - } - -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/debitnote/guiaremisionrelacionada/GuiaRemisionRelacionadaTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/debitnote/guiaremisionrelacionada/GuiaRemisionRelacionadaTest.java deleted file mode 100644 index 1c6d9884..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/debitnote/guiaremisionrelacionada/GuiaRemisionRelacionadaTest.java +++ /dev/null @@ -1,148 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.integrationtest.ubl.debitnote.guiaremisionrelacionada; - -import io.github.project.openubl.xmlbuilderlib.facade.DocumentManager; -import io.github.project.openubl.xmlbuilderlib.facade.DocumentWrapper; -import io.github.project.openubl.xmlbuilderlib.integrationtest.AbstractUBLTest; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1_Guia; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog6; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentLineInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.GuiaRemisionRelacionadaInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.note.debitNote.DebitNoteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.note.debitNote.DebitNoteOutputModel; -import org.junit.jupiter.api.Test; - -import java.math.BigDecimal; -import java.util.Arrays; - -public class GuiaRemisionRelacionadaTest extends AbstractUBLTest { - - public GuiaRemisionRelacionadaTest() throws Exception { - } - - @Test - void testGuiaRemisionRemitente() throws Exception { - // Given - DebitNoteInputModel input = DebitNoteInputModel.Builder.aDebitNoteInputModel() - .withSerie("FD01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("F001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .withGuiasRemisionRelacionadas(Arrays.asList( - GuiaRemisionRelacionadaInputModel.Builder.aGuiaRemisionRelacionadaInputModel() - .withSerieNumero("0001-002020") - .withTipoDocumento(Catalog1_Guia.GUIA_REMISION_REMITENTE.toString()) - .build(), - GuiaRemisionRelacionadaInputModel.Builder.aGuiaRemisionRelacionadaInputModel() - .withSerieNumero("0002-002020") - .withTipoDocumento(Catalog1_Guia.GUIA_REMISION_REMITENTE.toString()) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - DebitNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/debitnote/guiaremisionrelacionada/guiaRemisionRemitente.xml"); - assertSendSunat(xml); - } - - @Test - void testGuiaRemisionTransportista() throws Exception { - // Given - DebitNoteInputModel input = DebitNoteInputModel.Builder.aDebitNoteInputModel() - .withSerie("FD01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("F001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .withGuiasRemisionRelacionadas(Arrays.asList( - GuiaRemisionRelacionadaInputModel.Builder.aGuiaRemisionRelacionadaInputModel() - .withSerieNumero("0001-002020") - .withTipoDocumento(Catalog1_Guia.GUIA_REMISION_TRANSPORTISTA.toString()) - .build(), - GuiaRemisionRelacionadaInputModel.Builder.aGuiaRemisionRelacionadaInputModel() - .withSerieNumero("0002-002020") - .withTipoDocumento(Catalog1_Guia.GUIA_REMISION_TRANSPORTISTA.toString()) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - DebitNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/debitnote/guiaremisionrelacionada/guiaRemisionTransportista.xml"); - assertSendSunat(xml); - } - -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/debitnote/mindata/DebitNoteMinDataTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/debitnote/mindata/DebitNoteMinDataTest.java deleted file mode 100644 index 71fb9d50..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/debitnote/mindata/DebitNoteMinDataTest.java +++ /dev/null @@ -1,486 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.integrationtest.ubl.debitnote.mindata; - -import io.github.project.openubl.xmlbuilderlib.facade.DocumentManager; -import io.github.project.openubl.xmlbuilderlib.facade.DocumentWrapper; -import io.github.project.openubl.xmlbuilderlib.integrationtest.AbstractUBLTest; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog6; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentLineInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.note.debitNote.DebitNoteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.note.debitNote.DebitNoteOutputModel; -import org.junit.jupiter.api.Test; - -import java.math.BigDecimal; -import java.util.Arrays; - -public class DebitNoteMinDataTest extends AbstractUBLTest { - - public DebitNoteMinDataTest() throws Exception { - } - - @Test - void testDebitNoteWithMinDataSent_customerWithRuc() throws Exception { - // Given - DebitNoteInputModel input = DebitNoteInputModel.Builder.aDebitNoteInputModel() - .withSerie("FD01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("F001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - DebitNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/debitnote/mindata/MinData_RUC.xml"); - assertSendSunat(xml); - } - - @Test - void testDebitNoteWithMinDataSent_customerWithDni() throws Exception { - // Given - DebitNoteInputModel input = DebitNoteInputModel.Builder.aDebitNoteInputModel() - .withSerie("BD01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("B001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.DNI.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - DebitNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/debitnote/mindata/MinData_DNI.xml"); - assertSendSunat(xml); - } - - @Test - void testDebitNoteWithMinDataSent_customerWithDocTribNoDomSinRuc() throws Exception { - // Given - DebitNoteInputModel input = DebitNoteInputModel.Builder.aDebitNoteInputModel() - .withSerie("BD01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("B001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.DOC_TRIB_NO_DOM_SIN_RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - DebitNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/debitnote/mindata/MinData_DocTribNoDomSinRuc.xml"); - assertSendSunat(xml); - } - - @Test - void testDebitNoteWithMinDataSent_customerWithExtranjeria() throws Exception { - // Given - DebitNoteInputModel input = DebitNoteInputModel.Builder.aDebitNoteInputModel() - .withSerie("BD01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("B001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.EXTRANJERIA.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - DebitNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/debitnote/mindata/MinData_Extranjeria.xml"); - assertSendSunat(xml); - } - - @Test - void testDebitNoteWithMinDataSent_customerWithPasaporte() throws Exception { - // Given - DebitNoteInputModel input = DebitNoteInputModel.Builder.aDebitNoteInputModel() - .withSerie("BD01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("B001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.PASAPORTE.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - DebitNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/debitnote/mindata/MinData_Pasaporte.xml"); - assertSendSunat(xml); - } - - @Test - void testDebitNoteWithMinDataSent_customerWithDecDiplomatica() throws Exception { - // Given - DebitNoteInputModel input = DebitNoteInputModel.Builder.aDebitNoteInputModel() - .withSerie("BD01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("B001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.DEC_DIPLOMATICA.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - DebitNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/debitnote/mindata/MinData_DecDiplomatica.xml"); - assertSendSunat(xml); - } - - @Test - void testDebitNoteWithMinDataSent_usePrecioUnitario() throws Exception { - // Given - DebitNoteInputModel input = DebitNoteInputModel.Builder.aDebitNoteInputModel() - .withSerie("FD01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("F001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - DebitNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/debitnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgv.xml"); - assertSendSunat(xml); - } - - @Test - void testDebitNoteWithMinDataSent_usePrecioConIgv() throws Exception { - // Given - DebitNoteInputModel input = DebitNoteInputModel.Builder.aDebitNoteInputModel() - .withSerie("FD01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("F001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(118)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(118)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - DebitNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/debitnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgv.xml"); - assertSendSunat(xml); - } - - @Test - void testDebitNoteWithMinDataSent_usePrecioUnitarioAndCantidadThreeDecimals() throws Exception { - // Given - DebitNoteInputModel input = DebitNoteInputModel.Builder.aDebitNoteInputModel() - .withSerie("FC01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("F001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal("10.123")) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal("10.123")) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - DebitNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/debitnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgvAndCantidadThreeDecimals.xml"); - assertSendSunat(xml); - } - - @Test - void testDebitNoteWithMinDataSent_usePrecioConIgvAndCantidadThreeDecimals() throws Exception { - // Given - DebitNoteInputModel input = DebitNoteInputModel.Builder.aDebitNoteInputModel() - .withSerie("FC01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("F001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal("10.123")) - .withPrecioConIgv(new BigDecimal(118)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal("10.123")) - .withPrecioConIgv(new BigDecimal(118)) - .build()) - ) - .build(); - - - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - DebitNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/debitnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgvAndCantidadThreeDecimals.xml"); - assertSendSunat(xml); - } - -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/debitnote/otrosdocumentostributariosrelacionados/OtrosDocumentosTributariosRelacionadosTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/debitnote/otrosdocumentostributariosrelacionados/OtrosDocumentosTributariosRelacionadosTest.java deleted file mode 100644 index 8dd7d487..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/debitnote/otrosdocumentostributariosrelacionados/OtrosDocumentosTributariosRelacionadosTest.java +++ /dev/null @@ -1,201 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.integrationtest.ubl.debitnote.otrosdocumentostributariosrelacionados; - -import io.github.project.openubl.xmlbuilderlib.facade.DocumentManager; -import io.github.project.openubl.xmlbuilderlib.facade.DocumentWrapper; -import io.github.project.openubl.xmlbuilderlib.integrationtest.AbstractUBLTest; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog12_Doc_Trib_Relacionado_DebitNote; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog6; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentLineInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.note.debitNote.DebitNoteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.note.debitNote.DocTribRelacionadoInputModel_DebitNote; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.note.debitNote.DebitNoteOutputModel; -import org.junit.jupiter.api.Test; - -import java.math.BigDecimal; -import java.util.Arrays; - -public class OtrosDocumentosTributariosRelacionadosTest extends AbstractUBLTest { - - public OtrosDocumentosTributariosRelacionadosTest() throws Exception { - } - - @Test - void testTicketDeSalida() throws Exception { - // Given - DebitNoteInputModel input = DebitNoteInputModel.Builder.aDebitNoteInputModel() - .withSerie("FC01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("F001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .withOtrosDocumentosTributariosRelacionados(Arrays.asList( - DocTribRelacionadoInputModel_DebitNote.Builder.aDocTribRelacionadoInputModel_DebitNote() - .withSerieNumero("F001-1") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_DebitNote.TICKET_DE_SALIDA.toString()) - .build(), - DocTribRelacionadoInputModel_DebitNote.Builder.aDocTribRelacionadoInputModel_DebitNote() - .withSerieNumero("F002-2") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_DebitNote.TICKET_DE_SALIDA.toString()) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - DebitNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/debitnote/otrosdocumentostributariosrelacionados/ticketDeSalida.xml"); - assertSendSunat(xml); - } - - @Test - void testCodigoScop() throws Exception { - // Given - DebitNoteInputModel input = DebitNoteInputModel.Builder.aDebitNoteInputModel() - .withSerie("FC01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("F001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .withOtrosDocumentosTributariosRelacionados(Arrays.asList( - DocTribRelacionadoInputModel_DebitNote.Builder.aDocTribRelacionadoInputModel_DebitNote() - .withSerieNumero("F001-1") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_DebitNote.CODIGO_SCOP.toString()) - .build(), - DocTribRelacionadoInputModel_DebitNote.Builder.aDocTribRelacionadoInputModel_DebitNote() - .withSerieNumero("F002-2") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_DebitNote.CODIGO_SCOP.toString()) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - DebitNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/debitnote/otrosdocumentostributariosrelacionados/codigoScop.xml"); - assertSendSunat(xml); - } - - @Test - void testOtros() throws Exception { - // Given - DebitNoteInputModel input = DebitNoteInputModel.Builder.aDebitNoteInputModel() - .withSerie("FC01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("F001-1") - .withDescripcionSustento("mi sustento") - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .withOtrosDocumentosTributariosRelacionados(Arrays.asList( - DocTribRelacionadoInputModel_DebitNote.Builder.aDocTribRelacionadoInputModel_DebitNote() - .withSerieNumero("F001-1") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_DebitNote.OTROS.toString()) - .build(), - DocTribRelacionadoInputModel_DebitNote.Builder.aDocTribRelacionadoInputModel_DebitNote() - .withSerieNumero("F002-2") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_DebitNote.OTROS.toString()) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - DebitNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/debitnote/otrosdocumentostributariosrelacionados/otros.xml"); - assertSendSunat(xml); - } -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/debitnote/tiponota/DebitNoteTipoNotaTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/debitnote/tiponota/DebitNoteTipoNotaTest.java deleted file mode 100644 index 6e9b9e8d..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/debitnote/tiponota/DebitNoteTipoNotaTest.java +++ /dev/null @@ -1,85 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.integrationtest.ubl.debitnote.tiponota; - -import io.github.project.openubl.xmlbuilderlib.facade.DocumentManager; -import io.github.project.openubl.xmlbuilderlib.facade.DocumentWrapper; -import io.github.project.openubl.xmlbuilderlib.integrationtest.AbstractUBLTest; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog10; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog6; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentLineInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.note.debitNote.DebitNoteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.note.debitNote.DebitNoteOutputModel; -import org.junit.jupiter.api.Test; - -import java.math.BigDecimal; -import java.util.Arrays; - -public class DebitNoteTipoNotaTest extends AbstractUBLTest { - - public DebitNoteTipoNotaTest() throws Exception { - } - - @Test - void testDebitNoteTipoNota_GravadoOnerosa_precioUnitario() throws Exception { - // Given - DebitNoteInputModel input = DebitNoteInputModel.Builder.aDebitNoteInputModel() - .withSerie("FC01") - .withNumero(1) - .withSerieNumeroComprobanteAfectado("F001-1") - .withDescripcionSustento("mi sustento") - .withTipoNota(Catalog10.PENALIDAD_OTROS_CONCEPTOS.toString()) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - DebitNoteOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/debitnote/tiponota/descuentoPorItem.xml"); - assertSendSunat(xml); - } - -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/invoice/InvoiceTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/invoice/InvoiceTest.java deleted file mode 100644 index 186e5c91..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/invoice/InvoiceTest.java +++ /dev/null @@ -1,440 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.integrationtest.ubl.invoice; - -import io.github.project.openubl.xmlbuilderlib.facade.DocumentManager; -import io.github.project.openubl.xmlbuilderlib.facade.DocumentWrapper; -import io.github.project.openubl.xmlbuilderlib.integrationtest.AbstractUBLTest; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog6; -import io.github.project.openubl.xmlbuilderlib.models.input.common.*; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentLineInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.invoice.InvoiceInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.invoice.InvoiceOutputModel; -import org.junit.jupiter.api.Test; - -import java.math.BigDecimal; -import java.util.Arrays; -import java.util.Calendar; - -public class InvoiceTest extends AbstractUBLTest { - - public InvoiceTest() throws Exception { - } - - @Test - void testInvoiceWithCustomUnidadMedida() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withUnidadMedida("KGM") - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withUnidadMedida("KGM") - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/customUnidadMedida.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceWithCustomFechaEmision() throws Exception { - // Given - Calendar calendar = Calendar.getInstance(); - calendar.set(2019, Calendar.JANUARY, 6, 0, 0, 0); - calendar.setTimeZone(timeZone); - - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withFechaEmision(calendar.getTimeInMillis()) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/customFechaEmision.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceWithCustomClienteDireccionAndContacto() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .withContacto(ContactoInputModel.Builder.aContactoInputModel() - .withEmail("carlos@gmail.com") - .withTelefono("+123456789") - .build()) - .withDireccion(DireccionInputModel.Builder.aDireccionInputModel() - .withUbigeo("050101") - .withDepartamento("Ayacucho") - .withProvincia("Huamanga") - .withDistrito("Jesus Nazareno") - .withCodigoLocal("0101") - .withUrbanizacion("000000") - .withDireccion("Jr. Las piedras 123") - .withCodigoPais("PE") - .build()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/customClienteDireccionAndContacto.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceWithCustomProveedorDireccionAndContacto() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .withContacto(ContactoInputModel.Builder.aContactoInputModel() - .withEmail("carlos@gmail.com") - .withTelefono("+123456789") - .build()) - .withDireccion(DireccionInputModel.Builder.aDireccionInputModel() - .withUbigeo("050101") - .withDepartamento("Ayacucho") - .withProvincia("Huamanga") - .withDistrito("Jesus Nazareno") - .withCodigoLocal("0001") - .withUrbanizacion("000000") - .withDireccion("Jr. Las piedras 123") - .withCodigoPais("PE") - .build()) - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/customProveedorDireccionAndContacto.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceWithCustomFirmante() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withFirmante(FirmanteInputModel.Builder.aFirmanteInputModel() - .withRuc("000000000000") - .withRazonSocial("Wolsnut4 S.A.C.") - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/customFirmante.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceWithICB_precioUnitario() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withFirmante(FirmanteInputModel.Builder.aFirmanteInputModel() - .withRuc("000000000000") - .withRazonSocial("Wolsnut4 S.A.C.") - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withIcb(true) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withIcb(true) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/icb.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceWithICB_precioConIgv() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withFirmante(FirmanteInputModel.Builder.aFirmanteInputModel() - .withRuc("000000000000") - .withRazonSocial("Wolsnut4 S.A.C.") - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(118)) - .withIcb(true) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(118)) - .withIcb(true) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/icb.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceWithCustomProveedor_direccionNotNullAndCodigoLocalNull() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Project OpenUBL S.A.C.") - .withDireccion(DireccionInputModel.Builder.aDireccionInputModel() - .withDireccion("Jr. las flores 123") - .build() - ) - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withFirmante(FirmanteInputModel.Builder.aFirmanteInputModel() - .withRuc("000000000000") - .withRazonSocial("Wolsnut4 S.A.C.") - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(118)) - .withIcb(true) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(118)) - .withIcb(true) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/customCodigoLocal.xml"); - assertSendSunat(xml); - } -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/invoice/anticipos/AnticiposTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/invoice/anticipos/AnticiposTest.java deleted file mode 100644 index c1de252a..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/invoice/anticipos/AnticiposTest.java +++ /dev/null @@ -1,149 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.integrationtest.ubl.invoice.anticipos; - -import io.github.project.openubl.xmlbuilderlib.facade.DocumentManager; -import io.github.project.openubl.xmlbuilderlib.facade.DocumentWrapper; -import io.github.project.openubl.xmlbuilderlib.integrationtest.AbstractUBLTest; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog12_Anticipo; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog6; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentLineInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.invoice.AnticipoInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.invoice.InvoiceInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.invoice.InvoiceOutputModel; -import org.junit.jupiter.api.Test; - -import java.math.BigDecimal; -import java.util.Arrays; - -public class AnticiposTest extends AbstractUBLTest { - - public AnticiposTest() throws Exception { - } - -// @Test -// void testFacturaEmitidaPorAnticipos() throws Exception { -// // Given -// InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() -// .withSerie("F001") -// .withNumero(1) -// .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() -// .withRuc("12345678912") -// .withRazonSocial("Softgreen S.A.C.") -// .build() -// ) -// .withCliente(ClienteInputModel.Builder.aClienteInputModel() -// .withNombre("Carlos Feria") -// .withNumeroDocumentoIdentidad("12121212121") -// .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) -// .build() -// ) -// .withDetalle(Arrays.asList( -// DocumentLineInputModel.Builder.aDocumentLineInputModel() -// .withDescripcion("Item1") -// .withCantidad(new BigDecimal(10)) -// .withPrecioUnitario(new BigDecimal(100)) -// .build(), -// DocumentLineInputModel.Builder.aDocumentLineInputModel() -// .withDescripcion("Item2") -// .withCantidad(new BigDecimal(10)) -// .withPrecioUnitario(new BigDecimal(100)) -// .build()) -// ) -// .withAnticipos(Arrays.asList( -// AnticipoInputModel.Builder.anAnticipoInputModel() -// .withSerieNumero("F999-1") -// .withTipoDocumento(Catalog12_Anticipo.FACTURA_EMITIDA_POR_ANTICIPOS.toString()) -// .withMontoTotal(new BigDecimal("180")) -// .build(), -// AnticipoInputModel.Builder.anAnticipoInputModel() -// .withSerieNumero("F999-2") -// .withTipoDocumento(Catalog12_Anticipo.FACTURA_EMITIDA_POR_ANTICIPOS.toString()) -// .withMontoTotal(new BigDecimal("180")) -// .build() -// )) -// .build(); -// -// -// // When -// DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); -// InvoiceOutputModel output = result.getOutput(); -// String xml = result.getXml(); -// -// // Then -// assertOutputHasNoConstraintViolations(validator, output); -// assertSnapshot(xml, "xml/invoice/anticipos/facturaEmitidaPorAnticipos.xml"); -// assertSendSunat(xml); -// } -// -// @Test -// void testBoletaEmitidaPorAnticipos() throws Exception { -// // Given -// InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() -// .withSerie("F001") -// .withNumero(1) -// .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() -// .withRuc("12345678912") -// .withRazonSocial("Softgreen S.A.C.") -// .build() -// ) -// .withCliente(ClienteInputModel.Builder.aClienteInputModel() -// .withNombre("Carlos Feria") -// .withNumeroDocumentoIdentidad("12121212121") -// .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) -// .build() -// ) -// .withDetalle(Arrays.asList( -// DocumentLineInputModel.Builder.aDocumentLineInputModel() -// .withDescripcion("Item1") -// .withCantidad(new BigDecimal(10)) -// .withPrecioUnitario(new BigDecimal(100)) -// .build(), -// DocumentLineInputModel.Builder.aDocumentLineInputModel() -// .withDescripcion("Item2") -// .withCantidad(new BigDecimal(10)) -// .withPrecioUnitario(new BigDecimal(100)) -// .build()) -// ) -// .withAnticipos(Arrays.asList( -// AnticipoInputModel.Builder.anAnticipoInputModel() -// .withSerieNumero("B999-1") -// .withTipoDocumento(Catalog12_Anticipo.BOLETA_DE_VENTA_EMITIDA_POR_ANTICIPOS.toString()) -// .withMontoTotal(new BigDecimal("180")) -// .build(), -// AnticipoInputModel.Builder.anAnticipoInputModel() -// .withSerieNumero("B999-2") -// .withTipoDocumento(Catalog12_Anticipo.BOLETA_DE_VENTA_EMITIDA_POR_ANTICIPOS.toString()) -// .withMontoTotal(new BigDecimal("180")) -// .build() -// )) -// .build(); -// -// -// // When -// DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); -// InvoiceOutputModel output = result.getOutput(); -// String xml = result.getXml(); -// -// // Then -// assertOutputHasNoConstraintViolations(validator, output); -// assertSnapshot(xml, "xml/invoice/anticipos/boletaEmitidaPorAnticipos.xml"); -// assertSendSunat(xml); -// } -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/invoice/formapago/InvoiceFormaPagoTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/invoice/formapago/InvoiceFormaPagoTest.java deleted file mode 100644 index c20e9b20..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/invoice/formapago/InvoiceFormaPagoTest.java +++ /dev/null @@ -1,324 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.integrationtest.ubl.invoice.formapago; - -import io.github.project.openubl.xmlbuilderlib.facade.DocumentManager; -import io.github.project.openubl.xmlbuilderlib.facade.DocumentWrapper; -import io.github.project.openubl.xmlbuilderlib.integrationtest.AbstractUBLTest; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog6; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.CuotaDePagoInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentLineInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.invoice.InvoiceInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.invoice.InvoiceOutputModel; -import org.junit.jupiter.api.Test; - -import java.math.BigDecimal; -import java.util.Arrays; -import java.util.Calendar; - -public class InvoiceFormaPagoTest extends AbstractUBLTest { - - public InvoiceFormaPagoTest() throws Exception { - } - - @Test - void testFacturaWithFormaPagoContadoPorDefecto() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/formapago/sinFormaPagoFactura.xml"); - assertSendSunat(xml); - } - - @Test - void testBoletaFacturaWithFormaPagoContadoPorDefecto() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("B001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.DNI.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/formapago/sinFormaPagoBoleta.xml"); - assertSendSunat(xml); - } - - @Test - void testFacturaWithFormaPagoCredito() throws Exception { - Calendar calendar = Calendar.getInstance(); - calendar.set(2019, Calendar.JANUARY, 6, 0, 0, 0); - calendar.setTimeZone(timeZone); - - long fechaEmision = calendar.getTimeInMillis(); - - calendar.add(Calendar.DAY_OF_MONTH, 1); - long fechaCuota1 = calendar.getTimeInMillis(); - - calendar.add(Calendar.DAY_OF_MONTH, 1); - long fechaCuota2 = calendar.getTimeInMillis(); - - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withFechaEmision(fechaEmision) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .withCuotasDePago(Arrays.asList( - CuotaDePagoInputModel.Builder.aFormaPagoCuotaInputModel() - .withMonto(new BigDecimal(2000)) - .withFechaPago(fechaCuota1) - .build(), - CuotaDePagoInputModel.Builder.aFormaPagoCuotaInputModel() - .withMonto(new BigDecimal(360)) - .withFechaPago(fechaCuota2) - .build() - )) - .build(); - - - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/formapago/conFormaPagoFactura.xml"); - assertSendSunat(xml); - } - - @Test - void testBoletaWithFormaPagoCredito() throws Exception { - Calendar calendar = Calendar.getInstance(); - calendar.set(2019, Calendar.JANUARY, 6, 0, 0, 0); - calendar.setTimeZone(timeZone); - - long fechaEmision = calendar.getTimeInMillis(); - - calendar.add(Calendar.DAY_OF_MONTH, 1); - long fechaCuota1 = calendar.getTimeInMillis(); - - calendar.add(Calendar.DAY_OF_MONTH, 1); - long fechaCuota2 = calendar.getTimeInMillis(); - - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("B001") - .withNumero(1) - .withFechaEmision(fechaEmision) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.DNI.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .withCuotasDePago(Arrays.asList( - CuotaDePagoInputModel.Builder.aFormaPagoCuotaInputModel() - .withMonto(new BigDecimal(2000)) - .withFechaPago(fechaCuota1) - .build(), - CuotaDePagoInputModel.Builder.aFormaPagoCuotaInputModel() - .withMonto(new BigDecimal(360)) - .withFechaPago(fechaCuota2) - .build() - )) - .build(); - - - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/formapago/conFormaPagoBoleta.xml"); - assertSendSunat(xml); - } - - @Test - void testFacturaWithFormaPagoCredito_usingPercetajePayments() throws Exception { - Calendar calendar = Calendar.getInstance(); - calendar.set(2019, Calendar.JANUARY, 6, 0, 0, 0); - calendar.setTimeZone(timeZone); - - long fechaEmision = calendar.getTimeInMillis(); - - calendar.add(Calendar.DAY_OF_MONTH, 1); - long fechaCuota1 = calendar.getTimeInMillis(); - - calendar.add(Calendar.DAY_OF_MONTH, 1); - long fechaCuota2 = calendar.getTimeInMillis(); - - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withFechaEmision(fechaEmision) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .withCuotasDePago(Arrays.asList( - CuotaDePagoInputModel.Builder.aFormaPagoCuotaInputModel() - .withPorcentaje(new BigDecimal(10)) - .withFechaPago(fechaCuota1) - .build(), - CuotaDePagoInputModel.Builder.aFormaPagoCuotaInputModel() - .withPorcentaje(new BigDecimal(90)) - .withFechaPago(fechaCuota2) - .build() - )) - .build(); - - - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/formapago/conFormaPagoFactura_porcentaje.xml"); - assertSendSunat(xml); - } -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/invoice/guiaremisionrelacionada/GuiaRemisionRelacionadaTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/invoice/guiaremisionrelacionada/GuiaRemisionRelacionadaTest.java deleted file mode 100644 index 5d435c6e..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/invoice/guiaremisionrelacionada/GuiaRemisionRelacionadaTest.java +++ /dev/null @@ -1,146 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.integrationtest.ubl.invoice.guiaremisionrelacionada; - -import io.github.project.openubl.xmlbuilderlib.facade.DocumentManager; -import io.github.project.openubl.xmlbuilderlib.facade.DocumentWrapper; -import io.github.project.openubl.xmlbuilderlib.integrationtest.AbstractUBLTest; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1_Guia; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog6; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentLineInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.GuiaRemisionRelacionadaInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.invoice.InvoiceInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.invoice.InvoiceOutputModel; -import org.junit.jupiter.api.Test; - -import java.math.BigDecimal; -import java.util.Arrays; - -public class GuiaRemisionRelacionadaTest extends AbstractUBLTest { - - public GuiaRemisionRelacionadaTest() throws Exception { - } - - @Test - void testGuiaRemisionRemitente() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .withGuiasRemisionRelacionadas(Arrays.asList( - GuiaRemisionRelacionadaInputModel.Builder.aGuiaRemisionRelacionadaInputModel() - .withSerieNumero("0001-002020") - .withTipoDocumento(Catalog1_Guia.GUIA_REMISION_REMITENTE.toString()) - .build(), - GuiaRemisionRelacionadaInputModel.Builder.aGuiaRemisionRelacionadaInputModel() - .withSerieNumero("0002-002020") - .withTipoDocumento(Catalog1_Guia.GUIA_REMISION_REMITENTE.toString()) - .build() - )) - .build(); - - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/guiaremisionrelacionada/guiaRemisionRemitente.xml"); - assertSendSunat(xml); - } - - @Test - void testGuiaRemisionTransportista() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .withGuiasRemisionRelacionadas(Arrays.asList( - GuiaRemisionRelacionadaInputModel.Builder.aGuiaRemisionRelacionadaInputModel() - .withSerieNumero("0001-002020") - .withTipoDocumento(Catalog1_Guia.GUIA_REMISION_TRANSPORTISTA.toString()) - .build(), - GuiaRemisionRelacionadaInputModel.Builder.aGuiaRemisionRelacionadaInputModel() - .withSerieNumero("0002-002020") - .withTipoDocumento(Catalog1_Guia.GUIA_REMISION_TRANSPORTISTA.toString()) - .build() - )) - .build(); - - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/guiaremisionrelacionada/guiaRemisionTransportista.xml"); - assertSendSunat(xml); - } - -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/invoice/issues/Issue30.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/invoice/issues/Issue30.java deleted file mode 100644 index 1e0ba6a2..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/invoice/issues/Issue30.java +++ /dev/null @@ -1,229 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.integrationtest.ubl.invoice.issues; - -import io.github.project.openubl.xmlbuilderlib.facade.DocumentManager; -import io.github.project.openubl.xmlbuilderlib.facade.DocumentWrapper; -import io.github.project.openubl.xmlbuilderlib.integrationtest.AbstractUBLTest; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog6; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.DireccionInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.FirmanteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentLineInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.invoice.InvoiceInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.invoice.InvoiceOutputModel; -import org.junit.jupiter.api.Test; - -import java.math.BigDecimal; -import java.util.Collections; - -/** - * Description: La base imponible a nivel de linea difiere de la información consiganada en el comprobante - * Issue: https://github.com/project-openubl/xbuilder/issues/30 - */ -public class Issue30 extends AbstractUBLTest { - - public Issue30() throws Exception { - } - - @Test - void testInvoice_withPrecioUnitario() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Project OpenUBL S.A.C.") - .withDireccion(DireccionInputModel.Builder.aDireccionInputModel() - .withDireccion("Jr. las flores 123") - .build() - ) - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withFirmante(FirmanteInputModel.Builder.aFirmanteInputModel() - .withRuc("000000000000") - .withRazonSocial("Wolsnut4 S.A.C.") - .build() - ) - .withDetalle(Collections.singletonList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal("10")) - .withPrecioUnitario(new BigDecimal("6.68")) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/issues/issue-30-with-precioUnitario.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoice_withPrecioConIgv() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Project OpenUBL S.A.C.") - .withDireccion(DireccionInputModel.Builder.aDireccionInputModel() - .withDireccion("Jr. las flores 123") - .build() - ) - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withFirmante(FirmanteInputModel.Builder.aFirmanteInputModel() - .withRuc("000000000000") - .withRazonSocial("Wolsnut4 S.A.C.") - .build() - ) - .withDetalle(Collections.singletonList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal("10")) - .withPrecioConIgv(new BigDecimal("7.88")) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/issues/issue-30-with-precioConIgv.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoice_withPrecioUnitario_andICB() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Project OpenUBL S.A.C.") - .withDireccion(DireccionInputModel.Builder.aDireccionInputModel() - .withDireccion("Jr. las flores 123") - .build() - ) - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withFirmante(FirmanteInputModel.Builder.aFirmanteInputModel() - .withRuc("000000000000") - .withRazonSocial("Wolsnut4 S.A.C.") - .build() - ) - .withDetalle(Collections.singletonList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal("10")) - .withPrecioUnitario(new BigDecimal("6.68")) - .withIcb(true) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/issues/issue-30-with-precioUnitario_andICB.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoice_withPrecioConIgv_andICB() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Project OpenUBL S.A.C.") - .withDireccion(DireccionInputModel.Builder.aDireccionInputModel() - .withDireccion("Jr. las flores 123") - .build() - ) - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withFirmante(FirmanteInputModel.Builder.aFirmanteInputModel() - .withRuc("000000000000") - .withRazonSocial("Wolsnut4 S.A.C.") - .build() - ) - .withDetalle(Collections.singletonList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal("10")) - .withPrecioConIgv(new BigDecimal("7.88")) - .withIcb(true) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/issues/issue-30-with-precioConIgv_andICB.xml"); - assertSendSunat(xml); - } -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/invoice/mindata/InvoiceMinDataTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/invoice/mindata/InvoiceMinDataTest.java deleted file mode 100644 index 9c6de7ca..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/invoice/mindata/InvoiceMinDataTest.java +++ /dev/null @@ -1,459 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.integrationtest.ubl.invoice.mindata; - -import io.github.project.openubl.xmlbuilderlib.facade.DocumentManager; -import io.github.project.openubl.xmlbuilderlib.facade.DocumentWrapper; -import io.github.project.openubl.xmlbuilderlib.integrationtest.AbstractUBLTest; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog6; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentLineInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.invoice.InvoiceInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.invoice.InvoiceOutputModel; -import org.junit.jupiter.api.Test; - -import java.math.BigDecimal; -import java.util.Arrays; - -public class InvoiceMinDataTest extends AbstractUBLTest { - - public InvoiceMinDataTest() throws Exception { - } - - @Test - void testInvoiceWithMinDataSent_customerWithRuc() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/mindata/MinData_RUC.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceWithMinDataSent_customerWithDni() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("B001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.DNI.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/mindata/MinData_DNI.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceWithMinDataSent_customerWithDocTribNoDomSinRuc() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("B001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.DOC_TRIB_NO_DOM_SIN_RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/mindata/MinData_DocTribNoDomSinRuc.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceWithMinDataSent_customerWithExtranjeria() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("B001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.EXTRANJERIA.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/mindata/MinData_Extranjeria.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceWithMinDataSent_customerWithPasaporte() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("B001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.PASAPORTE.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/mindata/MinData_Pasaporte.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceWithMinDataSent_customerWithDecDiplomatica() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("B001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.DEC_DIPLOMATICA.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/mindata/MinData_DecDiplomatica.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceWithMinDataSent_usePrecioUnitario() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/mindata/MinData_UsePrecioUnitarioOPrecioConIgv.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceWithMinDataSent_usePrecioConIgv() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(118)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(118)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/mindata/MinData_UsePrecioUnitarioOPrecioConIgv.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceWithMinDataSent_usePrecioUnitarioAndCantidadThreeDecimals() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal("10.123")) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal("10.123")) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/mindata/MinData_UsePrecioUnitarioOPrecioConIgvAndCantidadThreeDecimals.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceWithMinDataSent_usePrecioConIgvAndCantidadThreeDecimals() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal("10.123")) - .withPrecioConIgv(new BigDecimal(118)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal("10.123")) - .withPrecioConIgv(new BigDecimal(118)) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/mindata/MinData_UsePrecioUnitarioOPrecioConIgvAndCantidadThreeDecimals.xml"); - assertSendSunat(xml); - } -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/invoice/otrosdocumentostributariosrelacionados/OtrosDocumentosTributariosRelacionadosTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/invoice/otrosdocumentostributariosrelacionados/OtrosDocumentosTributariosRelacionadosTest.java deleted file mode 100644 index 00c836af..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/invoice/otrosdocumentostributariosrelacionados/OtrosDocumentosTributariosRelacionadosTest.java +++ /dev/null @@ -1,404 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.integrationtest.ubl.invoice.otrosdocumentostributariosrelacionados; - -import io.github.project.openubl.xmlbuilderlib.facade.DocumentManager; -import io.github.project.openubl.xmlbuilderlib.facade.DocumentWrapper; -import io.github.project.openubl.xmlbuilderlib.integrationtest.AbstractUBLTest; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog12_Doc_Trib_Relacionado_Invoice; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog6; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentLineInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.invoice.DocTribRelacionadoInputModel_Invoice; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.invoice.InvoiceInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.invoice.InvoiceOutputModel; -import org.junit.jupiter.api.Test; - -import java.math.BigDecimal; -import java.util.Arrays; - -public class OtrosDocumentosTributariosRelacionadosTest extends AbstractUBLTest { - - public OtrosDocumentosTributariosRelacionadosTest() throws Exception { - } - - @Test - void testTicketDeSalida() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .withOtrosDocumentosTributariosRelacionados(Arrays.asList( - DocTribRelacionadoInputModel_Invoice.Builder.aDocTribRelacionadoInputModel_Invoice() - .withSerieNumero("F001-1") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_Invoice.TICKET_DE_SALIDA.toString()) - .build(), - DocTribRelacionadoInputModel_Invoice.Builder.aDocTribRelacionadoInputModel_Invoice() - .withSerieNumero("F002-2") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_Invoice.TICKET_DE_SALIDA.toString()) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/otrosdocumentostributariosrelacionados/ticketDeSalida.xml"); - assertSendSunat(xml); - } - - @Test - void testCodigoScop() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .withOtrosDocumentosTributariosRelacionados(Arrays.asList( - DocTribRelacionadoInputModel_Invoice.Builder.aDocTribRelacionadoInputModel_Invoice() - .withSerieNumero("F001-1") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_Invoice.CODIGO_SCOP.toString()) - .build(), - DocTribRelacionadoInputModel_Invoice.Builder.aDocTribRelacionadoInputModel_Invoice() - .withSerieNumero("F002-2") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_Invoice.CODIGO_SCOP.toString()) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/otrosdocumentostributariosrelacionados/codigoScop.xml"); - assertSendSunat(xml); - } - - @Test - void testFacturaElectronicaRemitente() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .withOtrosDocumentosTributariosRelacionados(Arrays.asList( - DocTribRelacionadoInputModel_Invoice.Builder.aDocTribRelacionadoInputModel_Invoice() - .withSerieNumero("F001-1") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_Invoice.FACTURA_ELECTRONICA_REMITENTE.toString()) - .build(), - DocTribRelacionadoInputModel_Invoice.Builder.aDocTribRelacionadoInputModel_Invoice() - .withSerieNumero("F002-2") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_Invoice.FACTURA_ELECTRONICA_REMITENTE.toString()) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/otrosdocumentostributariosrelacionados/facturaElectronicaRemitente.xml"); - assertSendSunat(xml); - } - - @Test - void testGuiaRemisionRemitente() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .withOtrosDocumentosTributariosRelacionados(Arrays.asList( - DocTribRelacionadoInputModel_Invoice.Builder.aDocTribRelacionadoInputModel_Invoice() - .withSerieNumero("F001-1") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_Invoice.GUIA_DE_REMISION_REMITENTE.toString()) - .build(), - DocTribRelacionadoInputModel_Invoice.Builder.aDocTribRelacionadoInputModel_Invoice() - .withSerieNumero("F002-2") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_Invoice.GUIA_DE_REMISION_REMITENTE.toString()) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/otrosdocumentostributariosrelacionados/guiaRemisionRemitente.xml"); - assertSendSunat(xml); - } - - @Test - void testDeclaracionDeSalidaDelDepositoFranco() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .withOtrosDocumentosTributariosRelacionados(Arrays.asList( - DocTribRelacionadoInputModel_Invoice.Builder.aDocTribRelacionadoInputModel_Invoice() - .withSerieNumero("F001-1") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_Invoice.DECLARACION_DE_SALIDA_DEL_DEPOSITO_FRANCO.toString()) - .build(), - DocTribRelacionadoInputModel_Invoice.Builder.aDocTribRelacionadoInputModel_Invoice() - .withSerieNumero("F002-2") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_Invoice.DECLARACION_DE_SALIDA_DEL_DEPOSITO_FRANCO.toString()) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/otrosdocumentostributariosrelacionados/declaracionDeSalidaDelDepositoFranco.xml"); - assertSendSunat(xml); - } - - @Test - void testDeclaracionSimplificadaDeImportacion() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .withOtrosDocumentosTributariosRelacionados(Arrays.asList( - DocTribRelacionadoInputModel_Invoice.Builder.aDocTribRelacionadoInputModel_Invoice() - .withSerieNumero("F001-1") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_Invoice.DECLARACION_SIMPLIFICADA_DE_IMPORTACION.toString()) - .build(), - DocTribRelacionadoInputModel_Invoice.Builder.aDocTribRelacionadoInputModel_Invoice() - .withSerieNumero("F002-2") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_Invoice.DECLARACION_SIMPLIFICADA_DE_IMPORTACION.toString()) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/otrosdocumentostributariosrelacionados/declaracionSimplificadaDeImportacion.xml"); - assertSendSunat(xml); - } - - @Test - void testOtros() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .build()) - ) - .withOtrosDocumentosTributariosRelacionados(Arrays.asList( - DocTribRelacionadoInputModel_Invoice.Builder.aDocTribRelacionadoInputModel_Invoice() - .withSerieNumero("F001-1") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_Invoice.OTROS.toString()) - .build(), - DocTribRelacionadoInputModel_Invoice.Builder.aDocTribRelacionadoInputModel_Invoice() - .withSerieNumero("F002-2") - .withTipoDocumento(Catalog12_Doc_Trib_Relacionado_Invoice.OTROS.toString()) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/otrosdocumentostributariosrelacionados/otros.xml"); - assertSendSunat(xml); - } - -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/invoice/tipoigv/InvoiceTipoIgvTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/invoice/tipoigv/InvoiceTipoIgvTest.java deleted file mode 100644 index f03e2d37..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/invoice/tipoigv/InvoiceTipoIgvTest.java +++ /dev/null @@ -1,1626 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.integrationtest.ubl.invoice.tipoigv; - -import io.github.project.openubl.xmlbuilderlib.facade.DocumentManager; -import io.github.project.openubl.xmlbuilderlib.facade.DocumentWrapper; -import io.github.project.openubl.xmlbuilderlib.integrationtest.AbstractUBLTest; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog6; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog7; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.DocumentLineInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.standard.invoice.InvoiceInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.standard.invoice.InvoiceOutputModel; -import org.junit.jupiter.api.Test; - -import java.math.BigDecimal; -import java.util.Arrays; - -public class InvoiceTipoIgvTest extends AbstractUBLTest { - - public InvoiceTipoIgvTest() throws Exception { - } - - @Test - void testInvoiceTipoIgv_GravadoOnerosa_precioUnitario() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.GRAVADO_OPERACION_ONEROSA.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.GRAVADO_OPERACION_ONEROSA.toString()) - .build()) - ) - .build(); - - - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/gravadoOnerosa.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_GravadoOnerosa_precioConIgv() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(118)) - .withTipoIgv(Catalog7.GRAVADO_OPERACION_ONEROSA.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(118)) - .withTipoIgv(Catalog7.GRAVADO_OPERACION_ONEROSA.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/gravadoOnerosa.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_GravadoRetiroPorPremio_precioUnitario() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.GRAVADO_RETIRO_POR_PREMIO.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.GRAVADO_RETIRO_POR_PREMIO.toString()) - .build()) - ) - .build(); - - - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/gravadoRetiroPorPremio.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_GravadoRetiroPorPremio_precioConIgv() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(118)) - .withTipoIgv(Catalog7.GRAVADO_RETIRO_POR_PREMIO.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(118)) - .withTipoIgv(Catalog7.GRAVADO_RETIRO_POR_PREMIO.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/gravadoRetiroPorPremio.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_GravadoRetiroPorDonacion_precioUnitario() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.GRAVADO_RETIRO_POR_DONACION.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.GRAVADO_RETIRO_POR_DONACION.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/gravadoRetiroPorDonacion.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_GravadoRetiroPorDonacion_precioConIgv() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(118)) - .withTipoIgv(Catalog7.GRAVADO_RETIRO_POR_DONACION.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(118)) - .withTipoIgv(Catalog7.GRAVADO_RETIRO_POR_DONACION.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/gravadoRetiroPorDonacion.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_GravadoRetiro_precioUnitario() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.GRAVADO_RETIRO.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.GRAVADO_RETIRO.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/gravadoRetiro.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_GravadoRetiro_precioConIgv() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(118)) - .withTipoIgv(Catalog7.GRAVADO_RETIRO.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(118)) - .withTipoIgv(Catalog7.GRAVADO_RETIRO.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/gravadoRetiro.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_GravadoRetiroPorPublicidad_precioUnitario() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.GRAVADO_RETIRO_POR_PUBLICIDAD.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.GRAVADO_RETIRO_POR_PUBLICIDAD.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/gravadoRetiroPorPublicidad.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_GravadoRetiroPorPublicidad_precioConIgv() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(118)) - .withTipoIgv(Catalog7.GRAVADO_RETIRO_POR_PUBLICIDAD.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(118)) - .withTipoIgv(Catalog7.GRAVADO_RETIRO_POR_PUBLICIDAD.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/gravadoRetiroPorPublicidad.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_GravadoBonificaciones_precioUnitario() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.GRAVADO_BONIFICACIONES.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.GRAVADO_BONIFICACIONES.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/gravadoBonificaciones.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_GravadoBonificaciones_precioConIgv() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(118)) - .withTipoIgv(Catalog7.GRAVADO_BONIFICACIONES.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(118)) - .withTipoIgv(Catalog7.GRAVADO_BONIFICACIONES.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/gravadoBonificaciones.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_GravadoRetiroPorEntregaATrabajadores_precioUnitario() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.GRAVADO_RETIRO_POR_ENTREGA_A_TRABAJADORES.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.GRAVADO_RETIRO_POR_ENTREGA_A_TRABAJADORES.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/gravadoRetiroPorEntregaATrabajadores.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_GravadoRetiroPorEntregaATrabajadores_precioConIgv() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(118)) - .withTipoIgv(Catalog7.GRAVADO_RETIRO_POR_ENTREGA_A_TRABAJADORES.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(118)) - .withTipoIgv(Catalog7.GRAVADO_RETIRO_POR_ENTREGA_A_TRABAJADORES.toString()) - .build()) - ) - .build(); - - - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/gravadoRetiroPorEntregaATrabajadores.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_GravadoIVAP_precioUnitario() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.GRAVADO_IVAP.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.GRAVADO_IVAP.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/gravadoIVAP.xml"); - assertSendSunat(xml, DOCUMENT_WITHOUT_2007_LEGEND); - } - - @Test - void testInvoiceTipoIgv_GravadoIVAP_precioConIgv() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(104)) - .withTipoIgv(Catalog7.GRAVADO_IVAP.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(104)) - .withTipoIgv(Catalog7.GRAVADO_IVAP.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/gravadoIVAP.xml"); - assertSendSunat(xml, DOCUMENT_WITHOUT_2007_LEGEND); - } - - @Test - void testInvoiceTipoIgv_ExoneradoOperacionOnerosa_precionSinImpuestos() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.EXONERADO_OPERACION_ONEROSA.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.EXONERADO_OPERACION_ONEROSA.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/exoneradoOperacionOnerosa.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_ExoneradoOperacionOnerosa_precionConImpuestos() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(100)) - .withTipoIgv(Catalog7.EXONERADO_OPERACION_ONEROSA.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(100)) - .withTipoIgv(Catalog7.EXONERADO_OPERACION_ONEROSA.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/exoneradoOperacionOnerosa.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_ExoneradoTransferenciaGratuita_precioUnitario() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.EXONERADO_TRANSFERENCIA_GRATUITA.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.EXONERADO_TRANSFERENCIA_GRATUITA.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/exoneradoTransferenciaGratuita.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_ExoneradoTransferenciaGratuita_precioConIgv() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(100)) - .withTipoIgv(Catalog7.EXONERADO_TRANSFERENCIA_GRATUITA.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(100)) - .withTipoIgv(Catalog7.EXONERADO_TRANSFERENCIA_GRATUITA.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/exoneradoTransferenciaGratuita.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_InafectoOperacionOnerosa_precioUnitario() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_OPERACION_ONEROSA.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_OPERACION_ONEROSA.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/inafectoOperacionOnerosa.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_InafectoOperacionOnerosa_precioConIgv() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_OPERACION_ONEROSA.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_OPERACION_ONEROSA.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/inafectoOperacionOnerosa.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_InafectoRetiroPorBonificacion_precioUnitario() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_RETIRO_POR_BONIFICACION.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_RETIRO_POR_BONIFICACION.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/inafectoRetiroPorBonificacion.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_InafectoRetiroPorBonificacion_precioConIgv() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_RETIRO_POR_BONIFICACION.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_RETIRO_POR_BONIFICACION.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/inafectoRetiroPorBonificacion.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_InafectoRetiro_precioUnitario() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_RETIRO.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_RETIRO.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/inafectoRetiro.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_InafectoRetiro_precioConIgv() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_RETIRO.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_RETIRO.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/inafectoRetiro.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_InafectoRetiroPorMuestrasMedicas_precioUnitario() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_RETIRO_POR_MUESTRAS_MEDICAS.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_RETIRO_POR_MUESTRAS_MEDICAS.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/inafectoPorMuestrasMedicas.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_InafectoRetiroPorMuestrasMedicas_precioConIgv() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_RETIRO_POR_MUESTRAS_MEDICAS.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_RETIRO_POR_MUESTRAS_MEDICAS.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/inafectoPorMuestrasMedicas.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_InafectoRetiroPorConvenioColectivo_precioUnitario() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_RETIRO_POR_CONVENIO_COLECTIVO.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_RETIRO_POR_CONVENIO_COLECTIVO.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/inafectoRetiroPorConvenioColectivo.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_InafectoRetiroPorConvenioColectivo_precioConIgv() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_RETIRO_POR_CONVENIO_COLECTIVO.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_RETIRO_POR_CONVENIO_COLECTIVO.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/inafectoRetiroPorConvenioColectivo.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_InafectoRetiroPorPremio_precioUnitario() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_RETIRO_POR_PREMIO.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_RETIRO_POR_PREMIO.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/inafectoRetiroPorPremio.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_InafectoRetiroPorPremio_precioConIgv() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_RETIRO_POR_PREMIO.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_RETIRO_POR_PREMIO.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/inafectoRetiroPorPremio.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_InafectoRetiroPorPublicidad_precioUnitario() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_RETIRO_POR_PUBLICIDAD.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioUnitario(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_RETIRO_POR_PUBLICIDAD.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/inafectoRetiroPorPublicidad.xml"); - assertSendSunat(xml); - } - - @Test - void testInvoiceTipoIgv_InafectoRetiroPorPublicidad_precioConIgv() throws Exception { - // Given - InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() - .withSerie("F001") - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item1") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_RETIRO_POR_PUBLICIDAD.toString()) - .build(), - DocumentLineInputModel.Builder.aDocumentLineInputModel() - .withDescripcion("Item2") - .withCantidad(new BigDecimal(10)) - .withPrecioConIgv(new BigDecimal(100)) - .withTipoIgv(Catalog7.INAFECTO_RETIRO_POR_PUBLICIDAD.toString()) - .build()) - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - InvoiceOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/invoice/tipoigv/inafectoRetiroPorPublicidad.xml"); - assertSendSunat(xml); - } - -// @Test -// void testInvoiceTipoIgv_Exportacion_precioUnitario() throws Exception { -// // Given -// InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() -// .withSerie("F001") -// .withNumero(1) -// .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() -// .withRuc("12345678912") -// .withRazonSocial("Softgreen S.A.C.") -// .build() -// ) -// .withCliente(ClienteInputModel.Builder.aClienteInputModel() -// .withNombre("Carlos Feria") -// .withNumeroDocumentoIdentidad("12121212121") -// .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) -// .build() -// ) -// .withDetalle(Arrays.asList( -// DocumentLineInputModel.Builder.aDocumentLineInputModel() -// .withDescripcion("Item1") -// .withCantidad(new BigDecimal(10)) -// .withPrecioUnitario(new BigDecimal(100)) -// .withTipoIgv(Catalog7.EXPORTACION.toString()) -// .build(), -// DocumentLineInputModel.Builder.aDocumentLineInputModel() -// .withDescripcion("Item2") -// .withCantidad(new BigDecimal(10)) -// .withPrecioUnitario(new BigDecimal(100)) -// .withTipoIgv(Catalog7.EXPORTACION.toString()) -// .build()) -// ) -// .build(); -// -// // When -// InvoiceOutputModel output = InputToOutput.toOutput(input, config, systemClock); -// String xml = DocumentFacade.createXML(input, config, systemClock); -// -// // Then -// assertOutputHasNoConstraintViolations(validator, output); -// assertSnapshot(xml, "xml/invoice/tipoigv/exportacion.xml"); -// assertSendSunat(xml); -// } -// -// @Test -// void testInvoiceTipoIgv_Exportacion_precioConIgv() throws Exception { -// // Given -// InvoiceInputModel input = InvoiceInputModel.Builder.anInvoiceInputModel() -// .withSerie("F001") -// .withNumero(1) -// .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() -// .withRuc("12345678912") -// .withRazonSocial("Softgreen S.A.C.") -// .build() -// ) -// .withCliente(ClienteInputModel.Builder.aClienteInputModel() -// .withNombre("Carlos Feria") -// .withNumeroDocumentoIdentidad("12121212121") -// .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) -// .build() -// ) -// .withDetalle(Arrays.asList( -// DocumentLineInputModel.Builder.aDocumentLineInputModel() -// .withDescripcion("Item1") -// .withCantidad(new BigDecimal(10)) -// .withPrecioConIgv(new BigDecimal(100)) -// .withTipoIgv(Catalog7.EXPORTACION.toString()) -// .build(), -// DocumentLineInputModel.Builder.aDocumentLineInputModel() -// .withDescripcion("Item2") -// .withCantidad(new BigDecimal(10)) -// .withPrecioConIgv(new BigDecimal(100)) -// .withTipoIgv(Catalog7.EXPORTACION.toString()) -// .build()) -// ) -// .build(); -// -// // When -// InvoiceOutputModel output = InputToOutput.toOutput(input, config, systemClock); -// String xml = DocumentFacade.createXML(input, config, systemClock); -// -// // Then -// assertOutputHasNoConstraintViolations(validator, output); -// assertSnapshot(xml, "xml/invoice/tipoigv/exportacion.xml"); -// assertSendSunat(xml); -// } -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/perception/PerceptionTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/perception/PerceptionTest.java deleted file mode 100644 index d878c1d2..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/perception/PerceptionTest.java +++ /dev/null @@ -1,97 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.integrationtest.ubl.perception; - -import io.github.project.openubl.xmlbuilderlib.integrationtest.AbstractUBLTest; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog22; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog6; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.sunat.PerceptionInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.sunat.PerceptionRetentionComprobanteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.sunat.PerceptionRetentionLineInputModel; -import org.junit.jupiter.api.Test; - -import java.math.BigDecimal; -import java.util.Arrays; -import java.util.Calendar; - - -public class PerceptionTest extends AbstractUBLTest { - - public PerceptionTest() throws Exception { - } - - @Test - void testPerception_minData() throws Exception { - // Given - Calendar calendar = Calendar.getInstance(); - calendar.set(2019, Calendar.DECEMBER, 1, 20, 30, 59); - - PerceptionInputModel input = PerceptionInputModel.Builder.aPerceptionInputModel() - .withSerie("P001") - .withNumero(1) - .withRegimen(Catalog22.VENTA_INTERNA.toString()) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12121212121") - .withTipoDocumentoIdentidad(Catalog6.RUC.toString()) - .build() - ) - .withDetalle(Arrays.asList( - PerceptionRetentionLineInputModel.Builder.aPerceptionRetentionLineInputModel() - .withComprobante(PerceptionRetentionComprobanteInputModel.Builder.aPerceptionRetentionComprobanteInputModel() - .withMoneda("PEN") - .withTipo(Catalog1.FACTURA.toString()) - .withSerieNumero("F001-1") - .withFechaEmision(calendar.getTimeInMillis()) - .withImporteTotal(new BigDecimal("100")) - .build() - ) - .build(), - PerceptionRetentionLineInputModel.Builder.aPerceptionRetentionLineInputModel() - .withComprobante(PerceptionRetentionComprobanteInputModel.Builder.aPerceptionRetentionComprobanteInputModel() - .withMoneda("PEN") - .withTipo(Catalog1.FACTURA.toString()) - .withSerieNumero("F001-1") - .withFechaEmision(calendar.getTimeInMillis()) - .withImporteTotal(new BigDecimal("100")) - .build() - ) - .build() - )) - .build(); - - - - // When -// PerceptionOutputModel output = InputToOutput.toOutput(input, config, systemClock); -// String xml = DocumentFacade.createXML(input, config, systemClock); -// -// // Then -// assertOutputHasNoConstraintViolations(validator, output); -// assertSnapshot(xml, "xml/perception/perception_min.xml"); -// assertSendSunat(xml); - } - -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/summarydocument/SummaryDocumentCasesTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/summarydocument/SummaryDocumentCasesTest.java deleted file mode 100644 index 5d55de6a..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/summarydocument/SummaryDocumentCasesTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.integrationtest.ubl.summarydocument; - -import io.github.project.openubl.xmlbuilderlib.facade.DocumentManager; -import io.github.project.openubl.xmlbuilderlib.facade.DocumentWrapper; -import io.github.project.openubl.xmlbuilderlib.integrationtest.AbstractUBLTest; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog19; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog6; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.sunat.*; -import io.github.project.openubl.xmlbuilderlib.models.output.sunat.SummaryDocumentOutputModel; -import org.junit.jupiter.api.Test; - -import java.math.BigDecimal; -import java.util.Calendar; -import java.util.Collections; - -public class SummaryDocumentCasesTest extends AbstractUBLTest { - - public SummaryDocumentCasesTest() throws Exception { - } - - @Test - void testSummaryDocument_withBigNumbers_shouldFormatNumbers() throws Exception { - // Given - Calendar calendar = Calendar.getInstance(); - calendar.set(2019, Calendar.DECEMBER, 1, 20, 30, 59); - calendar.setTimeZone(timeZone); - - SummaryDocumentInputModel input = SummaryDocumentInputModel.Builder.aSummaryDocumentInputModel() - .withNumero(1) - .withFechaEmisionDeComprobantesAsociados(calendar.getTimeInMillis()) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Openubl S.A.C.") - .build() - ) - .withDetalle(Collections.singletonList( - SummaryDocumentLineInputModel.Builder.aSummaryDocumentLineInputModel() - .withTipoOperacion(Catalog19.ADICIONAR.toString()) - .withComprobante(SummaryDocumentComprobanteInputModel.Builder.aSummaryDocumentComprobanteInputModel() - .withTipo(Catalog1.BOLETA.toString()) - .withSerieNumero("B001-1") - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Maria Pérez") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.DNI.toString()) - .build() - ) - .withImpuestos(SummaryDocumentImpuestosInputModel.Builder.aSummaryDocumentImpuestosInputModel() - .withIgv(new BigDecimal("180.02")) - .build() - ) - .withValorVenta(SummaryDocumentComprobanteValorVentaInputModel.Builder.aSummaryDocumentComprobanteValorVentaInputModel() - .withImporteTotal(new BigDecimal("1180.12")) - .withGravado(new BigDecimal("1000.1")) - .build() - ) - .build() - ) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - SummaryDocumentOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/summarydocument/summaryDocument_formatNumbers.xml"); - assertSendSunat(xml); - } - -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/summarydocument/SummaryDocumentTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/summarydocument/SummaryDocumentTest.java deleted file mode 100644 index 198f8034..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/summarydocument/SummaryDocumentTest.java +++ /dev/null @@ -1,427 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.integrationtest.ubl.summarydocument; - -import io.github.project.openubl.xmlbuilderlib.facade.DocumentManager; -import io.github.project.openubl.xmlbuilderlib.facade.DocumentWrapper; -import io.github.project.openubl.xmlbuilderlib.integrationtest.AbstractUBLTest; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog19; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog6; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ClienteInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.sunat.*; -import io.github.project.openubl.xmlbuilderlib.models.output.sunat.SummaryDocumentOutputModel; -import org.junit.jupiter.api.Test; - -import java.math.BigDecimal; -import java.util.Calendar; -import java.util.Collections; - -public class SummaryDocumentTest extends AbstractUBLTest { - - public SummaryDocumentTest() throws Exception { - } - - @Test - void testSummaryDocument_adicionarBoleta() throws Exception { - // Given - Calendar calendar = Calendar.getInstance(); - calendar.set(2019, Calendar.DECEMBER, 1, 20, 30, 59); - calendar.setTimeZone(timeZone); - - SummaryDocumentInputModel input = SummaryDocumentInputModel.Builder.aSummaryDocumentInputModel() - .withNumero(1) - .withFechaEmisionDeComprobantesAsociados(calendar.getTimeInMillis()) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withDetalle(Collections.singletonList( - SummaryDocumentLineInputModel.Builder.aSummaryDocumentLineInputModel() - .withTipoOperacion(Catalog19.ADICIONAR.toString()) - .withComprobante(SummaryDocumentComprobanteInputModel.Builder.aSummaryDocumentComprobanteInputModel() - .withTipo(Catalog1.BOLETA.toString()) - .withSerieNumero("B001-1") - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.DNI.toString()) - .build() - ) - .withImpuestos(SummaryDocumentImpuestosInputModel.Builder.aSummaryDocumentImpuestosInputModel() - .withIgv(new BigDecimal("100")) - .build() - ) - .withValorVenta(SummaryDocumentComprobanteValorVentaInputModel.Builder.aSummaryDocumentComprobanteValorVentaInputModel() - .withImporteTotal(new BigDecimal("118")) - .withGravado(new BigDecimal("100")) - .build() - ) - .build() - ) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - SummaryDocumentOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/summarydocument/summaryDocument_adicionarBoleta.xml"); - assertSendSunat(xml); - } - - @Test - void testSummaryDocument_adicionarNotaCreditoDeBoleta() throws Exception { - // Given - Calendar calendar = Calendar.getInstance(); - calendar.set(2019, Calendar.DECEMBER, 1, 20, 30, 59); - calendar.setTimeZone(timeZone); - - SummaryDocumentInputModel input = SummaryDocumentInputModel.Builder.aSummaryDocumentInputModel() - .withNumero(1) - .withFechaEmisionDeComprobantesAsociados(calendar.getTimeInMillis()) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withDetalle(Collections.singletonList( - SummaryDocumentLineInputModel.Builder.aSummaryDocumentLineInputModel() - .withTipoOperacion(Catalog19.ADICIONAR.toString()) - .withComprobante(SummaryDocumentComprobanteInputModel.Builder.aSummaryDocumentComprobanteInputModel() - .withTipo(Catalog1.NOTA_CREDITO.toString()) - .withSerieNumero("BC01-1") - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.DNI.toString()) - .build() - ) - .withImpuestos(SummaryDocumentImpuestosInputModel.Builder.aSummaryDocumentImpuestosInputModel() - .withIgv(new BigDecimal("100")) - .build() - ) - .withValorVenta(SummaryDocumentComprobanteValorVentaInputModel.Builder.aSummaryDocumentComprobanteValorVentaInputModel() - .withImporteTotal(new BigDecimal("118")) - .withGravado(new BigDecimal("100")) - .build() - ) - .build() - ) - .withComprobanteAfectado(SummaryDocumentComprobanteAfectadoInputModel.Builder.aSummaryDocumentComprobanteAfectadoInputModel() - .withTipo(Catalog1.BOLETA.toString()) - .withSerieNumero("B001-1") - .build() - ) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - SummaryDocumentOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/summarydocument/summaryDocument_adicionarNotaCreditoDeBoleta.xml"); - assertSendSunat(xml); - } - - @Test - void testSummaryDocument_anularBoleta() throws Exception { - // Given - Calendar calendar = Calendar.getInstance(); - calendar.set(2019, Calendar.DECEMBER, 1, 20, 30, 59); - calendar.setTimeZone(timeZone); - - SummaryDocumentInputModel input = SummaryDocumentInputModel.Builder.aSummaryDocumentInputModel() - .withNumero(1) - .withFechaEmisionDeComprobantesAsociados(calendar.getTimeInMillis()) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withDetalle(Collections.singletonList( - SummaryDocumentLineInputModel.Builder.aSummaryDocumentLineInputModel() - .withTipoOperacion(Catalog19.ANULADO.toString()) - .withComprobante(SummaryDocumentComprobanteInputModel.Builder.aSummaryDocumentComprobanteInputModel() - .withTipo(Catalog1.BOLETA.toString()) - .withSerieNumero("B001-1") - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.DNI.toString()) - .build() - ) - .withImpuestos(SummaryDocumentImpuestosInputModel.Builder.aSummaryDocumentImpuestosInputModel() - .withIgv(new BigDecimal("100")) - .build() - ) - .withValorVenta(SummaryDocumentComprobanteValorVentaInputModel.Builder.aSummaryDocumentComprobanteValorVentaInputModel() - .withImporteTotal(new BigDecimal("118")) - .withGravado(new BigDecimal("100")) - .build() - ) - .build() - ) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - SummaryDocumentOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/summarydocument/summaryDocument_anularBoleta.xml"); - assertSendSunat(xml); - } - - @Test - void testSummaryDocument_anularNotaDeCreditoDeBoleta() throws Exception { - // Given - Calendar calendar = Calendar.getInstance(); - calendar.set(2019, Calendar.DECEMBER, 1, 20, 30, 59); - calendar.setTimeZone(timeZone); - - SummaryDocumentInputModel input = SummaryDocumentInputModel.Builder.aSummaryDocumentInputModel() - .withNumero(1) - .withFechaEmisionDeComprobantesAsociados(calendar.getTimeInMillis()) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withDetalle(Collections.singletonList( - SummaryDocumentLineInputModel.Builder.aSummaryDocumentLineInputModel() - .withTipoOperacion(Catalog19.ANULADO.toString()) - .withComprobante(SummaryDocumentComprobanteInputModel.Builder.aSummaryDocumentComprobanteInputModel() - .withTipo(Catalog1.NOTA_CREDITO.toString()) - .withSerieNumero("BC01-1") - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.DNI.toString()) - .build() - ) - .withImpuestos(SummaryDocumentImpuestosInputModel.Builder.aSummaryDocumentImpuestosInputModel() - .withIgv(new BigDecimal("100")) - .build() - ) - .withValorVenta(SummaryDocumentComprobanteValorVentaInputModel.Builder.aSummaryDocumentComprobanteValorVentaInputModel() - .withImporteTotal(new BigDecimal("118")) - .withGravado(new BigDecimal("100")) - .build() - ) - .build() - ) - .withComprobanteAfectado(SummaryDocumentComprobanteAfectadoInputModel.Builder.aSummaryDocumentComprobanteAfectadoInputModel() - .withTipo(Catalog1.BOLETA.toString()) - .withSerieNumero("B001-1") - .build() - ) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - SummaryDocumentOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/summarydocument/summaryDocument_anularNotaCreditoDeBoleta.xml"); - assertSendSunat(xml); - } - - @Test - void testSummaryDocument_modificarBoleta() throws Exception { - // Given - Calendar calendar = Calendar.getInstance(); - calendar.set(2019, Calendar.DECEMBER, 1, 20, 30, 59); - calendar.setTimeZone(timeZone); - - SummaryDocumentInputModel input = SummaryDocumentInputModel.Builder.aSummaryDocumentInputModel() - .withNumero(1) - .withFechaEmisionDeComprobantesAsociados(calendar.getTimeInMillis()) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withDetalle(Collections.singletonList( - SummaryDocumentLineInputModel.Builder.aSummaryDocumentLineInputModel() - .withTipoOperacion(Catalog19.MODIFICAR.toString()) - .withComprobante(SummaryDocumentComprobanteInputModel.Builder.aSummaryDocumentComprobanteInputModel() - .withTipo(Catalog1.BOLETA.toString()) - .withSerieNumero("B001-1") - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.DNI.toString()) - .build() - ) - .withImpuestos(SummaryDocumentImpuestosInputModel.Builder.aSummaryDocumentImpuestosInputModel() - .withIgv(new BigDecimal("100")) - .build() - ) - .withValorVenta(SummaryDocumentComprobanteValorVentaInputModel.Builder.aSummaryDocumentComprobanteValorVentaInputModel() - .withImporteTotal(new BigDecimal("118")) - .withGravado(new BigDecimal("100")) - .build() - ) - .build() - ) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - SummaryDocumentOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/summarydocument/summaryDocument_modificarBoleta.xml"); - assertSendSunat(xml); - } - - @Test - void testSummaryDocument_modificarNotaDeCreditoDeBoleta() throws Exception { - // Given - Calendar calendar = Calendar.getInstance(); - calendar.set(2019, Calendar.DECEMBER, 1, 20, 30, 59); - calendar.setTimeZone(timeZone); - - SummaryDocumentInputModel input = SummaryDocumentInputModel.Builder.aSummaryDocumentInputModel() - .withNumero(1) - .withFechaEmisionDeComprobantesAsociados(calendar.getTimeInMillis()) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withDetalle(Collections.singletonList( - SummaryDocumentLineInputModel.Builder.aSummaryDocumentLineInputModel() - .withTipoOperacion(Catalog19.MODIFICAR.toString()) - .withComprobante(SummaryDocumentComprobanteInputModel.Builder.aSummaryDocumentComprobanteInputModel() - .withTipo(Catalog1.NOTA_CREDITO.toString()) - .withSerieNumero("BC01-1") - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.DNI.toString()) - .build() - ) - .withImpuestos(SummaryDocumentImpuestosInputModel.Builder.aSummaryDocumentImpuestosInputModel() - .withIgv(new BigDecimal("100")) - .build() - ) - .withValorVenta(SummaryDocumentComprobanteValorVentaInputModel.Builder.aSummaryDocumentComprobanteValorVentaInputModel() - .withImporteTotal(new BigDecimal("118")) - .withGravado(new BigDecimal("100")) - .build() - ) - .build() - ) - .withComprobanteAfectado(SummaryDocumentComprobanteAfectadoInputModel.Builder.aSummaryDocumentComprobanteAfectadoInputModel() - .withTipo(Catalog1.BOLETA.toString()) - .withSerieNumero("B001-1") - .build() - ) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - SummaryDocumentOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/summarydocument/summaryDocument_modificarNotaCreditoDeBoleta.xml"); - assertSendSunat(xml); - } - - @Test - void testSummaryDocument_adicionarBoletaConICB() throws Exception { - // Given - Calendar calendar = Calendar.getInstance(); - calendar.set(2019, Calendar.DECEMBER, 1, 20, 30, 59); - calendar.setTimeZone(timeZone); - - SummaryDocumentInputModel input = SummaryDocumentInputModel.Builder.aSummaryDocumentInputModel() - .withNumero(1) - .withFechaEmisionDeComprobantesAsociados(calendar.getTimeInMillis()) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withDetalle(Collections.singletonList( - SummaryDocumentLineInputModel.Builder.aSummaryDocumentLineInputModel() - .withTipoOperacion(Catalog19.ADICIONAR.toString()) - .withComprobante(SummaryDocumentComprobanteInputModel.Builder.aSummaryDocumentComprobanteInputModel() - .withTipo(Catalog1.BOLETA.toString()) - .withSerieNumero("B001-1") - .withCliente(ClienteInputModel.Builder.aClienteInputModel() - .withNombre("Carlos Feria") - .withNumeroDocumentoIdentidad("12345678") - .withTipoDocumentoIdentidad(Catalog6.DNI.toString()) - .build() - ) - .withImpuestos(SummaryDocumentImpuestosInputModel.Builder.aSummaryDocumentImpuestosInputModel() - .withIgv(new BigDecimal("100")) - .withIcb(new BigDecimal("2")) - .build() - ) - .withValorVenta(SummaryDocumentComprobanteValorVentaInputModel.Builder.aSummaryDocumentComprobanteValorVentaInputModel() - .withImporteTotal(new BigDecimal("120")) - .withGravado(new BigDecimal("100")) - .build() - ) - .build() - ) - .build() - )) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - SummaryDocumentOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/summarydocument/summaryDocument_adicionarBoletaConIcb.xml"); - assertSendSunat(xml); - } - -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/voideddocument/VoidedDocumentTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/voideddocument/VoidedDocumentTest.java deleted file mode 100644 index 9e41e30f..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/ubl/voideddocument/VoidedDocumentTest.java +++ /dev/null @@ -1,236 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.integrationtest.ubl.voideddocument; - -import io.github.project.openubl.xmlbuilderlib.facade.DocumentManager; -import io.github.project.openubl.xmlbuilderlib.facade.DocumentWrapper; -import io.github.project.openubl.xmlbuilderlib.integrationtest.AbstractUBLTest; -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog1; -import io.github.project.openubl.xmlbuilderlib.models.input.common.ProveedorInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.sunat.VoidedDocumentInputModel; -import io.github.project.openubl.xmlbuilderlib.models.input.sunat.VoidedDocumentLineInputModel; -import io.github.project.openubl.xmlbuilderlib.models.output.sunat.VoidedDocumentOutputModel; -import org.junit.jupiter.api.Test; - -import java.util.Calendar; - -public class VoidedDocumentTest extends AbstractUBLTest { - - public VoidedDocumentTest() throws Exception { - } - - @Test - void testVoidedDocument_Factura_MinData() throws Exception { - // Given - Calendar calendar = Calendar.getInstance(); - calendar.set(2019, Calendar.DECEMBER, 1, 20, 30, 59); - - VoidedDocumentInputModel input = VoidedDocumentInputModel.Builder.aVoidedDocumentInputModel() - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withDescripcionSustento("mi razon de baja") - .withComprobante(VoidedDocumentLineInputModel.Builder.aVoidedDocumentLineInputModel() - .withSerieNumero("F001-1") - .withTipoComprobante(Catalog1.FACTURA.toString()) - .withFechaEmision(calendar.getTimeInMillis()) - .build() - ) - .build(); - - - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - VoidedDocumentOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/voideddocument/factura_minData.xml"); - assertSendSunat(xml); - } - - @Test - void testVoidedDocument_NotaCreditoDeFactura_MinData() throws Exception { - // Given - Calendar calendar = Calendar.getInstance(); - calendar.set(2019, Calendar.DECEMBER, 1, 20, 30, 59); - - VoidedDocumentInputModel input = VoidedDocumentInputModel.Builder.aVoidedDocumentInputModel() - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withDescripcionSustento("mi razon de baja") - .withComprobante(VoidedDocumentLineInputModel.Builder.aVoidedDocumentLineInputModel() - .withSerieNumero("FC01-1") - .withTipoComprobante(Catalog1.NOTA_CREDITO.toString()) - .withFechaEmision(calendar.getTimeInMillis()) - .build() - ) - .build(); - - - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - VoidedDocumentOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/voideddocument/notaCreditoDeFactura.xml"); - assertSendSunat(xml); - } - - @Test - void testVoidedDocument_NotaDebitoDeFactura_MinData() throws Exception { - // Given - Calendar calendar = Calendar.getInstance(); - calendar.set(2019, Calendar.DECEMBER, 1, 20, 30, 59); - - VoidedDocumentInputModel input = VoidedDocumentInputModel.Builder.aVoidedDocumentInputModel() - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withDescripcionSustento("mi razon de baja") - .withComprobante(VoidedDocumentLineInputModel.Builder.aVoidedDocumentLineInputModel() - .withSerieNumero("FD01-1") - .withTipoComprobante(Catalog1.NOTA_DEBITO.toString()) - .withFechaEmision(calendar.getTimeInMillis()) - .build() - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - VoidedDocumentOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/voideddocument/notaDebitoDeFactura.xml"); - assertSendSunat(xml); - } - -// @Test -// void testVoided_GuiaRemisionRemitente_MinData() throws Exception { -// // Given -// Calendar calendar = Calendar.getInstance(); -// calendar.set(2019, Calendar.DECEMBER, 1, 20, 30, 59); -// -// VoidedDocumentInputModel input = VoidedDocumentInputModel.Builder.aVoidedDocumentInputModel() -// .withNumero(1) -// .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() -// .withRuc("12345678912") -// .withRazonSocial("Softgreen S.A.C.") -// .build() -// ) -// .withDescripcionSustento("mi razon de baja") -// .withComprobante(VoidedDocumentLineInputModel.Builder.aVoidedDocumentLineInputModel() -// .withSerieNumero("T001-1") -// .withTipoComprobante(Catalog1.GUIA_REMISION_REMITENTE.toString()) -// .withFechaEmision(calendar.getTimeInMillis()) -// .build() -// ) -// .build(); -// -// // When -// VoidedDocumentOutputModel output = InputToOutput.toOutput(input, config, systemClock); -// String xml = DocumentFacade.createXML(input, config, systemClock); -// -// // Then -// assertOutputHasNoConstraintViolations(validator, output); -// assertSnapshot(xml, "xml/voideddocument/guiaRemisionRemitente_minData.xml"); -// assertSendSunat(xml); -// } - - @Test - void testVoided_Percepcion_MinData() throws Exception { - // Given - Calendar calendar = Calendar.getInstance(); - calendar.set(2019, Calendar.DECEMBER, 1, 20, 30, 59); - - VoidedDocumentInputModel input = VoidedDocumentInputModel.Builder.aVoidedDocumentInputModel() - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withDescripcionSustento("mi razon de baja") - .withComprobante(VoidedDocumentLineInputModel.Builder.aVoidedDocumentLineInputModel() - .withSerieNumero("P001-1") - .withTipoComprobante(Catalog1.PERCEPCION.toString()) - .withFechaEmision(calendar.getTimeInMillis()) - .build() - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - VoidedDocumentOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/voideddocument/percepcion_minData.xml"); - assertSendSunat(xml); - } - - @Test - void testVoided_Retencion_MinData() throws Exception { - // Given - Calendar calendar = Calendar.getInstance(); - calendar.set(2019, Calendar.DECEMBER, 1, 20, 30, 59); - - VoidedDocumentInputModel input = VoidedDocumentInputModel.Builder.aVoidedDocumentInputModel() - .withNumero(1) - .withProveedor(ProveedorInputModel.Builder.aProveedorInputModel() - .withRuc("12345678912") - .withRazonSocial("Softgreen S.A.C.") - .build() - ) - .withDescripcionSustento("mi razon de baja") - .withComprobante(VoidedDocumentLineInputModel.Builder.aVoidedDocumentLineInputModel() - .withSerieNumero("R001-1") - .withTipoComprobante(Catalog1.RETENCION.toString()) - .withFechaEmision(calendar.getTimeInMillis()) - .build() - ) - .build(); - - // When - DocumentWrapper result = DocumentManager.createXML(input, config, systemClock); - VoidedDocumentOutputModel output = result.getOutput(); - String xml = result.getXml(); - - // Then - assertOutputHasNoConstraintViolations(validator, output); - assertSnapshot(xml, "xml/voideddocument/retencion_minData.xml"); - assertSendSunat(xml); - } -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/utils/AbstractCertTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/utils/AbstractCertTest.java deleted file mode 100644 index e69d3652..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/integrationtest/utils/AbstractCertTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.integrationtest.utils; - -import io.github.project.openubl.xmlbuilderlib.utils.CertificateDetails; -import io.github.project.openubl.xmlbuilderlib.utils.CertificateDetailsFactory; - -import java.io.IOException; -import java.io.InputStream; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.UnrecoverableEntryException; -import java.security.cert.CertificateException; - -public abstract class AbstractCertTest { - - static String SIGN_REFERENCE_ID = "SIGN-ID"; - static String KEYSTORE = "LLAMA-PE-CERTIFICADO-DEMO-10467793549.pfx"; - static String KEYSTORE_PASSWORD = "password"; - static CertificateDetails CERTIFICATE; - - public static void loadCertificate() throws NoSuchAlgorithmException, CertificateException, UnrecoverableEntryException, KeyStoreException, IOException { - InputStream ksInputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(KEYSTORE); - CERTIFICATE = CertificateDetailsFactory.create(ksInputStream, KEYSTORE_PASSWORD); - } - -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/constraints/CatalogValidatorTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/constraints/CatalogValidatorTest.java deleted file mode 100644 index 6cd203f1..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/models/catalogs/constraints/CatalogValidatorTest.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.models.catalogs.constraints; - -import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import javax.validation.ConstraintViolation; -import javax.validation.Validation; -import javax.validation.Validator; -import javax.validation.ValidatorFactory; -import java.util.Set; - -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - -public class CatalogValidatorTest { - - private static Validator validator; - - @BeforeAll - public static void setUpValidator() { - ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); - validator = factory.getValidator(); - } - - @Test - void nullValue_isValid() { - MyClass myClass = new MyClass(); - - Set> violations = validator.validate(myClass); - assertTrue(violations.isEmpty()); - } - - @Test - void usingEnumValue_isValid() { - MyClass myClass = new MyClass(); - myClass.setMyField(CatalogTest.ONE.toString()); - - Set> violations = validator.validate(myClass); - assertTrue(violations.isEmpty()); - } - - @Test - void usingEnumCode_isValid() { - MyClass myClass = new MyClass(); - myClass.setMyField(CatalogTest.ONE.getCode()); - - Set> violations = validator.validate(myClass); - assertTrue(violations.isEmpty()); - } - - @Test - void usingNoEnumValueNorCode_isInvalid() { - MyClass myClass = new MyClass(); - myClass.setMyField("piet"); - - Set> violations = validator.validate(myClass); - assertFalse(violations.isEmpty()); - } - - enum CatalogTest implements Catalog { - ONE("uno"), - TWO("dos"), - THREE("tres"); - - private String code; - - CatalogTest(String code) { - this.code = code; - } - - @Override - public String getCode() { - return code; - } - } - - public static class MyClass { - @CatalogConstraint(value = CatalogTest.class) - private String myField; - - public String getMyField() { - return myField; - } - - public void setMyField(String myField) { - this.myField = myField; - } - } -} diff --git a/src/test/java/io/github/project/openubl/xmlbuilderlib/xml/XMLSignerTest.java b/src/test/java/io/github/project/openubl/xmlbuilderlib/xml/XMLSignerTest.java deleted file mode 100644 index 57fb4096..00000000 --- a/src/test/java/io/github/project/openubl/xmlbuilderlib/xml/XMLSignerTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * 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. - */ -package io.github.project.openubl.xmlbuilderlib.xml; - -import io.github.project.openubl.xmlbuilderlib.utils.CertificateDetails; -import io.github.project.openubl.xmlbuilderlib.utils.CertificateDetailsFactory; -import org.junit.jupiter.api.Test; -import org.w3c.dom.Document; -import org.w3c.dom.NodeList; - -import javax.xml.crypto.dsig.Reference; -import javax.xml.crypto.dsig.XMLSignature; -import javax.xml.crypto.dsig.XMLSignatureFactory; -import javax.xml.crypto.dsig.dom.DOMValidateContext; -import javax.xml.parsers.DocumentBuilderFactory; -import java.io.InputStream; -import java.util.Iterator; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -public class XMLSignerTest { - - @Test - public void signXML() throws Exception { - // Given - InputStream ksInputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("LLAMA-PE-CERTIFICADO-DEMO-10467793549.pfx"); - CertificateDetails CERTIFICATE = CertificateDetailsFactory.create(ksInputStream, "password"); - - InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("xml/invoice_specialCharacters.xml"); - - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - dbf.setNamespaceAware(true); - Document documentToSign = dbf.newDocumentBuilder().parse(is); - - // When - Document signedDocument = XMLSigner.signXML(documentToSign, "PROJECT-OPENUBL", CERTIFICATE.getX509Certificate(), CERTIFICATE.getPrivateKey()); - - // Then - NodeList nodeList = signedDocument.getElementsByTagNameNS(XMLSignature.XMLNS, "Signature"); - if (nodeList.getLength() == 0) { - throw new Exception("Cannot find Signature element"); - } - - DOMValidateContext valContext = new DOMValidateContext(CERTIFICATE.getX509Certificate().getPublicKey(), nodeList.item(0)); - XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM"); - XMLSignature signature = fac.unmarshalXMLSignature(valContext); - boolean coreValidity = signature.validate(valContext); - assertTrue(coreValidity); - - boolean signatureValidity = signature.getSignatureValue().validate(valContext); - assertTrue(signatureValidity); - - Iterator i = signature.getSignedInfo().getReferences().iterator(); - for (int j = 0; i.hasNext(); j++) { - boolean refValid = i.next().validate(valContext); - assertTrue(refValid); - } - } -} diff --git a/src/test/resources/xml/creditnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgvAndCantidadThreeDecimals.xml b/src/test/resources/e2e/renderer/creditnote/CreditNoteTest/MinData_RUC.xml similarity index 51% rename from src/test/resources/xml/creditnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgvAndCantidadThreeDecimals.xml rename to src/test/resources/e2e/renderer/creditnote/CreditNoteTest/MinData_RUC.xml index b3bc4c7d..501321ad 100644 --- a/src/test/resources/xml/creditnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgvAndCantidadThreeDecimals.xml +++ b/src/test/resources/e2e/renderer/creditnote/CreditNoteTest/MinData_RUC.xml @@ -1,16 +1,15 @@ @@ -21,10 +20,7 @@ 2.0 FC01-1 2019-12-24 - 20:30:59 - PEN - + PEN F001-1 01 @@ -33,9 +29,7 @@ F001-1 - 01 - + 01 @@ -57,10 +51,7 @@ - 12345678912 - + 12345678912 @@ -73,10 +64,7 @@ - 12121212121 - + 12121212121 @@ -84,17 +72,14 @@ - 364.42 + 360.00 - 2024.6 - 364.42 + 2000.00 + 360.00 - S - + S - 1000 - + 1000 IGV VAT @@ -102,42 +87,31 @@ - 2024.6 - 2389.02 - 2389.02 + 2000.00 + 2360.00 + 2360.00 1 - 10.123 - - 1012.3 + 10 + 1000.00 - 118 - 01 - + 118.00 + 01 - 182.21 + 180.00 - 1012.3 - 182.21 + 1000.00 + 180.00 - S - - 18 - 10 - + S + 18.00 + 10 - - 1000 - + 1000 IGV VAT @@ -148,41 +122,30 @@ - 100 + 100.00 2 - 10.123 - - 1012.3 + 10 + 1000.00 - 118 - 01 - + 118.00 + 01 - 182.21 + 180.00 - 1012.3 - 182.21 + 1000.00 + 180.00 - S - - 18 - 10 - + S + 18.00 + 10 - - 1000 - + 1000 IGV VAT @@ -193,7 +156,7 @@ - 100 + 100.00 diff --git a/src/test/resources/xml/debitnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgv.xml b/src/test/resources/e2e/renderer/debitnote/DebitNoteTest/MinData_RUC.xml similarity index 74% rename from src/test/resources/xml/debitnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgv.xml rename to src/test/resources/e2e/renderer/debitnote/DebitNoteTest/MinData_RUC.xml index 93bd70ee..9594fff3 100644 --- a/src/test/resources/xml/debitnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgv.xml +++ b/src/test/resources/e2e/renderer/debitnote/DebitNoteTest/MinData_RUC.xml @@ -1,16 +1,15 @@ @@ -21,7 +20,6 @@ 2.0 FD01-1 2019-12-24 - 20:30:59 PEN F001-1 @@ -74,10 +72,10 @@ - 360 + 360.00 - 2000 - 360 + 2000.00 + 360.00 S @@ -89,28 +87,28 @@ - 2000 - 2360 - 2360 + 2000.00 + 2360.00 + 2360.00 1 10 - 1000 + 1000.00 - 118 + 118.00 01 - 180 + 180.00 - 1000 - 180 + 1000.00 + 180.00 S - 18 + 18.00 10 1000 @@ -124,27 +122,27 @@ - 100 + 100.00 2 10 - 1000 + 1000.00 - 118 + 118.00 01 - 180 + 180.00 - 1000 - 180 + 1000.00 + 180.00 S - 18 + 18.00 10 1000 @@ -158,7 +156,7 @@ - 100 + 100.00 diff --git a/src/test/resources/xml/invoice/otrosdocumentostributariosrelacionados/declaracionDeSalidaDelDepositoFranco.xml b/src/test/resources/e2e/renderer/invoice/InvoiceAnticiposTest/minAnticipos.xml similarity index 57% rename from src/test/resources/xml/invoice/otrosdocumentostributariosrelacionados/declaracionDeSalidaDelDepositoFranco.xml rename to src/test/resources/e2e/renderer/invoice/InvoiceAnticiposTest/minAnticipos.xml index 41b8a52f..ece35b1a 100644 --- a/src/test/resources/xml/invoice/otrosdocumentostributariosrelacionados/declaracionDeSalidaDelDepositoFranco.xml +++ b/src/test/resources/e2e/renderer/invoice/InvoiceAnticiposTest/minAnticipos.xml @@ -9,7 +9,8 @@ xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:sac="urn:sunat:names:specification:ubl:peru:schema:xsd:SunatAggregateComponents-1" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" - xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +> @@ -19,24 +20,17 @@ 2.0 F001-1 2019-12-24 - 20:30:59 - 01 - - PEN - + 01 + PEN - F001-1 - 08 - - - - F002-2 - 08 - + F001-2 + 02 + 1 + + + 12345678912 + + 12345678912 @@ -57,9 +51,7 @@ - 12345678912 - + 12345678912 @@ -72,9 +64,7 @@ - 12121212121 - + 12121212121 @@ -84,20 +74,27 @@ FormaPago Contado - 2360 + + 1 + 100 + + + false + 04 + 1 + 100 + 100 + - 360 + 54.00 - 2000 - 360 + 300.00 + 54.00 - S - + S - 1000 - + 1000 IGV VAT @@ -105,41 +102,32 @@ - 2000 - 2360 - 2360 + 400.00 + 472.00 + 100 + 372.00 1 - 10 - - 1000 + 2 + 200.00 - 118 - 01 - + 118.00 + 01 - 180 + 36.00 - 1000 - 180 + 200.00 + 36.00 - S - - 18 - 10 - + S + 18.00 + 10 - - 1000 - + 1000 IGV VAT @@ -150,40 +138,30 @@ - 100 + 100.00 2 - 10 - - 1000 + 2 + 200.00 - 118 - 01 - + 118.00 + 01 - 180 + 36.00 - 1000 - 180 + 200.00 + 36.00 - S - - 18 - 10 - + S + 18.00 + 10 - - 1000 - + 1000 IGV VAT @@ -194,7 +172,7 @@ - 100 + 100.00 diff --git a/src/test/resources/e2e/renderer/invoice/InvoiceDetraccionTest/detraccion.xml b/src/test/resources/e2e/renderer/invoice/InvoiceDetraccionTest/detraccion.xml new file mode 100644 index 00000000..f3b6e4a6 --- /dev/null +++ b/src/test/resources/e2e/renderer/invoice/InvoiceDetraccionTest/detraccion.xml @@ -0,0 +1,137 @@ + + + + + + + + 2.1 + 2.0 + F001-1 + 2019-12-24 + 01 + + PEN + + 12345678912 + + + 12345678912 + + + + + + + + #PROJECT-OPENUBL-SIGN + + + + + + + 12345678912 + + + + + 0000 + + + + + + + + 12121212121 + + + + + + + + Detraccion + 001 + + 0004-3342343243 + + + + Detraccion + 014 + 4.00 + 37.76 + + + FormaPago + Contado + + + 144.00 + + 800.00 + 144.00 + + S + + 1000 + IGV + VAT + + + + + + 800.00 + 944.00 + 0 + 944.00 + + + 1 + 4 + 800.00 + + + 236.00 + 01 + + + + 144.00 + + 800.00 + 144.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 200.00 + + + diff --git a/src/test/resources/e2e/renderer/invoice/InvoiceDireccionEntregaTest/direccionEntregaFull.xml b/src/test/resources/e2e/renderer/invoice/InvoiceDireccionEntregaTest/direccionEntregaFull.xml new file mode 100644 index 00000000..226dd169 --- /dev/null +++ b/src/test/resources/e2e/renderer/invoice/InvoiceDireccionEntregaTest/direccionEntregaFull.xml @@ -0,0 +1,176 @@ + + + + + + + + 2.1 + 2.0 + F001-1 + 2019-12-24 + 01 + + PEN + + 12345678912 + + + 12345678912 + + + + + + + + #PROJECT-OPENUBL-SIGN + + + + + + + 12345678912 + + + + + 0000 + + + + + + + + 12121212121 + + + + + + + + + + 050101 + 0101 + 000000 + Huamanga + Ayacucho + Jesus Nazareno + + + + + PE + + + + + + FormaPago + Contado + + + 72.00 + + 400.00 + 72.00 + + S + + 1000 + IGV + VAT + + + + + + 400.00 + 472.00 + 0 + 472.00 + + + 1 + 2 + 200.00 + + + 118.00 + 01 + + + + 36.00 + + 200.00 + 36.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 100.00 + + + + 2 + 2 + 200.00 + + + 118.00 + 01 + + + + 36.00 + + 200.00 + 36.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 100.00 + + + diff --git a/src/test/resources/e2e/renderer/invoice/InvoiceDireccionEntregaTest/direccionEntregaMin.xml b/src/test/resources/e2e/renderer/invoice/InvoiceDireccionEntregaTest/direccionEntregaMin.xml new file mode 100644 index 00000000..e6425af1 --- /dev/null +++ b/src/test/resources/e2e/renderer/invoice/InvoiceDireccionEntregaTest/direccionEntregaMin.xml @@ -0,0 +1,167 @@ + + + + + + + + 2.1 + 2.0 + F001-1 + 2019-12-24 + 01 + + PEN + + 12345678912 + + + 12345678912 + + + + + + + + #PROJECT-OPENUBL-SIGN + + + + + + + 12345678912 + + + + + 0000 + + + + + + + + 12121212121 + + + + + + + + + + + + + + + + + FormaPago + Contado + + + 72.00 + + 400.00 + 72.00 + + S + + 1000 + IGV + VAT + + + + + + 400.00 + 472.00 + 0 + 472.00 + + + 1 + 2 + 200.00 + + + 118.00 + 01 + + + + 36.00 + + 200.00 + 36.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 100.00 + + + + 2 + 2 + 200.00 + + + 118.00 + 01 + + + + 36.00 + + 200.00 + 36.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 100.00 + + + diff --git a/src/test/resources/xml/invoice/guiaremisionrelacionada/guiaRemisionTransportista.xml b/src/test/resources/e2e/renderer/invoice/InvoiceFechaVencimientoTest/conFechaVencimiento.xml similarity index 55% rename from src/test/resources/xml/invoice/guiaremisionrelacionada/guiaRemisionTransportista.xml rename to src/test/resources/e2e/renderer/invoice/InvoiceFechaVencimientoTest/conFechaVencimiento.xml index 7bcb4745..0b556c48 100644 --- a/src/test/resources/xml/invoice/guiaremisionrelacionada/guiaRemisionTransportista.xml +++ b/src/test/resources/e2e/renderer/invoice/InvoiceFechaVencimientoTest/conFechaVencimiento.xml @@ -9,7 +9,8 @@ xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:sac="urn:sunat:names:specification:ubl:peru:schema:xsd:SunatAggregateComponents-1" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" - xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +> @@ -19,25 +20,9 @@ 2.0 F001-1 2019-12-24 - 20:30:59 - 01 - - PEN - - - 0001-002020 - 31 - - - - 0002-002020 - 31 - - + 2022-01-01 + 01 + PEN 12345678912 @@ -57,9 +42,7 @@ - 12345678912 - + 12345678912 @@ -72,9 +55,7 @@ - 12121212121 - + 12121212121 @@ -84,20 +65,16 @@ FormaPago Contado - 2360 - 360 + 360.00 - 2000 - 360 + 2000.00 + 360.00 - S - + S - 1000 - + 1000 IGV VAT @@ -105,41 +82,32 @@ - 2000 - 2360 - 2360 + 2000.00 + 2360.00 + 0 + 2360.00 1 - 10 - - 1000 + 10 + 1000.00 - 118 - 01 - + 118.00 + 01 - 180 + 180.00 - 1000 - 180 + 1000.00 + 180.00 - S - - 18 - 10 - + S + 18.00 + 10 - - 1000 - + 1000 IGV VAT @@ -150,40 +118,30 @@ - 100 + 100.00 2 - 10 - - 1000 + 10 + 1000.00 - 118 - 01 - + 118.00 + 01 - 180 + 180.00 - 1000 - 180 + 1000.00 + 180.00 - S - - 18 - 10 - + S + 18.00 + 10 - - 1000 - + 1000 IGV VAT @@ -194,7 +152,7 @@ - 100 + 100.00 diff --git a/src/test/resources/e2e/renderer/invoice/InvoiceFormaPagoTest/conFormaPago.xml b/src/test/resources/e2e/renderer/invoice/InvoiceFormaPagoTest/conFormaPago.xml new file mode 100644 index 00000000..8a2cdf2c --- /dev/null +++ b/src/test/resources/e2e/renderer/invoice/InvoiceFormaPagoTest/conFormaPago.xml @@ -0,0 +1,170 @@ + + + + + + + + 2.1 + 2.0 + F001-1 + 2019-12-24 + 01 + PEN + + 12345678912 + + + 12345678912 + + + + + + + + #PROJECT-OPENUBL-SIGN + + + + + + + 12345678912 + + + + + 0000 + + + + + + + + 12121212121 + + + + + + + + FormaPago + Credito + 30.00 + + + FormaPago + Cuota001 + 10.00 + 2022-01-20 + + + FormaPago + Cuota002 + 20.00 + 2022-02-20 + + + 360.00 + + 2000.00 + 360.00 + + S + + 1000 + IGV + VAT + + + + + + 2000.00 + 2360.00 + 0 + 2360.00 + + + 1 + 10 + 1000.00 + + + 118.00 + 01 + + + + 180.00 + + 1000.00 + 180.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 100.00 + + + + 2 + 10 + 1000.00 + + + 118.00 + 01 + + + + 180.00 + + 1000.00 + 180.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 100.00 + + + diff --git a/src/test/resources/xml/invoice/guiaremisionrelacionada/guiaRemisionRemitente.xml b/src/test/resources/e2e/renderer/invoice/InvoiceFormaPagoTest/sinFormaPago.xml similarity index 55% rename from src/test/resources/xml/invoice/guiaremisionrelacionada/guiaRemisionRemitente.xml rename to src/test/resources/e2e/renderer/invoice/InvoiceFormaPagoTest/sinFormaPago.xml index 31532056..1dd0840d 100644 --- a/src/test/resources/xml/invoice/guiaremisionrelacionada/guiaRemisionRemitente.xml +++ b/src/test/resources/e2e/renderer/invoice/InvoiceFormaPagoTest/sinFormaPago.xml @@ -9,7 +9,8 @@ xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:sac="urn:sunat:names:specification:ubl:peru:schema:xsd:SunatAggregateComponents-1" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" - xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +> @@ -19,25 +20,8 @@ 2.0 F001-1 2019-12-24 - 20:30:59 - 01 - - PEN - - - 0001-002020 - 09 - - - - 0002-002020 - 09 - - + 01 + PEN 12345678912 @@ -57,9 +41,7 @@ - 12345678912 - + 12345678912 @@ -72,9 +54,7 @@ - 12121212121 - + 12121212121 @@ -84,20 +64,16 @@ FormaPago Contado - 2360 - 360 + 360.00 - 2000 - 360 + 2000.00 + 360.00 - S - + S - 1000 - + 1000 IGV VAT @@ -105,41 +81,32 @@ - 2000 - 2360 - 2360 + 2000.00 + 2360.00 + 0 + 2360.00 1 - 10 - - 1000 + 10 + 1000.00 - 118 - 01 - + 118.00 + 01 - 180 + 180.00 - 1000 - 180 + 1000.00 + 180.00 - S - - 18 - 10 - + S + 18.00 + 10 - - 1000 - + 1000 IGV VAT @@ -150,40 +117,30 @@ - 100 + 100.00 2 - 10 - - 1000 + 10 + 1000.00 - 118 - 01 - + 118.00 + 01 - 180 + 180.00 - 1000 - 180 + 1000.00 + 180.00 - S - - 18 - 10 - + S + 18.00 + 10 - - 1000 - + 1000 IGV VAT @@ -194,7 +151,7 @@ - 100 + 100.00 diff --git a/src/test/resources/xml/invoice/issues/issue-30-with-precioUnitario_andICB.xml b/src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitario-ICB.xml similarity index 66% rename from src/test/resources/xml/invoice/issues/issue-30-with-precioUnitario_andICB.xml rename to src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitario-ICB.xml index 99a93dff..afd766fa 100644 --- a/src/test/resources/xml/invoice/issues/issue-30-with-precioUnitario_andICB.xml +++ b/src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitario-ICB.xml @@ -9,7 +9,8 @@ xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:sac="urn:sunat:names:specification:ubl:peru:schema:xsd:SunatAggregateComponents-1" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" - xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +> @@ -19,21 +20,16 @@ 2.0 F001-1 2019-12-24 - 20:30:59 - 01 - - PEN - + 01 + PEN - 000000000000 + 12345678912 - 000000000000 + 12345678912 - + @@ -45,17 +41,12 @@ - 12345678912 - + 12345678912 0000 - - - @@ -63,9 +54,7 @@ - 12121212121 - + 12121212121 @@ -75,34 +64,27 @@ FormaPago Contado - 80.82 14.02 - 66.8 + 66.80 12.02 - S - + S - 1000 - + 1000 IGV VAT - 2 + 2.00 - S - + S - 7152 - + 7152 ICBPER OTH @@ -110,55 +92,44 @@ - 66.8 + 66.80 80.82 + 0 80.82 1 - 10 - - 66.8 + 10 + 66.80 7.88 - 01 - + 01 14.02 - 66.8 + 66.80 12.02 - S - - 18 - 10 - + S + 18.00 + 10 - - 1000 - + 1000 IGV VAT - 2 + 2.00 10 - 0.2 + 0.20 - - 7152 - + 7152 ICBPER OTH diff --git a/src/test/resources/xml/invoice/issues/issue-30-with-precioConIgv_andICB.xml b/src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitario-conImpuestos-ICB.xml similarity index 68% rename from src/test/resources/xml/invoice/issues/issue-30-with-precioConIgv_andICB.xml rename to src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitario-conImpuestos-ICB.xml index 2c8a0b65..2eb45afc 100644 --- a/src/test/resources/xml/invoice/issues/issue-30-with-precioConIgv_andICB.xml +++ b/src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitario-conImpuestos-ICB.xml @@ -9,7 +9,8 @@ xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:sac="urn:sunat:names:specification:ubl:peru:schema:xsd:SunatAggregateComponents-1" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" - xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +> @@ -19,21 +20,16 @@ 2.0 F001-1 2019-12-24 - 20:30:59 - 01 - - PEN - + 01 + PEN - 000000000000 + 12345678912 - 000000000000 + 12345678912 - + @@ -45,17 +41,12 @@ - 12345678912 - + 12345678912 0000 - - - @@ -63,9 +54,7 @@ - 12121212121 - + 12121212121 @@ -75,7 +64,6 @@ FormaPago Contado - 80.8 14.02 @@ -83,26 +71,20 @@ 66.78 12.02 - S - + S - 1000 - + 1000 IGV VAT - 2 + 2.00 - S - + S - 7152 - + 7152 ICBPER OTH @@ -111,21 +93,18 @@ 66.78 - 80.8 - 80.8 + 80.80 + 0 + 80.80 1 - 10 - + 10 66.78 7.88 - 01 - + 01 @@ -134,31 +113,23 @@ 66.78 12.02 - S - - 18 - 10 - + S + 18.00 + 10 - - 1000 - + 1000 IGV VAT - 2 + 2.00 10 - 0.2 + 0.20 - - 7152 - + 7152 ICBPER OTH diff --git a/src/test/resources/xml/invoice/issues/issue-30-with-precioUnitario.xml b/src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitario.xml similarity index 67% rename from src/test/resources/xml/invoice/issues/issue-30-with-precioUnitario.xml rename to src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitario.xml index 435f6f8f..20a1f925 100644 --- a/src/test/resources/xml/invoice/issues/issue-30-with-precioUnitario.xml +++ b/src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitario.xml @@ -9,7 +9,8 @@ xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:sac="urn:sunat:names:specification:ubl:peru:schema:xsd:SunatAggregateComponents-1" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" - xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +> @@ -19,21 +20,16 @@ 2.0 F001-1 2019-12-24 - 20:30:59 - 01 - - PEN - + 01 + PEN - 000000000000 + 12345678912 - 000000000000 + 12345678912 - + @@ -45,17 +41,12 @@ - 12345678912 - + 12345678912 0000 - - - @@ -63,9 +54,7 @@ - 12121212121 - + 12121212121 @@ -75,20 +64,16 @@ FormaPago Contado - 78.82 12.02 - 66.8 + 66.80 12.02 - S - + S - 1000 - + 1000 IGV VAT @@ -96,41 +81,32 @@ - 66.8 + 66.80 78.82 + 0 78.82 1 - 10 - - 66.8 + 10 + 66.80 7.88 - 01 - + 01 12.02 - 66.8 + 66.80 12.02 - S - - 18 - 10 - + S + 18.00 + 10 - - 1000 - + 1000 IGV VAT diff --git a/src/test/resources/xml/invoice/issues/issue-30-with-precioConIgv.xml b/src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitarioConImpuestos.xml similarity index 70% rename from src/test/resources/xml/invoice/issues/issue-30-with-precioConIgv.xml rename to src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitarioConImpuestos.xml index 1ae366c8..6277ad21 100644 --- a/src/test/resources/xml/invoice/issues/issue-30-with-precioConIgv.xml +++ b/src/test/resources/e2e/renderer/invoice/InvoiceIssue30Test/with-precioUnitarioConImpuestos.xml @@ -9,7 +9,8 @@ xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:sac="urn:sunat:names:specification:ubl:peru:schema:xsd:SunatAggregateComponents-1" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" - xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +> @@ -19,21 +20,16 @@ 2.0 F001-1 2019-12-24 - 20:30:59 - 01 - - PEN - + 01 + PEN - 000000000000 + 12345678912 - 000000000000 + 12345678912 - + @@ -45,17 +41,12 @@ - 12345678912 - + 12345678912 0000 - - - @@ -63,9 +54,7 @@ - 12121212121 - + 12121212121 @@ -75,7 +64,6 @@ FormaPago Contado - 78.8 12.02 @@ -83,12 +71,9 @@ 66.78 12.02 - S - + S - 1000 - + 1000 IGV VAT @@ -97,21 +82,18 @@ 66.78 - 78.8 - 78.8 + 78.80 + 0 + 78.80 1 - 10 - + 10 66.78 7.88 - 01 - + 01 @@ -120,17 +102,11 @@ 66.78 12.02 - S - - 18 - 10 - + S + 18.00 + 10 - - 1000 - + 1000 IGV VAT diff --git a/src/test/resources/e2e/renderer/invoice/InvoicePercepcionTest/percepcion.xml b/src/test/resources/e2e/renderer/invoice/InvoicePercepcionTest/percepcion.xml new file mode 100644 index 00000000..7026dc36 --- /dev/null +++ b/src/test/resources/e2e/renderer/invoice/InvoicePercepcionTest/percepcion.xml @@ -0,0 +1,135 @@ + + + + + + + + 2.1 + 2.0 + F001-1 + 2019-12-24 + 01 + + PEN + + 12345678912 + + + 12345678912 + + + + + + + + #PROJECT-OPENUBL-SIGN + + + + + + + 12345678912 + + + + + 0000 + + + + + + + + 12121212121 + + + + + + + + Percepcion + 816.00 + + + FormaPago + Contado + + + true + 51 + 0.02 + 16.00 + 800.00 + + + 144.00 + + 800.00 + 144.00 + + S + + 1000 + IGV + VAT + + + + + + 800.00 + 944.00 + 0 + 944.00 + + + 1 + 4 + 800.00 + + + 236.00 + 01 + + + + 144.00 + + 800.00 + 144.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 200.00 + + + diff --git a/src/test/resources/xml/invoice/customClienteDireccionAndContacto.xml b/src/test/resources/e2e/renderer/invoice/InvoiceTest/customClienteDireccionAndContacto.xml similarity index 58% rename from src/test/resources/xml/invoice/customClienteDireccionAndContacto.xml rename to src/test/resources/e2e/renderer/invoice/InvoiceTest/customClienteDireccionAndContacto.xml index dc95dae2..06cea7ef 100644 --- a/src/test/resources/xml/invoice/customClienteDireccionAndContacto.xml +++ b/src/test/resources/e2e/renderer/invoice/InvoiceTest/customClienteDireccionAndContacto.xml @@ -9,7 +9,8 @@ xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:sac="urn:sunat:names:specification:ubl:peru:schema:xsd:SunatAggregateComponents-1" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" - xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +> @@ -19,13 +20,8 @@ 2.0 F001-1 2019-12-24 - 20:30:59 - 01 - - PEN - + 01 + PEN 12345678912 @@ -33,7 +29,7 @@ 12345678912 - Softgreen S.A.C. + @@ -45,13 +41,10 @@ - 12345678912 - + 12345678912 - Softgreen S.A.C. + 0000 @@ -64,7 +57,7 @@ 12121212121 - Carlos Feria + 050101 0101 @@ -73,7 +66,7 @@ Ayacucho Jesus Nazareno - Jr. Las piedras 123 + PE @@ -89,20 +82,16 @@ FormaPago Contado - 2360 - 360 + 360.00 - 2000 - 360 + 2000.00 + 360.00 - S - + S - 1000 - + 1000 IGV VAT @@ -110,42 +99,32 @@ - 2000 - 2360 - 2360 + 2000.00 + 2360.00 + 0 + 2360.00 1 - 10 - - 1000 + 10 + 1000.00 - 118 - 01 - + 118.00 + 01 - 180 + 180.00 - 1000 - 180 + 1000.00 + 180.00 - S - - 18 - 10 - + S + 18.00 + 10 - - 1000 - + 1000 IGV VAT @@ -153,44 +132,33 @@ - Item1 + - 100 + 100.00 2 - 10 - - 1000 + 10 + 1000.00 - 118 - 01 - + 118.00 + 01 - 180 + 180.00 - 1000 - 180 + 1000.00 + 180.00 - S - - 18 - 10 - + S + 18.00 + 10 - - 1000 - + 1000 IGV VAT @@ -198,10 +166,10 @@ - Item2 + - 100 + 100.00 diff --git a/src/test/resources/xml/invoice/otrosdocumentostributariosrelacionados/codigoScop.xml b/src/test/resources/e2e/renderer/invoice/InvoiceTest/customCodigoLocal.xml similarity index 55% rename from src/test/resources/xml/invoice/otrosdocumentostributariosrelacionados/codigoScop.xml rename to src/test/resources/e2e/renderer/invoice/InvoiceTest/customCodigoLocal.xml index cbcc9aeb..2d236ef9 100644 --- a/src/test/resources/xml/invoice/otrosdocumentostributariosrelacionados/codigoScop.xml +++ b/src/test/resources/e2e/renderer/invoice/InvoiceTest/customCodigoLocal.xml @@ -9,7 +9,8 @@ xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:sac="urn:sunat:names:specification:ubl:peru:schema:xsd:SunatAggregateComponents-1" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" - xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +> @@ -19,25 +20,8 @@ 2.0 F001-1 2019-12-24 - 20:30:59 - 01 - - PEN - - - F001-1 - 05 - - - - F002-2 - 05 - - + 01 + PEN 12345678912 @@ -57,14 +41,15 @@ - 12345678912 - + 12345678912 0000 + + + @@ -72,9 +57,7 @@ - 12121212121 - + 12121212121 @@ -84,20 +67,16 @@ FormaPago Contado - 2360 - 360 + 424.80 - 2000 - 360 + 2360.00 + 424.80 - S - + S - 1000 - + 1000 IGV VAT @@ -105,41 +84,32 @@ - 2000 - 2360 - 2360 + 2360.00 + 2784.80 + 0 + 2784.80 1 - 10 - - 1000 + 10 + 1180.00 - 118 - 01 - + 139.24 + 01 - 180 + 212.40 - 1000 - 180 + 1180.00 + 212.40 - S - - 18 - 10 - + S + 18.00 + 10 - - 1000 - + 1000 IGV VAT @@ -150,40 +120,30 @@ - 100 + 118.00 2 - 10 - - 1000 + 10 + 1180.00 - 118 - 01 - + 139.24 + 01 - 180 + 212.40 - 1000 - 180 + 1180.00 + 212.40 - S - - 18 - 10 - + S + 18.00 + 10 - - 1000 - + 1000 IGV VAT @@ -194,7 +154,7 @@ - 100 + 118.00 diff --git a/src/test/resources/e2e/renderer/invoice/InvoiceTest/customFechaEmision.xml b/src/test/resources/e2e/renderer/invoice/InvoiceTest/customFechaEmision.xml new file mode 100644 index 00000000..5e004108 --- /dev/null +++ b/src/test/resources/e2e/renderer/invoice/InvoiceTest/customFechaEmision.xml @@ -0,0 +1,158 @@ + + + + + + + + 2.1 + 2.0 + F001-1 + 2019-01-06 + 00:00:00 + 01 + PEN + + 12345678912 + + + 12345678912 + + + + + + + + #PROJECT-OPENUBL-SIGN + + + + + + + 12345678912 + + + + + 0000 + + + + + + + + 12121212121 + + + + + + + + FormaPago + Contado + + + 360.00 + + 2000.00 + 360.00 + + S + + 1000 + IGV + VAT + + + + + + 2000.00 + 2360.00 + 0 + 2360.00 + + + 1 + 10 + 1000.00 + + + 118.00 + 01 + + + + 180.00 + + 1000.00 + 180.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 100.00 + + + + 2 + 10 + 1000.00 + + + 118.00 + 01 + + + + 180.00 + + 1000.00 + 180.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 100.00 + + + diff --git a/src/test/resources/e2e/renderer/invoice/InvoiceTest/customFirmante.xml b/src/test/resources/e2e/renderer/invoice/InvoiceTest/customFirmante.xml new file mode 100644 index 00000000..fcf351c4 --- /dev/null +++ b/src/test/resources/e2e/renderer/invoice/InvoiceTest/customFirmante.xml @@ -0,0 +1,157 @@ + + + + + + + + 2.1 + 2.0 + F001-1 + 2019-12-24 + 01 + PEN + + 000000000000 + + + 000000000000 + + + + + + + + #PROJECT-OPENUBL-SIGN + + + + + + + 12345678912 + + + + + 0000 + + + + + + + + 12121212121 + + + + + + + + FormaPago + Contado + + + 360.00 + + 2000.00 + 360.00 + + S + + 1000 + IGV + VAT + + + + + + 2000.00 + 2360.00 + 0 + 2360.00 + + + 1 + 10 + 1000.00 + + + 118.00 + 01 + + + + 180.00 + + 1000.00 + 180.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 100.00 + + + + 2 + 10 + 1000.00 + + + 118.00 + 01 + + + + 180.00 + + 1000.00 + 180.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 100.00 + + + diff --git a/src/test/resources/xml/invoice/customProveedorDireccionAndContacto.xml b/src/test/resources/e2e/renderer/invoice/InvoiceTest/customProveedorDireccionAndContacto.xml similarity index 56% rename from src/test/resources/xml/invoice/customProveedorDireccionAndContacto.xml rename to src/test/resources/e2e/renderer/invoice/InvoiceTest/customProveedorDireccionAndContacto.xml index c9deff24..cbf39cce 100644 --- a/src/test/resources/xml/invoice/customProveedorDireccionAndContacto.xml +++ b/src/test/resources/e2e/renderer/invoice/InvoiceTest/customProveedorDireccionAndContacto.xml @@ -9,7 +9,8 @@ xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:sac="urn:sunat:names:specification:ubl:peru:schema:xsd:SunatAggregateComponents-1" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" - xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +> @@ -19,13 +20,8 @@ 2.0 F001-1 2019-12-24 - 20:30:59 - 01 - - PEN - + 01 + PEN 12345678912 @@ -33,7 +29,7 @@ 12345678912 - Softgreen S.A.C. + @@ -45,22 +41,19 @@ - 12345678912 - + 12345678912 - Softgreen S.A.C. + 050101 - 0001 + 0101 000000 Huamanga Ayacucho Jesus Nazareno - Jr. Las piedras 123 + PE @@ -79,27 +72,23 @@ 12121212121 - Carlos Feria + FormaPago Contado - 2360 - 360 + 360.00 - 2000 - 360 + 2000.00 + 360.00 - S - + S - 1000 - + 1000 IGV VAT @@ -107,42 +96,32 @@ - 2000 - 2360 - 2360 + 2000.00 + 2360.00 + 0 + 2360.00 1 - 10 - - 1000 + 10 + 1000.00 - 118 - 01 - + 118.00 + 01 - 180 + 180.00 - 1000 - 180 + 1000.00 + 180.00 - S - - 18 - 10 - + S + 18.00 + 10 - - 1000 - + 1000 IGV VAT @@ -150,44 +129,33 @@ - Item1 + - 100 + 100.00 2 - 10 - - 1000 + 10 + 1000.00 - 118 - 01 - + 118.00 + 01 - 180 + 180.00 - 1000 - 180 + 1000.00 + 180.00 - S - - 18 - 10 - + S + 18.00 + 10 - - 1000 - + 1000 IGV VAT @@ -195,10 +163,10 @@ - Item2 + - 100 + 100.00 diff --git a/src/test/resources/e2e/renderer/invoice/InvoiceTest/customUnidadMedida.xml b/src/test/resources/e2e/renderer/invoice/InvoiceTest/customUnidadMedida.xml new file mode 100644 index 00000000..cd6a10c8 --- /dev/null +++ b/src/test/resources/e2e/renderer/invoice/InvoiceTest/customUnidadMedida.xml @@ -0,0 +1,157 @@ + + + + + + + + 2.1 + 2.0 + F001-1 + 2019-12-24 + 01 + PEN + + 12345678912 + + + 12345678912 + + + + + + + + #PROJECT-OPENUBL-SIGN + + + + + + + 12345678912 + + + + + 0000 + + + + + + + + 12121212121 + + + + + + + + FormaPago + Contado + + + 360.00 + + 2000.00 + 360.00 + + S + + 1000 + IGV + VAT + + + + + + 2000.00 + 2360.00 + 0 + 2360.00 + + + 1 + 10 + 1000.00 + + + 118.00 + 01 + + + + 180.00 + + 1000.00 + 180.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 100.00 + + + + 2 + 10 + 1000.00 + + + 118.00 + 01 + + + + 180.00 + + 1000.00 + 180.00 + + S + 18.00 + 10 + + 1000 + IGV + VAT + + + + + + + + + 100.00 + + + diff --git a/src/test/resources/xml/invoice/icb.xml b/src/test/resources/e2e/renderer/invoice/InvoiceTest/icb.xml similarity index 57% rename from src/test/resources/xml/invoice/icb.xml rename to src/test/resources/e2e/renderer/invoice/InvoiceTest/icb.xml index 60503671..602759e3 100644 --- a/src/test/resources/xml/invoice/icb.xml +++ b/src/test/resources/e2e/renderer/invoice/InvoiceTest/icb.xml @@ -9,8 +9,7 @@ xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:sac="urn:sunat:names:specification:ubl:peru:schema:xsd:SunatAggregateComponents-1" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" - xmlns:xs="http://www.w3.org/2001/XMLSchema" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > @@ -21,21 +20,16 @@ 2.0 F001-1 2019-12-24 - 20:30:59 - 01 - - PEN - + 01 + PEN - 000000000000 + 12345678912 - 000000000000 + 12345678912 - + @@ -47,10 +41,7 @@ - 12345678912 - + 12345678912 @@ -63,10 +54,7 @@ - 12121212121 - + 12121212121 @@ -76,34 +64,27 @@ FormaPago Contado - 2364 - 364 + 364.00 - 2000 - 360 + 2000.00 + 360.00 - S - + S - 1000 - + 1000 IGV VAT - 4 + 4.00 - S - + S - 7152 - + 7152 ICBPER OTH @@ -111,56 +92,44 @@ - 2000 - 2364 - 2364 + 2000.00 + 2364.00 + 0 + 2364.00 1 - 10 - - 1000 + 10 + 1000.00 - 118 - 01 - + 118.00 + 01 - 182 + 182.00 - 1000 - 180 + 1000.00 + 180.00 - S - - 18 - 10 - + S + 18.00 + 10 - - 1000 - + 1000 IGV VAT - 2 + 2.00 10 - 0.2 + 0.20 - - 7152 - + 7152 ICBPER OTH @@ -171,55 +140,42 @@ - 100 + 100.00 2 - 10 - - 1000 + 10 + 1000.00 - 118 - 01 - + 118.00 + 01 - 182 + 182.00 - 1000 - 180 + 1000.00 + 180.00 - S - - 18 - 10 - + S + 18.00 + 10 - - 1000 - + 1000 IGV VAT - 2 + 2.00 10 - 0.2 + 0.20 - - 7152 - + 7152 ICBPER OTH @@ -230,7 +186,7 @@ - 100 + 100.00 diff --git a/src/test/resources/xml/cases/proveedorsincodigopostal/CreditNote.xml b/src/test/resources/xml/cases/proveedorsincodigopostal/CreditNote.xml deleted file mode 100644 index 5d305c25..00000000 --- a/src/test/resources/xml/cases/proveedorsincodigopostal/CreditNote.xml +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-02-01 - 18:30:00 - PEN - 1 - - F009-9 - 01 - - - - - F009-9 - 01 - - - - #SIGN-ID - - - 22222222222 - - - - - - - - #SIGN-ID - - - - - - - 22222222222 - - - - - - - - - - 33333333333 - - - - - - - - 18 - - 100 - 18 - - S - - 1000 - IGV - VAT - - - - - - 0 - 0 - 118 - - - 1 - 1 - 100 - - - 118 - 01 - - - - 18 - - 100 - 18 - - S - 18 - 10 - - 1000 - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/cases/proveedorsincodigopostal/DebitNote.xml b/src/test/resources/xml/cases/proveedorsincodigopostal/DebitNote.xml deleted file mode 100644 index 2de34c83..00000000 --- a/src/test/resources/xml/cases/proveedorsincodigopostal/DebitNote.xml +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-02-01 - 18:30:00 - PEN - 1 - - F009-9 - 02 - - - - - F009-9 - 01 - - - - #SIGN-ID - - - 22222222222 - - - - - - - - #SIGN-ID - - - - - - - 22222222222 - - - - - - - - - - 33333333333 - - - - - - - - 18 - - 100 - 18 - - S - - 1000 - IGV - VAT - - - - - - 0 - 0 - 118 - - - 1 - 1 - 100 - - - 118 - 01 - - - - 18 - - 100 - 18 - - S - 18 - 10 - - 1000 - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/cases/proveedorsincodigopostal/Invoice.xml b/src/test/resources/xml/cases/proveedorsincodigopostal/Invoice.xml deleted file mode 100644 index 5a36cd20..00000000 --- a/src/test/resources/xml/cases/proveedorsincodigopostal/Invoice.xml +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-02-01 - 18:30:00 - 01 - PEN - 1 - - #SIGN-ID - - - 22222222222 - - - Proveedor - - - - - #SIGN-ID - - - - - - - 22222222222 - - - Proveedor - - - - - - - 33333333333 - - - Cliente - - - - - 18 - - 100 - 18 - - S - - 1000 - IGV - VAT - - - - - - 0 - 0 - 118 - - - 1 - 1 - 100 - - - 118 - 01 - - - - 18 - - 100 - 18 - - S - 18 - 10 - - 1000 - IGV - VAT - - - - - - item - - - 100 - - - diff --git a/src/test/resources/xml/cases/proveedorsincodigopostal/VoidedDocument.xml b/src/test/resources/xml/cases/proveedorsincodigopostal/VoidedDocument.xml deleted file mode 100644 index 444fd895..00000000 --- a/src/test/resources/xml/cases/proveedorsincodigopostal/VoidedDocument.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - 2.0 - 1.0 - RA-20191108-1 - 2019-11-07 - 2019-11-08 - - #SIGN-ID - - - 22222222222 - - - Proveedor - - - - - #SIGN-ID - - - - - 22222222222 - 6 - - - Proveedor - - - - - 1 - 01 - F001 - 1 - motivo baja - - diff --git a/src/test/resources/xml/creditnote/formapago/conFormaPago_afectaBoleta.xml b/src/test/resources/xml/creditnote/formapago/conFormaPago_afectaBoleta.xml deleted file mode 100644 index ff900058..00000000 --- a/src/test/resources/xml/creditnote/formapago/conFormaPago_afectaBoleta.xml +++ /dev/null @@ -1,210 +0,0 @@ - - - - - - - - 2.1 - 2.0 - BC01-1 - 2019-01-06 - 00:00:00 - PEN - - - B001-1 - 03 - - - - - B001-1 - 03 - - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12345678 - - - - - - - - - FormaPago - Credito - 2360 - - - FormaPago - Cuota000 - 2000 - 2019-01-07 - - - FormaPago - Cuota001 - 360 - 2019-01-08 - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/creditnote/formapago/conFormaPago_afectaFactura.xml b/src/test/resources/xml/creditnote/formapago/conFormaPago_afectaFactura.xml deleted file mode 100644 index cc919f35..00000000 --- a/src/test/resources/xml/creditnote/formapago/conFormaPago_afectaFactura.xml +++ /dev/null @@ -1,216 +0,0 @@ - - - - - - - - 2.1 - 2.0 - FC01-1 - 2019-01-06 - 00:00:00 - PEN - - - F001-1 - 01 - - - - - F001-1 - 01 - - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12121212121 - - - - - - - - - FormaPago - Credito - 2360 - - - FormaPago - Cuota000 - 2000 - 2019-01-07 - - - FormaPago - Cuota001 - 360 - 2019-01-08 - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/creditnote/formapago/sinFormaPago_afectaBoleta.xml b/src/test/resources/xml/creditnote/formapago/sinFormaPago_afectaBoleta.xml deleted file mode 100644 index baff58ff..00000000 --- a/src/test/resources/xml/creditnote/formapago/sinFormaPago_afectaBoleta.xml +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - - - 2.1 - 2.0 - BC01-1 - 2019-12-24 - 20:30:59 - PEN - - - B001-1 - 03 - - - - - B001-1 - 03 - - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12345678 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/creditnote/formapago/sinFormaPago_afectaFactura.xml b/src/test/resources/xml/creditnote/formapago/sinFormaPago_afectaFactura.xml deleted file mode 100644 index 2a823db7..00000000 --- a/src/test/resources/xml/creditnote/formapago/sinFormaPago_afectaFactura.xml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - 2.1 - 2.0 - FC01-1 - 2019-12-24 - 20:30:59 - PEN - - - F001-1 - 01 - - - - - F001-1 - 01 - - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12121212121 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/creditnote/guiaremisionrelacionada/guiaRemisionRemitente.xml b/src/test/resources/xml/creditnote/guiaremisionrelacionada/guiaRemisionRemitente.xml deleted file mode 100644 index 4cd012a4..00000000 --- a/src/test/resources/xml/creditnote/guiaremisionrelacionada/guiaRemisionRemitente.xml +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - 2.1 - 2.0 - FC01-1 - 2019-12-24 - 20:30:59 - PEN - - - F001-1 - 01 - - - - - F001-1 - 01 - - - - - 0001-002020 - 09 - - - - 0002-002020 - 09 - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12121212121 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/creditnote/guiaremisionrelacionada/guiaRemisionTransportista.xml b/src/test/resources/xml/creditnote/guiaremisionrelacionada/guiaRemisionTransportista.xml deleted file mode 100644 index b45f05e3..00000000 --- a/src/test/resources/xml/creditnote/guiaremisionrelacionada/guiaRemisionTransportista.xml +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - 2.1 - 2.0 - FC01-1 - 2019-12-24 - 20:30:59 - PEN - - - F001-1 - 01 - - - - - F001-1 - 01 - - - - - 0001-002020 - 31 - - - - 0002-002020 - 31 - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12121212121 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/creditnote/mindata/MinData_DNI.xml b/src/test/resources/xml/creditnote/mindata/MinData_DNI.xml deleted file mode 100644 index 56ecf610..00000000 --- a/src/test/resources/xml/creditnote/mindata/MinData_DNI.xml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - 2.1 - 2.0 - BC01-1 - 2019-12-24 - 20:30:59 - PEN - - - B001-1 - 03 - - - - - B001-1 - 03 - - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12345678 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/creditnote/mindata/MinData_DecDiplomatica.xml b/src/test/resources/xml/creditnote/mindata/MinData_DecDiplomatica.xml deleted file mode 100644 index e525312d..00000000 --- a/src/test/resources/xml/creditnote/mindata/MinData_DecDiplomatica.xml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - 2.1 - 2.0 - BC01-1 - 2019-12-24 - 20:30:59 - PEN - - - B001-1 - 03 - - - - - B001-1 - 03 - - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12345678 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/creditnote/mindata/MinData_DocTribNoDomSinRuc.xml b/src/test/resources/xml/creditnote/mindata/MinData_DocTribNoDomSinRuc.xml deleted file mode 100644 index a7bd49f4..00000000 --- a/src/test/resources/xml/creditnote/mindata/MinData_DocTribNoDomSinRuc.xml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - 2.1 - 2.0 - BC01-1 - 2019-12-24 - 20:30:59 - PEN - - - B001-1 - 03 - - - - - B001-1 - 03 - - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12345678 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/creditnote/mindata/MinData_Extranjeria.xml b/src/test/resources/xml/creditnote/mindata/MinData_Extranjeria.xml deleted file mode 100644 index 626fbe2c..00000000 --- a/src/test/resources/xml/creditnote/mindata/MinData_Extranjeria.xml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - 2.1 - 2.0 - BC01-1 - 2019-12-24 - 20:30:59 - PEN - - - B001-1 - 03 - - - - - B001-1 - 03 - - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12345678 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/creditnote/mindata/MinData_Pasaporte.xml b/src/test/resources/xml/creditnote/mindata/MinData_Pasaporte.xml deleted file mode 100644 index f984f7cd..00000000 --- a/src/test/resources/xml/creditnote/mindata/MinData_Pasaporte.xml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - 2.1 - 2.0 - BC01-1 - 2019-12-24 - 20:30:59 - PEN - - - B001-1 - 03 - - - - - B001-1 - 03 - - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12345678 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/creditnote/mindata/MinData_RUC.xml b/src/test/resources/xml/creditnote/mindata/MinData_RUC.xml deleted file mode 100644 index 2a823db7..00000000 --- a/src/test/resources/xml/creditnote/mindata/MinData_RUC.xml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - 2.1 - 2.0 - FC01-1 - 2019-12-24 - 20:30:59 - PEN - - - F001-1 - 01 - - - - - F001-1 - 01 - - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12121212121 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/creditnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgv.xml b/src/test/resources/xml/creditnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgv.xml deleted file mode 100644 index 2a823db7..00000000 --- a/src/test/resources/xml/creditnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgv.xml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - 2.1 - 2.0 - FC01-1 - 2019-12-24 - 20:30:59 - PEN - - - F001-1 - 01 - - - - - F001-1 - 01 - - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12121212121 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/creditnote/otrosdocumentostributariosrelacionados/codigoScop.xml b/src/test/resources/xml/creditnote/otrosdocumentostributariosrelacionados/codigoScop.xml deleted file mode 100644 index 1837a495..00000000 --- a/src/test/resources/xml/creditnote/otrosdocumentostributariosrelacionados/codigoScop.xml +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - 2.1 - 2.0 - FC01-1 - 2019-12-24 - 20:30:59 - PEN - - - F001-1 - 01 - - - - - F001-1 - 01 - - - - - F001-1 - 05 - - - - F002-2 - 05 - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12121212121 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/creditnote/otrosdocumentostributariosrelacionados/facturaEmitidaParaCorregirErrorEnElRuc.xml b/src/test/resources/xml/creditnote/otrosdocumentostributariosrelacionados/facturaEmitidaParaCorregirErrorEnElRuc.xml deleted file mode 100644 index 6cb970f5..00000000 --- a/src/test/resources/xml/creditnote/otrosdocumentostributariosrelacionados/facturaEmitidaParaCorregirErrorEnElRuc.xml +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - 2.1 - 2.0 - FC01-1 - 2019-12-24 - 20:30:59 - PEN - - - F001-1 - 01 - - - - - F001-1 - 01 - - - - - F001-1 - 01 - - - - F002-2 - 01 - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12121212121 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/creditnote/otrosdocumentostributariosrelacionados/otros.xml b/src/test/resources/xml/creditnote/otrosdocumentostributariosrelacionados/otros.xml deleted file mode 100644 index ab198944..00000000 --- a/src/test/resources/xml/creditnote/otrosdocumentostributariosrelacionados/otros.xml +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - 2.1 - 2.0 - FC01-1 - 2019-12-24 - 20:30:59 - PEN - - - F001-1 - 01 - - - - - F001-1 - 01 - - - - - F001-1 - 99 - - - - F002-2 - 99 - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12121212121 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/creditnote/otrosdocumentostributariosrelacionados/ticketDeSalida.xml b/src/test/resources/xml/creditnote/otrosdocumentostributariosrelacionados/ticketDeSalida.xml deleted file mode 100644 index ffde6b95..00000000 --- a/src/test/resources/xml/creditnote/otrosdocumentostributariosrelacionados/ticketDeSalida.xml +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - 2.1 - 2.0 - FC01-1 - 2019-12-24 - 20:30:59 - PEN - - - F001-1 - 01 - - - - - F001-1 - 01 - - - - - F001-1 - 04 - - - - F002-2 - 04 - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12121212121 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/creditnote/tiponota/descuentoPorItem.xml b/src/test/resources/xml/creditnote/tiponota/descuentoPorItem.xml deleted file mode 100644 index 6dee51a9..00000000 --- a/src/test/resources/xml/creditnote/tiponota/descuentoPorItem.xml +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - - - 2.1 - 2.0 - FC01-1 - 2019-12-24 - 20:30:59 - PEN - - - F001-1 - 01 - - - - - F001-1 - 01 - - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12121212121 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/debitnote/guiaremisionrelacionada/guiaRemisionRemitente.xml b/src/test/resources/xml/debitnote/guiaremisionrelacionada/guiaRemisionRemitente.xml deleted file mode 100644 index 99f7bfb1..00000000 --- a/src/test/resources/xml/debitnote/guiaremisionrelacionada/guiaRemisionRemitente.xml +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - 2.1 - 2.0 - FD01-1 - 2019-12-24 - 20:30:59 - PEN - - - F001-1 - 01 - - - - - F001-1 - 01 - - - - - 0001-002020 - 09 - - - - 0002-002020 - 09 - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12121212121 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/debitnote/guiaremisionrelacionada/guiaRemisionTransportista.xml b/src/test/resources/xml/debitnote/guiaremisionrelacionada/guiaRemisionTransportista.xml deleted file mode 100644 index 8fc4bd8c..00000000 --- a/src/test/resources/xml/debitnote/guiaremisionrelacionada/guiaRemisionTransportista.xml +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - 2.1 - 2.0 - FD01-1 - 2019-12-24 - 20:30:59 - PEN - - - F001-1 - 01 - - - - - F001-1 - 01 - - - - - 0001-002020 - 31 - - - - 0002-002020 - 31 - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12121212121 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/debitnote/mindata/MinData_DNI.xml b/src/test/resources/xml/debitnote/mindata/MinData_DNI.xml deleted file mode 100644 index a93f56d7..00000000 --- a/src/test/resources/xml/debitnote/mindata/MinData_DNI.xml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - 2.1 - 2.0 - BD01-1 - 2019-12-24 - 20:30:59 - PEN - - - B001-1 - 03 - - - - - B001-1 - 03 - - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12345678 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/debitnote/mindata/MinData_DecDiplomatica.xml b/src/test/resources/xml/debitnote/mindata/MinData_DecDiplomatica.xml deleted file mode 100644 index bb143d36..00000000 --- a/src/test/resources/xml/debitnote/mindata/MinData_DecDiplomatica.xml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - 2.1 - 2.0 - BD01-1 - 2019-12-24 - 20:30:59 - PEN - - - B001-1 - 03 - - - - - B001-1 - 03 - - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12345678 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/debitnote/mindata/MinData_DocTribNoDomSinRuc.xml b/src/test/resources/xml/debitnote/mindata/MinData_DocTribNoDomSinRuc.xml deleted file mode 100644 index 6391623f..00000000 --- a/src/test/resources/xml/debitnote/mindata/MinData_DocTribNoDomSinRuc.xml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - 2.1 - 2.0 - BD01-1 - 2019-12-24 - 20:30:59 - PEN - - - B001-1 - 03 - - - - - B001-1 - 03 - - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12345678 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/debitnote/mindata/MinData_Extranjeria.xml b/src/test/resources/xml/debitnote/mindata/MinData_Extranjeria.xml deleted file mode 100644 index 6260336c..00000000 --- a/src/test/resources/xml/debitnote/mindata/MinData_Extranjeria.xml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - 2.1 - 2.0 - BD01-1 - 2019-12-24 - 20:30:59 - PEN - - - B001-1 - 03 - - - - - B001-1 - 03 - - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12345678 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/debitnote/mindata/MinData_Pasaporte.xml b/src/test/resources/xml/debitnote/mindata/MinData_Pasaporte.xml deleted file mode 100644 index a8c4747e..00000000 --- a/src/test/resources/xml/debitnote/mindata/MinData_Pasaporte.xml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - 2.1 - 2.0 - BD01-1 - 2019-12-24 - 20:30:59 - PEN - - - B001-1 - 03 - - - - - B001-1 - 03 - - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12345678 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/debitnote/mindata/MinData_RUC.xml b/src/test/resources/xml/debitnote/mindata/MinData_RUC.xml deleted file mode 100644 index 4c4e7747..00000000 --- a/src/test/resources/xml/debitnote/mindata/MinData_RUC.xml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - 2.1 - 2.0 - FD01-1 - 2019-12-24 - 20:30:59 - PEN - - - F001-1 - 01 - - - - - F001-1 - 01 - - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12121212121 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/debitnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgvAndCantidadThreeDecimals.xml b/src/test/resources/xml/debitnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgvAndCantidadThreeDecimals.xml deleted file mode 100644 index 0113682c..00000000 --- a/src/test/resources/xml/debitnote/mindata/MinData_UsePrecioUnitarioOPrecioConIgvAndCantidadThreeDecimals.xml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - 2.1 - 2.0 - FC01-1 - 2019-12-24 - 20:30:59 - PEN - - - F001-1 - 01 - - - - - F001-1 - 01 - - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12121212121 - - - - - - - - - 364.42 - - 2024.6 - 364.42 - - S - - - 1000 - - IGV - VAT - - - - - - 2024.6 - 2389.02 - 2389.02 - - - 1 - 10.123 - - 1012.3 - - - 118 - 01 - - - - - 182.21 - - 1012.3 - 182.21 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10.123 - - 1012.3 - - - 118 - 01 - - - - - 182.21 - - 1012.3 - 182.21 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/debitnote/otrosdocumentostributariosrelacionados/codigoScop.xml b/src/test/resources/xml/debitnote/otrosdocumentostributariosrelacionados/codigoScop.xml deleted file mode 100644 index 3bde7886..00000000 --- a/src/test/resources/xml/debitnote/otrosdocumentostributariosrelacionados/codigoScop.xml +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - 2.1 - 2.0 - FC01-1 - 2019-12-24 - 20:30:59 - PEN - - - F001-1 - 01 - - - - - F001-1 - 01 - - - - - F001-1 - 05 - - - - F002-2 - 05 - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12121212121 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/debitnote/otrosdocumentostributariosrelacionados/otros.xml b/src/test/resources/xml/debitnote/otrosdocumentostributariosrelacionados/otros.xml deleted file mode 100644 index 79c967bc..00000000 --- a/src/test/resources/xml/debitnote/otrosdocumentostributariosrelacionados/otros.xml +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - 2.1 - 2.0 - FC01-1 - 2019-12-24 - 20:30:59 - PEN - - - F001-1 - 01 - - - - - F001-1 - 01 - - - - - F001-1 - 99 - - - - F002-2 - 99 - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12121212121 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/debitnote/otrosdocumentostributariosrelacionados/ticketDeSalida.xml b/src/test/resources/xml/debitnote/otrosdocumentostributariosrelacionados/ticketDeSalida.xml deleted file mode 100644 index 5b2ab9d8..00000000 --- a/src/test/resources/xml/debitnote/otrosdocumentostributariosrelacionados/ticketDeSalida.xml +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - 2.1 - 2.0 - FC01-1 - 2019-12-24 - 20:30:59 - PEN - - - F001-1 - 01 - - - - - F001-1 - 01 - - - - - F001-1 - 04 - - - - F002-2 - 04 - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12121212121 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/debitnote/tiponota/descuentoPorItem.xml b/src/test/resources/xml/debitnote/tiponota/descuentoPorItem.xml deleted file mode 100644 index 3dae669a..00000000 --- a/src/test/resources/xml/debitnote/tiponota/descuentoPorItem.xml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - 2.1 - 2.0 - FC01-1 - 2019-12-24 - 20:30:59 - PEN - - - F001-1 - 01 - - - - - F001-1 - 01 - - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12121212121 - - - - - - - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/despatchadvice/Simple.xml b/src/test/resources/xml/despatchadvice/Simple.xml deleted file mode 100644 index f8bf0acd..00000000 --- a/src/test/resources/xml/despatchadvice/Simple.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - 2.1 - 1.0 - T001-1 - 2019-11-08 - 09 - - #SIGN-ID - - - 22222222222 - - - Proveedor - - - - - #SIGN-ID - - - - - 22222222222 - - - 010101 - - - Proveedor - - - - - 10467793549 - - - Cliente - - - - - 1 - 01 - 10 - false - - 01 - - 2019-11-08 - - - - - 010101 - direccion llegada - - - - - 1 - 20 - - 1 - - - producto descripcion - - 123456 - - - - diff --git a/src/test/resources/xml/invoice/anticipos/boletaEmitidaPorAnticipos.xml b/src/test/resources/xml/invoice/anticipos/boletaEmitidaPorAnticipos.xml deleted file mode 100644 index 0a142143..00000000 --- a/src/test/resources/xml/invoice/anticipos/boletaEmitidaPorAnticipos.xml +++ /dev/null @@ -1,225 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - B999-1 - 03 - - 1 - - - 12345678912 - - - - - - B999-2 - 03 - - 2 - - - 12345678912 - - - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12121212121 - - - - - - - - - FormaPago - Contado - 2360 - - - 1 - 180 - - - 2 - 180 - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 360 - 2000 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/invoice/anticipos/facturaEmitidaPorAnticipos.xml b/src/test/resources/xml/invoice/anticipos/facturaEmitidaPorAnticipos.xml deleted file mode 100644 index 505eb3c2..00000000 --- a/src/test/resources/xml/invoice/anticipos/facturaEmitidaPorAnticipos.xml +++ /dev/null @@ -1,225 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - F999-1 - 02 - - 1 - - - 12345678912 - - - - - - F999-2 - 02 - - 2 - - - 12345678912 - - - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12121212121 - - - - - - - - - FormaPago - Contado - 2360 - - - 1 - 180 - - - 2 - 180 - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 360 - 2000 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/invoice/customCodigoLocal.xml b/src/test/resources/xml/invoice/customCodigoLocal.xml deleted file mode 100644 index d7a89bfd..00000000 --- a/src/test/resources/xml/invoice/customCodigoLocal.xml +++ /dev/null @@ -1,233 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - 000000000000 - - - 000000000000 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - - - - 12121212121 - - - - - - - - - FormaPago - Contado - 2364 - - - 364 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - 4 - - S - - - 7152 - - ICBPER - OTH - - - - - - 2000 - 2364 - 2364 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 182 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - 2 - 10 - - 0.2 - - - 7152 - - ICBPER - OTH - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 182 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - 2 - 10 - - 0.2 - - - 7152 - - ICBPER - OTH - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/invoice/customFechaEmision.xml b/src/test/resources/xml/invoice/customFechaEmision.xml deleted file mode 100644 index 1344cdd0..00000000 --- a/src/test/resources/xml/invoice/customFechaEmision.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-01-06 - 00:00:00 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - Carlos Feria - - - - - FormaPago - Contado - 2360 - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item1 - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item2 - - - 100 - - - diff --git a/src/test/resources/xml/invoice/customFirmante.xml b/src/test/resources/xml/invoice/customFirmante.xml deleted file mode 100644 index f6dcf5b7..00000000 --- a/src/test/resources/xml/invoice/customFirmante.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - 000000000000 - - - 000000000000 - - - Wolsnut4 S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - Carlos Feria - - - - - FormaPago - Contado - 2360 - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item1 - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item2 - - - 100 - - - diff --git a/src/test/resources/xml/invoice/customUnidadMedida.xml b/src/test/resources/xml/invoice/customUnidadMedida.xml deleted file mode 100644 index 5cd9aad3..00000000 --- a/src/test/resources/xml/invoice/customUnidadMedida.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - Carlos Feria - - - - - FormaPago - Contado - 2360 - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item1 - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item2 - - - 100 - - - diff --git a/src/test/resources/xml/invoice/formapago/conFormaPagoBoleta.xml b/src/test/resources/xml/invoice/formapago/conFormaPagoBoleta.xml deleted file mode 100644 index 50636aaf..00000000 --- a/src/test/resources/xml/invoice/formapago/conFormaPagoBoleta.xml +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - - - 2.1 - 2.0 - B001-1 - 2019-01-06 - 00:00:00 - 03 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12345678 - - - - Carlos Feria - - - - - FormaPago - Credito - 2360 - - - FormaPago - Cuota000 - 2000 - 2019-01-07 - - - FormaPago - Cuota001 - 360 - 2019-01-08 - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item1 - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item2 - - - 100 - - - diff --git a/src/test/resources/xml/invoice/formapago/conFormaPagoFactura.xml b/src/test/resources/xml/invoice/formapago/conFormaPagoFactura.xml deleted file mode 100644 index da82f1d9..00000000 --- a/src/test/resources/xml/invoice/formapago/conFormaPagoFactura.xml +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-01-06 - 00:00:00 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - Carlos Feria - - - - - FormaPago - Credito - 2360 - - - FormaPago - Cuota000 - 2000 - 2019-01-07 - - - FormaPago - Cuota001 - 360 - 2019-01-08 - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item1 - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item2 - - - 100 - - - diff --git a/src/test/resources/xml/invoice/formapago/conFormaPagoFactura_porcentaje.xml b/src/test/resources/xml/invoice/formapago/conFormaPagoFactura_porcentaje.xml deleted file mode 100644 index 377e0dd6..00000000 --- a/src/test/resources/xml/invoice/formapago/conFormaPagoFactura_porcentaje.xml +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-01-06 - 00:00:00 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - Carlos Feria - - - - - FormaPago - Credito - 2360 - - - FormaPago - Cuota000 - 236 - 2019-01-07 - - - FormaPago - Cuota001 - 2124 - 2019-01-08 - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item1 - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item2 - - - 100 - - - diff --git a/src/test/resources/xml/invoice/formapago/sinFormaPagoBoleta.xml b/src/test/resources/xml/invoice/formapago/sinFormaPagoBoleta.xml deleted file mode 100644 index a573aef6..00000000 --- a/src/test/resources/xml/invoice/formapago/sinFormaPagoBoleta.xml +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - 2.1 - 2.0 - B001-1 - 2019-12-24 - 20:30:59 - 03 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12345678 - - - - Carlos Feria - - - - - FormaPago - Contado - 2360 - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item1 - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item2 - - - 100 - - - diff --git a/src/test/resources/xml/invoice/formapago/sinFormaPagoFactura.xml b/src/test/resources/xml/invoice/formapago/sinFormaPagoFactura.xml deleted file mode 100644 index ace88ada..00000000 --- a/src/test/resources/xml/invoice/formapago/sinFormaPagoFactura.xml +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - Carlos Feria - - - - - FormaPago - Contado - 2360 - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item1 - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item2 - - - 100 - - - diff --git a/src/test/resources/xml/invoice/mindata/MinData_DNI.xml b/src/test/resources/xml/invoice/mindata/MinData_DNI.xml deleted file mode 100644 index a573aef6..00000000 --- a/src/test/resources/xml/invoice/mindata/MinData_DNI.xml +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - 2.1 - 2.0 - B001-1 - 2019-12-24 - 20:30:59 - 03 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12345678 - - - - Carlos Feria - - - - - FormaPago - Contado - 2360 - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item1 - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item2 - - - 100 - - - diff --git a/src/test/resources/xml/invoice/mindata/MinData_DecDiplomatica.xml b/src/test/resources/xml/invoice/mindata/MinData_DecDiplomatica.xml deleted file mode 100644 index 9e6cb36c..00000000 --- a/src/test/resources/xml/invoice/mindata/MinData_DecDiplomatica.xml +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - 2.1 - 2.0 - B001-1 - 2019-12-24 - 20:30:59 - 03 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12345678 - - - - Carlos Feria - - - - - FormaPago - Contado - 2360 - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item1 - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item2 - - - 100 - - - diff --git a/src/test/resources/xml/invoice/mindata/MinData_DocTribNoDomSinRuc.xml b/src/test/resources/xml/invoice/mindata/MinData_DocTribNoDomSinRuc.xml deleted file mode 100644 index 6771e098..00000000 --- a/src/test/resources/xml/invoice/mindata/MinData_DocTribNoDomSinRuc.xml +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - 2.1 - 2.0 - B001-1 - 2019-12-24 - 20:30:59 - 03 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12345678 - - - - Carlos Feria - - - - - FormaPago - Contado - 2360 - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item1 - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item2 - - - 100 - - - diff --git a/src/test/resources/xml/invoice/mindata/MinData_Extranjeria.xml b/src/test/resources/xml/invoice/mindata/MinData_Extranjeria.xml deleted file mode 100644 index 98520c8d..00000000 --- a/src/test/resources/xml/invoice/mindata/MinData_Extranjeria.xml +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - 2.1 - 2.0 - B001-1 - 2019-12-24 - 20:30:59 - 03 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12345678 - - - - Carlos Feria - - - - - FormaPago - Contado - 2360 - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item1 - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item2 - - - 100 - - - diff --git a/src/test/resources/xml/invoice/mindata/MinData_Pasaporte.xml b/src/test/resources/xml/invoice/mindata/MinData_Pasaporte.xml deleted file mode 100644 index 98f364bc..00000000 --- a/src/test/resources/xml/invoice/mindata/MinData_Pasaporte.xml +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - 2.1 - 2.0 - B001-1 - 2019-12-24 - 20:30:59 - 03 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12345678 - - - - Carlos Feria - - - - - FormaPago - Contado - 2360 - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item1 - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item2 - - - 100 - - - diff --git a/src/test/resources/xml/invoice/mindata/MinData_RUC.xml b/src/test/resources/xml/invoice/mindata/MinData_RUC.xml deleted file mode 100644 index ace88ada..00000000 --- a/src/test/resources/xml/invoice/mindata/MinData_RUC.xml +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - Carlos Feria - - - - - FormaPago - Contado - 2360 - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item1 - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item2 - - - 100 - - - diff --git a/src/test/resources/xml/invoice/mindata/MinData_UsePrecioUnitarioOPrecioConIgv.xml b/src/test/resources/xml/invoice/mindata/MinData_UsePrecioUnitarioOPrecioConIgv.xml deleted file mode 100644 index ace88ada..00000000 --- a/src/test/resources/xml/invoice/mindata/MinData_UsePrecioUnitarioOPrecioConIgv.xml +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - Carlos Feria - - - - - FormaPago - Contado - 2360 - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item1 - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item2 - - - 100 - - - diff --git a/src/test/resources/xml/invoice/mindata/MinData_UsePrecioUnitarioOPrecioConIgvAndCantidadThreeDecimals.xml b/src/test/resources/xml/invoice/mindata/MinData_UsePrecioUnitarioOPrecioConIgvAndCantidadThreeDecimals.xml deleted file mode 100644 index e06a2ca7..00000000 --- a/src/test/resources/xml/invoice/mindata/MinData_UsePrecioUnitarioOPrecioConIgvAndCantidadThreeDecimals.xml +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - Carlos Feria - - - - - FormaPago - Contado - 2389.02 - - - 364.42 - - 2024.6 - 364.42 - - S - - - 1000 - - IGV - VAT - - - - - - 2024.6 - 2389.02 - 2389.02 - - - 1 - 10.123 - - 1012.3 - - - 118 - 01 - - - - - 182.21 - - 1012.3 - 182.21 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item1 - - - 100 - - - - 2 - 10.123 - - 1012.3 - - - 118 - 01 - - - - - 182.21 - - 1012.3 - 182.21 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item2 - - - 100 - - - diff --git a/src/test/resources/xml/invoice/otrosdocumentostributariosrelacionados/declaracionSimplificadaDeImportacion.xml b/src/test/resources/xml/invoice/otrosdocumentostributariosrelacionados/declaracionSimplificadaDeImportacion.xml deleted file mode 100644 index 76bd029c..00000000 --- a/src/test/resources/xml/invoice/otrosdocumentostributariosrelacionados/declaracionSimplificadaDeImportacion.xml +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - F001-1 - 09 - - - - F002-2 - 09 - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12121212121 - - - - - - - - - FormaPago - Contado - 2360 - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/invoice/otrosdocumentostributariosrelacionados/facturaElectronicaRemitente.xml b/src/test/resources/xml/invoice/otrosdocumentostributariosrelacionados/facturaElectronicaRemitente.xml deleted file mode 100644 index df5c7291..00000000 --- a/src/test/resources/xml/invoice/otrosdocumentostributariosrelacionados/facturaElectronicaRemitente.xml +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - F001-1 - 06 - - - - F002-2 - 06 - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12121212121 - - - - - - - - - FormaPago - Contado - 2360 - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/invoice/otrosdocumentostributariosrelacionados/guiaRemisionRemitente.xml b/src/test/resources/xml/invoice/otrosdocumentostributariosrelacionados/guiaRemisionRemitente.xml deleted file mode 100644 index 18c1202b..00000000 --- a/src/test/resources/xml/invoice/otrosdocumentostributariosrelacionados/guiaRemisionRemitente.xml +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - F001-1 - 07 - - - - F002-2 - 07 - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12121212121 - - - - - - - - - FormaPago - Contado - 2360 - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/invoice/otrosdocumentostributariosrelacionados/otros.xml b/src/test/resources/xml/invoice/otrosdocumentostributariosrelacionados/otros.xml deleted file mode 100644 index 8e502661..00000000 --- a/src/test/resources/xml/invoice/otrosdocumentostributariosrelacionados/otros.xml +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - F001-1 - 99 - - - - F002-2 - 99 - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12121212121 - - - - - - - - - FormaPago - Contado - 2360 - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/invoice/otrosdocumentostributariosrelacionados/ticketDeSalida.xml b/src/test/resources/xml/invoice/otrosdocumentostributariosrelacionados/ticketDeSalida.xml deleted file mode 100644 index 7052abc8..00000000 --- a/src/test/resources/xml/invoice/otrosdocumentostributariosrelacionados/ticketDeSalida.xml +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - F001-1 - 04 - - - - F002-2 - 04 - - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - 0000 - - - - - - - - 12121212121 - - - - - - - - - FormaPago - Contado - 2360 - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/invoice/tipoigv/exoneradoOperacionOnerosa.xml b/src/test/resources/xml/invoice/tipoigv/exoneradoOperacionOnerosa.xml deleted file mode 100644 index 20c349d7..00000000 --- a/src/test/resources/xml/invoice/tipoigv/exoneradoOperacionOnerosa.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - Carlos Feria - - - - - FormaPago - Contado - 2000 - - - 0 - - 2000 - 0 - - S - - - 9997 - - EXO - VAT - - - - - - 2000 - 2000 - 2000 - - - 1 - 10 - - 1000 - - - 100 - 01 - - - - - 0 - - 1000 - 0 - - S - - 0 - 20 - - - - 9997 - - EXO - VAT - - - - - - Item1 - - - 100 - - - - 2 - 10 - - 1000 - - - 100 - 01 - - - - - 0 - - 1000 - 0 - - S - - 0 - 20 - - - - 9997 - - EXO - VAT - - - - - - Item2 - - - 100 - - - diff --git a/src/test/resources/xml/invoice/tipoigv/exoneradoTransferenciaGratuita.xml b/src/test/resources/xml/invoice/tipoigv/exoneradoTransferenciaGratuita.xml deleted file mode 100644 index e4c1c764..00000000 --- a/src/test/resources/xml/invoice/tipoigv/exoneradoTransferenciaGratuita.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - Carlos Feria - - - - - FormaPago - Contado - 0 - - - 0 - - 2000 - 0 - - S - - - 9996 - - GRA - FRE - - - - - - 0 - 0 - 0 - - - 1 - 10 - - 1000 - - - 100 - 02 - - - - - 0 - - 1000 - 0 - - S - - 0 - 21 - - - - 9996 - - GRA - FRE - - - - - - Item1 - - - 0 - - - - 2 - 10 - - 1000 - - - 100 - 02 - - - - - 0 - - 1000 - 0 - - S - - 0 - 21 - - - - 9996 - - GRA - FRE - - - - - - Item2 - - - 0 - - - diff --git a/src/test/resources/xml/invoice/tipoigv/exportacion.xml b/src/test/resources/xml/invoice/tipoigv/exportacion.xml deleted file mode 100644 index 58518c60..00000000 --- a/src/test/resources/xml/invoice/tipoigv/exportacion.xml +++ /dev/null @@ -1,176 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - - - - - - - - 12121212121 - - - - - - - - - FormaPago - Contado - 2000 - - - 0 - - - 2000 - 2000 - 2000 - - - 1 - 10 - - 1000 - - - 100 - 01 - - - - - 0 - - 1000 - 0 - - S - - 0 - 40 - - - - 9995 - - EXP - FRE - - - - - - - - - 100 - - - - 2 - 10 - - 1000 - - - 100 - 01 - - - - - 0 - - 1000 - 0 - - S - - 0 - 40 - - - - 9995 - - EXP - FRE - - - - - - - - - 100 - - - diff --git a/src/test/resources/xml/invoice/tipoigv/gravadoBonificaciones.xml b/src/test/resources/xml/invoice/tipoigv/gravadoBonificaciones.xml deleted file mode 100644 index 5f70077b..00000000 --- a/src/test/resources/xml/invoice/tipoigv/gravadoBonificaciones.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - Carlos Feria - - - - - FormaPago - Contado - 0 - - - 0 - - 2000 - 360 - - S - - - 9996 - - GRA - FRE - - - - - - 0 - 0 - 0 - - - 1 - 10 - - 1000 - - - 100 - 02 - - - - - 180 - - 1000 - 180 - - S - - 18 - 15 - - - - 9996 - - GRA - FRE - - - - - - Item1 - - - 0 - - - - 2 - 10 - - 1000 - - - 100 - 02 - - - - - 180 - - 1000 - 180 - - S - - 18 - 15 - - - - 9996 - - GRA - FRE - - - - - - Item2 - - - 0 - - - diff --git a/src/test/resources/xml/invoice/tipoigv/gravadoIVAP.xml b/src/test/resources/xml/invoice/tipoigv/gravadoIVAP.xml deleted file mode 100644 index 707e0268..00000000 --- a/src/test/resources/xml/invoice/tipoigv/gravadoIVAP.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - Carlos Feria - - - - - FormaPago - Contado - 2080 - - - 80 - - 2000 - 80 - - S - - - 1016 - - IVAP - VAT - - - - - - 2000 - 2080 - 2080 - - - 1 - 10 - - 1000 - - - 104 - 01 - - - - - 40 - - 1000 - 40 - - S - - 4 - 17 - - - - 1016 - - IVAP - VAT - - - - - - Item1 - - - 100 - - - - 2 - 10 - - 1000 - - - 104 - 01 - - - - - 40 - - 1000 - 40 - - S - - 4 - 17 - - - - 1016 - - IVAP - VAT - - - - - - Item2 - - - 100 - - - diff --git a/src/test/resources/xml/invoice/tipoigv/gravadoOnerosa.xml b/src/test/resources/xml/invoice/tipoigv/gravadoOnerosa.xml deleted file mode 100644 index b0fb7dde..00000000 --- a/src/test/resources/xml/invoice/tipoigv/gravadoOnerosa.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - Carlos Feria - - - - - FormaPago - Contado - 2360 - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item1 - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item2 - - - 100 - - - diff --git a/src/test/resources/xml/invoice/tipoigv/gravadoRetiro.xml b/src/test/resources/xml/invoice/tipoigv/gravadoRetiro.xml deleted file mode 100644 index 7b0f62da..00000000 --- a/src/test/resources/xml/invoice/tipoigv/gravadoRetiro.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - Carlos Feria - - - - - FormaPago - Contado - 0 - - - 0 - - 2000 - 360 - - S - - - 9996 - - GRA - FRE - - - - - - 0 - 0 - 0 - - - 1 - 10 - - 1000 - - - 100 - 02 - - - - - 180 - - 1000 - 180 - - S - - 18 - 13 - - - - 9996 - - GRA - FRE - - - - - - Item1 - - - 0 - - - - 2 - 10 - - 1000 - - - 100 - 02 - - - - - 180 - - 1000 - 180 - - S - - 18 - 13 - - - - 9996 - - GRA - FRE - - - - - - Item2 - - - 0 - - - diff --git a/src/test/resources/xml/invoice/tipoigv/gravadoRetiroPorDonacion.xml b/src/test/resources/xml/invoice/tipoigv/gravadoRetiroPorDonacion.xml deleted file mode 100644 index 466f4eae..00000000 --- a/src/test/resources/xml/invoice/tipoigv/gravadoRetiroPorDonacion.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - Carlos Feria - - - - - FormaPago - Contado - 0 - - - 0 - - 2000 - 360 - - S - - - 9996 - - GRA - FRE - - - - - - 0 - 0 - 0 - - - 1 - 10 - - 1000 - - - 100 - 02 - - - - - 180 - - 1000 - 180 - - S - - 18 - 12 - - - - 9996 - - GRA - FRE - - - - - - Item1 - - - 0 - - - - 2 - 10 - - 1000 - - - 100 - 02 - - - - - 180 - - 1000 - 180 - - S - - 18 - 12 - - - - 9996 - - GRA - FRE - - - - - - Item2 - - - 0 - - - diff --git a/src/test/resources/xml/invoice/tipoigv/gravadoRetiroPorEntregaATrabajadores.xml b/src/test/resources/xml/invoice/tipoigv/gravadoRetiroPorEntregaATrabajadores.xml deleted file mode 100644 index 780ad5b2..00000000 --- a/src/test/resources/xml/invoice/tipoigv/gravadoRetiroPorEntregaATrabajadores.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - Carlos Feria - - - - - FormaPago - Contado - 0 - - - 0 - - 2000 - 360 - - S - - - 9996 - - GRA - FRE - - - - - - 0 - 0 - 0 - - - 1 - 10 - - 1000 - - - 100 - 02 - - - - - 180 - - 1000 - 180 - - S - - 18 - 16 - - - - 9996 - - GRA - FRE - - - - - - Item1 - - - 0 - - - - 2 - 10 - - 1000 - - - 100 - 02 - - - - - 180 - - 1000 - 180 - - S - - 18 - 16 - - - - 9996 - - GRA - FRE - - - - - - Item2 - - - 0 - - - diff --git a/src/test/resources/xml/invoice/tipoigv/gravadoRetiroPorPremio.xml b/src/test/resources/xml/invoice/tipoigv/gravadoRetiroPorPremio.xml deleted file mode 100644 index 95f8f580..00000000 --- a/src/test/resources/xml/invoice/tipoigv/gravadoRetiroPorPremio.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - Carlos Feria - - - - - FormaPago - Contado - 0 - - - 0 - - 2000 - 360 - - S - - - 9996 - - GRA - FRE - - - - - - 0 - 0 - 0 - - - 1 - 10 - - 1000 - - - 100 - 02 - - - - - 180 - - 1000 - 180 - - S - - 18 - 11 - - - - 9996 - - GRA - FRE - - - - - - Item1 - - - 0 - - - - 2 - 10 - - 1000 - - - 100 - 02 - - - - - 180 - - 1000 - 180 - - S - - 18 - 11 - - - - 9996 - - GRA - FRE - - - - - - Item2 - - - 0 - - - diff --git a/src/test/resources/xml/invoice/tipoigv/gravadoRetiroPorPublicidad.xml b/src/test/resources/xml/invoice/tipoigv/gravadoRetiroPorPublicidad.xml deleted file mode 100644 index 32a22311..00000000 --- a/src/test/resources/xml/invoice/tipoigv/gravadoRetiroPorPublicidad.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - Carlos Feria - - - - - FormaPago - Contado - 0 - - - 0 - - 2000 - 360 - - S - - - 9996 - - GRA - FRE - - - - - - 0 - 0 - 0 - - - 1 - 10 - - 1000 - - - 100 - 02 - - - - - 180 - - 1000 - 180 - - S - - 18 - 14 - - - - 9996 - - GRA - FRE - - - - - - Item1 - - - 0 - - - - 2 - 10 - - 1000 - - - 100 - 02 - - - - - 180 - - 1000 - 180 - - S - - 18 - 14 - - - - 9996 - - GRA - FRE - - - - - - Item2 - - - 0 - - - diff --git a/src/test/resources/xml/invoice/tipoigv/inafectoOperacionOnerosa.xml b/src/test/resources/xml/invoice/tipoigv/inafectoOperacionOnerosa.xml deleted file mode 100644 index 5a0441f0..00000000 --- a/src/test/resources/xml/invoice/tipoigv/inafectoOperacionOnerosa.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - Carlos Feria - - - - - FormaPago - Contado - 2000 - - - 0 - - 2000 - 0 - - S - - - 9998 - - INA - FRE - - - - - - 2000 - 2000 - 2000 - - - 1 - 10 - - 1000 - - - 100 - 01 - - - - - 0 - - 1000 - 0 - - S - - 0 - 30 - - - - 9998 - - INA - FRE - - - - - - Item1 - - - 100 - - - - 2 - 10 - - 1000 - - - 100 - 01 - - - - - 0 - - 1000 - 0 - - S - - 0 - 30 - - - - 9998 - - INA - FRE - - - - - - Item2 - - - 100 - - - diff --git a/src/test/resources/xml/invoice/tipoigv/inafectoPorMuestrasMedicas.xml b/src/test/resources/xml/invoice/tipoigv/inafectoPorMuestrasMedicas.xml deleted file mode 100644 index cc258276..00000000 --- a/src/test/resources/xml/invoice/tipoigv/inafectoPorMuestrasMedicas.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - Carlos Feria - - - - - FormaPago - Contado - 0 - - - 0 - - 2000 - 0 - - S - - - 9996 - - GRA - FRE - - - - - - 0 - 0 - 0 - - - 1 - 10 - - 1000 - - - 100 - 02 - - - - - 0 - - 1000 - 0 - - S - - 0 - 33 - - - - 9996 - - GRA - FRE - - - - - - Item1 - - - 0 - - - - 2 - 10 - - 1000 - - - 100 - 02 - - - - - 0 - - 1000 - 0 - - S - - 0 - 33 - - - - 9996 - - GRA - FRE - - - - - - Item2 - - - 0 - - - diff --git a/src/test/resources/xml/invoice/tipoigv/inafectoRetiro.xml b/src/test/resources/xml/invoice/tipoigv/inafectoRetiro.xml deleted file mode 100644 index a30a4596..00000000 --- a/src/test/resources/xml/invoice/tipoigv/inafectoRetiro.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - Carlos Feria - - - - - FormaPago - Contado - 0 - - - 0 - - 2000 - 0 - - S - - - 9996 - - GRA - FRE - - - - - - 0 - 0 - 0 - - - 1 - 10 - - 1000 - - - 100 - 02 - - - - - 0 - - 1000 - 0 - - S - - 0 - 32 - - - - 9996 - - GRA - FRE - - - - - - Item1 - - - 0 - - - - 2 - 10 - - 1000 - - - 100 - 02 - - - - - 0 - - 1000 - 0 - - S - - 0 - 32 - - - - 9996 - - GRA - FRE - - - - - - Item2 - - - 0 - - - diff --git a/src/test/resources/xml/invoice/tipoigv/inafectoRetiroPorBonificacion.xml b/src/test/resources/xml/invoice/tipoigv/inafectoRetiroPorBonificacion.xml deleted file mode 100644 index f76df8a1..00000000 --- a/src/test/resources/xml/invoice/tipoigv/inafectoRetiroPorBonificacion.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - Carlos Feria - - - - - FormaPago - Contado - 0 - - - 0 - - 2000 - 0 - - S - - - 9996 - - GRA - FRE - - - - - - 0 - 0 - 0 - - - 1 - 10 - - 1000 - - - 100 - 02 - - - - - 0 - - 1000 - 0 - - S - - 0 - 31 - - - - 9996 - - GRA - FRE - - - - - - Item1 - - - 0 - - - - 2 - 10 - - 1000 - - - 100 - 02 - - - - - 0 - - 1000 - 0 - - S - - 0 - 31 - - - - 9996 - - GRA - FRE - - - - - - Item2 - - - 0 - - - diff --git a/src/test/resources/xml/invoice/tipoigv/inafectoRetiroPorConvenioColectivo.xml b/src/test/resources/xml/invoice/tipoigv/inafectoRetiroPorConvenioColectivo.xml deleted file mode 100644 index 71fc91d9..00000000 --- a/src/test/resources/xml/invoice/tipoigv/inafectoRetiroPorConvenioColectivo.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - Carlos Feria - - - - - FormaPago - Contado - 0 - - - 0 - - 2000 - 0 - - S - - - 9996 - - GRA - FRE - - - - - - 0 - 0 - 0 - - - 1 - 10 - - 1000 - - - 100 - 02 - - - - - 0 - - 1000 - 0 - - S - - 0 - 34 - - - - 9996 - - GRA - FRE - - - - - - Item1 - - - 0 - - - - 2 - 10 - - 1000 - - - 100 - 02 - - - - - 0 - - 1000 - 0 - - S - - 0 - 34 - - - - 9996 - - GRA - FRE - - - - - - Item2 - - - 0 - - - diff --git a/src/test/resources/xml/invoice/tipoigv/inafectoRetiroPorPremio.xml b/src/test/resources/xml/invoice/tipoigv/inafectoRetiroPorPremio.xml deleted file mode 100644 index 3d6b8c5f..00000000 --- a/src/test/resources/xml/invoice/tipoigv/inafectoRetiroPorPremio.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - Carlos Feria - - - - - FormaPago - Contado - 0 - - - 0 - - 2000 - 0 - - S - - - 9996 - - GRA - FRE - - - - - - 0 - 0 - 0 - - - 1 - 10 - - 1000 - - - 100 - 02 - - - - - 0 - - 1000 - 0 - - S - - 0 - 35 - - - - 9996 - - GRA - FRE - - - - - - Item1 - - - 0 - - - - 2 - 10 - - 1000 - - - 100 - 02 - - - - - 0 - - 1000 - 0 - - S - - 0 - 35 - - - - 9996 - - GRA - FRE - - - - - - Item2 - - - 0 - - - diff --git a/src/test/resources/xml/invoice/tipoigv/inafectoRetiroPorPublicidad.xml b/src/test/resources/xml/invoice/tipoigv/inafectoRetiroPorPublicidad.xml deleted file mode 100644 index 4f0ea70c..00000000 --- a/src/test/resources/xml/invoice/tipoigv/inafectoRetiroPorPublicidad.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - Softgreen S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Softgreen S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - Carlos Feria - - - - - FormaPago - Contado - 0 - - - 0 - - 2000 - 0 - - S - - - 9996 - - GRA - FRE - - - - - - 0 - 0 - 0 - - - 1 - 10 - - 1000 - - - 100 - 02 - - - - - 0 - - 1000 - 0 - - S - - 0 - 36 - - - - 9996 - - GRA - FRE - - - - - - Item1 - - - 0 - - - - 2 - 10 - - 1000 - - - 100 - 02 - - - - - 0 - - 1000 - 0 - - S - - 0 - 36 - - - - 9996 - - GRA - FRE - - - - - - Item2 - - - 0 - - - diff --git a/src/test/resources/xml/invoice_specialCharacters.xml b/src/test/resources/xml/invoice_specialCharacters.xml deleted file mode 100644 index e555bbf9..00000000 --- a/src/test/resources/xml/invoice_specialCharacters.xml +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - 2.1 - 2.0 - F001-1 - 2019-12-24 - 20:30:59 - 01 - - PEN - - - 12345678912 - - - 12345678912 - - - Project OpenUBL S.A.C. - - - - - #PROJECT-OPENUBL-SIGN - - - - - - - 12345678912 - - - - Project OpenUBL S.A.C. - - 0000 - - - - - - - - 12121212121 - - - - - - - - - FormaPago - Contado - 2360 - - - 360 - - 2000 - 360 - - S - - - 1000 - - IGV - VAT - - - - - - 2000 - 2360 - 2360 - - - 1 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item1 - - - 100 - - - - 2 - 10 - - 1000 - - - 118 - 01 - - - - - 180 - - 1000 - 180 - - S - - 18 - 10 - - - - 1000 - - IGV - VAT - - - - - - Item2 - - - 100 - - - diff --git a/src/test/resources/xml/perception/perception_min.xml b/src/test/resources/xml/perception/perception_min.xml deleted file mode 100644 index 0db6e1f2..00000000 --- a/src/test/resources/xml/perception/perception_min.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - 2.0 - 1.0 - - #SIGN-ID - - - 11111111111 - - - Firmante - - - - - #SIGN-ID - - - - P001-1 - 2019-11-08 - - - 22222222222 - - - 010101 - - - Proveedor - - - - - 33333333333 - - - Cliente - - - - 01 - 2 - 2 - 102 - - F001-1 - 2019-11-07 - 100 - - 1 - 100 - 2019-11-08 - - - 2 - 2019-11-08 - 102 - - - diff --git a/src/test/resources/xml/retention/Simple.xml b/src/test/resources/xml/retention/Simple.xml deleted file mode 100644 index c5d1ea5c..00000000 --- a/src/test/resources/xml/retention/Simple.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - 2.0 - 1.0 - - #SIGN-ID - - - 11111111111 - - - Firmante - - - - - #SIGN-ID - - - - R001-1 - 2019-11-08 - - - 22222222222 - - - 010101 - - - Proveedor - - - - - 33333333333 - - - Cliente - - - - 01 - 3 - 3 - 97 - - F001-1 - 2019-11-07 - 100 - - 1 - 100 - 2019-11-08 - - - 3 - 2019-11-08 - 97 - - - diff --git a/src/test/resources/xml/summarydocument/summaryDocument_adicionarBoleta.xml b/src/test/resources/xml/summarydocument/summaryDocument_adicionarBoleta.xml deleted file mode 100644 index c8940316..00000000 --- a/src/test/resources/xml/summarydocument/summaryDocument_adicionarBoleta.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - 2.0 - 1.1 - RC-20191224-1 - 2019-12-01 - 2019-12-24 - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - 12345678912 - 6 - - - - - - - - 1 - 03 - B001-1 - - 12345678 - 1 - - - 1 - - 118 - - 100 - 01 - - - 100 - - 100 - - - 1000 - IGV - VAT - - - - - - - diff --git a/src/test/resources/xml/summarydocument/summaryDocument_adicionarBoletaConIcb.xml b/src/test/resources/xml/summarydocument/summaryDocument_adicionarBoletaConIcb.xml deleted file mode 100644 index 0fc062d8..00000000 --- a/src/test/resources/xml/summarydocument/summaryDocument_adicionarBoletaConIcb.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - 2.0 - 1.1 - RC-20191224-1 - 2019-12-01 - 2019-12-24 - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - 12345678912 - 6 - - - - - - - - 1 - 03 - B001-1 - - 12345678 - 1 - - - 1 - - 120 - - 100 - 01 - - - 100 - - 100 - - - 1000 - IGV - VAT - - - - - - 2 - - 2 - - - 7152 - ICBPER - OTH - - - - - - - diff --git a/src/test/resources/xml/summarydocument/summaryDocument_adicionarNotaCreditoDeBoleta.xml b/src/test/resources/xml/summarydocument/summaryDocument_adicionarNotaCreditoDeBoleta.xml deleted file mode 100644 index f842ce62..00000000 --- a/src/test/resources/xml/summarydocument/summaryDocument_adicionarNotaCreditoDeBoleta.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - 2.0 - 1.1 - RC-20191224-1 - 2019-12-01 - 2019-12-24 - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - 12345678912 - 6 - - - - - - - - 1 - 07 - BC01-1 - - 12345678 - 1 - - - - B001-1 - 03 - - - - 1 - - 118 - - 100 - 01 - - - 100 - - 100 - - - 1000 - IGV - VAT - - - - - - diff --git a/src/test/resources/xml/summarydocument/summaryDocument_anularBoleta.xml b/src/test/resources/xml/summarydocument/summaryDocument_anularBoleta.xml deleted file mode 100644 index e524de82..00000000 --- a/src/test/resources/xml/summarydocument/summaryDocument_anularBoleta.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - 2.0 - 1.1 - RC-20191224-1 - 2019-12-01 - 2019-12-24 - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - 12345678912 - 6 - - - - - - - - 1 - 03 - B001-1 - - 12345678 - 1 - - - 3 - - 118 - - 100 - 01 - - - 100 - - 100 - - - 1000 - IGV - VAT - - - - - - - diff --git a/src/test/resources/xml/summarydocument/summaryDocument_anularNotaCreditoDeBoleta.xml b/src/test/resources/xml/summarydocument/summaryDocument_anularNotaCreditoDeBoleta.xml deleted file mode 100644 index f8d30f59..00000000 --- a/src/test/resources/xml/summarydocument/summaryDocument_anularNotaCreditoDeBoleta.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - 2.0 - 1.1 - RC-20191224-1 - 2019-12-01 - 2019-12-24 - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - 12345678912 - 6 - - - - - - - - 1 - 07 - BC01-1 - - 12345678 - 1 - - - - B001-1 - 03 - - - - 3 - - 118 - - 100 - 01 - - - 100 - - 100 - - - 1000 - IGV - VAT - - - - - - - diff --git a/src/test/resources/xml/summarydocument/summaryDocument_formatNumbers.xml b/src/test/resources/xml/summarydocument/summaryDocument_formatNumbers.xml deleted file mode 100644 index 8f9772e2..00000000 --- a/src/test/resources/xml/summarydocument/summaryDocument_formatNumbers.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - 2.0 - 1.1 - RC-20191224-1 - 2019-12-01 - 2019-12-24 - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - 12345678912 - 6 - - - - - - - - 1 - 03 - B001-1 - - 12345678 - 1 - - - 1 - - 1180.12 - - 1000.1 - 01 - - - 180.02 - - 180.02 - - - 1000 - IGV - VAT - - - - - - diff --git a/src/test/resources/xml/summarydocument/summaryDocument_modificarBoleta.xml b/src/test/resources/xml/summarydocument/summaryDocument_modificarBoleta.xml deleted file mode 100644 index 7fd3e4e3..00000000 --- a/src/test/resources/xml/summarydocument/summaryDocument_modificarBoleta.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - 2.0 - 1.1 - RC-20191224-1 - 2019-12-01 - 2019-12-24 - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - 12345678912 - 6 - - - - - - - - 1 - 03 - B001-1 - - 12345678 - 1 - - - 2 - - 118 - - 100 - 01 - - - 100 - - 100 - - - 1000 - IGV - VAT - - - - - - diff --git a/src/test/resources/xml/summarydocument/summaryDocument_modificarNotaCreditoDeBoleta.xml b/src/test/resources/xml/summarydocument/summaryDocument_modificarNotaCreditoDeBoleta.xml deleted file mode 100644 index 10464131..00000000 --- a/src/test/resources/xml/summarydocument/summaryDocument_modificarNotaCreditoDeBoleta.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - 2.0 - 1.1 - RC-20191224-1 - 2019-12-01 - 2019-12-24 - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - 12345678912 - 6 - - - - - - - - 1 - 07 - BC01-1 - - 12345678 - 1 - - - - B001-1 - 03 - - - - 2 - - 118 - - 100 - 01 - - - 100 - - 100 - - - 1000 - IGV - VAT - - - - - - - diff --git a/src/test/resources/xml/voideddocument/factura_minData.xml b/src/test/resources/xml/voideddocument/factura_minData.xml deleted file mode 100644 index c228e00e..00000000 --- a/src/test/resources/xml/voideddocument/factura_minData.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - 2.0 - 1.0 - RA-20191224-1 - 2019-12-01 - 2019-12-24 - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - 12345678912 - 6 - - - - - - - - 1 - 01 - F001 - 1 - - - diff --git a/src/test/resources/xml/voideddocument/guiaRemisionRemitente_minData.xml b/src/test/resources/xml/voideddocument/guiaRemisionRemitente_minData.xml deleted file mode 100644 index e61e28cf..00000000 --- a/src/test/resources/xml/voideddocument/guiaRemisionRemitente_minData.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - 2.0 - 1.0 - RR-20191224-1 - 2019-12-01 - 2019-12-24 - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - 12345678912 - 6 - - - - - - - - 1 - 09 - T001 - 1 - - - - diff --git a/src/test/resources/xml/voideddocument/notaCreditoDeFactura.xml b/src/test/resources/xml/voideddocument/notaCreditoDeFactura.xml deleted file mode 100644 index 66a66c56..00000000 --- a/src/test/resources/xml/voideddocument/notaCreditoDeFactura.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - 2.0 - 1.0 - RA-20191224-1 - 2019-12-01 - 2019-12-24 - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - 12345678912 - 6 - - - - - - - - 1 - 07 - FC01 - 1 - - - diff --git a/src/test/resources/xml/voideddocument/notaDebitoDeFactura.xml b/src/test/resources/xml/voideddocument/notaDebitoDeFactura.xml deleted file mode 100644 index 31d963a4..00000000 --- a/src/test/resources/xml/voideddocument/notaDebitoDeFactura.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - 2.0 - 1.0 - RA-20191224-1 - 2019-12-01 - 2019-12-24 - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - 12345678912 - 6 - - - - - - - - 1 - 08 - FD01 - 1 - - - diff --git a/src/test/resources/xml/voideddocument/percepcion_minData.xml b/src/test/resources/xml/voideddocument/percepcion_minData.xml deleted file mode 100644 index e244c208..00000000 --- a/src/test/resources/xml/voideddocument/percepcion_minData.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - 2.0 - 1.0 - RR-20191224-1 - 2019-12-01 - 2019-12-24 - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - 12345678912 - 6 - - - - - - - - 1 - 40 - P001 - 1 - - - diff --git a/src/test/resources/xml/voideddocument/retencion_minData.xml b/src/test/resources/xml/voideddocument/retencion_minData.xml deleted file mode 100644 index 78a99a17..00000000 --- a/src/test/resources/xml/voideddocument/retencion_minData.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - 2.0 - 1.0 - RR-20191224-1 - 2019-12-01 - 2019-12-24 - - 12345678912 - - - 12345678912 - - - - - - - - #PROJECT-OPENUBL-SIGN - - - - - 12345678912 - 6 - - - - - - - - 1 - 20 - R001 - 1 - - - - diff --git a/tools/copyright.txt b/tools/copyright.txt index 5dfd9323..9f363c69 100644 --- a/tools/copyright.txt +++ b/tools/copyright.txt @@ -1,11 +1,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, diff --git a/xbuilder.svg b/xbuilder.svg deleted file mode 100644 index 58fa7244..00000000 --- a/xbuilder.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file