r97349 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97348‎ | r97349 | r97350 >
Date:23:25, 16 September 2011
Author:khorn
Status:ok (Comments)
Tags:fundraising 
Comment:
Saves donor information to the session so we can save it after their successful conversion.
Modified paths:
  • /branches/fundraising/extensions/DonationInterface/gateway_common/DonationData.php (modified) (history)
  • /branches/fundraising/extensions/DonationInterface/gateway_common/gateway.adapter.php (modified) (history)
  • /branches/fundraising/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php (modified) (history)
  • /branches/fundraising/extensions/DonationInterface/globalcollect_gateway/globalcollect_resultswitcher.body.php (modified) (history)

Diff [purge]

Index: branches/fundraising/extensions/DonationInterface/globalcollect_gateway/globalcollect_resultswitcher.body.php
@@ -97,6 +97,15 @@
9898 } else {
9999 $wgOut->addHTML( "Empty Results" );
100100 }
 101+ if (array_key_exists('Donor', $_SESSION)){
 102+ $wgOut->addHTML("Session Donor Vars:<ul>");
 103+ foreach ($_SESSION['Donor'] as $key=>$val){
 104+ $wgOut->addHTML( "<li>$key: $val" );
 105+ }
 106+ $wgOut->addHTML("</ul>");
 107+ } else {
 108+ $wgOut->addHTML("No Session Donor Vars:<ul>");
 109+ }
101110 }
102111
103112 /**
Index: branches/fundraising/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php
@@ -115,6 +115,7 @@
116116 } else { // The submitted form data is valid, so process it
117117 // allow any external validators to have their way with the data
118118 $result = $this->adapter->do_transaction( 'INSERT_ORDERWITHPAYMENT' );
 119+ $this->adapter->addDonorDataToSession();
119120 //$result = $this->adapter->do_transaction( 'TEST_CONNECTION' );
120121
121122 $this->displayResultsForDebug($result);
@@ -227,6 +228,15 @@
228229 } else {
229230 $wgOut->addHTML("Empty Results");
230231 }
 232+ if (array_key_exists('Donor', $_SESSION)){
 233+ $wgOut->addHTML("Session Donor Vars:<ul>");
 234+ foreach ($_SESSION['Donor'] as $key=>$val){
 235+ $wgOut->addHTML( "<li>$key: $val" );
 236+ }
 237+ $wgOut->addHTML("</ul>");
 238+ } else {
 239+ $wgOut->addHTML("No Session Donor Vars:<ul>");
 240+ }
231241 }
232242
233243 /**
Index: branches/fundraising/extensions/DonationInterface/gateway_common/gateway.adapter.php
@@ -619,5 +619,9 @@
620620 //if we walk straight off the end...
621621 return null;
622622 }
 623+
 624+ function addDonorDataToSession(){
 625+ $this->dataObj->addDonorDataToSession();
 626+ }
623627
624628 }
Index: branches/fundraising/extensions/DonationInterface/gateway_common/DonationData.php
@@ -651,6 +651,28 @@
652652 $db->update( 'contribution_tracking', $tracked_contribution, array( 'id' => $this->getVal( 'contribution_tracking_id' ) ) );
653653 }
654654 }
 655+
 656+ public function addDonorDataToSession(){
 657+ self::ensureSession();
 658+ $donordata = array(
 659+ 'email',
 660+ 'fname',
 661+ 'mname',
 662+ 'lname',
 663+ 'street',
 664+ 'city',
 665+ 'state',
 666+ 'zip',
 667+ 'country',
 668+ );
 669+
 670+ foreach ($donordata as $item){
 671+ if ($this->isSomething($item)){
 672+ $_SESSION['Donor'][$item] = $this->getVal($item);
 673+ }
 674+ }
 675+
 676+ }
655677
656678 }
657679

Comments

#Comment by Khorn (WMF) (talk | contribs)   18:42, 23 September 2011

Please note that this branch is in the middle of a serious refactoring, and is by no means ready to be merged back into trunk. (Latest DonationInterface branch rev at the time of this comment is r97833.)

Status & tagging log