Skip to content

Commit

Permalink
Merge pull request #24 from majulvez/Phoenix
Browse files Browse the repository at this point in the history
v1.3.2
  • Loading branch information
majulvez authored Dec 20, 2019
2 parents 6f37153 + ef8a53e commit 5271c67
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ public interface AppConfig {
String getSecretKey();
boolean isTestMode();

void saveNotification(Notification notification);
void saveNotification(Notification notification) throws OperationException;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.miguelangeljulvez.easyredsys.server.ws.axis;

import com.miguelangeljulvez.easyredsys.client.AppConfig;
import com.miguelangeljulvez.easyredsys.client.OperationException;
import com.miguelangeljulvez.easyredsys.client.util.EasyredsysUtil;
import com.miguelangeljulvez.easyredsys.client.util.ResponseCodes;
import com.miguelangeljulvez.easyredsys.server.core.MessageOrderSOAPRequest;
Expand Down Expand Up @@ -59,16 +60,29 @@ public String procesaNotificacionSIS(String XML) throws java.rmi.RemoteException
throw new SecurityException(ResponseCodes.getErrorResponseMessage(messageOrderSOAPRequest.getNotificationSOAP().getDs_Response()));
}

boolean error = false;
if (getAppConfig() == null) {
_log.log(Level.WARNING, "El bean con los datos de la pasarela no se ha inyectado. Debes crear una clase que implemente la interface AppConfig");
_log.log(Level.WARNING, "No hay nada que hacer con la notificación recibida");

error = true;
} else {
getAppConfig().saveNotification(messageOrderSOAPRequest.getNotificationSOAP());
try {
getAppConfig().saveNotification(messageOrderSOAPRequest.getNotificationSOAP());
} catch (OperationException e) {
_log.log(Level.SEVERE, e.getMessage(), e);
error = true;
}
}

OrderSOAP orderSOAP = new OrderSOAP(messageOrderSOAPRequest.getNotificationSOAP().getDs_Order());
orderSOAP.setDs_version("0.0");
orderSOAP.setDs_response_merchant("OK"); //o KO, depende

if (error) {
orderSOAP.setDs_response_merchant("KO");
} else {
orderSOAP.setDs_response_merchant("OK");
}

MessageOrderSOAPResponse messageOrderSOAPResponse = new MessageOrderSOAPResponse(orderSOAP, clave);

Expand Down Expand Up @@ -99,7 +113,7 @@ private String getRemoteAddr() {
return remoteAddr;
}

