Magento 1 integration
The Magento 1 site synced Orders and Customers from the Magento database and into the Sage 200 database. This was done using CSV exports and some custom code on the Sage end to manipulate data into a format that Sage could then import. There were issues with how this process functioned and the order/customer sync would regularly fail and require manual intervention.
Magento 2 legacy integration
For the launch of the site, it was decided to replicate the existing Magento 1 order and customer sync as closely as possible. This was to ensure that there were fewer points of failure on the launch of the Magento 2 site. Post launch we would revisit switching over to an API sync and disable the CSV based sync.
Magento 2 API integration
The client’s Sage 200 database is provided by a third party. They provide the ability to import data into their system via a CSV. At the time of the build they were in the process of building an API collection that could be used to push and pull data to/from the Sage 200 database, so this meant the API integration would not be available for the site launch; however we were able to progress this in anticipation of adding the API integration shortly afterwards.
Using these endpoints the following functionality was scoped:
Push Customers to Sage 200
Push Orders to Sage 200
Pull Stock from Sage 200
The Sage 200 API is similar to others at a high level in that all the expected endpoints exist for pushing, pulling or querying different entities in the Sage database. But at a low level it differs in its structure, i.e. the specific format of the payloads which must pass validation to be processed.
The API integration is entirely one sided in terms of pushing data into Sage. Meaning that any push requests sent to Sage 200 would not return a successful response, but instead, the response would indicate that the message had been received and queued. It is Magento’s ‘responsibility’ to periodically check if the previous request had succeeded after it was received.
The Magento integration will also handle the sending of data in the correct order to help fix issues being experienced with the CSV integration. Before an order can be imported into Sage 200, the customer for that order must already exist in the Sage database. The API integration would first query the Sage database using the customer’s email and/or Magento ID to validate if the customer exists in Sage before attempting to sync the order. If no customer exists, it will then send a request to Sage to create one. Only when the customer is verified as existing in Sage will the order request be sent.
Errors in each step of this process are recorded in the admin and sent to select email addresses to help make the client aware of any issues that do arise so they can manually intervene and promptly fix the issue.