Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d6db59b
Create document
carlosthe19916 Oct 9, 2021
2fe28e7
Merge branch 'master' into createDocument
carlosthe19916 Oct 9, 2021
037ded9
verbose
carlosthe19916 Oct 9, 2021
d83a8a6
verbose
carlosthe19916 Oct 9, 2021
29d938b
comment test
carlosthe19916 Oct 9, 2021
0bad65d
comment test
carlosthe19916 Oct 9, 2021
92756d4
change test size
carlosthe19916 Oct 10, 2021
b9c42cd
license
carlosthe19916 Oct 10, 2021
08c9030
exclude docker
carlosthe19916 Oct 10, 2021
d0e4d08
update .dockerignore
carlosthe19916 Oct 10, 2021
b4ee470
add test
carlosthe19916 Oct 10, 2021
b38c84e
comment test
carlosthe19916 Oct 10, 2021
5746f60
comment test
carlosthe19916 Oct 10, 2021
756001c
debug
carlosthe19916 Oct 10, 2021
b17188d
Remove withTransaction(
carlosthe19916 Oct 10, 2021
587f5d7
Remove withTransaction(
carlosthe19916 Oct 10, 2021
d36dadf
flush panache
carlosthe19916 Oct 10, 2021
3bf0257
flush panache
carlosthe19916 Oct 10, 2021
45a2248
enable wtch
carlosthe19916 Oct 10, 2021
6761d55
enable test
carlosthe19916 Oct 10, 2021
039a829
add trans
carlosthe19916 Oct 10, 2021
0b3f1be
add trans
carlosthe19916 Oct 10, 2021
a307e2e
add trans
carlosthe19916 Oct 10, 2021
f72f5e7
add retry
carlosthe19916 Oct 10, 2021
5fc14a0
add retry
carlosthe19916 Oct 10, 2021
aac9f9a
add retry
carlosthe19916 Oct 10, 2021
6f12d26
add retry
carlosthe19916 Oct 10, 2021
ad6ba7f
add retry
carlosthe19916 Oct 11, 2021
640320b
test thread
carlosthe19916 Oct 11, 2021
c4aa88e
Restore delay
carlosthe19916 Oct 11, 2021
ab17a0c
add tests
carlosthe19916 Oct 11, 2021
c73aed3
force commit
carlosthe19916 Oct 11, 2021
6aea61c
force commit
carlosthe19916 Oct 11, 2021
75dbe1f
Add documents
carlosthe19916 Oct 11, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<surefire-plugin.version>3.0.0-M5</surefire-plugin.version>

<!--libs-->
<xbuilder-lib.version>1.2.1.Final</xbuilder-lib.version>
<xsender-lib.version>3.0.3.Final</xsender-lib.version>
<testcontainers.version>1.15.3</testcontainers.version>
<awaitility.version>4.1.0</awaitility.version>
Expand Down Expand Up @@ -108,6 +109,11 @@
</dependencyManagement>

<dependencies>
<dependency>
<groupId>io.github.project-openubl</groupId>
<artifactId>xbuilder</artifactId>
<version>${xbuilder-lib.version}</version>
</dependency>
<dependency>
<groupId>io.github.project-openubl</groupId>
<artifactId>xsender</artifactId>
Expand Down Expand Up @@ -279,6 +285,8 @@
<exclude>**/README</exclude>
<exclude>**/src/test/resources/**</exclude>
<exclude>**/src/main/resources/**</exclude>
<exclude>**/src/main/docker/**</exclude>
<exclude>.dockerignore</exclude>
<exclude>.github/**</exclude>
<exclude>.mvn/**</exclude>
</excludes>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*
* 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.xsender.builder;

import io.github.project.openubl.xmlbuilderlib.models.catalogs.Catalog;
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 org.eclipse.microprofile.config.inject.ConfigProperty;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
import java.math.BigDecimal;
import java.util.TimeZone;

@ApplicationScoped
public class UBLHubXBuilderConfigProducer {

@ConfigProperty(name = "openubl.xbuilder.igv")
BigDecimal igv;

@ConfigProperty(name = "openubl.xbuilder.ivap")
BigDecimal ivap;

@ConfigProperty(name = "openubl.xbuilder.defaultMoneda")
String defaultMoneda;

@ConfigProperty(name = "openubl.xbuilder.defaultUnidadMedida")
String defaultUnidadMedida;

@ConfigProperty(name = "openubl.xbuilder.defaultTipoNotaCredito")
String defaultTipoNotaCredito;

@ConfigProperty(name = "openubl.xbuilder.defaultTipoNotaDebito")
String defaultTipoNotaDebito;

@ConfigProperty(name = "openubl.xbuilder.defaultIcb")
BigDecimal defaultIcb;

@ConfigProperty(name = "openubl.xbuilder.defaultTipoIgv")
String defaultTipoIgv;

//

@ConfigProperty(name = "openubl.xbuilder.timezone")
String timezone;

@Produces
public UblHubXBuilderConfig produceConfig() {
UblHubXBuilderConfig config = new UblHubXBuilderConfig();

config.setIgv(igv);
config.setIvap(ivap);
config.setDefaultMoneda(defaultMoneda);
config.setDefaultUnidadMedida(defaultUnidadMedida);
config.setDefaultTipoNotaCredito(Catalog.valueOfCode(Catalog9.class, defaultTipoNotaCredito)
.orElseThrow(() -> new IllegalStateException("Invalid defaultTipoNotaCredito in config"))
);
config.setDefaultTipoNotaDebito(Catalog.valueOfCode(Catalog10.class, defaultTipoNotaDebito)
.orElseThrow(() -> new IllegalStateException("Invalid defaultTipoNotaDebito in config"))
);
config.setDefaultIcb(defaultIcb);
config.setDefaultTipoIgv(Catalog.valueOfCode(Catalog7.class, defaultTipoIgv)
.orElseThrow(() -> new IllegalStateException("Invalid defaultTipoIgv in config"))
);

return config;
}

@Produces
public UblHubXBuilderClock produceClock() {
UblHubXBuilderClock clock = new UblHubXBuilderClock();
clock.setTimeZone(TimeZone.getTimeZone(timezone));

return clock;
}
}
Original file line number Diff line number Diff line change
@@ -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 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.xsender.builder;

import io.github.project.openubl.xmlbuilderlib.clock.SystemClock;

import java.util.Calendar;
import java.util.TimeZone;

public class UblHubXBuilderClock implements SystemClock {

private TimeZone timeZone;

@Override
public TimeZone getTimeZone() {
return timeZone;
}

@Override
public Calendar getCalendarInstance() {
return Calendar.getInstance();
}

public void setTimeZone(TimeZone timeZone) {
this.timeZone = timeZone;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/*
* 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.xsender.builder;

import io.github.project.openubl.xmlbuilderlib.config.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 UblHubXBuilderConfig 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;

@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;
}
}
Original file line number Diff line number Diff line change
@@ -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 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.xsender.idgenerator;

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.SummaryDocumentInputModel;
import io.github.project.openubl.xmlbuilderlib.models.input.sunat.VoidedDocumentInputModel;

import java.util.Map;

public interface IDGenerator {

void enrichWithID(InvoiceInputModel invoice, Map<String, String> config);

void enrichWithID(CreditNoteInputModel creditNote, Map<String, String> config);

void enrichWithID(DebitNoteInputModel debitNote, Map<String, String> config);

void enrichWithID(VoidedDocumentInputModel voidedDocument, Map<String, String> config);

void enrichWithID(SummaryDocumentInputModel summaryDocument, Map<String, String> config);

}
Original file line number Diff line number Diff line change
@@ -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 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.xsender.idgenerator;

import javax.inject.Qualifier;
import java.lang.annotation.*;

@Qualifier
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.TYPE})
@Documented
public @interface IDGeneratorProvider {
IDGeneratorType value();
}
Original file line number Diff line number Diff line change
@@ -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 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.xsender.idgenerator;

import javax.enterprise.util.AnnotationLiteral;

public class IDGeneratorProviderLiteral extends AnnotationLiteral<IDGeneratorProvider> implements IDGeneratorProvider {

private final IDGeneratorType providerType;

public IDGeneratorProviderLiteral(IDGeneratorType providerType) {
this.providerType = providerType;
}

@Override
public IDGeneratorType value() {
return providerType;
}

}
Original file line number Diff line number Diff line change
@@ -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 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.xsender.idgenerator;

public enum IDGeneratorType {
none
}
Loading