商店间 7.10.- 获取支付配置 [英] Intershop 7.10. - fetching payment configuration

查看:40
本文介绍了商店间 7.10.- 获取支付配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们想从 Java 类(OrderBO 扩展)中的 Order 中获取支付配置.到目前为止,我们已经设法像这样获取服务:

We would like to fetch the payment configuration from Order in Java class (OrderBO extension). So far we have managed to fetch the service like this:

final OrderBOPaymentExtension<OrderBO> paymentExtension = getExtendedObject().getExtension(OrderBOPaymentExtension.EXTENSION_ID);

final PaymentBO paymentBO = paymentExtension.getPaymentBOs().stream().findFirst().orElse(null);

PaymentServiceBO paymentServiceBO = paymentBO.getPaymentServiceBO();

现在我们需要获取配置,所以我们可以从支付方式中读取某些配置参数.最好的方法是什么?

Now we need to fetch the configuration, so we can read certain configuration parameters from the payment method. What is the best way to do that?

我们知道可以像这样通过 PO Factory 获取付款配置:

We know it is possible to fetch the payment configuration through the PO Factory like this:

PaymentConfigurationPOFactory f = (PaymentConfigurationPOFactory)NamingMgr.getInstance().lookupFactory(PaymentConfigurationPO.class);
PaymentConfigurationPO r = f.getConfigForIDAndDomain(iD, domain);

但我们希望避免使用已弃用的代码.

But we would like to avoid using deprecated code.

更新:我们试图实现的是在 Java 代码中访问这些 BO 参数:

UPDATE: What we are trying to achieve is access these BO parameters in Java code:

推荐答案

我建议你编写一个 PaymentServiceBO 扩展.在该扩展中,您可以编写 getter 方法来查询某些配置值.访问服务配置对象的java代码为:

I'd suggest you write a PaymentServiceBO extension. Within that extension you can write getter methods to query for certain config values. The java code for accessing service configuration object is:

PaymentConfiguration paymentConfig = paymentServiceBO.getExtension(PersistentObjectBOExtension.class).getPersistentObject();
ServiceConfigurationBO serviceConfigurationBO = repository.getServiceConfigurationBOByID(paymentConfig.getManagedServiceConfiguration().getUUID());
ConfigurationProvider configProviderExtension = serviceConfigurationBO.getExtension(ConfigurationProvider.class);
Configuration configuration = configProviderExtension.getConfiguration();
Logger.debug(this, "payment service config keys = {}", configuration.getKeys());

这篇关于商店间 7.10.- 获取支付配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