AL-1801
parent
052c45252b
commit
d55b35300c
2
pom.xml
2
pom.xml
|
@ -3,7 +3,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>br.com.rjconsultores</groupId>
|
<groupId>br.com.rjconsultores</groupId>
|
||||||
<artifactId>ModelWeb</artifactId>
|
<artifactId>ModelWeb</artifactId>
|
||||||
<version>1.0.33</version>
|
<version>1.0.34</version>
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
<repository>
|
<repository>
|
||||||
<id>rj-releases</id>
|
<id>rj-releases</id>
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.EmpresaMercadoPagoConfig;
|
||||||
|
|
||||||
|
public interface EmpresaMercadoPagoConfigDAO extends GenericDAO<EmpresaMercadoPagoConfig, Integer> {
|
||||||
|
|
||||||
|
public List<EmpresaMercadoPagoConfig> obtenerTodos();
|
||||||
|
|
||||||
|
public EmpresaMercadoPagoConfig buscarPorEmpresa(Empresa empresa);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hibernate.Criteria;
|
||||||
|
import org.hibernate.SessionFactory;
|
||||||
|
import org.hibernate.criterion.Restrictions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.EmpresaMercadoPagoConfigDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.EmpresaMercadoPagoConfig;
|
||||||
|
|
||||||
|
@Repository("empresaMercadoPagoConfigDAO")
|
||||||
|
public class EmpresaMercadoPagoConfigHibernateDAO extends GenericHibernateDAO<EmpresaMercadoPagoConfig, Integer>
|
||||||
|
implements EmpresaMercadoPagoConfigDAO {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public EmpresaMercadoPagoConfigHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
|
setSessionFactory(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EmpresaMercadoPagoConfig> obtenerTodos() {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
|
||||||
|
return c.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EmpresaMercadoPagoConfig buscarPorEmpresa(Empresa empresa) {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||||
|
c.add(Restrictions.eq("empresa", empresa));
|
||||||
|
|
||||||
|
return (EmpresaMercadoPagoConfig) c.uniqueResult();
|
||||||
|
}
|
||||||
|
}
|
|
@ -411,6 +411,12 @@ public class Empresa implements Serializable, Auditavel<Empresa> {
|
||||||
|
|
||||||
@Column(name = "INDJUROSCREDITO")
|
@Column(name = "INDJUROSCREDITO")
|
||||||
private Boolean indJurosCredito;
|
private Boolean indJurosCredito;
|
||||||
|
|
||||||
|
@Column(name = "LATITUDE ")
|
||||||
|
private Float latitude;
|
||||||
|
|
||||||
|
@Column(name = "LONGITUDE ")
|
||||||
|
private Float longitude;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
@NaoAuditar
|
@NaoAuditar
|
||||||
|
@ -1527,4 +1533,21 @@ public class Empresa implements Serializable, Auditavel<Empresa> {
|
||||||
public void setIndJurosCredito(Boolean indJurosCredito) {
|
public void setIndJurosCredito(Boolean indJurosCredito) {
|
||||||
this.indJurosCredito = indJurosCredito;
|
this.indJurosCredito = indJurosCredito;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Float getLatitude() {
|
||||||
|
return latitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLatitude(Float latitude) {
|
||||||
|
this.latitude = latitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float getLongitude() {
|
||||||
|
return longitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLongitude(Float longitude) {
|
||||||
|
this.longitude = longitude;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,6 @@ import javax.persistence.Table;
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
import org.apache.commons.lang.BooleanUtils;
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@SequenceGenerator(name = "EMPRESA_ADYEN_CONFIG_SEQ", sequenceName = "EMPRESA_ADYEN_CONFIG_SEQ", allocationSize = 1)
|
@SequenceGenerator(name = "EMPRESA_ADYEN_CONFIG_SEQ", sequenceName = "EMPRESA_ADYEN_CONFIG_SEQ", allocationSize = 1)
|
||||||
@Table(name = "EMPRESA_ADYEN_CONFIG")
|
@Table(name = "EMPRESA_ADYEN_CONFIG")
|
||||||
|
|
|
@ -0,0 +1,165 @@
|
||||||
|
package com.rjconsultores.ventaboletos.entidad;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import javax.persistence.Basic;
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.OneToOne;
|
||||||
|
import javax.persistence.SequenceGenerator;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.Temporal;
|
||||||
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@SequenceGenerator(name = "EMPRESA_MERCADOPAGO_CONFIG_SEQ", sequenceName = "EMPRESA_MERCADOPAGO_CONFIG_SEQ", allocationSize = 1)
|
||||||
|
@Table(name = "EMPRESA_MERCADOPAGO_CONFIG")
|
||||||
|
public class EmpresaMercadoPagoConfig implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Id
|
||||||
|
@Basic(optional = false)
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "EMPRESA_MERCADOPAGO_CONFIG_SEQ")
|
||||||
|
@Column(name = "EMPRESAMERCADOPAGOCONFIG_ID")
|
||||||
|
private Integer empresaMercadoPagoConfigId;
|
||||||
|
@OneToOne
|
||||||
|
@JoinColumn(name = "EMPRESA_ID")
|
||||||
|
private Empresa empresa;
|
||||||
|
@Column(name = "USER_ID")
|
||||||
|
private String userId;
|
||||||
|
@Column(name = "STORE")
|
||||||
|
private String store;
|
||||||
|
@Column(name = "POS")
|
||||||
|
private String pos;
|
||||||
|
@Column(name = "TOKEN")
|
||||||
|
private String token;
|
||||||
|
@Column(name = "URL_API")
|
||||||
|
private String urlApi;
|
||||||
|
@Column(name = "ACTIVO")
|
||||||
|
private Boolean activo;
|
||||||
|
@Column(name = "FECMODIF")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
private Date fecmodif;
|
||||||
|
@Column(name = "USUARIO_ID")
|
||||||
|
private Integer usuarioId;
|
||||||
|
|
||||||
|
public EmpresaMercadoPagoConfig() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getEmpresaMercadoPagoConfigId() {
|
||||||
|
return empresaMercadoPagoConfigId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmpresaMercadoPagoConfigId(Integer empresaMercadoPagoConfigId) {
|
||||||
|
this.empresaMercadoPagoConfigId = empresaMercadoPagoConfigId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Empresa getEmpresa() {
|
||||||
|
return empresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmpresa(Empresa empresa) {
|
||||||
|
this.empresa = empresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(String userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStore() {
|
||||||
|
return store;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStore(String store) {
|
||||||
|
this.store = store;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPos() {
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPos(String pos) {
|
||||||
|
this.pos = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getToken() {
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setToken(String token) {
|
||||||
|
this.token = token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrlApi() {
|
||||||
|
return urlApi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrlApi(String urlApi) {
|
||||||
|
this.urlApi = urlApi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getActivo() {
|
||||||
|
return activo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivo(Boolean activo) {
|
||||||
|
this.activo = activo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getFecmodif() {
|
||||||
|
return fecmodif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFecmodif(Date fecmodif) {
|
||||||
|
this.fecmodif = fecmodif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getUsuarioId() {
|
||||||
|
return usuarioId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsuarioId(Integer usuarioId) {
|
||||||
|
this.usuarioId = usuarioId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + ((empresaMercadoPagoConfigId == null) ? 0 : empresaMercadoPagoConfigId.hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
EmpresaMercadoPagoConfig other = (EmpresaMercadoPagoConfig) obj;
|
||||||
|
if (empresaMercadoPagoConfigId == null) {
|
||||||
|
if (other.empresaMercadoPagoConfigId != null)
|
||||||
|
return false;
|
||||||
|
} else if (!empresaMercadoPagoConfigId.equals(other.empresaMercadoPagoConfigId))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.valueOf(this.getEmpresaMercadoPagoConfigId());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -2,5 +2,8 @@ package com.rjconsultores.ventaboletos.enums;
|
||||||
|
|
||||||
public enum TipoEnvioRest {
|
public enum TipoEnvioRest {
|
||||||
GET,
|
GET,
|
||||||
POST;
|
POST,
|
||||||
|
PUT,
|
||||||
|
DELETE,
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ public enum TipoFormapago {
|
||||||
TPI(15, Labels.getLabel("editarFormaPagoController.lblTPI.label")),
|
TPI(15, Labels.getLabel("editarFormaPagoController.lblTPI.label")),
|
||||||
MOBIPIX(16,Labels.getLabel("editarFormaPagoController.lblMobiPix.label")),
|
MOBIPIX(16,Labels.getLabel("editarFormaPagoController.lblMobiPix.label")),
|
||||||
ADYEN(17,Labels.getLabel("editarFormaPagoController.lblAdyen.label")),
|
ADYEN(17,Labels.getLabel("editarFormaPagoController.lblAdyen.label")),
|
||||||
|
MERCADO_PAGO(18,Labels.getLabel("editarFormaPagoController.lblMercadoPago.label")),
|
||||||
;
|
;
|
||||||
|
|
||||||
private Integer valor;
|
private Integer valor;
|
||||||
|
|
|
@ -0,0 +1,147 @@
|
||||||
|
package com.rjconsultores.ventaboletos.rest.generic;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.http.HttpResponse;
|
||||||
|
import org.apache.http.HttpStatus;
|
||||||
|
import org.apache.http.client.HttpClient;
|
||||||
|
import org.apache.http.client.methods.HttpDelete;
|
||||||
|
import org.apache.http.client.methods.HttpGet;
|
||||||
|
import org.apache.http.client.methods.HttpPost;
|
||||||
|
import org.apache.http.client.methods.HttpPut;
|
||||||
|
import org.apache.http.client.methods.HttpUriRequest;
|
||||||
|
import org.apache.http.entity.ContentType;
|
||||||
|
import org.apache.http.entity.StringEntity;
|
||||||
|
import org.apache.http.impl.client.HttpClientBuilder;
|
||||||
|
import org.apache.http.util.EntityUtils;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.rjconsultores.ventaboletos.enums.TipoEnvioRest;
|
||||||
|
|
||||||
|
public class GenericRest {
|
||||||
|
|
||||||
|
private static Logger log = Logger.getLogger(GenericRest.class);
|
||||||
|
|
||||||
|
private static GenericRest instance;
|
||||||
|
|
||||||
|
public static synchronized GenericRest getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new GenericRest();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
|
public <T> RetornoGenericRest fazerChamada(String uri, TipoEnvioRest metodo, String parametro,
|
||||||
|
ContentType contentType, HashMap<String, String> headers, Class<T> targetClassType, Class<T> errorClass)
|
||||||
|
throws Exception {
|
||||||
|
|
||||||
|
HttpClient client = HttpClientBuilder.create().build();
|
||||||
|
|
||||||
|
HttpUriRequest request = retornaRequestWithHeader(uri, metodo, parametro, contentType, headers);
|
||||||
|
|
||||||
|
HttpResponse response = client.execute(request);
|
||||||
|
|
||||||
|
RetornoGenericRest retorno = new RetornoGenericRest();
|
||||||
|
retorno.setStatusResposta(response.getStatusLine().getStatusCode());
|
||||||
|
retorno.setMensagemResposta(response.getStatusLine().getReasonPhrase());
|
||||||
|
|
||||||
|
log.info(String.format("httpStatusCode: %s ", response.getStatusLine().getStatusCode()));
|
||||||
|
|
||||||
|
if (response.getEntity() != null) {
|
||||||
|
|
||||||
|
String entity = EntityUtils.toString(response.getEntity());
|
||||||
|
|
||||||
|
if (retorno.getStatusResposta() == HttpStatus.SC_OK
|
||||||
|
|| retorno.getStatusResposta() == HttpStatus.SC_CREATED) {
|
||||||
|
if (targetClassType != null) {
|
||||||
|
retorno.setConteudo(new Gson().fromJson(entity, targetClassType));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
retorno.setConteudoErro(new Gson().fromJson(entity, errorClass));
|
||||||
|
}
|
||||||
|
|
||||||
|
return retorno;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
|
public <T> RetornoGenericRest fazerChamada(String uri, TipoEnvioRest metodo, String parametro,
|
||||||
|
ContentType contentType, HashMap<String, String> headers, Type targetType, Class<T> errorClass)
|
||||||
|
throws Exception {
|
||||||
|
|
||||||
|
HttpClient client = HttpClientBuilder.create().build();
|
||||||
|
|
||||||
|
HttpUriRequest request = retornaRequestWithHeader(uri, metodo, parametro, contentType, headers);
|
||||||
|
|
||||||
|
HttpResponse response = client.execute(request);
|
||||||
|
|
||||||
|
RetornoGenericRest retorno = new RetornoGenericRest();
|
||||||
|
retorno.setStatusResposta(response.getStatusLine().getStatusCode());
|
||||||
|
retorno.setMensagemResposta(response.getStatusLine().getReasonPhrase());
|
||||||
|
|
||||||
|
log.info(String.format("httpStatusCode: %s ", response.getStatusLine().getStatusCode()));
|
||||||
|
|
||||||
|
if (response.getEntity() != null) {
|
||||||
|
String entity = EntityUtils.toString(response.getEntity());
|
||||||
|
|
||||||
|
if (retorno.getStatusResposta() == HttpStatus.SC_OK
|
||||||
|
|| retorno.getStatusResposta() == HttpStatus.SC_CREATED) {
|
||||||
|
if (targetType != null) {
|
||||||
|
retorno.setConteudo(new Gson().fromJson(entity, targetType));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
retorno.setConteudoErro(new Gson().fromJson(entity, errorClass));
|
||||||
|
}
|
||||||
|
|
||||||
|
return retorno;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private HttpUriRequest retornaRequestWithHeader(String uri, TipoEnvioRest metodo, String parametro,
|
||||||
|
ContentType contentType, HashMap<String, String> headers) throws Exception {
|
||||||
|
HttpUriRequest request = new HttpPost(uri);
|
||||||
|
StringEntity body = new StringEntity(parametro != null ? parametro : "");
|
||||||
|
|
||||||
|
if (TipoEnvioRest.GET.equals(metodo)) {
|
||||||
|
request = new HttpGet(parametro != null
|
||||||
|
? montarUrlRequest(uri, URLEncoder.encode(parametro, Charset.forName("UTF-8").displayName()))
|
||||||
|
: uri);
|
||||||
|
} else if (TipoEnvioRest.POST.equals(metodo)) {
|
||||||
|
request = new HttpPost(uri);
|
||||||
|
((HttpPost) request).setEntity(body);
|
||||||
|
} else if (TipoEnvioRest.DELETE.equals(metodo)) {
|
||||||
|
request = new HttpDelete(montarUrlRequest(uri, parametro));
|
||||||
|
} else if (TipoEnvioRest.PUT.equals(metodo)) {
|
||||||
|
request = new HttpPut(montarUrlRequest(uri, parametro));
|
||||||
|
} else {
|
||||||
|
throw new Exception("No request type especified.");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Map.Entry<String, String> entry : headers.entrySet()) {
|
||||||
|
String key = entry.getKey();
|
||||||
|
String value = entry.getValue();
|
||||||
|
request.addHeader(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String montarUrlRequest(String url, String path) {
|
||||||
|
|
||||||
|
url = url.toLowerCase();
|
||||||
|
|
||||||
|
if (!url.endsWith("/")) {
|
||||||
|
url += "/";
|
||||||
|
}
|
||||||
|
|
||||||
|
return url.concat(path);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.rjconsultores.ventaboletos.rest.generic;
|
||||||
|
|
||||||
|
public class RetornoGenericRest<T> {
|
||||||
|
|
||||||
|
private T conteudo;
|
||||||
|
private Integer statusResposta;
|
||||||
|
private String mensagemResposta;
|
||||||
|
private T conteudoErro;
|
||||||
|
|
||||||
|
public Integer getStatusResposta() {
|
||||||
|
return statusResposta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatusResposta(Integer statusResposta) {
|
||||||
|
this.statusResposta = statusResposta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMensagemResposta() {
|
||||||
|
return mensagemResposta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMensagemResposta(String mensagemResposta) {
|
||||||
|
this.mensagemResposta = mensagemResposta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getConteudo() {
|
||||||
|
return conteudo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConteudo(T conteudo) {
|
||||||
|
this.conteudo = conteudo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getConteudoErro() {
|
||||||
|
return conteudoErro;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConteudoErro(T conteudoErro) {
|
||||||
|
this.conteudoErro = conteudoErro;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.EmpresaMercadoPagoConfig;
|
||||||
|
|
||||||
|
public interface EmpresaMercadoPagoConfigService extends GenericService<EmpresaMercadoPagoConfig, Integer> {
|
||||||
|
|
||||||
|
public EmpresaMercadoPagoConfig buscarPorEmpresa(Empresa empresa);
|
||||||
|
}
|
|
@ -10,7 +10,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import com.rjconsultores.ventaboletos.dao.EmpresaAdyenConfigDAO;
|
import com.rjconsultores.ventaboletos.dao.EmpresaAdyenConfigDAO;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
import com.rjconsultores.ventaboletos.entidad.EmpresaAdyenConfig;
|
import com.rjconsultores.ventaboletos.entidad.EmpresaAdyenConfig;
|
||||||
import com.rjconsultores.ventaboletos.entidad.EmpresaEmailConfig;
|
|
||||||
import com.rjconsultores.ventaboletos.service.EmpresaAdyenConfigService;
|
import com.rjconsultores.ventaboletos.service.EmpresaAdyenConfigService;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service.impl;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.EmpresaMercadoPagoConfigDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.EmpresaMercadoPagoConfig;
|
||||||
|
import com.rjconsultores.ventaboletos.service.EmpresaMercadoPagoConfigService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
|
@Service("empresaMercadoPagoConfigService")
|
||||||
|
public class EmpresaMercadoPagoConfigServiceImpl implements EmpresaMercadoPagoConfigService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EmpresaMercadoPagoConfigDAO empresaMercadoPagoConfigDAO;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EmpresaMercadoPagoConfig> obtenerTodos() {
|
||||||
|
return empresaMercadoPagoConfigDAO.obtenerTodos();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EmpresaMercadoPagoConfig obtenerID(Integer id) {
|
||||||
|
return empresaMercadoPagoConfigDAO.obtenerID(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public EmpresaMercadoPagoConfig suscribir(EmpresaMercadoPagoConfig entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
|
return empresaMercadoPagoConfigDAO.suscribir(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public EmpresaMercadoPagoConfig actualizacion(EmpresaMercadoPagoConfig entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
|
return empresaMercadoPagoConfigDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void borrar(EmpresaMercadoPagoConfig entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.FALSE);
|
||||||
|
|
||||||
|
empresaMercadoPagoConfigDAO.actualizacion(entidad);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EmpresaMercadoPagoConfig buscarPorEmpresa(Empresa empresa) {
|
||||||
|
return empresaMercadoPagoConfigDAO.buscarPorEmpresa(empresa);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
package com.rjconsultores.ventaboletos.vo.mercadopago;
|
||||||
|
|
||||||
|
public class PosVO extends RetornoErro {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
private String name;
|
||||||
|
private boolean fixed_amount;
|
||||||
|
private String store_id;
|
||||||
|
private String external_store_id;
|
||||||
|
private String external_id;
|
||||||
|
private Integer category;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFixed_amount() {
|
||||||
|
return fixed_amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFixed_amount(boolean fixed_amount) {
|
||||||
|
this.fixed_amount = fixed_amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStore_id() {
|
||||||
|
return store_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStore_id(String store_id) {
|
||||||
|
this.store_id = store_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExternal_store_id() {
|
||||||
|
return external_store_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExternal_store_id(String external_store_id) {
|
||||||
|
this.external_store_id = external_store_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExternal_id() {
|
||||||
|
return external_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExternal_id(String external_id) {
|
||||||
|
this.external_id = external_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getCategory() {
|
||||||
|
return category;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategory(Integer category) {
|
||||||
|
this.category = category;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return this.getExternal_id();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.rjconsultores.ventaboletos.vo.mercadopago;
|
||||||
|
|
||||||
|
public class RetornoErro {
|
||||||
|
|
||||||
|
public int statusCode;
|
||||||
|
public Object message;
|
||||||
|
public String error;
|
||||||
|
|
||||||
|
public int getStatusCode() {
|
||||||
|
return statusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatusCode(int statusCode) {
|
||||||
|
this.statusCode = statusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(Object message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getError() {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setError(String error) {
|
||||||
|
this.error = error;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
package com.rjconsultores.ventaboletos.vo.mercadopago;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class RetornoPosVO {
|
||||||
|
|
||||||
|
private Paging paging;
|
||||||
|
private ArrayList<PosVO> results;
|
||||||
|
|
||||||
|
public Paging getPaging() {
|
||||||
|
return paging;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPaging(Paging paging) {
|
||||||
|
this.paging = paging;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<PosVO> getResults() {
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResults(ArrayList<PosVO> results) {
|
||||||
|
this.results = results;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Paging {
|
||||||
|
private Integer total;
|
||||||
|
private Integer offset;
|
||||||
|
private Integer limit;
|
||||||
|
|
||||||
|
public Integer getTotal() {
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotal(Integer total) {
|
||||||
|
this.total = total;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getOffset() {
|
||||||
|
return offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOffset(Integer offset) {
|
||||||
|
this.offset = offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getLimit() {
|
||||||
|
return limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLimit(Integer limit) {
|
||||||
|
this.limit = limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
package com.rjconsultores.ventaboletos.vo.mercadopago;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class RetornoStoreVO {
|
||||||
|
|
||||||
|
private Paging paging;
|
||||||
|
private ArrayList<StoreVO> results;
|
||||||
|
|
||||||
|
public Paging getPaging() {
|
||||||
|
return paging;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPaging(Paging paging) {
|
||||||
|
this.paging = paging;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<StoreVO> getResults() {
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResults(ArrayList<StoreVO> results) {
|
||||||
|
this.results = results;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Paging {
|
||||||
|
private Integer total;
|
||||||
|
private Integer offset;
|
||||||
|
private Integer limit;
|
||||||
|
|
||||||
|
public Integer getTotal() {
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotal(Integer total) {
|
||||||
|
this.total = total;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getOffset() {
|
||||||
|
return offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOffset(Integer offset) {
|
||||||
|
this.offset = offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getLimit() {
|
||||||
|
return limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLimit(Integer limit) {
|
||||||
|
this.limit = limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,114 @@
|
||||||
|
package com.rjconsultores.ventaboletos.vo.mercadopago;
|
||||||
|
|
||||||
|
public class StoreVO extends RetornoErro {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
private String name;
|
||||||
|
private String external_id;
|
||||||
|
private Location location;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExternal_id() {
|
||||||
|
return external_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExternal_id(String external_id) {
|
||||||
|
this.external_id = external_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getLocation() {
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLocation(Location location) {
|
||||||
|
this.location = location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Location {
|
||||||
|
private String street_number;
|
||||||
|
private String street_name;
|
||||||
|
private String city_name;
|
||||||
|
private String state_name;
|
||||||
|
private Float latitude;
|
||||||
|
private Float longitude;
|
||||||
|
private String reference;
|
||||||
|
|
||||||
|
public String getStreet_number() {
|
||||||
|
return street_number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStreet_number(String street_number) {
|
||||||
|
this.street_number = street_number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStreet_name() {
|
||||||
|
return street_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStreet_name(String street_name) {
|
||||||
|
this.street_name = street_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCity_name() {
|
||||||
|
return city_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCity_name(String city_name) {
|
||||||
|
this.city_name = city_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getState_name() {
|
||||||
|
return state_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setState_name(String state_name) {
|
||||||
|
this.state_name = state_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float getLatitude() {
|
||||||
|
return latitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLatitude(Float latitude) {
|
||||||
|
this.latitude = latitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float getLongitude() {
|
||||||
|
return longitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLongitude(Float longitude) {
|
||||||
|
this.longitude = longitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReference() {
|
||||||
|
return reference;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReference(String reference) {
|
||||||
|
this.reference = reference;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return this.getExternal_id();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue