PaypalDonationExtension
From PeacockWiki
Revision as of 23:00, 8 April 2007 (edit) Trevorp (Talk | contribs) ← Previous diff |
Revision as of 23:23, 8 April 2007 (edit) Trevorp (Talk | contribs) (→Installation) Next diff → |
||
Line 107: | Line 107: | ||
require("extensions/paypal/paypal.php"); | require("extensions/paypal/paypal.php"); | ||
- | Modify common.php, setting the email address to make donations to, as well as changing any other options desired. | + | Modify common.php, setting the email address to make donations to, set the paypal URL to use (sandbox or HTTPS), as well as changing any other options desired. |
To check to see if it is installed properly, visit your Version page, eg [[Special:Version]]. | To check to see if it is installed properly, visit your Version page, eg [[Special:Version]]. | ||
Line 116: | Line 116: | ||
*** [http://wiki.peacocktech.com/wiki/PaypalDonationExtension Paypal Donation Extension (version 0.0.1)], Adds a special page allowing users to donate money to the wiki., by [http://about.peacocktech.com/trevorp/ Trevor Ian Peacock] | *** [http://wiki.peacocktech.com/wiki/PaypalDonationExtension Paypal Donation Extension (version 0.0.1)], Adds a special page allowing users to donate money to the wiki., by [http://about.peacocktech.com/trevorp/ Trevor Ian Peacock] | ||
** Extension functions: | ** Extension functions: | ||
- | *** paypalSetup | + | *** paypalSetup |
==Releases== | ==Releases== |
Revision as of 23:23, 8 April 2007
PaypalDonationExtension is an extension for Mediawiki that provides users a form allowing them to make a payment via PayPal.
Contents |
Details
- Version 0.1
- Date 9 Apr 2007
- Tested on MediaWiki 1.7.1, PHP 5.1.6 (apache2handler), MySQL 5.0.24a-Debian_9ubuntu0.1-log
Features
- Allows users to complete a form allowing them to make a payment via PayPal.
- Provides other features through other extensions:
Design
This extension provides support for related extensions. It will automatically load these 'plugins', with no modification of LocalSettings.php required for each plugin.
The interaction between the Extension and plugins is shown:
+--------+ +--------+ +-----------------+ | PayPal | | Donors | | Finance Reports | +--------+ +--------+ +-----------------+ | / / +------+ +--------+ +=====+ +---------+ +=====+ +----------+ | Wiki |---| Donate |----= API =---| Finance |---= API =---| Progress | +------+ +--------+ +=====+ +---------+ +=====+ +----------+ | | +---------------------------------+ | Database | +---------------------------------+
- Donate
- Facilitates paypal donations, and recording of transactions
- Provides an API to allow access to donation info
- Donors
- Public list of donors
- Private list of own contributions
- Finance
- Allows treasurer to enter financial details
- Retrieves data from donations and provides (monthly) reports on financial status
- Provides an API to allow information to be used for status indicators, other reporting engnes etc.
- Finance Reports
- Provides reports of financial details to the public
- Progress
- Adds a progress bar to each page showing how much of this months costs are met.
Files
- paypal.php
- Main file facilitating donations
- common.php
- Common functions used by all plugins
- ipn.php
- script for callback from paypal server
- paypal-api.php
- Functions allowing access to donation data
Database
CREATE TABLE `wiki`.`donations` ( `item_number` int(11) NOT NULL auto_increment, `user_id` text NOT NULL, `request_time` datetime NOT NULL default '0000-00-00 00:00:00', `firstname` text NOT NULL, `lastname` text NOT NULL, `address1` text NOT NULL, `address2` text NOT NULL, `city` text NOT NULL, `state` text NOT NULL, `zip` text NOT NULL, `email` text NOT NULL, `amount` double NOT NULL default '0', `comment` text NOT NULL, `anonymous` tinyint(1) NOT NULL default '0', `validated` tinyint(1) NOT NULL default '0', `ipn_results` longtext NOT NULL, `payment_date` datetime NOT NULL default '0000-00-00 00:00:00', `payment_gross` double NOT NULL default '0', `payer_email` text NOT NULL, `mc_fee` double NOT NULL default '0', `mc_gross` double NOT NULL default '0', `country` text NOT NULL, PRIMARY KEY (`item_number`) ) ENGINE=MyISAM AUTO_INCREMENT=25 DEFAULT CHARSET=latin1;
API
- class paypal_api
- static function donations($number=10, $start=0)
- Retrieves an array of the most recent donations.
- static function myDonations($user)
- Returns an array of all donations made by the specified user.
- static function totalDuring($start, $end)
- Returns the total money received from donations between the dates specified.
- static function donations($number=10, $start=0)
Usage
Example
see Special:Donate
This demo uses the PayPal sandbox. To sucessfully test the product you must register with a paypal developer account, and create a sandbox Business account with the email address tp@pt.com, as well as a personal account for testing.
Installation
copy the four files into extensions/paypal/ (if you choose to change this path you will have to modify paypalCommon::$paypal[notify_url])
Use the sql code above to create a table in the wiki database.
Insert the following line into the end of 'LocalSettings.php' (before the '?>')
require("extensions/paypal/paypal.php");
Modify common.php, setting the email address to make donations to, set the paypal URL to use (sandbox or HTTPS), as well as changing any other options desired.
To check to see if it is installed properly, visit your Version page, eg Special:Version.
You should see the following items:
- Extensions:
- Other:
- Paypal Donation Extension (version 0.0.1), Adds a special page allowing users to donate money to the wiki., by Trevor Ian Peacock
- Extension functions:
- paypalSetup
- Other:
Releases
Todo
- Interface to allow hiding of ads
- Donations in other currencies
RoadMap
0.2 No Date
- Interface to allow hiding of ads
- Donations in other currencies
History
0.1 9 April 2007
- Ability to make donations
- Recording of donors details, and receipt
- API to allow other extensions