r75095 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75094‎ | r75095 | r75096 >
Date:18:39, 20 October 2010
Author:nimishg
Status:deferred
Tags:
Comment:
OWA changes in DonationInterface
Modified paths:
  • /branches/fundraising/OWA/DonationInterface/DonationInterface/payflowpro_gateway/forms/Form.php (modified) (history)
  • /branches/fundraising/OWA/DonationInterface/DonationInterface/payflowpro_gateway/owa_get_info.js (modified) (history)
  • /branches/fundraising/OWA/DonationInterface/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php (modified) (history)

Diff [purge]

Index: branches/fundraising/OWA/DonationInterface/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php
@@ -389,7 +389,8 @@
390390 global $wgOut, $wgDonationTestingMode, $wgPayflowGatewayUseHTTPProxy, $wgPayflowGatewayHTTPProxy;
391391
392392 // update contribution tracking
393 - $this->updateContributionTracking( $data );
 393+ // only forced when OWA is defined
 394+ $this->updateContributionTracking( $data, defined(OWA) );
394395
395396 // create payflow query string, include string lengths
396397 $queryArray = array(
@@ -924,6 +925,28 @@
925926 wfSetupSession();
926927 }
927928
 929+ function get_owa_ref_id($ref){
 930+ // Replication lag means sometimes a new event will not exist in the table yet
 931+ $dbw = contributionTrackingConnection();
 932+ $id_num = $dbw->selectField(
 933+ 'contribution_tracking_owa_ref',
 934+ 'id',
 935+ array( 'url' => $ref ),
 936+ __METHOD__
 937+ );
 938+ // Once we're on mysql 5, we can use replace() instead of this selectField --> insert or update hooey
 939+ if ( $id_num === false ) {
 940+ $dbw->insert(
 941+ 'contribution_tracking_owa_ref',
 942+ array( 'url' => (string) $event_name ),
 943+ __METHOD__
 944+ );
 945+ $id_num = $dbw->insertId();
 946+ }
 947+ return $id_num === false ? 0 : $id_num;
 948+ }
 949+
 950+
928951 /**
929952 * Populate the $data array for the credit card form
930953 *
@@ -933,6 +956,11 @@
934957 public function fnGetFormData( $amount, $numAttempt, $token, $order_id ) {
935958 global $wgPayflowGatewayTest, $wgRequest;
936959
 960+ $owa_ref = $wgRequest->getText( 'owa_ref', null);
 961+ if($owa_ref != null && !is_numeric($owa_ref)){
 962+ $owa_ref = $this->get_owa_ref($owa_ref);
 963+ }
 964+
937965 // if we're in testing mode and an action hasn't yet be specified, prepopulate the form
938966 if ( !$wgRequest->getText( 'action', false ) && !$numAttempt && $wgPayflowGatewayTest ) {
939967 // define arrays of cc's and cc #s for random selection
@@ -948,7 +976,7 @@
949977
950978 // randomly select a credit card #
951979 $card_num_index = array_rand( $card_nums[ $cards[ $card_index ]] );
952 -
 980+
953981 $data = array(
954982 'amount' => ( $amount != "0.00" ) ? $amount : "35",
955983 'amountOther' => '',
@@ -1018,6 +1046,8 @@
10191047 'contribution_tracking_id' => $wgRequest->getText( 'contribution_tracking_id' ),
10201048 'data_hash' => $wgRequest->getText( 'data_hash' ),
10211049 'action' => $wgRequest->getText( 'action' ),
 1050+ 'owa_session' => $wgRequest->getText( 'owa_session', null ),
 1051+ 'owa_ref' => $owa_ref,
10221052 );
10231053 }
10241054 return $data;
@@ -1127,6 +1157,9 @@
11281158
11291159 if (!$db) { return true ; }
11301160
 1161+ /*NIMISH*/
 1162+
 1163+
11311164 $tracked_contribution = array(
11321165 'note' => $data['comment'],
11331166 'referrer' => $data['referrer'],
@@ -1136,6 +1169,8 @@
11371170 'utm_campaign' => $data['utm_campaign'],
11381171 'optout' => $optout[ 'optout' ],
11391172 'language' => $data['language'],
 1173+ 'owa_session' => $data['owa_session'],
 1174+ 'owa_ref' => $data['owa_ref'],
11401175 );
11411176
11421177 // Make all empty strings NULL
Index: branches/fundraising/OWA/DonationInterface/DonationInterface/payflowpro_gateway/forms/Form.php
@@ -353,6 +353,8 @@
354354 'contribution_tracking_id' => $this->form_data[ 'contribution_tracking_id' ],
355355 'data_hash' => $this->form_data[ 'data_hash' ],
356356 'action' => $this->form_data[ 'action' ],
 357+ 'owa_session' => $this->form_data[ 'owa_session' ],
 358+ 'owa_ref' => $this->form_data[ 'owa_ref' ],
357359 );
358360 }
359361
Index: branches/fundraising/OWA/DonationInterface/DonationInterface/payflowpro_gateway/owa_get_info.js
@@ -4,14 +4,14 @@
55 var owa_s_ident = "sid%3D%3E";
66 var owaS_start_index = owa_s_val.indexOf(owa_s_ident);
77 //NOTE: This only works as long as sid is the last param in the OWA cookie
8 - if(owaS_start_index >= 0){
9 - var owaSessionID = owa_s_val.substr(owaS_start_index + owa_s_ident.length);
10 - if(document.getElementById("owa_session_id") &&
11 - document.getElementById("owa_pageref") ){ ){
12 - document.getElementById("owa_session_id").value = owaSessionID;
13 - document.getElementById("owa_pageref").value = encode(window.location);
14 - }
15 - }
 8+ if(owaS_start_index >= 0){
 9+ var owaSessionID = owa_s_val.substr(owaS_start_index + owa_s_ident.length);
 10+ if(document.getElementById("owa_session_id") &&
 11+ document.getElementById("owa_pageref")){
 12+ document.getElementById("owa_session").value = owaSessionID;
 13+ document.getElementById("owa_ref").value = encode(window.location);
 14+ }
 15+ }
1616 }
1717 };
1818

Status & tagging log