File "BasePaymentMethod.php"

Full Path: /home/romayxjt/public_html/wp-content/plugins/fluentform/app/Modules/Payments/PaymentMethods/BasePaymentMethod.php
File size: 842 bytes
MIME-type: text/x-php
Charset: utf-8

<?php

namespace FluentForm\App\Modules\Payments\PaymentMethods;

if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly.
}

abstract class BasePaymentMethod
{
    protected $key = '';

    protected $settingsKey = '';

    public function __construct($key)
    {
        $this->key = $key;
        $this->settingsKey = 'fluentform_payment_settings_'.$key;

        add_filter('fluentform/payment_methods_global_settings', function ($methods) {
            $fields = $this->getGlobalFields();
            if($fields) {
                $methods[$this->key] = $fields;
            }
            return $methods;
        });
        add_filter('fluentform/payment_settings_' . $this->key, array($this, 'getGlobalSettings'));
    }

    abstract public function getGlobalFields();

    abstract public function getGlobalSettings();

}