Accessing Payment service configuration from within JAVA code

Renato Dragišić :

At our webshop, there is a need to retrieve some payment method configuration values. On the old ES6.4 based webshop, we used to retrieve payment service configuration values like this:

Iterator<? extends PaymentInstrumentInfo> piis = order.createPaymentInstrumentInfoIterator(); /* order.getPaymentMethod(); */
    PaymentInstrumentInfo pii = piis.next();
    final String isCreditCard = pii.getPaymentService().getConfiguration().getString("CreditCardPayment");
    String pmn = pii.getPaymentService().getID();

In IS7.9 it seems the method getPaymentService() on PaymentInstrumentInfo object is deprecated, but in javadoc there is no explanation of deprecation in comment, it is just marked as deprecated.

How should we retrieve payment method service configuration params in IS7.9?

Bas de Groot :

ISH offers a GetPaymentServiceConfigurationByID pipelet which retrieves the PaymentServiceConfiguration based on the ID and Domain.

The ID and the Domain for the PaymentServiceConfiguration can be found in the following way:

String serviceConfigurationDomain = pii.getServiceConfigurationDomain();
String serviceConfigurationID = pii.getServiceConfigurationID();

Be aware that the getServiceConfigurationDomain method returns a String instead of a Domain. To fetch the actual domain from this String you could use the GetDomainByName pipelet.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=81624&siteId=1