Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php |
— | — | @@ -46,7 +46,7 @@ |
47 | 47 | ); |
48 | 48 | |
49 | 49 | |
50 | | - $wgOut->addScript( Skin::makeVariablesScript( $scriptVars ) ); |
| 50 | + $wgOut->addScript( Skin::makeVariablesScript( $scriptVars ) ); |
51 | 51 | |
52 | 52 | // create token if one doesn't already exist |
53 | 53 | $token = $wgUser->editToken( 'mrxc877668DwQQ' ); |
— | — | @@ -175,6 +175,14 @@ |
176 | 176 | |
177 | 177 | global $wgOut, $wgLang; |
178 | 178 | |
| 179 | + // save contrib tracking id early to track abondonment |
| 180 | + if ( $data[ 'numAttempt' ] == 0 ) { |
| 181 | + if ( !$tracked = $this->fnPayflowSaveContributionTracking( $data ) ) { |
| 182 | + $when = time(); |
| 183 | + wfDebugLog( 'payflowpro_gateway', 'Unable to save data to the contribution_tracking table ' . $when ); |
| 184 | + } |
| 185 | + } |
| 186 | + |
179 | 187 | // create drop down of countries |
180 | 188 | $countries = countryCodes(); |
181 | 189 | |
— | — | @@ -231,22 +239,22 @@ |
232 | 240 | |
233 | 241 | $currencyMenu = ''; |
234 | 242 | |
235 | | - foreach( $currencies as $value => $fullName ) { |
236 | | - $currencyMenu .= Xml::option( $fullName, $value ); |
237 | | - } |
| 243 | + foreach( $currencies as $value => $fullName ) { |
| 244 | + $currencyMenu .= Xml::option( $fullName, $value ); |
| 245 | + } |
238 | 246 | |
239 | | - // Build currency options |
240 | | - $default_currency = $data['currency']; |
| 247 | + // Build currency options |
| 248 | + $default_currency = $data['currency']; |
241 | 249 | |
242 | | - $currency_options = ''; |
| 250 | + $currency_options = ''; |
243 | 251 | |
244 | | - foreach ( $currencies as $code => $name ) { |
245 | | - $selected = ''; |
246 | | - if ( $code == $default_currency ) { |
247 | | - $selected = ' selected="selected"'; |
248 | | - } |
249 | | - $currency_options .= '<option value="' . $code . '"' . $selected . '>' . wfMsg( 'donate_interface-' . $code ) . '</option>'; |
250 | | - } |
| 252 | + foreach ( $currencies as $code => $name ) { |
| 253 | + $selected = ''; |
| 254 | + if ( $code == $default_currency ) { |
| 255 | + $selected = ' selected="selected"'; |
| 256 | + } |
| 257 | + $currency_options .= '<option value="' . $code . '"' . $selected . '>' . wfMsg( 'donate_interface-' . $code ) . '</option>'; |
| 258 | + } |
251 | 259 | |
252 | 260 | // intro text |
253 | 261 | $form = Xml::openElement( 'div', array( 'id' => 'mw-creditcard' ) ) . |
— | — | @@ -270,9 +278,9 @@ |
271 | 279 | Xml::label( wfMsg( 'payflowpro_gateway-donor-currency-label' ), 'currency_code' ) . |
272 | 280 | $endCell . |
273 | 281 | Xml::openElement( 'select', array( 'name' => 'currency_code', 'id' => "input_currency_code" )) . |
274 | | - $currency_options . |
275 | | - Xml::closeElement( 'select' ) . |
276 | | - $endRow . |
| 282 | + $currency_options . |
| 283 | + Xml::closeElement( 'select' ) . |
| 284 | + $endRow . |
277 | 285 | Xml::label( wfMsg( 'payflowpro_gateway-donor-email' ), 'emailAdd' ) . |
278 | 286 | $endCell . |
279 | 287 | Xml::input( 'emailAdd', '30', $data['email'], array( 'maxlength' => '64', 'id' => 'emailAdd' ) ) . |
— | — | @@ -663,6 +671,7 @@ |
664 | 672 | $errorCode = $this->fnPayflowGetResponseMsg( $resultCode, $responseMsg ); |
665 | 673 | |
666 | 674 | // if approved, display results and send transaction to the queue |
| 675 | + |
667 | 676 | if( $errorCode == '1' ) { |
668 | 677 | $this->fnPayflowDisplayApprovedResults( $data, $responseArray, $responseMsg ); |
669 | 678 | // give user a second chance to enter incorrect data |
— | — | @@ -698,7 +707,7 @@ |
699 | 708 | $errorCode = '1'; |
700 | 709 | break; |
701 | 710 | case '126': |
702 | | - $responseMsg = wfMsg( 'payflowpro_gateway-response-126' ); |
| 711 | + $responseMsg = wfMsg( 'payflowpro_gateway-response-126-2' ); |
703 | 712 | $errorCode = '5'; |
704 | 713 | break; |
705 | 714 | case '12': |
— | — | @@ -730,7 +739,7 @@ |
731 | 740 | $errorCode = '3'; |
732 | 741 | break; |
733 | 742 | case '125': |
734 | | - $responseMsg = wfMsg( 'payflowpro_gateway-response-125' ); |
| 743 | + $responseMsg = wfMsg( 'payflowpro_gateway-response-125-2' ); |
735 | 744 | $errorCode = '3'; |
736 | 745 | break; |
737 | 746 | default: |
— | — | @@ -754,13 +763,6 @@ |
755 | 764 | |
756 | 765 | require_once( 'includes/countryCodes.inc' ); |
757 | 766 | |
758 | | - //save data to the contribution tracking database |
759 | | - if ( !$tracked = $this->fnPayflowSaveContributionTracking( $data ) ) { |
760 | | - $when = time(); |
761 | | - wfDebugLog( 'payflowpro_gateway', 'Unable to save data to the contribution_tracking table ' . $when ); |
762 | | - } |
763 | | - |
764 | | - |
765 | 767 | // display response message |
766 | 768 | $wgOut->addHTML( '<h3 class="response_message">' . $responseMsg . '</h3>' ); |
767 | 769 | |
— | — | @@ -826,23 +828,26 @@ |
827 | 829 | // display response message |
828 | 830 | $wgOut->addHTML( '<h3 class="response_message">' . $declinedDefault . $responseMsg . '</h3>' ); |
829 | 831 | } |
830 | | - |
831 | 832 | function fnPayflowDisplayPending( $responseMsg ) { |
832 | 833 | global $wgOut; |
833 | 834 | |
| 835 | + $thankyou = wfMsg( 'payflowpro_gateway-thankyou' ); |
| 836 | + |
834 | 837 | // display response message |
835 | | - $wgOut->addHTML( '<h3 class="response_message">' . $responseMsg . '</h3>' ); |
| 838 | + $wgOut->addHTML( '<h2 class="response_message">' . $thankyou . '</h2>' ); |
| 839 | + $wgOut->addHTML( '<p>' . $responseMsg ); |
| 840 | + |
836 | 841 | } |
837 | 842 | |
838 | 843 | function fnPayflowSaveContributionTracking( &$data ) { |
839 | | - $data['optout'] = ($data['optout'] == "1") ? '0' : '1'; |
840 | | - $data['anonymous'] = ($data['anonymous'] == "1") ? '0' : '1'; |
| 844 | + $data['optout'] = ($data['optout'] == "1") ? '0' : '1'; |
| 845 | + $data['anonymous'] = ($data['anonymous'] == "1") ? '0' : '1'; |
841 | 846 | |
842 | | - $db = payflowGatewayConnection(); |
| 847 | + $db = payflowGatewayConnection(); |
843 | 848 | |
844 | | - if (!$db) { return true ; } |
| 849 | + if (!$db) { return true ; } |
845 | 850 | |
846 | | - $ts = $db->timestamp(); |
| 851 | + $ts = $db->timestamp(); |
847 | 852 | |
848 | 853 | $tracked_contribution = array( |
849 | 854 | 'note' => $data['comment'], |
— | — | @@ -865,7 +870,7 @@ |
866 | 871 | |
867 | 872 | // Store the contribution data |
868 | 873 | if ($db->insert( 'contribution_tracking', $tracked_contribution ) ) { |
869 | | - // $data['contribution_tracking_id'] = $db->insertId(); |
| 874 | + $data['contribution_tracking_id'] = $db->insertId(); |
870 | 875 | return true; |
871 | 876 | } else { return false; } |
872 | 877 | |