|   |   | 
| Line 7: | Line 7: | 
|  |  |  |  | 
|  | In the long run, it may make sense for these two functions (managing subscriptions and handling PayPal IPN) to be split into separate modules. |  | In the long run, it may make sense for these two functions (managing subscriptions and handling PayPal IPN) to be split into separate modules. | 
|  | + | ===Pages=== | 
|  | + | * [[/tables]]: data design, including SQL to create tables | 
|  | + | * [[/code]]: PHP code of the extension | 
|  | ==Status== |  | ==Status== | 
| − | This extension is currently under development. Code will beposted here when it works. | + | This extension is in alpha: some hand-coding will probably be needed in order to work with your installation, and steps necessary for configuration have not yet been documented. | 
|  | ===Functionality=== |  | ===Functionality=== | 
| − | * TO DO: record new subscriptions (sent via [[PayPal/IPN|IPN]])  | + | * TO DO: allow admins more fine-grained control of subscription expiration (change the date rather than just extend to today plus one year) | 
| − | ** TO DO: function to create/extend subscriptions when IPN received
 | + | * TO DO: show logs & related info for selected subscriber | 
| − | ** TO DO: add user into "subscribers" group when payment received
 |  | 
| − | * TO DO: track subscription status (expiration)
 |  | 
| − | ** TO DO: detect when user's account has expired
 |  | 
| − | ** TO DO: remove user from "subscribers" group on expiration
 |  | 
| − | ** display subscription status for admins
 |  | 
| − | ** allow adminsto modify subscriptionstatus (changeexpiration, add new subscription)
 |  | 
| − | *** currently, subscriptions can only be extended tonow plus one year; TO DO:subscription deletion (soon)
 |  | 
|  | ===History=== |  | ===History=== | 
|  | * '''2009-02-15''' ssub_post, ssub_post_line tables designed |  | * '''2009-02-15''' ssub_post, ssub_post_line tables designed | 
| − | ==Data Design==
 | + | * '''2009-04-03''' working alpha code finally posted, but there are a lot of rough edges | 
| − | ===ssub_paymts===
 |  | 
| − | * '''Purpose''': Log of payments received
 |  | 
| − | * '''Fields''':
 |  | 
| − | ** '''IDS_Trx''': transaction ID assigned by processing service
 |  | 
| − | *** i.e. at present, txn_id from PayPal
 |  | 
| − | * '''History''':
 |  | 
| − | ** '''2009-02-23''' Added IDS_Trx field
 |  | 
| − | ** '''2009-02-26''' Added isTest field - same as ssub_post.isTest
 |  | 
| − | <section begin=sql /><mysql>CREATE TABLE `ssub_paymts` (
 |  | 
| − |     ID       INT          NOT NULL AUTO_INCREMENT,
 |  | 
| − |     ID_User  INT          NOT NULL COMMENT "user.user_id of user making the payment",
 |  | 
| − |     WhenRecd DATETIME     NOT NULL COMMENT "when the payment was received",
 |  | 
| − |     AmtRecd  DECIMAL(9,2) NOT NULL COMMENT "dollar amount received",
 |  | 
| − |     IDS_Trx  VARCHAR(63)  NOT NULL COMMENT "transaction ID from processing service",
 |  | 
| − |     isTest   BOOL         DEFAULT NULL COMMENT "TRUE = test transaction (sandbox), not a real payment",
 |  | 
| − |   PRIMARY KEY(`ID`)
 |  | 
| − | )
 |  | 
| − | ENGINE = MYISAM;</mysql>
 |  | 
| − | <section end=sql />
 |  | 
| − |   |  | 
| − | ===ssub_subscrs===
 |  | 
| − | Subscription status
 |  | 
| − | <section begin=sql /><mysql>CREATE TABLE `ssub_subscrs` (
 |  | 
| − |    ID_User  INT          NOT NULL COMMENT "user.user_id of user making the payment",
 |  | 
| − |    WhenExp  DATETIME     NOT NULL COMMENT "when the subscription expires",
 |  | 
| − |   PRIMARY KEY(`ID_User`)
 |  | 
| − | )
 |  | 
| − | ENGINE = MYISAM;</mysql>
 |  | 
| − | <section end=sql />
 |  | 
