4 * @file classes/plugins/PaymethodPlugin.inc.php
6 * Copyright (c) 2006-2007 Gunther Eysenbach, Juan Pablo Alperin, MJ Suhonos
7 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
9 * @class PaymethodPlugin
12 * @brief Abstract class for paymethod plugins
16 import('plugins.Plugin');
18 class PaymethodPlugin
extends Plugin
{
22 function PaymethodPlugin() {
26 * Called as a plugin is registered to the registry. Subclasses over-
27 * riding this method should call the parent method first.
28 * @param $category String Name of category plugin was registered to
29 * @param $path String The path the plugin was found in
30 * @return boolean True iff plugin initialized successfully; if false,
31 * the plugin will not be registered.
33 function register($category, $path) {
34 $success = parent
::register($category, $path);
36 HookRegistry
::register('Template::Manager::Payment::displayPaymentSettingsForm', array(&$this, '_smartyDisplayPaymentSettingsForm'));
42 * Get the name of this plugin. The name must be unique within
43 * its category, and should be suitable for part of a filename
44 * (ie short, no spaces, and no dependencies on cases being unique).
45 * @return String name of plugin
48 return 'PaymethodPlugin';
52 * Get a description of this plugin.
54 function getDescription() {
55 return 'This is the base payment method plugin class. It contains no concrete implementation. Its functions must be overridden by subclasses to provide actual functionality.';
59 * Get the Template path for this plugin.
61 function getTemplatePath() {
62 return parent
::getTemplatePath() . 'templates' . DIRECTORY_SEPARATOR
;
65 function displayPaymentForm($queuedPaymentId, $key, &$queuedPayment) {
66 die('ABSTRACT METHOD');
69 function isConfigured() {
70 return false; // Abstract; should be implemented in subclasses
74 * This is a hook wrapper that is responsible for calling
75 * displayPaymentSettingsForm. Subclasses should override
76 * displayPaymentSettingsForm as necessary.
78 function _smartyDisplayPaymentSettingsForm($hookName, $args) {
83 if (isset($params['plugin']) && $params['plugin'] == $this->getName()) {
84 $output .= $this->displayPaymentSettingsForm($params, $smarty);
89 function displayPaymentSettingsForm(&$params, &$smarty) {
90 return $smarty->fetch($this->getTemplatePath() . 'settingsForm.tpl');
93 function getSettingsFormFieldNames() {
94 return array(); // Subclasses should override
98 * Handle an incoming request from a user callback or an external
99 * payment processing system.
101 function handle($args) {
102 // Subclass should override.
103 Request
::redirect(null, null, 'index');