# Installation

# 1. Download Bsmart Plugins

WARNING

  • Be sure to copy the entire bsmart_plugins folder to your project folder.
  • You will need access to the GitHub repository. Send a request to admin if you cannot access the repository.

Open your console/terminal and type in the following:

git clone https://github.com/blazpezdir/bsmart-plugins.git

or visit the project on GitHub and download the repository.

# 2. Failed Orders Setup

REQUIRED ACTION

Failed orders setup is mandatory for this plugin to work correctly

This plugin uses MySQL database storage for saving orders that could not be sent to Eračuni API. Either API is unavailable or there are errors in order data.

Eračuni's API rate limiting is set to 1 request at a time. Database storage solves handling multiple order submissions at the same time to overcome this API rate limit without any orders being undelivered.

# 2.1. Database Table Schema

WARNING

It is expected that you create the table for saving failed orders on your own.

  • download .sql file from THIS link and import the table in your database

  • or create a table schema manually in your database from the instructions below:

Column Column Type
id bigInt, auto_increment, primary
content text
retries int
landing varchar(255)
order_id varchar(255)
country_code varchar(10)
method varchar(100)
created_at timestamp
updated_at timestamp

# 2.2. Database Connection

Configure your database connection in .env file located under bsmart_plugins/src/Bsmart/Eracuni/.env.

DB_HOST=localhost
DB_USERNAME=xxxxxxxxxxx
DB_PASSWORD=xxxxxxxxxx
ERACUNI_DB_NAME=eracuni_database_name
ERACUNI_DB_TABLE=eracuni_table_name

# 2.3. Schedule a CRON job

Last step to setup failed orders handling is to schedule a cron job that will handle resending orders. Set up a cron job for the file located under bsmart_plugins/src/Bsmart/Eracuni/cron/retrySending.php. You can copy this file somewhere else if you wish to. It is advised to keep the frequency of the cron job schedule at every 5 minutes minimum.

# Debugging Failed Orders

Sometimes order data might contain errors and cannot be sent to eračuni API. To handle such situations it is advised that you check the failed orders MySQL table from time to time. The database table contains column retries that keeps count of how many times has sending to eračuni API failed.

If this number is very large you can manually fire the retrySending.php script (via browser on terminal) and it will display errors for each order in failed orders table.

When you find out what the error was, you have 2 options:

  • Edit row data in table to fix the error manually
  • Delete row from table & optionally add additional validation logic into order form to avoid such errors in the future

# 3. Eračuni Account Setup

REQUIRED ACTION

Eračuni account setup is mandatory for this plugin to work correctly

In order to successfully connect to Eračuni API you must provide valid credentials in the .env file located under bsmart_plugins/src/Bsmart/Eracuni/.env.

ERACUNI_USERNAME=xxxxxxxxxxxxxxxxxxx
ERACUNI_PASSWORD=xxxxxxxxxxxxxxxxxxxxxx
ERACUNI_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxx