NHibernate (database connection) configuration
The database access configuration is placed into the hibernate-configuration
section of the API web.config
file. This is the standard NHibernate configuration section with only one property to change – connection.connection_string
. Its value is the connection string for the AtomiaBilling
database.
Here are some examples of this configuration with and without integrated security:
<property name="connection.connection_string"> Server=localhost;Initial Catalog=AtomiaBilling;Integrated Security=True </property>
<property name="connection.connection_string"> Server=localhost;Initial Catalog=AtomiaBilling;user id=atomiabilling;password=********** </property>
Atomia Billing API main configuration
The Atomia Billing API core configuration is placed inside the atomiaBilling
configuration section. It has several attributes and subsections (elements):
- Attributes :
- provisioningPluginName – name of the provisioning plug-in to be used in application.
- invoiceTemplatingPluginName – name of the invoice templating plug-in to be used in application.
- hostingCategoryName – name of the hosting category.
- domainCategoryName – name of the domains category.
- onlyRoleBasedAuthorization – determines whether authorization is performed based on role data only or if operation data should be included too. Can be
true
orfalse
. - permanentCampaignCode – campaign code which will be applied to all orders.
- itemEmailSubjectTemplateNameFormat and itemEmailBodyTemplateNameFormat – formats of template names for subject and body of e-mails sent after provisioning is done
- Elements :
- pdfPrintLocation – used for specifying the root folder on the hard drive for saving printed invoices (PDF files) and its root url used for downloading created files:
<pdfPrintLocation fileRootPath="e:\Program Files\Atomia\Atomia Billing API\PDFs\" urlRootPath="http://billingapi.atomia.com/pdfs/" />
- packageCategoryNames – contains list of categories which are used for package products
<packageCategoryNames> <packageCategoryName name="DNS" /> <packageCategoryName name="Hosting" /> </packageCategoryNames>
- templates – contains templates which will be used for invoices and credit invoices. There should be configured templates of following types:
Default
,FullGraphics
andNoBackground
. They will be used with adequate print options.<templates> <invoicePrintTemplates> <printTemplate key="Default" name="DefaultInvoicePrintTemplate" /> <printTemplate key="FullGraphics" name="FullGraphicsInvoicePrintTemplate" /> <printTemplate key="NoBackground" name="NoBackgroundInvoicePrintTemplate" /> </invoicePrintTemplates> <creditInvoicePrintTemplates> <printTemplate key="Default" name="DefaultCreditInvoiceTemplate" /> <printTemplate key="FullGraphics" name="FullGraphicsCreditInvoiceTemplate" /> <printTemplate key="NoBackground" name="NoBackgroundCreditInvoiceTemplate" /> </creditInvoicePrintTemplates> </templates>
- authorization – contains configuration for checking whether users have permission for requested operations. It contains a list of operation containers (
operationContainers
element), object resolvers (objectResolvers
element) and explicitly allowed users (explicitlyAllowedUsers
element). Operation containers and object resolvers are specified by settingfullClassName
to their fully qualified type name while explicitly allowed users are specified by their names:<authorization> <operationContainers> <operationContainer fullClassName="Atomia.Billing.Core.Sdk.IAtomiaBillingApi, Atomia.Billing.Core.Sdk" /> </operationContainers> <objectResolvers> <objectResolver fullClassName="Atomia.Billing.Core.Sdk.Authorization.AuthorizationHelper, Atomia.Billing.Core.Sdk" /> </objectResolvers> <explicitlyAllowedUsers> <allowedUser name="User one"/> <allowedUser name="User two"/> </explicitlyAllowedUsers> </authorization>
- stateRules – defines possible customer and subscription state transitions.
<stateRules> <state name="OK"> <rules> <rule name="Suspended" /> <rule name="Closed" /> </rules> </state> <state name="Suspended"> <rules> <rule name="Unsuspended" /> <rule name="Closed" /> </rules> </state> <state name="Unsuspended"> <rules> <rule name="OK" /> <rule name="Closed" /> <rule name="Suspended" /> </rules> </state> </stateRules>
- subscribtionProvisioningProcess – defines configuration of subscription provisioning processes. The
subscribtionProvisioningProcess
configuration section contains attributes and elements which specify the maximum number of attempts for provisioning of one item and intervals for those specific attempts. These values are used by the scheduler to determine when items will be provisioned.<subscribtionProvisioningProcess maxAttempts="10"> <attemptsCollection> <attemptDescription attemptCount="2" interval="5"/> <attemptDescription attemptCount="3" interval="10"/> <attemptDescription attemptCount="4" interval="30"/> </attemptsCollection> </subscribtionProvisioningProcess>
- pdfPrintLocation – used for specifying the root folder on the hard drive for saving printed invoices (PDF files) and its root url used for downloading created files:
Here is complete atomiaBilling
configuration section example:
<atomiaBilling xmlns="atomiaBilling" provisioningPluginName="AtomiaProvisioningHosting" invoiceTemplatingPluginName="InvoiceTemplating" referenceNumberPluginName="ReferenceNumberPlugin" hostingCategoryName="Hosting" onlyRoleBasedAuthorization="true"> <packageCategoryNames> <packageCategoryName name="DNS" /> <packageCategoryName name="Hosting" /> </packageCategoryNames> <templates> <invoicePrintTemplates> <printTemplate key="Default" name="DefaultInvoicePrintTemplate" /> <printTemplate key="FullGraphics" name="FullGraphicsInvoicePrintTemplate" /> <printTemplate key="NoBackground" name="NoBackgroundInvoicePrintTemplate" /> </invoicePrintTemplates> <creditInvoicePrintTemplates> <printTemplate key="Default" name="DefaultCreditInvoiceTemplate" /> <printTemplate key="FullGraphics" name="FullGraphicsCreditInvoiceTemplate" /> <printTemplate key="NoBackground" name="NoBackgroundCreditInvoiceTemplate" /> </creditInvoicePrintTemplates> </templates> <authorization> <operationContainers> <operationContainer fullClassName="Atomia.Billing.Core.Sdk.IAtomiaBillingApi, Atomia.Billing.Core.Sdk" /> </operationContainers> <objectResolvers> <objectResolver fullClassName="Atomia.Billing.Core.Sdk.Authorization.AuthorizationHelper, Atomia.Billing.Core.Sdk" /> </objectResolvers> <explicitlyAllowedUsers> <allowedUser name="User one" /> <allowedUser name="User two" /> </explicitlyAllowedUsers> </authorization> <pdfPrintLocation fileRootPath="e:\Program Files\Atomia\Atomia Billing API\PDFs\" urlRootPath="http://billingapi.atomia.com/pdfs/" /> <stateRules> <state name="OK"> <rules> <rule name="Suspended" /> <rule name="Closed" /> </rules> </state> <state name="Suspended"> <rules> <rule name="Unsuspended" /> <rule name="Closed" /> </rules> </state> <state name="Unsuspended"> <rules> <rule name="OK" /> <rule name="Closed" /> <rule name="Suspended" /> </rules> </state> </stateRules> <subscribtionProvisioningProcess maxAttempts="10"> <attemptsCollection> <attemptDescription attemptCount="2" interval="5" /> <attemptDescription attemptCount="3" interval="10" /> <attemptDescription attemptCount="4" interval="30" /> </attemptsCollection> </subscribtionProvisioningProcess> </atomiaBilling>
Search property configuration
This configuration is used for searching entities of a defined type and in defined state in specific situations. Currently, it is used for checking whether domain names exist in orders and subscriptions. This search is performed as part of the availability check before registration and transfer of domain names. The onfiguration is defined in the searchPropertyConfiguration
section of web.config. Search object definitions are specified as a list of searchObject elements. It has the following attributes and elements:
- type (attribute) – type of entity to be searched for. List of searched objects include Orders, Order Lines and Subscriptions.
- forSearch (attribute) – type of search where the
searchObject
element is used. Can be DomainCheck and DomainCheckForTransfer. - allowedStates (element) – contains a list of states of defined types to be matched. These states are specified as
state
elements with the attributename
for setting allowed state. - properties (element) – contains a list of properties to be matched. The list of properties is specified with
property
elements with the attributename
for setting the property name.
Example 1
<searchPropertyConfiguration xmlns="publicOrderService"> <objects> <searchObject type="Order" forSearch="DomainCheck"> <allowedStates> <state name="1"/> <state name="3"/> <state name="5"/> </allowedStates> <properties> <property name="DomainName"/> </properties> </searchObject> </objects> </searchPropertyConfiguration>
In this example, search object configuration is defined for search in DomainCheck
method for entity Order
. It filters DomainName
property for orders in state 1, 3 and 5.
Example 2
<searchPropertyConfiguration xmlns="publicOrderService"> <objects> <searchObject type="Subscription" forSearch="DomainCheck"> <allowedStates> <state name="OK"/> </allowedStates> <properties> <property name="DomainName"/> </properties> </searchObject> </objects> </searchPropertyConfiguration>
Like in the previous example, this configuration sets up a search for the DomainCheck
method but for Subscription
entities. It filters subscriptions in state OK with the same properties.
Default e-mail client configuration
In the default configuration, Atomia Billing API uses its implementation of IEmailClient
for sending messages. It should be configured by adding a defaultEmailClientConfig
configuration section to web.config
. It has the following attributes:
- host – hostname of the mail server.
- port – port number for the SMTP service on the mail server.
- username – username for logging into the mail server.
- password – password for logging into the mail server.
- ssl – value indicating whether to use SSL or not (yes or no).
Here is an example of a default e-mail client configuration:
<defaultEmailClientConfig host="smtp.foobar.com" username="foobar" password="******" port="25" ssl="true" xmlns="Atomia.Billing.Core.Sdk.Utils.Email.DefaultEmailClient" />
Reports Configuration
Reports engine in Billing is based on using stored procedures in the database. Because of that, connection string for the database has to be configured, which is done in reportsConfiguration
section:
<reportsConfiguration xmlns="reportsConfiguration" connectionString="Data Source=localhost;Initial Catalog=AtomiaBilling;Integrated Security=True" />
Shop validators configuration
When shops are saved, validation is performed by configured shop validators. List of active validators is configured in Unity section of Atomia Billing API config file. The following figure shops list of predefined validator types and their registration for usage in the code.
<unity> <typeAliases><typeAlias alias="IShopHelper" type="Atomia.Billing.Core.Sdk.BusinessLogic.IShopHelper, Atomia.Billing.Core.Sdk" /> <typeAlias alias="ShopHelper" type="Atomia.Billing.Core.Sdk.BusinessLogic.ShopHelper, Atomia.Billing.Core.Sdk" /> <typeAlias alias="IShopValidator" type="Atomia.Billing.Core.Sdk.BusinessLogic.IShopValidator, Atomia.Billing.Core.Sdk" /> <typeAlias alias="DefaltShopValidator" type="Atomia.Billing.Core.Sdk.BusinessLogic.DefaltShopValidator, Atomia.Billing.Core.Sdk" /> <typeAlias alias="ShopNameValidator" type="Atomia.Billing.Core.Sdk.BusinessLogic.ShopNameValidator, Atomia.Billing.Core.Sdk" /> <typeAlias alias="DefaultCurrencyPricesShopValidator" type="Atomia.Billing.Core.Sdk.BusinessLogic.DefaultCurrencyPricesShopValidator, Atomia.Billing.Core.Sdk" /> <typeAlias alias="PricesShopValidator" type="Atomia.Billing.Core.Sdk.BusinessLogic.PricesShopValidator, Atomia.Billing.Core.Sdk" /> </typeAliases> <containers> <container name="defaultContainer"> <types> <type type="IShopHelper" mapTo="ShopHelper"> <constructor> <param name="shopValidators" value="null" /> </constructor> </type> <type type="IShopValidator" mapTo="DefaltShopValidator" name="DefaltShopValidator"> <constructor> <param name="shopHelper" /> </constructor> </type> <type type="IShopValidator" mapTo="ShopNameValidator" name="ShopNameValidator"> <constructor> <param name="shopHelper" /> </constructor> </type> <type type="IShopValidator" mapTo="DefaultCurrencyPricesShopValidator" name="DefaultCurrencyPricesShopValidator" /> </types> </container> </containers> </unity>
This configuration sets DefaltShopValidator, ShopNameValidator and DefaultCurrencyPricesShopValidator as active shop validators. If another price validator is to be used, last mapping should be changed to reflect that validator type alias (PricesShopValidator).