bug#al-3609

Documentacao_integracao_PM_ARTESP
dev:
qua:
master
valdir.cordeiro 2024-01-11 15:29:18 -03:00
parent e5a78d3339
commit 3924e30038
5 changed files with 216 additions and 9 deletions

View File

@ -4,12 +4,12 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>br.com.rjconsultores</groupId> <groupId>br.com.rjconsultores</groupId>
<artifactId>ventaboletosadm</artifactId> <artifactId>ventaboletosadm</artifactId>
<version>1.41.0</version> <version>1.42.0</version>
<packaging>war</packaging> <packaging>war</packaging>
<properties> <properties>
<modelWeb.version>1.30.0</modelWeb.version> <modelWeb.version>1.31.0</modelWeb.version>
<flyway.version>1.24.0</flyway.version> <flyway.version>1.25.0</flyway.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties> </properties>

View File

@ -35,8 +35,7 @@ import java.util.regex.Pattern;
import org.apache.commons.lang.BooleanUtils; import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.brazilutils.br.cpfcnpj.Cnpj; import org.brazilutils.br.cpfcnpj.Cnpj;
import org.brazilutils.br.cpfcnpj.Cpf; import org.brazilutils.br.cpfcnpj.Cpf;
import org.brazilutils.validation.ValidationException; import org.brazilutils.validation.ValidationException;
@ -87,11 +86,13 @@ import com.rjconsultores.ventaboletos.entidad.EmpresaEmailEComerce;
import com.rjconsultores.ventaboletos.entidad.EmpresaEmailFlexBus; import com.rjconsultores.ventaboletos.entidad.EmpresaEmailFlexBus;
import com.rjconsultores.ventaboletos.entidad.EmpresaImposto; import com.rjconsultores.ventaboletos.entidad.EmpresaImposto;
import com.rjconsultores.ventaboletos.entidad.EmpresaMercadoPagoConfig; import com.rjconsultores.ventaboletos.entidad.EmpresaMercadoPagoConfig;
import com.rjconsultores.ventaboletos.entidad.EmpresaPMArtespConfig;
import com.rjconsultores.ventaboletos.entidad.EmpresaSaferConfig; import com.rjconsultores.ventaboletos.entidad.EmpresaSaferConfig;
import com.rjconsultores.ventaboletos.entidad.Estado; import com.rjconsultores.ventaboletos.entidad.Estado;
import com.rjconsultores.ventaboletos.entidad.FormaPago; import com.rjconsultores.ventaboletos.entidad.FormaPago;
import com.rjconsultores.ventaboletos.entidad.InscricaoEstadual; import com.rjconsultores.ventaboletos.entidad.InscricaoEstadual;
import com.rjconsultores.ventaboletos.entidad.InstiFinanceira; import com.rjconsultores.ventaboletos.entidad.InstiFinanceira;
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
import com.rjconsultores.ventaboletos.entidad.Parada; import com.rjconsultores.ventaboletos.entidad.Parada;
import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra;
import com.rjconsultores.ventaboletos.enums.TipoCstGratuidade; import com.rjconsultores.ventaboletos.enums.TipoCstGratuidade;
@ -109,11 +110,13 @@ import com.rjconsultores.ventaboletos.service.EmpresaEmailFlexBusService;
import com.rjconsultores.ventaboletos.service.EmpresaEmailService; import com.rjconsultores.ventaboletos.service.EmpresaEmailService;
import com.rjconsultores.ventaboletos.service.EmpresaImpostoService; import com.rjconsultores.ventaboletos.service.EmpresaImpostoService;
import com.rjconsultores.ventaboletos.service.EmpresaMercadoPagoConfigService; import com.rjconsultores.ventaboletos.service.EmpresaMercadoPagoConfigService;
import com.rjconsultores.ventaboletos.service.EmpresaPMArtespConfigService;
import com.rjconsultores.ventaboletos.service.EmpresaSaferConfigService; import com.rjconsultores.ventaboletos.service.EmpresaSaferConfigService;
import com.rjconsultores.ventaboletos.service.EmpresaService; import com.rjconsultores.ventaboletos.service.EmpresaService;
import com.rjconsultores.ventaboletos.service.EstadoService; import com.rjconsultores.ventaboletos.service.EstadoService;
import com.rjconsultores.ventaboletos.service.FormaPagoService; import com.rjconsultores.ventaboletos.service.FormaPagoService;
import com.rjconsultores.ventaboletos.service.InstiFinanceiraService; import com.rjconsultores.ventaboletos.service.InstiFinanceiraService;
import com.rjconsultores.ventaboletos.service.OrgaoConcedenteService;
import com.rjconsultores.ventaboletos.service.TipoEventoExtraService; import com.rjconsultores.ventaboletos.service.TipoEventoExtraService;
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
import com.rjconsultores.ventaboletos.utilerias.CustomEnum; import com.rjconsultores.ventaboletos.utilerias.CustomEnum;
@ -135,7 +138,6 @@ import com.rjconsultores.ventaboletos.web.utilerias.render.RenderComEmpTipoEvent
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderEmpresaContaBancaria; import com.rjconsultores.ventaboletos.web.utilerias.render.RenderEmpresaContaBancaria;
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderEmpresaImposto; import com.rjconsultores.ventaboletos.web.utilerias.render.RenderEmpresaImposto;
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderEmpresaInscricaoEstadual; import com.rjconsultores.ventaboletos.web.utilerias.render.RenderEmpresaInscricaoEstadual;
import com.rjconsultores.ventaboletos.web.utilerias.security.SecurityEmpresaToken;
/** /**
* *
@ -180,6 +182,11 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
private EmpresaAdyenConfigService empresaAdyenConfigService; private EmpresaAdyenConfigService empresaAdyenConfigService;
@Autowired @Autowired
private EmpresaMercadoPagoConfigService empresaMercadoPagoConfigService; private EmpresaMercadoPagoConfigService empresaMercadoPagoConfigService;
@Autowired
private EmpresaPMArtespConfigService empresaPMArtespConfigService;
@Autowired
private OrgaoConcedenteService orgaoConcedenteService;
private Empresa empresa; private Empresa empresa;
private EmpresaEmail empresaEmail; private EmpresaEmail empresaEmail;
@ -475,6 +482,17 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
private boolean cadastroEmpresaNova = false; private boolean cadastroEmpresaNova = false;
private Checkbox chkIndntegracaoAGR; private Checkbox chkIndntegracaoAGR;
//Integracao PM ARTESP
private Checkbox chkAtivarIntegracaoPMARTESP;
private Textbox txtUrlIntegracaoARTESP;
private Textbox txtTokenIntegracaoARTESP;
private MyComboboxEstandar cmbTipoDePassagem;
private MyComboboxEstandar cmbOrgaoConcedente;
private EmpresaPMArtespConfig empresaPMArtespConfig;
private List<OrgaoConcedente> lsOrgaoConcedente;
private static final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" private static final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
+ "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
@ -486,6 +504,7 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
lsCategorias = categoriaService.obtenerTodasCategoriasVisibles(); lsCategorias = categoriaService.obtenerTodasCategoriasVisibles();
lsFormaPagos = formaPagoService.obtenerTodos(); lsFormaPagos = formaPagoService.obtenerTodos();
lsTipoEventoExtras = tipoEventoExtraService.obtenerTodos(); lsTipoEventoExtras = tipoEventoExtraService.obtenerTodos();
lsOrgaoConcedente = orgaoConcedenteService.obtenerTodos();
empresa = (Empresa) Executions.getCurrent().getArg().get("empresa"); empresa = (Empresa) Executions.getCurrent().getArg().get("empresa");
empresaList = (MyListbox) Executions.getCurrent().getArg().get("empresaList"); empresaList = (MyListbox) Executions.getCurrent().getArg().get("empresaList");
@ -502,6 +521,7 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
empresaSaferConfig = empresaSaferConfigService.buscarPorEmpresa(empresa); empresaSaferConfig = empresaSaferConfigService.buscarPorEmpresa(empresa);
empresaAdyenConfig = empresaAdyenConfigService.buscarPorEmpresa(empresa); empresaAdyenConfig = empresaAdyenConfigService.buscarPorEmpresa(empresa);
empresaMercadoPagoConfig = empresaMercadoPagoConfigService.buscarPorEmpresa(empresa); empresaMercadoPagoConfig = empresaMercadoPagoConfigService.buscarPorEmpresa(empresa);
empresaPMArtespConfig = empresaPMArtespConfigService.buscarPorEmpresa(empresa);
} }
if (empresa != null && empresa.getEmpresaId() != null) { if (empresa != null && empresa.getEmpresaId() != null) {
@ -609,6 +629,21 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
carregarConfiguracaoMercadoPago(); carregarConfiguracaoMercadoPago();
} }
if(empresaPMArtespConfig != null) {
chkAtivarIntegracaoPMARTESP.setChecked(empresaPMArtespConfig.getValidacaoAtiva());
txtUrlIntegracaoARTESP.setText(empresaPMArtespConfig.getUrlApi());
txtTokenIntegracaoARTESP.setText(empresaPMArtespConfig.getApiKey());
if(empresaPMArtespConfig.getOrgaoConcedente() != null) {
cmbOrgaoConcedente.setText(empresaPMArtespConfig.getOrgaoConcedente().getDescOrgao());
}
if(empresaPMArtespConfig.getCategoria() != null) {
cmbTipoDePassagem.setText(empresaPMArtespConfig.getCategoria().getDesccategoria());
}
}
if (empresa.getIndfechatarifa() == null) { if (empresa.getIndfechatarifa() == null) {
rdgFechaSalida.setChecked(Boolean.TRUE); rdgFechaSalida.setChecked(Boolean.TRUE);
} else if (empresa.getIndfechatarifa()) { } else if (empresa.getIndfechatarifa()) {
@ -1054,6 +1089,11 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
Ciudad cidade = (Ciudad) cbiCidade.getValue(); Ciudad cidade = (Ciudad) cbiCidade.getValue();
empresa.setCidade(cidade); empresa.setCidade(cidade);
} }
if(!isValidosCamposIntegracaoPMArtesp()) {
return;
}
try { try {
if (empresa.getIndExterna() == null) { if (empresa.getIndExterna() == null) {
@ -1302,7 +1342,9 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
empresaMercadoPagoConfigService.actualizacion(empresaMercadoPagoConfig); empresaMercadoPagoConfigService.actualizacion(empresaMercadoPagoConfig);
} }
//INTEGRACAO TIPO DE PASSAGEM PM ARTESP
salvarEmpresaPMArtespConfig();
Messagebox.show(Labels.getLabel("editarEmpresaController.MSG.suscribirOK"), Messagebox.show(Labels.getLabel("editarEmpresaController.MSG.suscribirOK"),
Labels.getLabel("editarEmpresaController.window.title"), Labels.getLabel("editarEmpresaController.window.title"),
@ -1337,6 +1379,53 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
} }
} }
private boolean isValidosCamposIntegracaoPMArtesp() throws InterruptedException {
if(chkAtivarIntegracaoPMARTESP.isChecked()) {
if(cmbOrgaoConcedente.getSelectedItem() == null || cmbTipoDePassagem.getSelectedItem() == null ||
txtTokenIntegracaoARTESP.getValue() == null || txtUrlIntegracaoARTESP.getValue() == null) {
Messagebox.show(Labels.getLabel("editarEmpresaController.MSG.InfoCamposIntegracaoPMArtespInvalido"),
Labels.getLabel("editarEmpresaController.window.title"), Messagebox.OK, Messagebox.EXCLAMATION);
return false;
}
}
return true;
}
private void salvarEmpresaPMArtespConfig() {
boolean atualizar = true;
if(empresaPMArtespConfig == null) {
empresaPMArtespConfig = new EmpresaPMArtespConfig();
atualizar = false;
}
empresaPMArtespConfig.setEmpresa(empresa);
if(cmbOrgaoConcedente.getSelectedItem() != null) {
OrgaoConcedente orgao = (OrgaoConcedente) cmbOrgaoConcedente.getSelectedItem().getValue();
empresaPMArtespConfig.setOrgaoConcedente(orgao);
}
if(cmbTipoDePassagem.getSelectedItem() != null) {
Categoria categoria = (Categoria) cmbTipoDePassagem.getSelectedItem().getValue();
empresaPMArtespConfig.setCategoria(categoria);
}
empresaPMArtespConfig.setApiKey(txtTokenIntegracaoARTESP.getValue());
empresaPMArtespConfig.setUrlApi(txtUrlIntegracaoARTESP.getValue());
empresaPMArtespConfig.setValidacaoAtiva(chkAtivarIntegracaoPMARTESP.isChecked());
if(atualizar) {
empresaPMArtespConfig = empresaPMArtespConfigService.actualizacion(empresaPMArtespConfig);
} else {
empresaPMArtespConfig = empresaPMArtespConfigService.suscribir(empresaPMArtespConfig);
}
}
private Date buscarHora(Date horaEmbarque) { private Date buscarHora(Date horaEmbarque) {
if (horaEmbarque != null) { if (horaEmbarque != null) {
GregorianCalendar gHoraSalida = new GregorianCalendar(); GregorianCalendar gHoraSalida = new GregorianCalendar();
@ -2918,5 +3007,37 @@ public void onClick$btnTestEmailFlexBus(Event ev) throws InterruptedException {
public boolean isExibeDadosTokenLicenca() { public boolean isExibeDadosTokenLicenca() {
return !cadastroEmpresaNova; return !cadastroEmpresaNova;
} }
public MyComboboxEstandar getCmbTipoDePassagem() {
return cmbTipoDePassagem;
}
public void setCmbTipoDePassagem(MyComboboxEstandar cmbTipoDePassagem) {
this.cmbTipoDePassagem = cmbTipoDePassagem;
}
public EmpresaPMArtespConfig getEmpresaPMArtespConfig() {
return empresaPMArtespConfig;
}
public void setEmpresaPMArtespConfig(EmpresaPMArtespConfig empresaPMArtespConfig) {
this.empresaPMArtespConfig = empresaPMArtespConfig;
}
public MyComboboxEstandar getCmbOrgaoConcedente() {
return cmbOrgaoConcedente;
}
public void setCmbOrgaoConcedente(MyComboboxEstandar cmbOrgaoConcedente) {
this.cmbOrgaoConcedente = cmbOrgaoConcedente;
}
public List<OrgaoConcedente> getLsOrgaoConcedente() {
return lsOrgaoConcedente;
}
public void setLsOrgaoConcedente(List<OrgaoConcedente> lsOrgaoConcedente) {
this.lsOrgaoConcedente = lsOrgaoConcedente;
}
} }

View File

@ -454,7 +454,8 @@
<value>com.rjconsultores.ventaboletos.entidad.PricingConexao</value> <value>com.rjconsultores.ventaboletos.entidad.PricingConexao</value>
<value>com.rjconsultores.ventaboletos.entidad.OrgaoComprovanteCustomizado</value> <value>com.rjconsultores.ventaboletos.entidad.OrgaoComprovanteCustomizado</value>
<value>com.rjconsultores.ventaboletos.entidad.HeaderTabelaEsquemaCorrida</value> <value>com.rjconsultores.ventaboletos.entidad.HeaderTabelaEsquemaCorrida</value>
<value>com.rjconsultores.ventaboletos.entidad.Disponibilidad</value> <value>com.rjconsultores.ventaboletos.entidad.Disponibilidad</value>
<value>com.rjconsultores.ventaboletos.entidad.EmpresaPMArtespConfig</value>
</list> </list>
</property> </property>

View File

@ -2057,6 +2057,16 @@ editarEmpresaController.lblBtnCadastrarPOSMercadoPago.value = Cadastrar POS
editarEmpresaController.lblMsgCadastrarStoreMercadoPago.value = Store cadastrada com sucesso editarEmpresaController.lblMsgCadastrarStoreMercadoPago.value = Store cadastrada com sucesso
editarEmpresaController.lblMsgCadastrarPOSMercadoPago.value = POS cadastrada com sucesso editarEmpresaController.lblMsgCadastrarPOSMercadoPago.value = POS cadastrada com sucesso
editarEmpresaController.lblIntegracoesTipoPassagem.value=Integrações Tipo de Passagem
editarEmpresaController.lblTabPMArtesp.value=Integração PM Artesp
editarEmpresaController.lblOrgaoConcedenteIntegracao.value=Orgão Concedente
editarEmpresaController.lblTipoDePassagemIntegracao.value=Tipo de Passagem
editarEmpresaController.lblAtivarArtesp.value=Ativar Validação
editarEmpresaController.lblUrlApiPMArtesp.value=URL API
editarEmpresaController.lblApiKeyPMArtesp.value=API KEY
editarEmpresaController.MSG.InfoCamposIntegracaoPMArtespInvalido= Ao habilitar a integração PM Artesp, os campos passam ser obrigatorios.
editarEmpresaController.lblUrlApiPMArtesp.value.ajuda=URL API deve conter os dados {RE}, {EMBARQUE} e {DESEMBARQUE}, que serão subtituidos no momento da validação de gratuidade pelo totalbus.
# Muestra o ponto de Pesquisa de Venda # Muestra o ponto de Pesquisa de Venda
busquedaPuntoVentaController.window.title = Ponto de Venda ( Agência ) busquedaPuntoVentaController.window.title = Ponto de Venda ( Agência )
busquedaPuntoVentaController.btnRefresh.tooltiptext = Atualizar busquedaPuntoVentaController.btnRefresh.tooltiptext = Atualizar

View File

@ -64,6 +64,9 @@
label="${c:l('editarEmpresaController.lblAdyen.value')}" /> label="${c:l('editarEmpresaController.lblAdyen.value')}" />
<tab id="tabMercadoPago" <tab id="tabMercadoPago"
label="${c:l('editarEmpresaController.lblMercadoPago.value')}" /> label="${c:l('editarEmpresaController.lblMercadoPago.value')}" />
<tab
label="${c:l('editarEmpresaController.lblIntegracoesTipoPassagem.value')}" />
</tabs> </tabs>
@ -2487,10 +2490,82 @@
</tabpanel> </tabpanel>
</tabpanels> </tabpanels>
</tabbox> </tabbox>
</tabpanel> </tabpanel>
<tabpanel>
<tabbox>
<tabs>
<tab label="${c:l('editarEmpresaController.lblTabPMArtesp.value')}" />
</tabs>
<tabpanels>
<tabpanel>
<grid fixedLayout="true">
<columns>
<column width="25%" />
<column width="75%" />
</columns>
<rows>
<row>
<label value="${c:l('editarEmpresaController.lblAtivarArtesp.value')}" />
<checkbox id="chkAtivarIntegracaoPMARTESP"
value="@{winEditarEmpresa$composer.empresaPMArtespConfig.validacaoAtiva}"/>
</row>
<row>
<hlayout>
<label value="${c:l('editarEmpresaController.lblUrlApiPMArtesp.value')}" />
<image src="/gui/img/Question_mark_1.png" tooltiptext="${c:l('editarEmpresaController.lblUrlApiPMArtesp.value.ajuda')}"
style="cursor: help" />
</hlayout>
<textbox
id="txtUrlIntegracaoARTESP" width="80%" maxlength="500"
value="@{winEditarEmpresa$composer.empresaPMArtespConfig.urlApi}" />
</row>
<row>
<label value="${c:l('editarEmpresaController.lblApiKeyPMArtesp.value')}" />
<textbox
id="txtTokenIntegracaoARTESP" width="80%" maxlength="4000"
value="@{winEditarEmpresa$composer.empresaPMArtespConfig.apiKey}" />
</row>
<row>
<label value="${c:l('editarEmpresaController.lblOrgaoConcedenteIntegracao.value')}" />
<combobox
id="cmbOrgaoConcedente" width="30%" mold="rounded"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
model="@{winEditarEmpresa$composer.lsOrgaoConcedente}"
selectedItem="@{winEditarPuntoVenta$composer.empresaPMArtespConfig.orgaoConcedente}"/>
</row>
<row>
<label value="${c:l('editarEmpresaController.lblTipoDePassagemIntegracao.value')}" />
<combobox
id="cmbTipoDePassagem" width="30%" mold="rounded"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
model="@{winEditarEmpresa$composer.lsCategorias}"
selectedItem="@{winEditarPuntoVenta$composer.empresaPMArtespConfig.categoria}"
/>
</row>
</rows>
</grid>
</tabpanel>
</tabpanels>
</tabbox>
</tabpanel>
</tabpanels> </tabpanels>
</tabbox> </tabbox>
</window> </window>