# Gratify Pay Extension of OpenCart

### Running locally

Get your local ip address (something like 192...) - localhost won't work, then:

```shell
export EXTERNAL_IP=<your local ip>
cd docker
docker-compose up
```

Default administration credentials:

- http://<your-private-ip>/admin
- username: gratify
- password: gratify

### Building

```shell
make all
```

### Installing

1. Install Fix OC 3.x Extension Installer (it's in this repo - fixoc3installer.ocmod.zip)
   1. Go to admin page of installer extensions
      ![Admin installing page](./images/opencart_2.png)
   2. Go to Extensions > Modifications and "Refresh" at the top
2. Install gratify_opencart.ocmod.zip

3. Download and install to opencart shop the extension - [Fix OC 3.x Extension Installer](https://www.opencart.com/index.php?route=marketplace/extension/info&extension_id=33410)
   1. Go by [the link](https://www.opencart.com/index.php?route=marketplace/extension/info&extension_id=33410)
      ![Download the extension](./images/opencart_1.png)
   2. Go to admin page of installer extensions
      ![Admin installing page](./images/opencart_2.png)
   3. Enable the extension
      ![Click to install](./images/opencart_3.png)
4. After point 1 need to installing Gratify Pay Open Cart extension
   1. Execute this:
      1. ```shell
         git clone https://github.com/GratifyPay/plugin-opencart.git;
         cd plugin-opencart;
         git checkout *; #to last available version of the plugin
         make all;
         ```
         after that you will see a zip file is named like this: `gratifypay-payment-module.ocmod.zip`
   2. Install the file: `gratifypay-payment-module.ocmod.zip` in Open Cart
      ![Installing Gratify Pay extension](./images/opencart_4.png)
   3. Enabling like Fix OC 3.x
      ![Enabling Gratify Pay](./images/opencart_5.png)
   4. Install to site required dependency:
      1. Add to composer.json:
      ```json
      "repositories": [
            {
               "type": "vcs",
               "url": "https://github.com/GratifyPay/plugin-php-sdk.git"
            }
      ]
      ```
      2. Install gratify-php-sdk:
      ```shell
      composer require gratifypay/plugin-php-sdk:^1.0
      ```
5. Configuration
   1. Go to configuration page Gratify Pay extension
      ![Searching Gratify Pay](./images/opencart_6.png)
      ![](./images/opencart_7.png)
   2. Set up your merchant id, secret api key and other settings
      ![Gratify Pay setting api key](./images/opencart_8.png)
   3. You can configure the settings:
      - Merchant id
      - Secret key
      - Order statuses for successfully processed payment and for failed one
      - Enabled the module
      - And optionally setup sort order id if you want to move the payment option higher level in payment method list

#### Using

After described installation you can use the Open Cart Gratify Pay extension:

1. Category page
   ![Gratify Pay at a category page](./images/opencart_9.png)
2. Product page
   ![Gratify Pay at a product page](./images/opencart_10.png)
3. Cart page
   ![Gratify Pat at a cart page](./images/opencart_11.png)
4. Checkout page
   ![Gratify Pay at a checkout page](./images/opencart_12.png)
