I am getting null Section when trying to retreive configuration section. I am trying to do this so I can retreive CallbackUrl from the Netbanx.config like so this.Section.CallbackUrl
Here are my service and configs public class NetbanxPaymentService : AbstractPaymentMethodService, IPaymentWindow
Unable to retreive ConfigurationSection
Hello
I am getting null Section when trying to retreive configuration section. I am trying to do this so I can retreive CallbackUrl from the Netbanx.config like so this.Section.CallbackUrl
Here are my service and configs
public class NetbanxPaymentService : AbstractPaymentMethodService, IPaymentWindow
{
private NetbanxMethodServiceConfigurationSection Section { get; set; }
public NetbanxPaymentService(CommerceConfigurationProvider configProvider) {
Section = configProvider.GetSection<NetbanxMethodServiceConfigurationSection>(); }
Root Web.Config
-------------------------
<sectionGroup name="commerce" type="System.Configuration.ConfigurationSectionGroup">
<section name="netbanxPaymentMethodService" type="NetbanxPayment.Library.NetbanxMethodServiceConfigurationSection, NetbanxPayment" requirePermission="false"/>
and <commerce>
<netbanxPaymentMethodService configSource="umbraco\ucommerce\configuration\payments\Netbanx.config"/>
Custom.config
--------------------
<configuration>
<components>
<component id="DemoStoreWebApi" service="UCommerce.Web.Api.IContainsWebservices, UCommerce.Web.Api" type="UCommerce.RazorStore.Services.AssemblyTag, UCommerce.RazorStore" />
<component id="NetbanxPaymentMethodService" service="NetbanxPayment.Library.NetbanxPaymentService, NetbanxPayment" type="NetbanxPayment.Library.NetbanxPaymentService, NetbanxPayment" />
</components>
</configuration>
Payments\Netbanx.config
--------------------------------------
<?xml version="1.0"?>
<netbanxPaymentMethodService
merchantId="merchant Id"
privateKey="private key"
callbackUrl="http:\\www.test.com"
/>
any help will be appreciated.
Hello Owais,
The call to GetSection<NetbanxMethodServiceConfigurationSection>();
will as default look for a section named "netbanxMethodService". It removes ConfigurationSection and lowercases the first letter.
If you need it to find a section with a different name, use the GetSection method that takes a string.
GetSection<NetbanxMethodServiceConfigurationSection>("netbanxPaymentMethodService"); // Note the additional "Payment".
Kind regards,
Jesper
is working on a reply...