use of net.bankid.merchant.library.Communicator in project iaf by ibissource.
the class IdinSender method configure.
@Override
public void configure() throws ConfigurationException {
super.configure();
if (StringUtils.isNotEmpty(getAction()) && !actions.contains(getAction()))
throw new ConfigurationException(getLogPrefix() + "unknown action [" + getAction() + "] supported methods are " + actions.toString() + "");
// Create a new instance and populate it
idinConfig = Configuration.defaultInstance();
if (StringUtils.isNotEmpty(getMerchantID()))
idinConfig.setMerchantID(getMerchantID());
if (getMerchantSubID() > 0)
idinConfig.setMerchantSubID(getMerchantSubID());
if (StringUtils.isNotEmpty(getMerchantReturnUrl()))
idinConfig.setMerchantReturnUrl(getMerchantReturnUrl());
if (StringUtils.isNotEmpty(getAcquirerDirectoryUrl()))
idinConfig.setAcquirerDirectoryURL(getAcquirerDirectoryUrl());
if (StringUtils.isNotEmpty(getAcquirerTransactionUrl()))
idinConfig.setAcquirerTransactionURL(getAcquirerTransactionUrl());
if (StringUtils.isNotEmpty(getAcquirerStatusUrl()))
idinConfig.setAcquirerStatusURL(getAcquirerStatusUrl());
if (StringUtils.isNotEmpty(getKeyStoreLocation())) {
idinConfig.setKeyStoreLocation(getKeyStoreLocation());
if (StringUtils.isNotEmpty(getKeyStorePassword()))
idinConfig.setKeyStorePassword(getKeyStorePassword());
}
if (StringUtils.isNotEmpty(getMerchantCertificateAlias())) {
idinConfig.setMerchantCertificateAlias(getMerchantCertificateAlias());
if (StringUtils.isNotEmpty(getMerchantCertificatePassword()))
idinConfig.setMerchantCertificatePassword(getMerchantCertificatePassword());
}
if (StringUtils.isNotEmpty(getAcquirerCertificateAlias()))
idinConfig.setAcquirerCertificateAlias(getAcquirerCertificateAlias());
if (StringUtils.isNotEmpty(getAcquirerAlternativeCertificateAlias()))
idinConfig.setAcquirerAlternateCertificateAlias(getAcquirerAlternativeCertificateAlias());
if (StringUtils.isNotEmpty(getSAMLCertificateAlias())) {
idinConfig.setSamlCertificateAlias(getSAMLCertificateAlias());
if (StringUtils.isNotEmpty(getSAMLCertificatePassword()))
idinConfig.setSamlCertificatePassword(getSAMLCertificatePassword());
}
if (getLogsEnabled())
idinConfig.setLogsEnabled(getLogsEnabled());
if (getServiceLogsEnabled())
idinConfig.setServiceLogsEnabled(getServiceLogsEnabled());
if (StringUtils.isNotEmpty(getServiceLogsLocation()))
idinConfig.setServiceLogsLocation(getServiceLogsLocation());
if (StringUtils.isNotEmpty(getServiceLogsPattern()))
idinConfig.setServiceLogsPattern(getServiceLogsPattern());
idinConfig.setTls12Enabled(true);
communicator = new Communicator(idinConfig);
}
use of net.bankid.merchant.library.Communicator in project iaf by ibissource.
the class IdinSenderTest method initializeIdinSender.
@Before
public void initializeIdinSender() throws FileNotFoundException, ParserConfigurationException, SAXException, IOException {
URL expectedUrl = ClassUtils.getResourceURL("bankid-config.xml");
Configuration.defaultInstance().Load(expectedUrl.openStream());
Communicator communicator = mock(Communicator.class);
DirectoryResponse response = mock(DirectoryResponse.class);
when(response.getIsError()).thenReturn(false);
// when(response.getIssuers()).thenReturn(new ArrayList<Issuer>());
// when(response.getIssuersByCountry()).thenReturn(new HashMap<String, List<Issuer>>());
when(response.getDirectoryDateTimestamp()).thenReturn(getDateTimestamp());
when(communicator.getDirectory()).thenReturn(response);
sender = spy(new IdinSender());
when(sender.getCommunicator()).thenReturn(communicator);
sender.setAction("DIRECTORY");
}
Aggregations