Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php |
— | — | @@ -147,24 +147,24 @@ |
148 | 148 | $this->fnPayflowDisplayForm( $data, $error ); |
149 | 149 | } else { // The submitted form data is valid, so process it |
150 | 150 | // allow any external validators to have their way with the data |
151 | | - wfRunHooks( 'PayflowGatewayValidate', array( &$this, &$data )); |
| 151 | + wfRunHooks( 'PayflowGatewayValidate', array( $this, $data )); |
152 | 152 | |
153 | 153 | // if the transaction was flagged for review |
154 | 154 | if ( $this->action == 'review' ) { |
155 | 155 | // expose a hook for external handling of trxns flagged for review |
156 | | - wfRunHooks( 'PayflowGatewayReview', array( &$this, &$data )); |
| 156 | + wfRunHooks( 'PayflowGatewayReview', array( $this, $data )); |
157 | 157 | } |
158 | 158 | |
159 | 159 | // if the transaction was flagged to be 'challenged' |
160 | 160 | if ( $this->action == 'challenge' ) { |
161 | 161 | // expose a hook for external handling of trxns flagged for challenge (eg captcha) |
162 | | - wfRunHooks( 'PayflowGatewayChallenge', array( &$this, &$data )); |
| 162 | + wfRunHooks( 'PayflowGatewayChallenge', array( $this, $data )); |
163 | 163 | } |
164 | 164 | |
165 | 165 | // if the transaction was flagged for rejection |
166 | 166 | if ( $this->action == 'reject' ) { |
167 | 167 | // expose a hook for external handling of trxns flagged for rejection |
168 | | - wfRunHooks( 'PayflowGatewayReject', array( &$this, &$data )); |
| 168 | + wfRunHooks( 'PayflowGatewayReject', array( $this, $data )); |
169 | 169 | |
170 | 170 | $this->fnPayflowDisplayDeclinedResults( '' ); |
171 | 171 | $this->fnPayflowUnsetEditToken(); |
— | — | @@ -173,13 +173,13 @@ |
174 | 174 | // if the transaction was flagged for processing |
175 | 175 | if ( $this->action == 'process' ) { |
176 | 176 | // expose a hook for external handling of trxns ready for processing |
177 | | - wfRunHooks( 'PayflowGatewayProcess', array( &$this, &$data )); |
| 177 | + wfRunHooks( 'PayflowGatewayProcess', array( $this, $data )); |
178 | 178 | $this->fnPayflowProcessTransaction( $data, $payflow_data ); |
179 | 179 | $this->fnPayflowUnsetEditToken(); |
180 | 180 | } |
181 | 181 | |
182 | 182 | // expose a hook for any post processing |
183 | | - wfRunHooks( 'PayflowGatewayPostProcess', array( &$this, &$data )); |
| 183 | + wfRunHooks( 'PayflowGatewayPostProcess', array( $this, $data )); |
184 | 184 | } |
185 | 185 | } else { |
186 | 186 | //Display form for the first time |
— | — | @@ -466,8 +466,8 @@ |
467 | 467 | */ |
468 | 468 | public function fnPayflowDisplayForm( $data, &$error ) { |
469 | 469 | global $wgOut; |
470 | | - $form = $this->fnPayflowGenerateFormBody( &$data, &$error ); |
471 | | - $form .= $this->fnPayflowGenerateFormSubmit( &$data, &$error ); |
| 470 | + $form = $this->fnPayflowGenerateFormBody( $data, $error ); |
| 471 | + $form .= $this->fnPayflowGenerateFormSubmit( $data, $error ); |
472 | 472 | $wgOut->addHTML( $form ); |
473 | 473 | } |
474 | 474 | |
— | — | @@ -819,7 +819,7 @@ |
820 | 820 | $transaction += array_merge( $data, $responseArray ); |
821 | 821 | |
822 | 822 | // hook to call stomp functions |
823 | | - wfRunHooks( 'gwStomp', array( &$transaction ) ); |
| 823 | + wfRunHooks( 'gwStomp', array( $transaction ) ); |
824 | 824 | |
825 | 825 | if ( $wgExternalThankYouPage ) { |
826 | 826 | $wgOut->redirect( $wgExternalThankYouPage . "/" . $data['language'] ); |
— | — | @@ -890,7 +890,7 @@ |
891 | 891 | $transaction += array_merge( $data, $responseArray ); |
892 | 892 | |
893 | 893 | // hook to call stomp functions |
894 | | - wfRunHooks( 'gwPendingStomp', array( &$transaction ) ); |
| 894 | + wfRunHooks( 'gwPendingStomp', array( $transaction ) ); |
895 | 895 | |
896 | 896 | $thankyou = wfMsg( 'payflowpro_gateway-thankyou' ); |
897 | 897 | |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/extras/minfraud/minfraud.body.php |
— | — | @@ -35,7 +35,6 @@ |
36 | 36 | parent::__construct(); |
37 | 37 | $dir = dirname( __FILE__ ) .'/'; |
38 | 38 | require_once( $dir . "ccfd/CreditCardFraudDetection.php" ); |
39 | | - //require_once( $dir . "../../includes/countryCodes.inc" ); |
40 | 39 | global $wgMinFraudLicenseKey, $wgMinFraudActionRanges; |
41 | 40 | |
42 | 41 | // set the minfraud license key, go no further if we don't have it |
— | — | @@ -56,7 +55,7 @@ |
57 | 56 | */ |
58 | 57 | public function validate( &$pfp_gateway_object, &$data ) { |
59 | 58 | // see if we can bypass minfraud |
60 | | - if ( $this->can_bypass_minfraud( $pfp_gateway_object, &$data )) return TRUE; |
| 59 | + if ( $this->can_bypass_minfraud( $pfp_gateway_object, $data )) return TRUE; |
61 | 60 | |
62 | 61 | $minfraud_query = $this->build_query( $data ); |
63 | 62 | $this->query_minfraud( $minfraud_query ); |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/extras/minfraud/minfraud.php |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | /** |
4 | 4 | * Validates a transaction against MaxMind's minFraud service |
5 | 5 | * |
6 | | - * For more detailf on minFraud, go: http://www.maxmind.com/app/minfraud |
| 6 | + * For more details on minFraud, go: http://www.maxmind.com/app/minfraud |
7 | 7 | * |
8 | 8 | * To install: |
9 | 9 | * require_once( "$IP/extensions/DonationInterface/payflowpro_gateway/extras/minfraud/minfraud.php" ); |
— | — | @@ -21,17 +21,8 @@ |
22 | 22 | ); |
23 | 23 | |
24 | 24 | /** |
25 | | - * Full path to file to use for logging for Payflowpro Gateway scripts |
26 | | - * |
27 | | - * Declare in LocalSettings.php |
28 | | - */ |
29 | | -global $wgPayflowGatewayLog; |
30 | | -$wgPayflowGatewayLog = ''; |
31 | | - |
32 | | -/** |
33 | 25 | * Your minFraud license key. |
34 | 26 | */ |
35 | | -global $wgMinFraudLicenseKey; |
36 | 27 | $wgMinFraudLicenseKey = ''; |
37 | 28 | |
38 | 29 | /** |
— | — | @@ -50,7 +41,6 @@ |
51 | 42 | * These are evauluated on a >= or <= basis. Please refer to minFraud |
52 | 43 | * documentation for a thorough explanation of the 'riskScore'. |
53 | 44 | */ |
54 | | -global $wgMinFraudActionRanges; |
55 | 45 | $wgMinFraudActionRanges = array( |
56 | 46 | 'process' => array( 0, 100 ), |
57 | 47 | 'review' => array( -1, -1 ), |
— | — | @@ -60,7 +50,6 @@ |
61 | 51 | |
62 | 52 | $dir = dirname( __FILE__ ) . "/"; |
63 | 53 | require_once( $dir . "../../includes/countryCodes.inc" ); |
64 | | -$wgAutoloadClasses['PayflowProGateway_Extras'] = $dir . "../extras.php"; |
65 | 54 | $wgAutoloadClasses['PayflowProGateway_Extras_MinFraud'] = $dir . "minfraud.body.php"; |
66 | 55 | |
67 | 56 | /** |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/extras/conversion_log/conversion_log.body.php |
— | — | @@ -0,0 +1,39 @@ |
| 2 | +<?php |
| 3 | +class PayflowProGateway_Extras_ConversionLog extends PayflowProGateway_Extras { |
| 4 | + static $instance; |
| 5 | + |
| 6 | + /** |
| 7 | + * Logs the response from a payflow transaction |
| 8 | + */ |
| 9 | + public function post_process( &$pfp_gateway_object, &$data ) { |
| 10 | + // if the trxn has been outright rejected, log it |
| 11 | + if ( $pfp_gateway_object->action == 'reject' ) { |
| 12 | + $this->log( |
| 13 | + $data[ 'contribution_tracking_id' ], |
| 14 | + 'Rejected' |
| 15 | + ); |
| 16 | + return TRUE; |
| 17 | + } |
| 18 | + |
| 19 | + //make sure the payflow response property has been set (signifying a transaction has been made) |
| 20 | + if ( !$pfp_gateway_object->payflow_response ) return FALSE; |
| 21 | + |
| 22 | + $this->log( |
| 23 | + $data[ 'contribution_tracking_id' ], |
| 24 | + "Payflow response: " . addslashes( $pfp_gateway_object->payflow_response[ 'RESPMSG' ] ), |
| 25 | + '"' . addslashes( json_encode( $pfp_gateway_object->payflow_response )) . '"' |
| 26 | + ); |
| 27 | + return TRUE; |
| 28 | + } |
| 29 | + |
| 30 | + static function onPostProcess( &$pfp_gateway_object, &$data ) { |
| 31 | + return self::singleton()->post_process( $pfp_gateway_object, $data ); |
| 32 | + } |
| 33 | + |
| 34 | + static function singleton() { |
| 35 | + if ( !self::$instance ) { |
| 36 | + self::$instance = new self; |
| 37 | + } |
| 38 | + return self::$instance; |
| 39 | + } |
| 40 | +} |
Property changes on: trunk/extensions/DonationInterface/payflowpro_gateway/extras/conversion_log/conversion_log.body.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 41 | + native |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/extras/conversion_log/conversion_log.php |
— | — | @@ -1,38 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * Extra to log payflow response during post processing hook |
5 | | - * |
6 | | - * @fixme Class/file names should likely change to reflect change in purpose... |
7 | | - * |
8 | | - * To install: |
9 | | - * require_once( "$IP/extensions/DonationInterface/payflowpro_gateway/extras/conversion_log/conversion_log.php" ) |
10 | | - * In LocalSettings.php: |
11 | | - * $wgHooks["PayflowGatewayPostProcess"][] = array( new PayflowProGateway_Extras_ConversionLog, 'post_process' ); // sets this script to log some information after a transaction has been processed by PayflowPro |
12 | | - */ |
13 | | -require_once( dirname( __FILE__ ) . "/../extras.php" ); |
14 | | -class PayflowProGateway_Extras_ConversionLog extends PayflowProGateway_Extras { |
15 | | - |
16 | | - /** |
17 | | - * Logs the response from a payflow transaction |
18 | | - */ |
19 | | - public function post_process( &$pfp_gateway_object, &$data ) { |
20 | | - // if the trxn has been outright rejected, log it |
21 | | - if ( $pfp_gateway_object->action == 'reject' ) { |
22 | | - $this->log( |
23 | | - $data[ 'contribution_tracking_id' ], |
24 | | - 'Rejected' |
25 | | - ); |
26 | | - return TRUE; |
27 | | - } |
28 | | - |
29 | | - //make sure the payflow response property has been set (signifying a transaction has been made) |
30 | | - if ( !$pfp_gateway_object->payflow_response ) return FALSE; |
31 | | - |
32 | | - $this->log( |
33 | | - $data[ 'contribution_tracking_id' ], |
34 | | - "Payflow response: " . addslashes( $pfp_gateway_object->payflow_response[ 'RESPMSG' ] ), |
35 | | - '"' . addslashes( json_encode( $pfp_gateway_object->payflow_response )) . '"' |
36 | | - ); |
37 | | - return TRUE; |
38 | | - } |
39 | | -} |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/extras/conversion_log/conversion_log.php |
— | — | @@ -0,0 +1,26 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Extra to log payflow response during post processing hook |
| 5 | + * |
| 6 | + * @fixme Class/file names should likely change to reflect change in purpose... |
| 7 | + * |
| 8 | + * To install: |
| 9 | + * require_once( "$IP/extensions/DonationInterface/payflowpro_gateway/extras/conversion_log/conversion_log.php" |
| 10 | + */ |
| 11 | + |
| 12 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| 13 | + die( "This file is part of the Conversion Log for PayflowPro Gateway extension. It is not a valid entry point.\n"); |
| 14 | +} |
| 15 | + |
| 16 | +$wgExtensionCredits['validextensionclass'][] = array( |
| 17 | + 'name' => 'conversion log', |
| 18 | + 'author' =>'Arthur Richards', |
| 19 | + 'url' => '', |
| 20 | + 'description' => "This extension handles logging for Payflow Gateway extension 'extras'" |
| 21 | +); |
| 22 | + |
| 23 | +$dir = dirname( __FILE__ ) . "/"; |
| 24 | +$wgAutoloadClasses['PayflowProGateway_Extras_ConversionLog'] = $dir . "conversion_log.body.php"; |
| 25 | + |
| 26 | +// Sets the 'conversion log' as logger for post-processing |
| 27 | +$wgHooks["PayflowGatewayPostProcess"][] = array( "PayflowProGateway_Extras_ConversionLog::onPostProcess" ); |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/extras/extras.body.php |
— | — | @@ -0,0 +1,78 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * An abstract class for payflowpro gateway 'extras' |
| 5 | + */ |
| 6 | + |
| 7 | +abstract class PayflowProGateway_Extras { |
| 8 | + /** |
| 9 | + * File handle for log file |
| 10 | + * @var public |
| 11 | + */ |
| 12 | + public $log_fh = NULL; |
| 13 | + |
| 14 | + public function __construct() { |
| 15 | + global $wgPayflowGatewayLog; |
| 16 | + // prepare the log file if the user has specified one |
| 17 | + if ( strlen( $wgPayflowGatewayLog) > 0 ) $this->prepare_log_file( $wgPayflowGatewayLog ); |
| 18 | + } |
| 19 | + |
| 20 | + /** |
| 21 | + * Prepare a log file |
| 22 | + * |
| 23 | + * @param string path to log file |
| 24 | + * @return resource Pointer for the log file |
| 25 | + */ |
| 26 | + protected function prepare_log_file( $log_file ){ |
| 27 | + $this->log_fh = fopen( $log_file, 'a+' ); |
| 28 | + } |
| 29 | + |
| 30 | + /** |
| 31 | + * Writes message to a log file |
| 32 | + * |
| 33 | + * If a log file does not exist and could not be created, |
| 34 | + * do nothing. |
| 35 | + * @fixme Perhaps lack of log file can be handled better? |
| 36 | + * @param string The message to log |
| 37 | + */ |
| 38 | + public function log( $id='', $status='', $data='' ) { |
| 39 | + if ( !$this->log_fh ) { |
| 40 | + return; |
| 41 | + } |
| 42 | + $msg = '"' . date( 'c' ) . '"'; |
| 43 | + $msg .= "\t" . '"' . $id . '"'; |
| 44 | + $msg .= "\t" . '"' . $status . '"'; |
| 45 | + $msg .= "\t" . $data . "\n"; |
| 46 | + fwrite( $this->log_fh, $msg ); |
| 47 | + } |
| 48 | + |
| 49 | + /** |
| 50 | + * Generate a hash of some data |
| 51 | + * @param string the data to hash |
| 52 | + * @return string The hash of the data |
| 53 | + */ |
| 54 | + public function generate_hash( $data ) { |
| 55 | + global $wgPayflowGatewaySalt; |
| 56 | + return hash( "sha512", $wgPayflowGatewaySalt . $data ); |
| 57 | + } |
| 58 | + |
| 59 | + /** |
| 60 | + * Compare a hash to the hash of some given data |
| 61 | + * @param string $hash A given hash |
| 62 | + * @param string $data The data to hash and compare to $hash |
| 63 | + * @return bool |
| 64 | + */ |
| 65 | + public function compare_hash( $hash, $data ) { |
| 66 | + if ( $hash == $this->generate_hash( $data )) { |
| 67 | + return TRUE; |
| 68 | + } |
| 69 | + |
| 70 | + return FALSE; |
| 71 | + } |
| 72 | + |
| 73 | + /** |
| 74 | + * Close the open log file handler if it's open |
| 75 | + */ |
| 76 | + public function __destruct() { |
| 77 | + if ( $this->log_fh ) fclose( $this->log_fh ); |
| 78 | + } |
| 79 | +} |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/extras/extras.php |
— | — | @@ -1,78 +1,29 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * An abstract class for payflowpro gateway 'extras' |
| 4 | + * An abstract class and set up for payflowpro gateway 'extras' |
| 5 | + * |
| 6 | + * To install: |
| 7 | + * require_once( "$IP/extensions/DonationInterface/payflowpro_gateway/extras/extras.php" |
| 8 | + * Note: This should be specified in LocalSettings.php BEFORE requiring any of the other 'extras' |
5 | 9 | */ |
6 | 10 | |
7 | | -abstract class PayflowProGateway_Extras { |
8 | | - /** |
9 | | - * File handle for log file |
10 | | - * @var public |
11 | | - */ |
12 | | - public $log_fh = NULL; |
| 11 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| 12 | + die( "This file is part of PayflowPro Gateway extension. It is not a valid entry point.\n"); |
| 13 | +} |
13 | 14 | |
14 | | - public function __construct() { |
15 | | - global $wgPayflowGatewayLog; |
16 | | - // prepare the log file if the user has specified one |
17 | | - if ( strlen( $wgPayflowGatewayLog) > 0 ) $this->prepare_log_file( $wgPayflowGatewayLog ); |
18 | | - } |
| 15 | +$wgExtensionCredits['payflowprogateway_extras'][] = array( |
| 16 | + 'name' => 'extras', |
| 17 | + 'author' =>'Arthur Richards', |
| 18 | + 'url' => '', |
| 19 | + 'description' => "This extension handles some of the set up required for PayflowPro Gateway extras" |
| 20 | +); |
19 | 21 | |
20 | | - /** |
21 | | - * Prepare a log file |
22 | | - * |
23 | | - * @param string path to log file |
24 | | - * @return resource Pointer for the log file |
25 | | - */ |
26 | | - protected function prepare_log_file( $log_file ){ |
27 | | - $this->log_fh = fopen( $log_file, 'a+' ); |
28 | | - } |
| 22 | +/** |
| 23 | + * Full path to file to use for logging for Payflowpro Gateway scripts |
| 24 | + * |
| 25 | + * Declare in LocalSettings.php |
| 26 | + */ |
| 27 | +$wgPayflowGatewayLog = ''; |
29 | 28 | |
30 | | - /** |
31 | | - * Writes message to a log file |
32 | | - * |
33 | | - * If a log file does not exist and could not be created, |
34 | | - * do nothing. |
35 | | - * @fixme Perhaps lack of log file can be handled better? |
36 | | - * @param string The message to log |
37 | | - */ |
38 | | - public function log( $id='', $status='', $data='' ) { |
39 | | - if ( !$this->log_fh ) { |
40 | | - return; |
41 | | - } |
42 | | - $msg = '"' . date( 'c' ) . '"'; |
43 | | - $msg .= "\t" . '"' . $id . '"'; |
44 | | - $msg .= "\t" . '"' . $status . '"'; |
45 | | - $msg .= "\t" . $data . "\n"; |
46 | | - fwrite( $this->log_fh, $msg ); |
47 | | - } |
48 | | - |
49 | | - /** |
50 | | - * Generate a hash of some data |
51 | | - * @param string the data to hash |
52 | | - * @return string The hash of the data |
53 | | - */ |
54 | | - public function generate_hash( $data ) { |
55 | | - global $wgPayflowGatewaySalt; |
56 | | - return hash( "sha512", $wgPayflowGatewaySalt . $data ); |
57 | | - } |
58 | | - |
59 | | - /** |
60 | | - * Compare a hash to the hash of some given data |
61 | | - * @param string $hash A given hash |
62 | | - * @param string $data The data to hash and compare to $hash |
63 | | - * @return bool |
64 | | - */ |
65 | | - public function compare_hash( $hash, $data ) { |
66 | | - if ( $hash == $this->generate_hash( $data )) { |
67 | | - return TRUE; |
68 | | - } |
69 | | - |
70 | | - return FALSE; |
71 | | - } |
72 | | - |
73 | | - /** |
74 | | - * Close the open log file handler if it's open |
75 | | - */ |
76 | | - public function __destruct() { |
77 | | - if ( $this->log_fh ) fclose( $this->log_fh ); |
78 | | - } |
79 | | -} |
| 29 | +$dir = dirname( __FILE__ ) . "/"; |
| 30 | +$wgAutoloadClasses['PayflowProGateway_Extras'] = $dir . "extras.body.php"; |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.php |
— | — | @@ -45,10 +45,8 @@ |
46 | 46 | * potentially leave you and your users vulnerable to CSRF or other forms of |
47 | 47 | * attack. |
48 | 48 | */ |
49 | | -global $wgPayflowGatewaySalt, $wgSecretKey; |
50 | 49 | $wgPayflowGatewaySalt = $wgSecretKey; |
51 | 50 | |
52 | | -global $wgPayflowGatewayDBserver, $wgPayflowGatewayDBname, $wgPayflowGatewayDBuser, $wgPayflowGatewayDBpassword; |
53 | 51 | $wgPayflowGatewayDBserver = $wgDBserver; |
54 | 52 | $wgPayflowGatewayDBname = $wgDBname; |
55 | 53 | $wgPayflowGatewayDBuser = $wgDBuser; |
— | — | @@ -114,8 +112,6 @@ |
115 | 113 | function pfpGatewayPage( &$url ) { |
116 | 114 | global $wgScript; |
117 | 115 | |
118 | | - //$url['payflow'] = 'https://payments.wikimedia.org/index.php' . '?title=Special:PayflowProGateway'; |
119 | | - //$url['payflow'] = 'http://c2p2.fkbuild.com/index.php?title=Special:PayflowProGateway'; |
120 | 116 | $url['payflow'] = $wgScript . "?title=Special:PayflowProGateway"; |
121 | 117 | return true; |
122 | 118 | } |