Plugins

Overview

Plugins are used to send notifications to third-party e.g. SAP upon completion of an order. Currently, every centre can only have one plugin.

Configuration

Plugins are located in plugins folder located in the following path:

coredna_engine/classes/CoreDNA/SalesOrder/plugins

Every new plugin must extend SalesOrderPlugin class. For example:

class NewPlugin extends SalesOrderPlugin
{
 /**
 * Send the request to a third party
 *
 * @param $order_id
 * @return mixed
 */
 public function handle($order_id)
 {
 // TODO: Implement handle() method.
 }
}

Also after adding a new plugin (php file) it will be automatically displayed in Core dna Admin -> Commerce module -> Manage Plugins:

After enabling a plugin, every time an order is placed a notification will be send to a third-party using the the enabled plugin. If the the third-party returns a successful response synced_status will be set to 1 in order table. Otherwise it will be zero and also the error message will be stored in log table.

Cronjob

To sync all the failed transactions, there is a cronjob called cron_prodcatalogueorder_sales_order_sync which picks all the unsynced orders and tries to sync them again. An example of the command to run the cron is as follow:

sudo php /var/virtual/coredna_engine/coreDNA11/cron/cron_prodcatalogueorder_sales_order_sync.php -s /var/virtual/coredna_engine/config/merlin-git/inc.Settings.php -d true

Re-sync an order

You can sync all the orders even those that have already synced using 'Re-sync' button. The sync happens in real-time.