Integrating with e-conomic

This article details how to integrate with e-conomic, a widely used Danish accounting program which aims to address all your bookkeeping needs.

An integration with e-conomic involves the following features:

  • Orders placed in Dynamicweb are exported to e-conomic, where you can then handle the billing procedure
  • Products and product groups created in e-conomic can be imported to Dynamicweb

The following e-conomic modules are a prerequisite:

  • Small/Standard agreements
  • Add-on API (integration)

The following Dynamicweb modules are a prerequisite:

  • e-conomic Integration
  • Data Integration

In order for e-conomic to handle orders created in Dynamicweb Ecommerce, you must create two items; one for discounts and one for fees.

First, create two product groups - this is necessary to handle VAT properly. We recommend that you set up the same VAT rules in both e-conomic and Dynamicweb Ecommerce, so your orders and bills align.

First, create the two DW_FEE and DW_DISCOUNT product groups (Figure 2.1):

  • Click Products in the left menu
  • Click Product Groups and then Create Product Group
  • Provide a number and name
  • Choose tax and VAT-free
  • Save
  • Repeat the process for DW_DISCOUNT
Figure 2.1 Creating product groups in e-conomic

Then, create the two Fee and Discount products (Figure 2.2):

  • Click Products in the left menu
  • Click Products and then New Product
  • Select the appropriate product group
  • Provide a number, name, sales price, etc.
Figure 2.2 Creating products in e-conomic

The e-conomic Integration module for Dynamicweb Ecommerce consists of two main features:

  • Export of orders to e-conomic
  • Import of Products Data to Dynamicweb Ecommerce

To set up the Dynamicweb side of the integration:

  • Go to Settings > Integration > e-conomic
  • Click the Use Dynamicweb e-conomic application button – the public and secret token parameters will be auto-filled with data from our e-conomic app (Figure 3.1)
Figure 3.1 Dynamicweb setup
  • Click Authorize to open a new tab in your browser and login to your e-conomic account
  • You will be prompted to add the Dynamicweb app to your agreement – do so (Figure 3.2)
Figure 3.2 Using the Dynamicweb app

After clicking “Add app” you will be redirected back to Dynamicweb and see the generated grant token and connection information (Figure 3.3).

Figure 3.3 Connection Successful

Once the connection is successful, you can configure the Order settings (Figure 4.1) which control how orders are exported from Dynamicweb to e-conomic.

Figure 4.1 Exporting orders

You should:

  • Check Export to e-conomic on complete to activate order exports
  • Provide a prefix for orders from Dynamicweb when they are create in e-conomic
  • Enter the product number for the Fee and Discount products you created earlier

You must select values for the three dropdowns; Invoice Layout, Payment Condition, and Debitor Group.

If exporting an order fails, the error is saved in an XML document in the following path: /Files/Files/Integration/eCommerce/economic/OrderErrors/*.xml. This file contains the information about the failed order and line items as well as the actual error message.

To import products and groups from e-conomic you must do two things:

  • First, select the product groups which you want to import alongside all their products
  • Second, create a data integration job to handle the import

To select the product groups & products you want to import, go to Settings > Integration > e-conomic and check the relevant checkboxes (Figure 6.1).

Figure 6.1 Selecting product groups to import

To actually import the products and groups you just selected, you must create and configure a Data Integration job in Dynamicweb. Read more about Data Integration Module.

For an e-conomic integration:

  • Go to Settings > Integration > Data Integration and select a new activity
  • As the source provider, select the E-conomic provider (Figure 7.1)
  • Select a language and a shop to import to
Figure 7.1 Source provider
  • As the destination provider, select the Dynamicweb Provider and select the same language and shop as on the source provider(Figure 7.2)
Figure 7.2 Destination provider
  • Map the source tables to their relevant targets (Figure 7.3)
Figure 7.3 Mapping the source and destination tables
  • Name the activity (Figure 8.1)
Figure 8.1 Naming the integration job
  • Save and run the activity

After the activity has been successfully run, the products and groups you selected has been imported to the shop and language you selected.

With the following items it is possible to expand the product import as well as modify order, debtor, etc at the order export.

You can implement own ProductImportActivityExtender which allows you to manipulate the products and groups from e-conomic before they are being imported to Dynamicweb.

Here is some example code:

using Economic.Api.Data; namespace Dynamicweb.Ecommerce.Economic.Test { /// <summary> /// Test implementation of the ProductImportActivityExtender /// </summary> public class ProductAddin : Integration.ProductImportActivityExtender { /// <summary> /// Method to do manipulation with the E-conomic Group object before it is imported to Dynamicweb /// </summary> /// <param name="economicProductGroup">E-conomic IProductGroup object that is currently being transfered</param> /// <returns>E-conomic Group object</returns> public override IProductGroupData ProductGroupConverter(IProductGroupData economicProductGroup) { economicProductGroup.Name = $"Custom {economicProductGroup.Name}"; return economicProductGroup; } /// <summary> /// Method to do manipulation with the E-conomic Product object before is is imported to Dynamicweb /// </summary> /// <param name="economicProduct">E-conomic IProduct object that is currently being transfered</param> /// <returns>E-conomic IProduct object</returns> public override IProductData ProductConverter(IProductData economicProduct) { economicProduct.Description = $"Custom {economicProduct.Description}"; return economicProduct; } } }

To extend the order export, can implement own OrderCompleteNotificationExtender and override the methods you want in order to manipulate order objects before they are sent to e-conomic:

  • DynamicwebOrder - to modify Dynamicweb order information
  • EconomicDebitor - to do manipulation with the EconomicDebitor object
  • EconomicOrder - to do manipulation with the EconomicOrder object
  • EconomicOrderLine - to do manipulation with the ordinary EconomicOrderline
  • EconomicDiscountOrderline - to do manipulation with the Discount EconomicOrderline
  • EconomicPaymentFeeOrderline - to do manipulation with the Payment Fee EconomicOrderline
  • EconomicShippingFeeOrderline - to do manipulation with the Shipping Fee EconomicOrderline