Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/tests/DonationDataTestCase.php |
— | — | @@ -303,7 +303,6 @@ |
304 | 304 | /** |
305 | 305 | * TODO: Make sure ALL these functions in DonationData are tested, either directly or through a calling function. |
306 | 306 | * I know that's more regression-ish, but I stand by it. :p |
307 | | - function isCache(){ |
308 | 307 | function setNormalizedOrderIDs(){ |
309 | 308 | function generateOrderId() { |
310 | 309 | public function sanitizeInput( &$value, $key, $flags=ENT_COMPAT, $double_encode=false ) { |
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/tests |
___________________________________________________________________ |
Modified: svn:mergeinfo |
311 | 310 | Merged /trunk/extensions/DonationInterface/tests:r101786 |
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php |
— | — | @@ -65,7 +65,7 @@ |
66 | 66 | $this->displayForm( $this->errors ); |
67 | 67 | } |
68 | 68 | } else { |
69 | | - if ( !$this->adapter->isCache() ) { |
| 69 | + if ( !$this->adapter->isCaching() ) { |
70 | 70 | // if we're not caching, there's a token mismatch |
71 | 71 | $this->errors['general']['token-mismatch'] = wfMsg( 'donate_interface-token-mismatch' ); |
72 | 72 | } |
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway |
___________________________________________________________________ |
Modified: svn:mergeinfo |
73 | 73 | Merged /trunk/extensions/DonationInterface/payflowpro_gateway:r101786 |
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_resultswitcher.body.php |
— | — | @@ -90,7 +90,7 @@ |
91 | 91 | $wgOut->redirect( $go ); |
92 | 92 | } |
93 | 93 | } else { |
94 | | - if ( !$this->adapter->isCache() ) { |
| 94 | + if ( !$this->adapter->isCaching() ) { |
95 | 95 | // if we're not caching, there's a token mismatch |
96 | 96 | $this->errors['general']['token-mismatch'] = wfMsg( 'donate_interface-token-mismatch' ); |
97 | 97 | } |
— | — | @@ -103,36 +103,24 @@ |
104 | 104 | */ |
105 | 105 | function getDeclinedResultPage() { |
106 | 106 | global $wgOut; |
| 107 | + |
| 108 | + $displayData = $this->adapter->getDisplayData(); |
107 | 109 | $failpage = $this->adapter->getGlobal( 'FailPage' ); |
108 | 110 | |
109 | 111 | if ( $failpage ) { |
110 | | - $wgOut->redirect( $failpage . "/" . $data['language'] ); |
| 112 | + $wgOut->redirect( $failpage . "/" . $displayData['language'] ); |
111 | 113 | } else { |
112 | | - // general decline message |
113 | | - $declinedDefault = wfMsg( 'php-response-declined' ); |
114 | | - |
115 | | - $displayData = $this->adapter->getDisplayData(); |
| 114 | + // Get the page we're going to send them back to. |
116 | 115 | $referrer = $displayData['referrer']; |
| 116 | + $returnto = htmlspecialchars_decode( $referrer ); // escape for security |
117 | 117 | |
118 | | - $queryArray = array ( |
119 | | - 'fname' => $displayData['fname'], |
120 | | - 'lname' => $displayData['lname'], |
121 | | - 'street' => $displayData['street'], |
122 | | - 'city' => $displayData['city'], |
123 | | - 'state' => $displayData['state'], |
124 | | - 'zip' => $displayData['zip'], |
125 | | - 'country' => $displayData['country'], |
126 | | - 'utm_source' => $displayData['utm_source'], |
127 | | - 'utm_medium' => $displayData['utm_medium'], |
128 | | - 'utm_campaign' => $displayData['utm_campaign'], |
129 | | - 'numAttempt' => $displayData['numAttempt'], |
130 | | - 'error' => $declinedDefault, |
131 | | - ); |
| 118 | + // Set the response as failure so that an error message will be displayed when the form reloads. |
| 119 | + $this->adapter->addData( array( 'response' => 'failure' ) ); |
132 | 120 | |
133 | | - // TODO: figure out something better so we aren't expanding the URL after every attempt. |
134 | | - $returnto = wfAppendQuery( htmlspecialchars_decode( $referrer ), $queryArray ); |
| 121 | + // Store their data in the session. |
| 122 | + $this->adapter->addDonorDataToSession(); |
135 | 123 | |
136 | | - // Return the referrer URL with the data included in the query string |
| 124 | + // Return the referrer URL |
137 | 125 | return $returnto; |
138 | 126 | } |
139 | 127 | } |
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php |
— | — | @@ -84,7 +84,12 @@ |
85 | 85 | |
86 | 86 | |
87 | 87 | // dispatch forms/handling |
88 | | - if ( $this->adapter->checkTokens() ) { |
| 88 | + if ( $this->adapter->checkTokens() ) { |
| 89 | + |
| 90 | + //TODO: Get rid of $data out here completely, by putting this logic inside the adapter somewhere. |
| 91 | + //All we seem to be doing with it now, is internal adapter logic outside of the adapter. |
| 92 | + $data = $this->adapter->getDisplayData(); |
| 93 | + |
89 | 94 | if ( $this->adapter->posted ) { |
90 | 95 | // The form was submitted and the payment method has been set |
91 | 96 | /* |
— | — | @@ -92,11 +97,6 @@ |
93 | 98 | * |
94 | 99 | * An invalid $payment_method will cause an error. |
95 | 100 | */ |
96 | | - |
97 | | - //TODO: Get rid of $data out here completely, by putting this logic inside the adapter somewhere. |
98 | | - //All we seem to be doing with it now, is internal adapter logic outside of the adapter. |
99 | | - $data = $this->adapter->getDisplayData(); |
100 | | - |
101 | 101 | $payment_method = ( isset( $data['payment_method'] ) && !empty( $data['payment_method'] ) ) ? $data['payment_method'] : 'cc'; |
102 | 102 | $payment_submethod = ( isset( $data['payment_submethod'] ) && !empty( $data['payment_submethod'] ) ) ? $data['payment_submethod'] : ''; |
103 | 103 | |
— | — | @@ -124,17 +124,24 @@ |
125 | 125 | |
126 | 126 | } |
127 | 127 | } else { |
128 | | - // Display form for the first time |
| 128 | + // Display form |
| 129 | + |
| 130 | + // Not sure what this is for. |
129 | 131 | $oid = $wgRequest->getText( 'order_id' ); |
130 | 132 | if ( $oid ) { |
131 | | - // $wgOut->addHTML( "<pre>CAME BACK FROM SOMETHING.</pre>" ); |
132 | 133 | $result = $this->adapter->do_transaction( 'GET_ORDERSTATUS' ); |
133 | 134 | $this->displayResultsForDebug( $result ); |
134 | 135 | } |
| 136 | + |
| 137 | + // If the result of the previous transaction was failure, set the retry message. |
| 138 | + if ( $data && array_key_exists( 'response', $data ) && $data['response'] == 'failure' ) { |
| 139 | + $this->errors['retryMsg'] = wfMsg( 'php-response-declined' ); |
| 140 | + } |
| 141 | + |
135 | 142 | $this->displayForm( $this->errors ); |
136 | 143 | } |
137 | 144 | } else { |
138 | | - if ( !$this->adapter->isCache() ) { |
| 145 | + if ( !$this->adapter->isCaching() ) { |
139 | 146 | // if we're not caching, there's a token mismatch |
140 | 147 | $this->errors['general']['token-mismatch'] = wfMsg( 'donate_interface-token-mismatch' ); |
141 | 148 | } |
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/interface.i18n.php |
— | — | @@ -122,7 +122,8 @@ |
123 | 123 | // Migrated messages |
124 | 124 | 'donate_interface-accessible' => 'This page is only accessible from the donation page.', |
125 | 125 | 'donate_interface-paypal-button' => 'Donate via PayPal', |
126 | | - 'donate_interface-cc-button' => 'Donate by Credit Card', |
| 126 | + 'donate_interface-cc-button' => 'Donate by credit card', |
| 127 | + 'donate_interface-dd-button' => 'Donate by direct debit', |
127 | 128 | 'donate_interface-donor-legend' => 'Donor information', |
128 | 129 | 'donate_interface-card-legend' => 'Credit card information', |
129 | 130 | 'donate_interface-amount-legend' => 'Donation amount', |
— | — | @@ -313,7 +314,6 @@ |
314 | 315 | 'donate_interface-on-the-back' => 'With this on the back:', |
315 | 316 | 'donate_interface-tshirt-confirmation' => 'Your t-shirt will be shipped in the size and language below:', |
316 | 317 | 'donate_interface-donation-tshirt' => 'Donation (t-shirt offer)', |
317 | | - |
318 | 318 | 'donate_interface-change' => 'Change', |
319 | 319 | 'donate_interface-select-credit-card' => 'Select credit card', |
320 | 320 | |
— | — | @@ -340,9 +340,38 @@ |
341 | 341 | 'donate_interface-translate-redlink1' => 'Help translate this page.', |
342 | 342 | 'donate_interface-translate-redlink2' => 'Or e-mail your translation to translations@wikimedia.org', |
343 | 343 | |
| 344 | + // E-mail related variables |
| 345 | + 'donate_interface-email-fallbackname' => 'friend of the Wikimedia Foundation', |
| 346 | + 'donate_interface-email-subject' => 'Thank you from the Wikimedia Foundation', |
| 347 | + 'donate_interface-email-unsub-title' => 'Wikimedia Foundation unsubscribe', |
| 348 | + 'donate_interface-email-unsub-button' => 'Unsubscribe', |
| 349 | + 'donate_interface-email-unsub-success' => 'You have successfully been removed from our mailing list', |
| 350 | + 'donate_interface-email-unsub-delay' => 'Please allow up to four (4) days for the changes to take effect. We apologize for any emails you receive during this time. If you have any questions, please contact <donations@wikimedia.org>', |
| 351 | + 'donate_interface-email-unsub-fail' => 'There was an error processing your request, please contact <donations@wikimedia.org>.', |
| 352 | + |
| 353 | + // Various form interface elements |
344 | 354 | 'donate_interface-faqs' => 'Frequently asked questions', |
345 | 355 | 'donate_interface-tax-info' => 'Tax deductibility information', |
346 | 356 | 'donate_interface-informationsharing' => 'By donating, you are sharing your information with the Wikimedia Foundation, the nonprofit organization that hosts Wikipedia and other Wikimedia projects, and its service providers in the U.S. and elsewhere pursuant to our donor privacy policy. We do not sell or trade your information to anyone. For more information please read <a href="http://wikimediafoundation.org/wiki/Donor_policy/en">our donor policy</a>.' |
| 357 | + 'donate_interface-currency-change' => 'Change?', |
| 358 | + 'donate_interface-bank_transfer_message' => 'Please notice that your statement will show \'Global Collect\' as the recipient of this gift. Global Collect is authorized to accept and process payments on behalf of Wikimedia Foundation. Remember to include the reference number provided here on your bank transfer and feel free to email donations@wikimedia.org if you have any questions or concerns.', |
| 359 | + |
| 360 | + // Tax deductibility and other legalese |
| 361 | + 'donate_interface-taxded-link-int' => 'Tax and other legal information', |
| 362 | + 'donate_interface-taxded-link-us' => 'Tax deductibility information', |
| 363 | + 'donate_interface-taxded-msg-int' => 'Wikimedia Foundation is a non-profit charity established in the United States under the US IRS Code Section 501(c)(3), and, for that reason, donations from persons or entities located in the United States may benefit from tax deductible status. Donations from persons or entities located outside the United States may not be eligible for tax deductions in the United States and elsewhere; in such cases, donors should seek local tax advice. Importantly, Wikimedia does not seek donations from persons or entities located in any jurisdiction that prohibits or restricts fundraising activities by international charities such as Wikimedia or applies gift taxes on donations made to such international charities.', |
| 364 | + 'donate_interface-taxded-msg-us' => 'Wikimedia Foundation is a non-profit charity established in the United States under the US IRS Code Section 501(c)(3), and, for that reason, donations from persons or entities located in the United States may benefit from tax deductible status.', |
| 365 | + 'donate_interface-legal-original' => 'This is a courtesy translation. In the event of a conflict between this translation and the English version, the English version shall govern.', |
| 366 | + 'donate_interface-legal-donorpolicy' => 'By donating, you are sharing your information with the Wikimedia Foundation, the nonprofit organization that hosts Wikipedia and other Wikimedia projects, and its service providers in the U.S. and elsewhere pursuant to our donor privacy policy. We do not sell or trade your information to anyone.', |
| 367 | + |
| 368 | + // Monthly donation box |
| 369 | + 'donate_interface-monthlybox-title' => 'Make it monthly?', |
| 370 | + 'donate_interface-monthlybox-content' => 'Monthly donations are processed on the 2<sup>nd</sup> of every month. You may cancel at any time.', |
| 371 | + 'donate_interface-monthlybox-amount' => 'Donation amount:', |
| 372 | + 'donate_interface-monthlybox-yes' => 'Sure, make it monthly', |
| 373 | + 'donate_interface-monthlybox-no' => 'NO, make a one-time donation', |
| 374 | + 'donate_interface-monthlybox-bottom' => 'Your donation will be securely processed.', |
| 375 | + |
347 | 376 | |
348 | 377 | ); |
349 | 378 | |
— | — | @@ -463,6 +492,7 @@ |
464 | 493 | 'donate_interface-accessible' => 'Error message if you try to go to "Special:PayFlowProGateway" from anywhere else than the donation form.', |
465 | 494 | 'donate_interface-paypal-button' => 'Button to choose to donate via PayPal.', |
466 | 495 | 'donate_interface-cc-button' => 'Button to choose to donate by credit card.', |
| 496 | + 'donate_interface-dd-button' => 'Button to choose to donate by direct debit.', |
467 | 497 | 'donate_interface-donor-legend' => 'Header for the entire form where you fill out your personal information.', |
468 | 498 | 'donate_interface-card-legend' => 'Header for part of the form that has information about the credit card itself.', |
469 | 499 | 'donate_interface-amount-legend' => 'Where you choose what amount to donate.', |
— | — | @@ -671,6 +701,27 @@ |
672 | 702 | 'donate_interface-translate-redlink2' => 'Plain text (not link) at the bottom of an appeal telling people that they can e-mail a translation. Preceded by [[MediaWiki:Donate interface-translate-redlink1]].', |
673 | 703 | 'donate_interface-faqs' => 'Link text to the frequently asked questions page', |
674 | 704 | 'donate_interface-tax-info' => 'Link to information about the tax deducability of donations', |
| 705 | + 'donate_interface-email-fallbackname' => 'String that will be used instead of the donor\'s name in the e-mail in case it is missing.', |
| 706 | + 'donate_interface-email-subject' => 'Subject line of thank you e-mail', |
| 707 | + 'donate_interface-email-unsub-title' => 'Title for unsubscription box', |
| 708 | + 'donate_interface-email-unsub-button' => 'The button you click to unsubscribe from receiving e-mails', |
| 709 | + 'donate_interface-email-unsub-success' => 'The message that is shown when a user is successfully unsubscribed from the mailing list', |
| 710 | + 'donate_interface-email-unsub-delay' => 'The message that is shown when there is a delay in the unsubscription of a donor from the mailing list', |
| 711 | + 'donate_interface-email-unsub-fail' => 'The message that is shown when there has been an error in the unsubscription of a donor from the mailing list', |
| 712 | + 'donate_interface-currency-change' => 'Link shown next to the radio buttons to choose amount. Users click this to change the currency of their donation.', |
| 713 | + 'donate_interface-bank_transfer_message' => 'Message notifying donors that the recipient of the donation will show as Global Collect.', |
| 714 | + 'donate_interface-taxded-link-int' => 'Link to information about tax deductibility and other legal information, to be used outside of the U.S.', |
| 715 | + 'donate_interface-taxded-link-us' => 'Link to information about tax deductibility, to be used inside of the U.S.', |
| 716 | + 'donate_interface-taxded-msg-int' => 'Legal information shown to international donors.', |
| 717 | + 'donate_interface-taxded-msg-us' => 'Tax deductibility shown to U.S. donors.', |
| 718 | + 'donate_interface-legal-original' => 'Message notifying users that the English version of legal pages is the prevalent one.', |
| 719 | + 'donate_interface-legal-donorpolicy' => 'Message telling donors about the Donor Privacy Policy.', |
| 720 | + 'donate_interface-monthlybox-title' => 'Header for box prompting users to change from one-time donation to a recurring monthly donation.', |
| 721 | + 'donate_interface-monthlybox-content' => 'Information about when and how monthly donations are processed.', |
| 722 | + 'donate_interface-monthlybox-amount' => 'Label for the field for the donation amount.', |
| 723 | + 'donate_interface-monthlybox-yes' => 'Button to click to accept giving a monthly donation.', |
| 724 | + 'donate_interface-monthlybox-no' => 'Button to click to decline giving a monthly donation.', |
| 725 | + 'donate_interface-monthlybox-bottom' => 'Message in the bottom of the monthly donation box ensuring donors that their donation will be processed securely.', |
675 | 726 | ); |
676 | 727 | |
677 | 728 | /** Magyar (magázó) (Magyar (magázó)) |
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/gateway.adapter.php |
— | — | @@ -269,6 +269,14 @@ |
270 | 270 | } |
271 | 271 | } |
272 | 272 | } |
| 273 | + |
| 274 | + /** |
| 275 | + * A helper function to let us stash extra data after the form has been submitted. |
| 276 | + * @param array $dataArray An associative array of data. |
| 277 | + */ |
| 278 | + public function addData( $dataArray ) { |
| 279 | + $this->dataObj->addData( $dataArray ); |
| 280 | + } |
273 | 281 | |
274 | 282 | /** |
275 | 283 | * Returns the variable $this->dataObj which should be an instance of |
— | — | @@ -293,8 +301,8 @@ |
294 | 302 | } |
295 | 303 | } |
296 | 304 | |
297 | | - function isCache() { |
298 | | - return $this->dataObj->isCache(); |
| 305 | + function isCaching() { |
| 306 | + return $this->dataObj->isCaching(); |
299 | 307 | } |
300 | 308 | |
301 | 309 | /** |
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/DonationData.php |
— | — | @@ -143,10 +143,6 @@ |
144 | 144 | return $this->normalized; |
145 | 145 | } |
146 | 146 | |
147 | | - function isCache() { |
148 | | - return $this->cache; |
149 | | - } |
150 | | - |
151 | 147 | function populateData_Test( $testdata = false ) { |
152 | 148 | // define arrays of cc's and cc #s for random selection |
153 | 149 | $cards = array( 'american' ); |
— | — | @@ -273,19 +269,27 @@ |
274 | 270 | */ |
275 | 271 | function handleContributionTrackingID(){ |
276 | 272 | if ( !$this->isSomething( 'contribution_tracking_id' ) && |
277 | | - ( !$this->canCache() ) ){ |
| 273 | + ( !$this->isCaching() ) ){ |
278 | 274 | $this->saveContributionTracking(); |
279 | 275 | } |
280 | 276 | } |
281 | 277 | |
282 | 278 | |
283 | | - function canCache(){ |
284 | | - if ( $this->getVal( '_cache_' ) === 'true' ){ //::head. hit. keyboard.:: |
285 | | - if ( $this->isSomething( 'utm_source_id' ) && !is_null( 'utm_source_id' ) ){ |
286 | | - return true; |
| 279 | + function isCaching(){ |
| 280 | + //I think it's safe to static this here. I don't want to calc this every |
| 281 | + //time some outside object asks if we're caching. |
| 282 | + static $cache = null; |
| 283 | + if ( is_null( $cache ) ){ |
| 284 | + if ( $this->getVal( '_cache_' ) === 'true' ){ //::head. hit. keyboard.:: |
| 285 | + if ( $this->isSomething( 'utm_source_id' ) && !is_null( 'utm_source_id' ) ){ |
| 286 | + $cache = true; |
| 287 | + } |
287 | 288 | } |
| 289 | + if ( is_null( $cache ) ){ |
| 290 | + $cache = false; |
| 291 | + } |
288 | 292 | } |
289 | | - return false; |
| 293 | + return $cache; |
290 | 294 | } |
291 | 295 | |
292 | 296 | /** |
— | — | @@ -404,9 +408,8 @@ |
405 | 409 | function doCacheStuff() { |
406 | 410 | //TODO: Wow, name. |
407 | 411 | // if _cache_ is requested by the user, do not set a session/token; dynamic data will be loaded via ajax |
408 | | - if ( $this->isSomething( '_cache_' ) ) { |
| 412 | + if ( $this->isCaching() ) { |
409 | 413 | self::log( $this->getAnnoyingOrderIDLogLinePrefix() . ' Cache requested', LOG_DEBUG ); |
410 | | - $this->cache = true; //TODO: If we don't need this, kill it in the face. |
411 | 414 | $this->setVal( 'token', 'cache' ); |
412 | 415 | |
413 | 416 | // if we have squid caching enabled, set the maxage |
— | — | @@ -417,8 +420,6 @@ |
418 | 421 | self::log( $this->getAnnoyingOrderIDLogLinePrefix() . ' Setting s-max-age: ' . $maxAge, LOG_DEBUG ); |
419 | 422 | $wgOut->setSquidMaxage( $maxAge ); |
420 | 423 | } |
421 | | - } else { |
422 | | - $this->cache = false; //TODO: Kill this one in the face, too. (see above) |
423 | 424 | } |
424 | 425 | } |
425 | 426 | |
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface |
___________________________________________________________________ |
Modified: svn:mergeinfo |
426 | 427 | Merged /trunk/extensions/DonationInterface:r101778,101781,101786-101789 |