DefaultWorldpayDynamicInteractionResolverService implements WorldpayDynamicInteractionResolverService { @Override public DynamicInteractionType resolveInteractionTypeForDirectIntegration(final WorldpayAdditionalInfoData worldpayAdditionalInfoData) { if(worldpayAdditionalInfoData.isReplenishmentOrder()) { return CONT_AUTH; } else { return isASMEnabled() ? MOTO : ECOMMERCE; } }  @Override DynamicInteractionType resolveInteractionTypeForDirectIntegration(final WorldpayAdditionalInfoData worldpayAdditionalInfoData); @Required void setAssistedServiceService(final AssistedServiceService assistedServiceService);  }
@Test public void resolveIterationTypeForEcommerce() { final DynamicInteractionType result = testObj.resolveInteractionTypeForDirectIntegration(worldpayAdditionalInfoDataMock); assertThat(result).isEqualTo(DynamicInteractionType.ECOMMERCE); }
@Test public void resolveIterationTypeForMOTO() { when(assistedServiceServiceMock.getAsmSession()).thenReturn(assistedServiceSessionMock); when(assistedServiceSessionMock.getAgent()).thenReturn(userModelMock); final DynamicInteractionType result = testObj.resolveInteractionTypeForDirectIntegration(worldpayAdditionalInfoDataMock); assertThat(result).isEqualTo(DynamicInteractionType.MOTO); }
@Test public void resolveIterationTypeForContAuth() { when(worldpayAdditionalInfoDataMock.isReplenishmentOrder()).thenReturn(true); when(assistedServiceServiceMock.getAsmSession()).thenReturn(assistedServiceSessionMock); when(assistedServiceSessionMock.getAgent()).thenReturn(userModelMock); final DynamicInteractionType result = testObj.resolveInteractionTypeForDirectIntegration(worldpayAdditionalInfoDataMock); assertThat(result).isEqualTo(DynamicInteractionType.CONT_AUTH); }