| − | ===ssub_post===
 |  | 
| − | * '''Purpose''': Http POSTs received by this extension -- partly for debugging, and partly as a fallback in case of technical problems or data loss
 |  | 
| − | * '''History''':
 |  | 
| − | ** '''2009-02-15''' Created
 |  | 
| − | ** '''2009-02-22'''WhenRepl,isOkay fields
 |  | 
| − | ** '''2009-02-26''' isTest field
 |  | 
| − | * '''Fields''':
 |  | 
| − | ** '''ConfText''' should be status text from PayPal - "VERIFIED" or "INVALID" - unless WhenRepl is NULL, in which case it is the http error message
 |  | 
| − | ** '''isTest''' flags whether the post was from a[[PayPal Sandbox]] transaction (TRUE) or a regular transaction (FALSE), as determined by the test_ipn field in the POST data
 |  | 
| − | <section begin=sql /><mysql>CREATE TABLE `ssub_post` (
 |  | 
| − |    ID       INT          NOT NULL AUTO_INCREMENT,
 |  | 
| − |    RmtAddr  VARCHAR(15)  NOT NULL COMMENT "IP address of POST sender",
 |  | 
| − |    WhenRecd DATETIME     NOT NULL COMMENT "when the POST was received",
 |  | 
| − |    WhenConf DATETIME     DEFAULT NULL COMMENT "when a confirmation was sent back, if any",
 |  | 
| − |    WhenRepl DATETIME     DEFAULT NULL COMMENT "when a reply to the confirmation was received, if any",
 |  | 
| − |    isOkay   BOOL         DEFAULT NULL COMMENT "FALSE = reply was not received",
 |  | 
| − |    isTest   BOOL         DEFAULT NULL COMMENT "TRUE = sandbox transaction, for testing",
 |  | 
| − |    ConfText VARCHAR(255) DEFAULT NULL COMMENT "contents retrieved by the confirmation",
 |  | 
| − |   PRIMARY KEY(`ID`)
 |  | 
| − | )
 |  | 
| − | ENGINE = MYISAM;</mysql>
 |  | 
| − | <section end=sql />
 |  | 
| − |   |  | 
| − | ===ssub_post_line===
 |  | 
| − | * '''Purpose''': Data received via POST - child of ssub_post
 |  | 
| − | * '''History''':
 |  | 
| − | ** '''2009-02-15''' Created
 |  | 
| − | <section begin=sql /><mysql>CREATE TABLE `ssub_post_line` (
 |  | 
| − |    ID_Post       INT          NOT NULL COMMENT "ssub_post.ID",
 |  | 
| − |    DataKey       VARCHAR(255) NOT NULL COMMENT "name ofdata item",
 |  | 
| − |    DataVal       VARCHAR(255) NOT NULL COMMENT "value of data item",
 |  | 
| − |   PRIMARY KEY(`ID_Post`,`DataKey`)
 |  | 
| − | )
 |  | 
| − | ENGINE = MYISAM;</mysql>
 |  | 
| − | <section end=sql />
 |  | 
Overview
Special:SiteSubscribe is a MediaWiki extension to provide functions for managing paid subscriptions to a wiki site. The preliminary version supports PayPal and manual adjustment by site admins, but other payment methods could be added.
The access-restriction is being accomplished by a combination of MediaWiki site settings and W3TPL, and is very flexible.
Necessity
MediaWiki extensions currently available for interacting with PayPal seem to be limited to displaying static PayPal buttons, which can also be done using W3TPL and other extensions capable of displaying linked external images. This extension makes it possible to receive and process Instant Payment Notifications from PayPal.
In the long run, it may make sense for these two functions (managing subscriptions and handling PayPal IPN) to be split into separate modules.
Pages
- /tables: data design, including SQL to create tables
- /code: PHP code of the extension
Status
This extension is in alpha: some hand-coding will probably be needed in order to work with your installation, and steps necessary for configuration have not yet been documented.
Functionality
- TO DO: allow admins more fine-grained control of subscription expiration (change the date rather than just extend to today plus one year)
- TO DO: show logs & related info for selected subscriber
History
- 2009-02-15 ssub_post, ssub_post_line tables designed
- 2009-04-03 working alpha code finally posted, but there are a lot of rough edges