Browse Source

ResetView on invalid eventLog

hbw_build
Wong Joon Hui 3 years ago
parent
commit
f1c0dc955a
  1. 14
      app/src/main/java/com/cst/im30/activity/MainActivity.java
  2. 9
      app/src/main/java/com/cst/im30/service/IDVerificationService.java

14
app/src/main/java/com/cst/im30/activity/MainActivity.java

@ -382,6 +382,11 @@ public class MainActivity extends AppCompatActivity implements CallableInterface
if (source.equalsIgnoreCase(IDVerificationService.SUCCESS_GET_EVENT_LOG)) { if (source.equalsIgnoreCase(IDVerificationService.SUCCESS_GET_EVENT_LOG)) {
EventLogDetailed incomingEventLogDetailed = (EventLogDetailed) object; EventLogDetailed incomingEventLogDetailed = (EventLogDetailed) object;
if (incomingEventLogDetailed == null) {
resetView();
return;
}
boolean cancelAction = incomingEventLogDetailed.getAction().equalsIgnoreCase(Constants.IC_FUNCTION_CANCEL); boolean cancelAction = incomingEventLogDetailed.getAction().equalsIgnoreCase(Constants.IC_FUNCTION_CANCEL);
if (cancelAction) { if (cancelAction) {
if (MainApplication.working && MainApplication.currentActivity instanceof ICCActivity) { if (MainApplication.working && MainApplication.currentActivity instanceof ICCActivity) {
@ -416,6 +421,11 @@ public class MainActivity extends AppCompatActivity implements CallableInterface
else if (source.equalsIgnoreCase(PaymentService.SUCCESS_GET_EVENT_LOG)) { else if (source.equalsIgnoreCase(PaymentService.SUCCESS_GET_EVENT_LOG)) {
EventLogDetailed incomingEventLogDetailed = (EventLogDetailed) object; EventLogDetailed incomingEventLogDetailed = (EventLogDetailed) object;
if (incomingEventLogDetailed == null) {
resetView();
return;
}
boolean cancelPayFunction = incomingEventLogDetailed.getPayFunction().equalsIgnoreCase(Constants.PAY_FUNCTION_CANCEL); boolean cancelPayFunction = incomingEventLogDetailed.getPayFunction().equalsIgnoreCase(Constants.PAY_FUNCTION_CANCEL);
if (cancelPayFunction) { if (cancelPayFunction) {
// Cancel whether working or not at the moment // Cancel whether working or not at the moment
@ -554,12 +564,12 @@ public class MainActivity extends AppCompatActivity implements CallableInterface
} }
private void initEchoClientIC() { private void initEchoClientIC() {
//Logger.logD("echoClient IC: " + BuildConfig.ECHO_SERVER_URL + ":" + BuildConfig.ECHO_SERVER_PORT); Logger.logD("echoClient IC: " + BuildConfig.ECHO_SERVER_URL + ":" + BuildConfig.ECHO_SERVER_PORT);
MainApplication.icClient = new EchoClient(BuildConfig.ECHO_SERVER_URL + ":" + BuildConfig.ECHO_SERVER_PORT); MainApplication.icClient = new EchoClient(BuildConfig.ECHO_SERVER_URL + ":" + BuildConfig.ECHO_SERVER_PORT);
} }
private void initEchoClientPayment() { private void initEchoClientPayment() {
//Logger.logD("echoClient Payment: " + BuildConfig.ECHO_SERVER_URL + ":" + BuildConfig.ECHO_SERVER_PORT); Logger.logD("echoClient Payment: " + BuildConfig.ECHO_SERVER_URL + ":" + BuildConfig.ECHO_SERVER_PORT);
MainApplication.paymentClient = new EchoClient(BuildConfig.ECHO_SERVER_URL + ":" + BuildConfig.ECHO_SERVER_PORT); MainApplication.paymentClient = new EchoClient(BuildConfig.ECHO_SERVER_URL + ":" + BuildConfig.ECHO_SERVER_PORT);
} }

9
app/src/main/java/com/cst/im30/service/IDVerificationService.java

@ -177,6 +177,8 @@ public class IDVerificationService {
} }
private EventLogDetailed parseGetEventLogResponse(JSONObject jsonObject) throws Exception { private EventLogDetailed parseGetEventLogResponse(JSONObject jsonObject) throws Exception {
if (jsonObject.has("data")) {
try {
String type = jsonObject.getJSONObject("data").getString("type"); String type = jsonObject.getJSONObject("data").getString("type");
String status = jsonObject.getJSONObject("data").getString("status"); String status = jsonObject.getJSONObject("data").getString("status");
String action = jsonObject.getJSONObject("data").getString("action"); String action = jsonObject.getJSONObject("data").getString("action");
@ -201,6 +203,13 @@ public class IDVerificationService {
eventLogDetailed.setProfileIdOpera(profileOperaId); eventLogDetailed.setProfileIdOpera(profileOperaId);
return eventLogDetailed; return eventLogDetailed;
} catch (Exception e) {
Logger.logE(e.getMessage());
e.printStackTrace();
return null;
}
}
return null;
} }
} }

Loading…
Cancel
Save