One of the most challenging tasks when in a work environment is to unite two departments that handle similar tasks. For this project we are referring to the logistics department along with our online presence such as our E-Commerce store as well as the IT department.
As an example we can examine what needed to be done when product prices had to be changed in bulk. At first the logistics department had to calculate the available stock quantities and then in conjunction with an accounting supervisor calculate the new prices. These prices were then added to lists that were forwarded to the IT department for further processing and finally manually updated in the e-commerce store.
This task is time consuming for both departments and lengthy both on paper as well as in real life especially if the product count was high. A solution had to be created in order to increase productivity and reduce the time spent on single tasks.
A big plus for the implementation of this task is that the ERP application at the organization is able handle scripts that can be programmed directly into its general logic. Using this advantage we created a bridge that helped connect the logistics department with the online store directly. The system also had support for handling SOAP requests which helped us implement this task both ways, like introducing changes from the ERP application directly to the online store and vise versa.
The E-Commerce store was developed on the Woocommerce platform which is an open source plugin used in the WordPress CMS to transform a regular blog to a full fledged online store. Woocommerce has a built-in REST API which allows us to implement a variety of tasks like updating product variables, view and update customer information, and much more.
In order for the ERP application to communicate directly with the E-Commerce store an application had to be created in order to utilize the organizations needs. This was achieved by coding the required applications, as well as the ERP request handling, in the .NET programming language.
Some of the core aspects needed were:
- Updating products (prices, SKUs, description, stock quantities, etc.)
- Viewing and updating customer information
- Order processing
- Parcel tracking
Before starting with all the application brainstorming we had to first configure the Woocommerce REST API properly, check its reliability and see if it matches the organizations needs. After initial setup and testing we then had to insure the implementation is secure and any third party access is prohibited. A wide range of techniques were used for security such as an HTTPS connection, rate and IP limiting, brute force protection, authentication, etc. Also a pseudo-user was created to handle read and write permissions as well as insure that the application scope was limited only to the variables needed for the implementation. We are then ready to test if the API works properly.
curl -X PUT https://example.com/wp-json/wc/v3/products/794 \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
After thorough testing and once we are certain that the API works properly for both reading and writing variables we can then start with the main application development.
Every application on the planet how matter how free, open-source, or like some vendors like to call them, “unlock” there are always limitations in place that don’t match every organizations needs. The tricky part was that even though the ERP application was based on .NET, the code functionality that we could introduce was fairly limited. Because the scope of variables needed to implement was fairly big we opted to go for a man-in-the-middle application (referred to as “main application” from now on) as a result.
On the ERP application the processing level was fairly limited. Several listener modules were created that would check whether the end user was saving or requesting data from the server. All this information was then divided into variables which are fed to the main application.
Once the main application receives these variables it analyses the content in order to the determine the users’ needs, further process it and provide with the required result.
After this procedure the application then forwards the request to the Woocommerce REST API which process it and responds appropriately.
The code above is a very small snippet of how the finalized application works along with several other aspects like updating orders, error correction, exception handling and response handling. A “sidekick” to the main application had to also be created in order to log requests and responses to and from the REST API. This helped the non-tech savvy staff understand the servers’ response and act appropriately based on feedback.
The full implementation contains more that 4000 lines of code which consist of the modules mentioned above. Several information regarding the implementation were omitted for security and proprietary reasons.
This project helped the logistics department tackle every day tasks more easily without having to forward them to the IT department for further implementation and correction. As an organization grows these kind of everyday tasks can be time consuming and using this method we were able to increase productivity and reduce working double time, that had to be previously done in order to achieve something as simple as updating a product’s price.