@Test public void getSepaMandateDataTest() { String creditorID = "12345"; String creditorName = "creditor"; String storeCity = "city"; WirecardAuthenticationModel authentication = new WirecardAuthenticationModel(); authentication.setCreditorId(creditorID); authentication.setCreditorName(creditorName); authentication.setStoreCity(storeCity); WirecardPaymentConfigurationModel configuration = new WirecardPaymentConfigurationModel(); configuration.setAuthentication(authentication); when(wirecardPaymentConfigurationService.getConfiguration(Mockito.anyObject())).thenReturn(configuration); SepaMandateData sepaMandateData = wirecardPaymentModeFacade.getSepaMandateData(PAYMENT_METHOD_CODE); assertNotNull("SEPA mandate data is null", sepaMandateData); assertEquals("Creditor ID does not match", creditorID, sepaMandateData.getCreditorId()); assertEquals("Creditor name does not match", creditorName, sepaMandateData.getCreditorName()); assertEquals("Store city does not match", storeCity, sepaMandateData.getStoreCity()); }
@Override public SepaMandateData getSepaMandateData(String sepaCode) { SepaMandateData sepaMandateData = null; Optional<PaymentModeModel> sepaPaymentMode = wirecardPaymentConfigurationService.getAllAllowedPaymentModes() .stream() .filter(p -> p.getCode().equals(sepaCode)) .findAny(); if (sepaPaymentMode.isPresent()) { WirecardPaymentConfigurationModel configuration = wirecardPaymentConfigurationService.getConfiguration(sepaPaymentMode.get()); if (configuration != null) { sepaMandateData = new SepaMandateData(); sepaMandateData.setCreditorId(configuration.getAuthentication().getCreditorId()); sepaMandateData.setCreditorName(configuration.getAuthentication().getCreditorName()); sepaMandateData.setStoreCity(configuration.getAuthentication().getStoreCity()); } } return sepaMandateData; }
DefaultWirecardPaymentModeFacade implements WirecardPaymentModeFacade { @Override public SepaMandateData getSepaMandateData(String sepaCode) { SepaMandateData sepaMandateData = null; Optional<PaymentModeModel> sepaPaymentMode = wirecardPaymentConfigurationService.getAllAllowedPaymentModes() .stream() .filter(p -> p.getCode().equals(sepaCode)) .findAny(); if (sepaPaymentMode.isPresent()) { WirecardPaymentConfigurationModel configuration = wirecardPaymentConfigurationService.getConfiguration(sepaPaymentMode.get()); if (configuration != null) { sepaMandateData = new SepaMandateData(); sepaMandateData.setCreditorId(configuration.getAuthentication().getCreditorId()); sepaMandateData.setCreditorName(configuration.getAuthentication().getCreditorName()); sepaMandateData.setStoreCity(configuration.getAuthentication().getStoreCity()); } } return sepaMandateData; } }
DefaultWirecardPaymentModeFacade implements WirecardPaymentModeFacade { @Override public SepaMandateData getSepaMandateData(String sepaCode) { SepaMandateData sepaMandateData = null; Optional<PaymentModeModel> sepaPaymentMode = wirecardPaymentConfigurationService.getAllAllowedPaymentModes() .stream() .filter(p -> p.getCode().equals(sepaCode)) .findAny(); if (sepaPaymentMode.isPresent()) { WirecardPaymentConfigurationModel configuration = wirecardPaymentConfigurationService.getConfiguration(sepaPaymentMode.get()); if (configuration != null) { sepaMandateData = new SepaMandateData(); sepaMandateData.setCreditorId(configuration.getAuthentication().getCreditorId()); sepaMandateData.setCreditorName(configuration.getAuthentication().getCreditorName()); sepaMandateData.setStoreCity(configuration.getAuthentication().getStoreCity()); } } return sepaMandateData; }  }
DefaultWirecardPaymentModeFacade implements WirecardPaymentModeFacade { @Override public SepaMandateData getSepaMandateData(String sepaCode) { SepaMandateData sepaMandateData = null; Optional<PaymentModeModel> sepaPaymentMode = wirecardPaymentConfigurationService.getAllAllowedPaymentModes() .stream() .filter(p -> p.getCode().equals(sepaCode)) .findAny(); if (sepaPaymentMode.isPresent()) { WirecardPaymentConfigurationModel configuration = wirecardPaymentConfigurationService.getConfiguration(sepaPaymentMode.get()); if (configuration != null) { sepaMandateData = new SepaMandateData(); sepaMandateData.setCreditorId(configuration.getAuthentication().getCreditorId()); sepaMandateData.setCreditorName(configuration.getAuthentication().getCreditorName()); sepaMandateData.setStoreCity(configuration.getAuthentication().getStoreCity()); } } return sepaMandateData; }  @Override List<PaymentModeData> getActivePaymentModes(); PaymentModeData getActiveCreditCardPaymentMode(List<PaymentModeData> paymentModeData, String alias); @Override boolean isPurchase(String paymentMethodChosen); @Override WirecardRequestData getSeamlessFormData(AbstractOrderModel abstractOrderModel,
                                                   TransactionType transactionType,
                                                   PaymentMethodName paymentMethodName, PaymentModeModel paymentModeModel); @Override SepaMandateData getSepaMandateData(String sepaCode); @Override boolean isPaymentMethodActive(String paymentMethodChosen); @Override boolean isPaymentMethodChooseInactive(String paymentMethodChosen); @Required void setI18NService(I18NService i18NService); @Required void setPaymentModeConverter(Converter<PaymentModeModel, PaymentModeData> paymentModeConverter); @Required void setWirecardPaymentModeService(WirecardPaymentModeService wirecardPaymentModeService); @Required void setWirecardPaymentConfigurationService(WirecardPaymentConfigurationService wirecardPaymentConfigurationService); @Required void setWirecardSignatureStrategy(WirecardSignatureStrategy wirecardSignatureStrategy); }
