<?php
/**
 * Authorize.net Loader Class
 *
 * Handles plugin link setup for Credit Card and eCheck configuration pages in WooCommerce.
 *
 * @package Authorize_Net_Payments_For_Woocommerce
 * @subpackage Authorize_Net_Payments_For_Woocommerce/admin
 */

if (! defined('ABSPATH')) {
    exit;
}

/**
 * Class Anet_Loader
 *
 * Adds configuration links for Credit Card and eCheck gateways to the WooCommerce plugins page.
 */
class Anet_Loader
{
    /**
     * Adds configuration links to the plugin action links on the plugins page.
     *
     * @param array $links Existing plugin action links.
     * @return array Modified plugin action links with added configuration URLs.
     */
    public function plugin_action_links($links)
    {
        $plugin_links = array(
            '<a href="' . esc_url($this->credit_card_settings_url()) . '">' . __('Configure Credit Card', 'authorize-net-payments-for-woocommerce') . '</a>',
            '<a href="' . esc_url($this->echeck_settings_url()) . '">' . __('Configure eCheck', 'authorize-net-payments-for-woocommerce') . '</a>'
        );
        return array_merge($plugin_links, $links);
    }
    /**
     * Returns the admin URL for the Credit Card gateway settings page.
     *
     * @return string URL to the Credit Card settings.
     */
    public function credit_card_settings_url()
    {
        return admin_url('admin.php?page=wc-settings&tab=checkout&section=anet');
    }
    /**
     * Returns the admin URL for the eCheck gateway settings page.
     *
     * @return string URL to the eCheck settings.
     */
    public function echeck_settings_url()
    {
        return admin_url('admin.php?page=wc-settings&tab=checkout&section=anet_echeck');
    }
}
