Source:
public boolean handleNotificationFor(String ipAddress, String payload) { if (isNotificationRejectedFromIpAddress(ipAddress)) { logger.error("{} notification received from ip '{}' which is not in domain '{}'", gatewayName(), ipAddress, notificationDomain()); return false; } WorldpayNotification notification; try { logger.info("Parsing notification", gatewayName()); logger.debug("Payload: {}", payload); notification = XMLUnmarshaller.unmarshall(payload, WorldpayNotification.class); logger.info("Parsed notification: {}", gatewayName(), notification); } catch (XMLUnmarshallerException e) { logger.error("{} notification parsing failed: {}", gatewayName(), e.toString()); return true; } if (isIgnored(notification)) { logger.info("{} notification ignored", gatewayName(), notification); return true; } if (isTransactionIdBlank(notification)) { logger.info("{} notification failed verification because it has no transaction ID", gatewayName(), notification); return true; } Optional<ChargeEntity> optionalChargeEntity = chargeDao.findByProviderAndTransactionId(gatewayName(), notification.getTransactionId()); if (!optionalChargeEntity.isPresent()) { logger.error("{} notification could not be evaluated (associated charge entity not found)", gatewayName(), notification); return true; } if (isCaptureNotification(notification)) { chargeNotificationProcessor.invoke(notification.getTransactionId(), optionalChargeEntity.get(), CAPTURED, notification.getGatewayEventDate()); } else if (isRefundNotification(notification)) { refundNotificationProcessor.invoke(getPaymentGatewayName(), newRefundStatus(notification), notification.getReference(), notification.getTransactionId()); } else { logger.error("{} notification unknown", gatewayName(), notification); } return true; }

Target:
public boolean handleNotificationFor(String ipAddress, String payload) { if (isNotificationRejectedFromIpAddress(ipAddress)) { logger.error("{} notification received from ip '{}' which is not in domain '{}'", gatewayName(), ipAddress, notificationDomain()); return false; } WorldpayNotification notification; try { logger.info("Parsing notification", gatewayName()); logger.debug("Payload: {}", payload); notification = XMLUnmarshaller.unmarshall(payload, WorldpayNotification.class); logger.info("Parsed notification: {}", gatewayName(), notification); } catch (XMLUnmarshallerException e) { logger.error("{} notification parsing failed: {}", gatewayName(), e.toString()); return true; } if (isIgnored(notification)) { logger.info("{} notification ignored", gatewayName(), notification); return true; } if (isTransactionIdBlank(notification)) { logger.warn("{} notification failed verification because it has no transaction ID", gatewayName(), notification); return true; } Optional<ChargeEntity> optionalChargeEntity = chargeDao.findByProviderAndTransactionId(gatewayName(), notification.getTransactionId()); if (!optionalChargeEntity.isPresent()) { logger.error("{} notification could not be evaluated (associated charge entity not found)", gatewayName(), notification); return true; } if (isCaptureNotification(notification)) { chargeNotificationProcessor.invoke(notification.getTransactionId(), optionalChargeEntity.get(), CAPTURED, notification.getGatewayEventDate()); } else if (isRefundNotification(notification)) { refundNotificationProcessor.invoke(getPaymentGatewayName(), newRefundStatus(notification), notification.getReference(), notification.getTransactionId()); } else { logger.error("{} notification unknown", gatewayName(), notification); } return true; }