DefaultWirecardPaymentModeFacade implements WirecardPaymentModeFacade { @Override public SepaMandateData getSepaMandateData(String sepaCode) { SepaMandateData sepaMandateData = null; Optional<PaymentModeModel> sepaPaymentMode = wirecardPaymentConfigurationService.getAllAllowedPaymentModes() .stream() .filter(p -> p.getCode().equals(sepaCode)) .findAny(); if (sepaPaymentMode.isPresent()) { WirecardPaymentConfigurationModel configuration = wirecardPaymentConfigurationService.getConfiguration(sepaPaymentMode.get()); if (configuration != null) { sepaMandateData = new SepaMandateData(); sepaMandateData.setCreditorId(configuration.getAuthentication().getCreditorId()); sepaMandateData.setCreditorName(configuration.getAuthentication().getCreditorName()); sepaMandateData.setStoreCity(configuration.getAuthentication().getStoreCity()); } } return sepaMandateData; }  @Override List<PaymentModeData> getActivePaymentModes(); PaymentModeData getActiveCreditCardPaymentMode(List<PaymentModeData> paymentModeData, String alias); @Override boolean isPurchase(String paymentMethodChosen); @Override WirecardRequestData getSeamlessFormData(AbstractOrderModel abstractOrderModel,
                                                   TransactionType transactionType,
                                                   PaymentMethodName paymentMethodName, PaymentModeModel paymentModeModel); @Override SepaMandateData getSepaMandateData(String sepaCode); @Override boolean isPaymentMethodActive(String paymentMethodChosen); @Override boolean isPaymentMethodChooseInactive(String paymentMethodChosen); @Required void setI18NService(I18NService i18NService); @Required void setPaymentModeConverter(Converter<PaymentModeModel, PaymentModeData> paymentModeConverter); @Required void setWirecardPaymentModeService(WirecardPaymentModeService wirecardPaymentModeService); @Required void setWirecardPaymentConfigurationService(WirecardPaymentConfigurationService wirecardPaymentConfigurationService); @Required void setWirecardSignatureStrategy(WirecardSignatureStrategy wirecardSignatureStrategy);  }