@Test public void onEventShouldNotSaveModificationModelDueToIncorrectMapping() { when(journalReplyMock.getJournalType()).thenReturn(EXPIRED); testObj.onEvent(orderModificationEventMock); verify(modelServiceMock, never()).save(any()); }
@Override protected void onEvent(final OrderModificationEvent orderModificationEvent) { final OrderNotificationMessage orderNotificationMessage = orderModificationEvent.getOrderNotificationMessage(); final AuthorisedStatus journalType = orderNotificationMessage.getJournalReply().getJournalType(); if (journalType.equals(REFUSED)) { setDeclineCodeInCart(orderNotificationMessage); } final PaymentTransactionType transactionType = paymentTransactionTypeMap.get(journalType); if (transactionType != null) { saveOrderModification(orderNotificationMessage, transactionType); } else { LOG.warn(MessageFormat.format("Transaction type {0} not supported. Ignoring event.", journalType)); } }
WorldpayOrderModificationListener extends AbstractEventListener<OrderModificationEvent> { @Override protected void onEvent(final OrderModificationEvent orderModificationEvent) { final OrderNotificationMessage orderNotificationMessage = orderModificationEvent.getOrderNotificationMessage(); final AuthorisedStatus journalType = orderNotificationMessage.getJournalReply().getJournalType(); if (journalType.equals(REFUSED)) { setDeclineCodeInCart(orderNotificationMessage); } final PaymentTransactionType transactionType = paymentTransactionTypeMap.get(journalType); if (transactionType != null) { saveOrderModification(orderNotificationMessage, transactionType); } else { LOG.warn(MessageFormat.format("Transaction type {0} not supported. Ignoring event.", journalType)); } } }
WorldpayOrderModificationListener extends AbstractEventListener<OrderModificationEvent> { @Override protected void onEvent(final OrderModificationEvent orderModificationEvent) { final OrderNotificationMessage orderNotificationMessage = orderModificationEvent.getOrderNotificationMessage(); final AuthorisedStatus journalType = orderNotificationMessage.getJournalReply().getJournalType(); if (journalType.equals(REFUSED)) { setDeclineCodeInCart(orderNotificationMessage); } final PaymentTransactionType transactionType = paymentTransactionTypeMap.get(journalType); if (transactionType != null) { saveOrderModification(orderNotificationMessage, transactionType); } else { LOG.warn(MessageFormat.format("Transaction type {0} not supported. Ignoring event.", journalType)); } }  }
WorldpayOrderModificationListener extends AbstractEventListener<OrderModificationEvent> { @Override protected void onEvent(final OrderModificationEvent orderModificationEvent) { final OrderNotificationMessage orderNotificationMessage = orderModificationEvent.getOrderNotificationMessage(); final AuthorisedStatus journalType = orderNotificationMessage.getJournalReply().getJournalType(); if (journalType.equals(REFUSED)) { setDeclineCodeInCart(orderNotificationMessage); } final PaymentTransactionType transactionType = paymentTransactionTypeMap.get(journalType); if (transactionType != null) { saveOrderModification(orderNotificationMessage, transactionType); } else { LOG.warn(MessageFormat.format("Transaction type {0} not supported. Ignoring event.", journalType)); } }  @Required void setPaymentTransactionTypeMap(final Map<AuthorisedStatus, PaymentTransactionType> paymentTransactionTypeMap); @Required void setModelService(final ModelService modelService); @Required void setOrderModificationSerialiser(final OrderModificationSerialiser orderModificationSerialiser); @Required void setWorldpayCartService(final WorldpayCartService worldpayCartService); }
WorldpayOrderModificationListener extends AbstractEventListener<OrderModificationEvent> { @Override protected void onEvent(final OrderModificationEvent orderModificationEvent) { final OrderNotificationMessage orderNotificationMessage = orderModificationEvent.getOrderNotificationMessage(); final AuthorisedStatus journalType = orderNotificationMessage.getJournalReply().getJournalType(); if (journalType.equals(REFUSED)) { setDeclineCodeInCart(orderNotificationMessage); } final PaymentTransactionType transactionType = paymentTransactionTypeMap.get(journalType); if (transactionType != null) { saveOrderModification(orderNotificationMessage, transactionType); } else { LOG.warn(MessageFormat.format("Transaction type {0} not supported. Ignoring event.", journalType)); } }  @Required void setPaymentTransactionTypeMap(final Map<AuthorisedStatus, PaymentTransactionType> paymentTransactionTypeMap); @Required void setModelService(final ModelService modelService); @Required void setOrderModificationSerialiser(final OrderModificationSerialiser orderModificationSerialiser); @Required void setWorldpayCartService(final WorldpayCartService worldpayCartService);  }