<?php

defined('BASEPATH') or exit('No direct script access allowed');

/*
Module Name: Niubiz Pago Link
Description: Niubiz Pago Link gateway for Perfex CRM. Redirects invoice payments to a fixed Niubiz payment link.
Version: 1.0.0
Requires at least: 1.0.*
Author: Novaris
*/

define('NIUBIZ_PAYLINK_GATEWAY_MODULE_NAME', 'niubiz_paylink_gateway');

$CI = &get_instance();

/*
|--------------------------------------------------------------------------
| Activation hook
|--------------------------------------------------------------------------
*/

register_activation_hook(NIUBIZ_PAYLINK_GATEWAY_MODULE_NAME, 'niubiz_paylink_gateway_activation_hook');

function niubiz_paylink_gateway_activation_hook()
{
    require_once(__DIR__ . '/install.php');
}

/*
|--------------------------------------------------------------------------
| Language files
|--------------------------------------------------------------------------
*/

register_language_files(NIUBIZ_PAYLINK_GATEWAY_MODULE_NAME, [NIUBIZ_PAYLINK_GATEWAY_MODULE_NAME]);

/*
|--------------------------------------------------------------------------
| Module action links
|--------------------------------------------------------------------------
*/

hooks()->add_filter('module_niubiz_paylink_gateway_action_links', 'module_niubiz_paylink_gateway_action_links');

function module_niubiz_paylink_gateway_action_links($actions)
{
    $actions[] = '<a href="' . admin_url('settings?group=payment_gateways&tab=online_payments_niubiz_paylink_tab') . '">' . _l('settings') . '</a>';

    return $actions;
}

/*
|--------------------------------------------------------------------------
| Register payment gateway
|--------------------------------------------------------------------------
*/

register_payment_gateway('niubiz_paylink_gateway', 'niubiz_paylink_gateway');