PaypalDonationExtension

From PeacockWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 22:58, 8 April 2007 (edit)
Trevorp (Talk | contribs)

← Previous diff
Revision as of 23:00, 8 April 2007 (edit)
Trevorp (Talk | contribs)

Next diff →
Line 2: Line 2:
==Details== ==Details==
-*Version 0.0+*Version 0.1
-*Date 5 Apr 2007+*Date 9 Apr 2007
*Tested on MediaWiki 1.7.1, PHP 5.1.6 (apache2handler), MySQL 5.0.24a-Debian_9ubuntu0.1-log *Tested on MediaWiki 1.7.1, PHP 5.1.6 (apache2handler), MySQL 5.0.24a-Debian_9ubuntu0.1-log

Revision as of 23:00, 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

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.

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, 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:

Releases

Todo

  • Interface to allow hiding of ads
  • Donations in other currencies

Full Todo

RoadMap

0.2 No Date

  • Interface to allow hiding of ads
  • Donations in other currencies

Full RoadMap

History

0.1 9 April 2007

  • Ability to make donations
  • Recording of donors details, and receipt
  • API to allow other extensions

Full History

Source Code

Personal tools