Index: branches/fundraising/OWA/DonationInterface/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php |
— | — | @@ -389,7 +389,8 @@ |
390 | 390 | global $wgOut, $wgDonationTestingMode, $wgPayflowGatewayUseHTTPProxy, $wgPayflowGatewayHTTPProxy; |
391 | 391 | |
392 | 392 | // update contribution tracking |
393 | | - $this->updateContributionTracking( $data ); |
| 393 | + // only forced when OWA is defined |
| 394 | + $this->updateContributionTracking( $data, defined(OWA) ); |
394 | 395 | |
395 | 396 | // create payflow query string, include string lengths |
396 | 397 | $queryArray = array( |
— | — | @@ -924,6 +925,28 @@ |
925 | 926 | wfSetupSession(); |
926 | 927 | } |
927 | 928 | |
| 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 | + |
928 | 951 | /** |
929 | 952 | * Populate the $data array for the credit card form |
930 | 953 | * |
— | — | @@ -933,6 +956,11 @@ |
934 | 957 | public function fnGetFormData( $amount, $numAttempt, $token, $order_id ) { |
935 | 958 | global $wgPayflowGatewayTest, $wgRequest; |
936 | 959 | |
| 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 | + |
937 | 965 | // if we're in testing mode and an action hasn't yet be specified, prepopulate the form |
938 | 966 | if ( !$wgRequest->getText( 'action', false ) && !$numAttempt && $wgPayflowGatewayTest ) { |
939 | 967 | // define arrays of cc's and cc #s for random selection |
— | — | @@ -948,7 +976,7 @@ |
949 | 977 | |
950 | 978 | // randomly select a credit card # |
951 | 979 | $card_num_index = array_rand( $card_nums[ $cards[ $card_index ]] ); |
952 | | - |
| 980 | + |
953 | 981 | $data = array( |
954 | 982 | 'amount' => ( $amount != "0.00" ) ? $amount : "35", |
955 | 983 | 'amountOther' => '', |
— | — | @@ -1018,6 +1046,8 @@ |
1019 | 1047 | 'contribution_tracking_id' => $wgRequest->getText( 'contribution_tracking_id' ), |
1020 | 1048 | 'data_hash' => $wgRequest->getText( 'data_hash' ), |
1021 | 1049 | 'action' => $wgRequest->getText( 'action' ), |
| 1050 | + 'owa_session' => $wgRequest->getText( 'owa_session', null ), |
| 1051 | + 'owa_ref' => $owa_ref, |
1022 | 1052 | ); |
1023 | 1053 | } |
1024 | 1054 | return $data; |
— | — | @@ -1127,6 +1157,9 @@ |
1128 | 1158 | |
1129 | 1159 | if (!$db) { return true ; } |
1130 | 1160 | |
| 1161 | + /*NIMISH*/ |
| 1162 | + |
| 1163 | + |
1131 | 1164 | $tracked_contribution = array( |
1132 | 1165 | 'note' => $data['comment'], |
1133 | 1166 | 'referrer' => $data['referrer'], |
— | — | @@ -1136,6 +1169,8 @@ |
1137 | 1170 | 'utm_campaign' => $data['utm_campaign'], |
1138 | 1171 | 'optout' => $optout[ 'optout' ], |
1139 | 1172 | 'language' => $data['language'], |
| 1173 | + 'owa_session' => $data['owa_session'], |
| 1174 | + 'owa_ref' => $data['owa_ref'], |
1140 | 1175 | ); |
1141 | 1176 | |
1142 | 1177 | // Make all empty strings NULL |
Index: branches/fundraising/OWA/DonationInterface/DonationInterface/payflowpro_gateway/forms/Form.php |
— | — | @@ -353,6 +353,8 @@ |
354 | 354 | 'contribution_tracking_id' => $this->form_data[ 'contribution_tracking_id' ], |
355 | 355 | 'data_hash' => $this->form_data[ 'data_hash' ], |
356 | 356 | 'action' => $this->form_data[ 'action' ], |
| 357 | + 'owa_session' => $this->form_data[ 'owa_session' ], |
| 358 | + 'owa_ref' => $this->form_data[ 'owa_ref' ], |
357 | 359 | ); |
358 | 360 | } |
359 | 361 | |
Index: branches/fundraising/OWA/DonationInterface/DonationInterface/payflowpro_gateway/owa_get_info.js |
— | — | @@ -4,14 +4,14 @@ |
5 | 5 | var owa_s_ident = "sid%3D%3E"; |
6 | 6 | var owaS_start_index = owa_s_val.indexOf(owa_s_ident); |
7 | 7 | //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 | + } |
16 | 16 | } |
17 | 17 | }; |
18 | 18 | |