private AppConfig getAppConfig() {
protected AppConfig getAppConfig() {

if (appConfig == null) {

Expand Down Expand Up @@ -127,5 +141,9 @@ private AppConfig getAppConfig() {
return appConfig;
}

protected void setAppConfig(AppConfig appConfig) {
this.appConfig = appConfig;
}

private static final Logger _log = Logger.getLogger(InotificacionSISBindingImpl.class.getName());
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.miguelangeljulvez.easyredsys.server.ws.literal;

import com.miguelangeljulvez.easyredsys.client.AppConfig;
import com.miguelangeljulvez.easyredsys.client.OperationException;
import com.miguelangeljulvez.easyredsys.client.util.EasyredsysUtil;
import com.miguelangeljulvez.easyredsys.client.util.ResponseCodes;
import com.miguelangeljulvez.easyredsys.server.core.MessageOrderSOAPRequest;
Expand All @@ -24,7 +25,7 @@
@WebService(serviceName = "InotificacionSIS", endpointInterface = "com.miguelangeljulvez.easyredsys.server.ws.literal.InotificacionSIS")
public class InotificacionSISImpl implements InotificacionSIS {

private AppConfig appConfig;
protected AppConfig appConfig;

@Override
public String notificacion(String datoEntrada) {
Expand Down Expand Up @@ -63,16 +64,29 @@ public String notificacion(String datoEntrada) {
throw new SecurityException(ResponseCodes.getErrorResponseMessage(messageOrderSOAPRequest.getNotificationSOAP().getDs_Response()));
}

boolean error = false;
if (getAppConfig() == null) {
_log.log(Level.WARNING, "El bean con los datos de la pasarela no se ha inyectado. Debes crear una clase que implemente la interface AppConfig");
_log.log(Level.WARNING, "No hay nada que hacer con la notificación recibida");

error = true;
} else {
getAppConfig().saveNotification(messageOrderSOAPRequest.getNotificationSOAP());
try {
getAppConfig().saveNotification(messageOrderSOAPRequest.getNotificationSOAP());
} catch (OperationException e) {
_log.log(Level.SEVERE, e.getMessage(), e);
error = true;
}
}

OrderSOAP orderSOAP = new OrderSOAP(messageOrderSOAPRequest.getNotificationSOAP().getDs_Order());
orderSOAP.setDs_version("0.0");
orderSOAP.setDs_response_merchant("OK"); //o KO, depende

if (error) {
orderSOAP.setDs_response_merchant("KO");
} else {
orderSOAP.setDs_response_merchant("OK");
}

MessageOrderSOAPResponse messageOrderSOAPResponse = new MessageOrderSOAPResponse(orderSOAP, clave);

Expand Down Expand Up @@ -103,7 +117,7 @@ private String getRemoteAddr() {
return remoteAddr;
}

private AppConfig getAppConfig() {
protected AppConfig getAppConfig() {

if (appConfig == null) {

Expand Down Expand Up @@ -131,6 +145,10 @@ private AppConfig getAppConfig() {
return appConfig;
}

protected void setAppConfig(AppConfig appConfig) {
this.appConfig = appConfig;
}

private static final Logger _log = Logger.getLogger(InotificacionSISImpl.class.getName());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


import com.miguelangeljulvez.easyredsys.client.AppConfig;
import com.miguelangeljulvez.easyredsys.client.OperationException;
import com.miguelangeljulvez.easyredsys.client.core.MessageOrderCESResponse;
import com.miguelangeljulvez.easyredsys.client.util.EasyredsysUtil;
import com.miguelangeljulvez.easyredsys.client.util.ResponseCodes;
Expand Down Expand Up @@ -67,17 +68,29 @@ public Response notificar(
throw new SecurityException(ResponseCodes.getErrorResponseMessage(messageOrderCESResponse.getOperationCES().getDs_Response()));
}

boolean error = false;
if (getAppConfig() == null) {
_log.log(Level.WARNING, "El bean con los datos de la pasarela no se ha inyectado. Debes crear una clase que implemente la interface AppConfig");
_log.log(Level.WARNING, "No hay nada que hacer con la notificación recibida");

error = true;
} else {
getAppConfig().saveNotification(messageOrderCESResponse.getOperationCES());
try {
getAppConfig().saveNotification(messageOrderCESResponse.getOperationCES());
} catch (OperationException e) {
_log.log(Level.SEVERE, e.getMessage(), e);
error = true;
}
}

return Response.status(200).build();
if (error) {
return Response.status(400).build();
} else {
return Response.status(200).build();
}
}

private AppConfig getAppConfig() {
protected AppConfig getAppConfig() {

if (appConfig == null) {

Expand Down Expand Up @@ -105,6 +118,10 @@ private AppConfig getAppConfig() {
return appConfig;
}

protected void setAppConfig(AppConfig appConfig) {
this.appConfig = appConfig;
}

private static final Logger _log = Logger.getLogger(InotificacionSISRest.class.getName());

}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VERSION=1.3.1
VERSION=1.3.2
GROUP=com.miguelangeljulvez.easyredsys
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.miguelangeljulvez.easyredsys.example;

import com.miguelangeljulvez.easyredsys.client.AppConfig;
import com.miguelangeljulvez.easyredsys.client.OperationException;
import com.miguelangeljulvez.easyredsys.client.core.Notification;

import javax.inject.Named;
Expand All @@ -24,7 +25,7 @@ public String getSecretKey() {
public boolean isTestMode() { return true;}

@Override
public void saveNotification(Notification notification) {
public void saveNotification(Notification notification) throws OperationException {
_log.info("OLEEEEEÉ - Si puedes leer esto es que todo ha ido bien");

// Pon aquí lo que quieras hacer con la notificación recibida
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.miguelangeljulvez.easyredsys.example;

import com.miguelangeljulvez.easyredsys.client.AppConfig;
import com.miguelangeljulvez.easyredsys.client.OperationException;
import com.miguelangeljulvez.easyredsys.client.core.Notification;

import javax.inject.Named;
Expand All @@ -24,7 +25,7 @@ public String getSecretKey() {
public boolean isTestMode() { return true;}

@Override
public void saveNotification(Notification notification) {
public void saveNotification(Notification notification) throws OperationException {
_log.info("OLEEEEEÉ - Si puedes leer esto es que todo ha ido bien");

// Pon aquí lo que quieras hacer con la notificación recibida
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.miguelangeljulvez.easyredsys.example;

import com.miguelangeljulvez.easyredsys.client.AppConfig;
import com.miguelangeljulvez.easyredsys.client.OperationException;
import com.miguelangeljulvez.easyredsys.client.core.Notification;

import javax.inject.Named;
Expand All @@ -24,7 +25,7 @@ public String getSecretKey() {
public boolean isTestMode() { return true;}

@Override
public void saveNotification(Notification notification) {
public void saveNotification(Notification notification) throws OperationException {
_log.info("OLEEEEEÉ - Si puedes leer esto es que todo ha ido bien");

// Pon aquí lo que quieras hacer con la notificación recibida
Expand Down

0 comments on commit 5271c67

Please sign in to comment.