r78106 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78105‎ | r78106 | r78107 >
Date:23:36, 8 December 2010
Author:awjrichards
Status:deferred
Tags:
Comment:
Made some of the values for posting to PayPal configurable
Modified paths:
  • /trunk/extensions/ContributionTracking/ContributionTracking.php (modified) (history)
  • /trunk/extensions/ContributionTracking/ContributionTracking_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ContributionTracking/ContributionTracking_body.php
@@ -7,7 +7,7 @@
88
99 function get_owa_ref_id($ref){
1010 // Replication lag means sometimes a new event will not exist in the table yet
11 - $dbw = wfGetDB( DB_MASTER );
 11+ $dbw = contributionTrackingConnection(); //wfGetDB( DB_MASTER );
1212 $id_num = $dbw->selectField(
1313 'contribution_tracking_owa_ref',
1414 'id',
@@ -28,7 +28,8 @@
2929
3030
3131 function execute( $language ) {
32 - global $wgRequest, $wgOut;
 32+ global $wgRequest, $wgOut, $wgContributionTrackingPayPalIPN, $wgContributionTrackingReturnToURLDefault,
 33+ $wgContributionTrackingPayPalRecurringIPN, $wgContributionTrackingPayPalBusiness;
3334
3435 if ( !preg_match( '/^[a-z-]+$/', $language ) ) {
3536 $language = 'en';
@@ -84,7 +85,7 @@
8586 if( $returnTitle ) {
8687 $returnto = $returnTitle->getFullUrl();
8788 } else {
88 - $returnto = "http://wikimediafoundation.org/wiki/Thank_You/$language";
 89+ $returnto = $wgContributionTrackingReturnToURLDefault . "/$language";
8990 }
9091
9192 // Set the action and tracking ID fields
@@ -92,6 +93,7 @@
9394 $action = 'http://wikimediafoundation.org/';
9495 $amount_field_name = 'amount'; // the amount fieldname may be different depending on the service
9596 if ( $gateway == 'paypal' ) {
 97+
9698 $action = 'https://www.paypal.com/cgi-bin/webscr';
9799
98100 // Premiums
@@ -102,7 +104,7 @@
103105 }
104106
105107 // PayPal
106 - $repost['business'] = 'donations@wikimedia.org';
 108+ $repost['business'] = $wgContributionTrackingPayPalBusiness;
107109 $repost['item_name'] = 'One-time donation';
108110 $repost['item_number'] = 'DONATE';
109111 $repost['no_note'] = '0';
@@ -123,9 +125,10 @@
124126 $repost[ 'sra' ] = '1'; // Turn on re-attempt on failure
125127 $repost[ 'cmd' ] = '_xclick-subscriptions';
126128 $amount_field_name = 'a3';
 129+ $repost['notify_url'] = $wgContributionTrackingPayPalRecurringIPN;
127130 } else {
128131 $repost['cmd'] = '_xclick';
129 - $repost['notify_url'] = 'https://civicrm.wikimedia.org/fundcore_gateway/paypal';
 132+ $repost['notify_url'] = $wgContributionTrackingPayPalIPN;
130133 }
131134 }
132135 else if ( $gateway == 'moneybookers' ) {
Index: trunk/extensions/ContributionTracking/ContributionTracking.php
@@ -26,11 +26,33 @@
2727 //this only works if contribution tracking is inside a mediawiki DB, which typically it isn't.
2828 //$wgHooks['LoadExtensionSchemaUpdates'][] = 'efContributionTrackingLoadUpdates';
2929
 30+/**
 31+ * The default 'return to' URL for a thank you page after posting to the contribution
 32+ *
 33+ * NO trailing slash, please
 34+ */
 35+$wgContributionTrackingReturnToURLDefault = 'http://wikimediafoundation.org/wiki/Thank_You';
 36+
3037 $wgContributionTrackingDBserver = $wgDBserver;
3138 $wgContributionTrackingDBname = $wgDBname;
3239 $wgContributionTrackingDBuser = $wgDBuser;
3340 $wgContributionTrackingDBpassword = $wgDBpassword;
3441
 42+/**
 43+ * IPN listener address for regular PayPal trxns
 44+ */
 45+$wgContributionTrackingPayPalIPN = 'https://civicrm.wikimedia.org/fundcore_gateway/paypal';
 46+
 47+/**
 48+ * IPN listener address for recurring payment PayPal trxns
 49+ */
 50+$wgContributionTrackingPayPalRecurringIPN = 'https://civicrm.wikimedia.org/fundcore_gateway/paypal';
 51+
 52+/**
 53+ * 'Business' string for PayPal
 54+ */
 55+$wgContributionTrackingPayPalBusiness = 'donations@wikimedia.org';
 56+
3557 function efContributionTrackingLoadUpdates(){
3658 global $wgExtNewTables, $wgExtNewFields;
3759 $dir = dirname( __FILE__ ) . '/';

Status & tagging log