Worldpay / hybris

Worldpay SAP Hybris Addon
25 stars 32 forks source link

`java.lang.ClassCastException` when a worldpay order code relates to a cart that has the transaction type set to `AUTHORIZATION` #74

Closed 1gmar closed 8 months ago

1gmar commented 2 years ago

Hello again, worldpay team, we've encountered another issue with the latest 1905_7.0 release:

When the new DefaultWorldpayOrderModificationProcessService has been introduced, a class cast has creeped out of the if branch on this line. This causes an unhandled ClassCastException which crashes the OrderModificationProcessorJobPerformable completely and orders are stuck in Pending Payment Notification status.

Here is a unit test which you can add to DefaultWorldpayOrderModificationProcessServiceTest to reproduce the issue:

@Test
public void processOrderModificationMessages_WhenWorldpayOrderCodeRelatesToCartWithAuthorizationTransactionType_ShouldDoNothing() throws WorldpayConfigurationException {
    when(paymentTransactionModelMock.getOrder()).thenReturn(cartModelMock);

    final boolean result = testObj.processOrderModificationMessages(AUTHORIZATION);

    assertTrue(result);
    verify(worldpayOrderNotificationHandlerMock, never()).handleNotificationBusinessProcess(AUTHORIZATION, worldpayOrderModificationMock, orderModelMock, orderNotificationMessageMock);
    verify(worldpayOrderModificationMock, never()).setProcessed(Boolean.TRUE);
    verify(worldpayOrderModificationMock, never()).setDefective(any(Boolean.class));
}

Thank you for your support.

Regards.

slav-pilus commented 8 months ago

This is still a problem I've seen in production - it needs fixing

Magdoosha commented 8 months ago

Thanks @slav-pilus for flagging this up. We are looking into this and will be back in touch in due course.

adbame commented 8 months ago

Hello @slav-pilus

A new release has been published for versions 2211, 2205 and 2105 fixing this issue