Index: trunk/extensions/DonationInterface/payflowpro_gateway/validate_input.js |
— | — | @@ -1,5 +1,28 @@ |
2 | 2 | //<![CDATA[ |
3 | 3 | |
| 4 | +function addEvent(obj, evType, fn){ |
| 5 | + if (obj.addEventListener){ |
| 6 | + obj.addEventListener(evType, fn, false); |
| 7 | + return true; |
| 8 | + } else if (obj.attachEvent){ |
| 9 | + var r = obj.attachEvent("on"+evType, fn); |
| 10 | + return r; |
| 11 | + } else { |
| 12 | + return false; |
| 13 | + } |
| 14 | +} |
| 15 | +addEvent( window, 'load', getIfSessionSet ); |
| 16 | + |
| 17 | +function getIfSessionSet() { |
| 18 | + sajax_do_call( 'efPayflowGatewayCheckSession', [], checkSession ); |
| 19 | +} |
| 20 | + |
| 21 | +function checkSession( request ) { |
| 22 | + if ( request.responseText == "no" ) { |
| 23 | + window.location = document.location.href; |
| 24 | + } |
| 25 | +} |
| 26 | + |
4 | 27 | function validate_form( form ) { |
5 | 28 | var msg = [ 'EmailAdd', 'Fname', 'Lname', 'Street', 'City', 'State', 'Zip', 'CardNum', 'Cvv', 'Amount' ]; |
6 | 29 | |
— | — | @@ -66,5 +89,4 @@ |
67 | 90 | } |
68 | 91 | |
69 | 92 | window.onfocus = CloseCVV; |
70 | | - |
71 | 93 | //]]> |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php |
— | — | @@ -57,9 +57,6 @@ |
58 | 58 | $this->fnPayflowEnsureSession(); |
59 | 59 | $this->setHeaders(); |
60 | 60 | |
61 | | - $wgOut->addHeadItem( 'validatescript', '<script type="text/javascript" language="javascript" src="' . |
62 | | - $wgScriptPath . |
63 | | - '/extensions/DonationInterface/payflowpro_gateway/validate_input.js"></script>' ); |
64 | 61 | |
65 | 62 | $wgOut->addExtensionStyle( |
66 | 63 | "{$wgScriptPath}/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.css?" . |
— | — | @@ -155,7 +152,6 @@ |
156 | 153 | // expose a hook for external handling of trxns ready for processing |
157 | 154 | wfRunHooks( 'PayflowGatewayProcess', array( &$this, &$data )); |
158 | 155 | $this->fnPayflowProcessTransaction( $data, $payflow_data ); |
159 | | - $this->fnPayflowUnsetEditToken(); |
160 | 156 | } |
161 | 157 | |
162 | 158 | // expose a hook for any post processing |
— | — | @@ -181,8 +177,13 @@ |
182 | 178 | * The message at the top of the form can be edited in the payflow_gateway.i18.php file |
183 | 179 | */ |
184 | 180 | public function fnPayflowDisplayForm( &$data, &$error ) { |
185 | | - global $wgOut; |
| 181 | + global $wgOut, $wgScriptPath; |
186 | 182 | |
| 183 | + // we only want to load this JS if the form is being rendered |
| 184 | + $wgOut->addHeadItem( 'validatescript', '<script type="text/javascript" language="javascript" src="' . |
| 185 | + $wgScriptPath . |
| 186 | + '/extensions/DonationInterface/payflowpro_gateway/validate_input.js"></script>' ); |
| 187 | + |
187 | 188 | // save contrib tracking id early to track abondonment |
188 | 189 | if ( $data[ 'numAttempt' ] == '0' ) { |
189 | 190 | if ( !$tracked = $this->fnPayflowSaveContributionTracking( $data ) ) { |
— | — | @@ -559,7 +560,7 @@ |
560 | 561 | $responseMsg = wfMsg( 'payflowpro_gateway-response-default' ); |
561 | 562 | $errorCode = '4'; |
562 | 563 | } |
563 | | - |
| 564 | + |
564 | 565 | return $errorCode; |
565 | 566 | } |
566 | 567 | |
— | — | @@ -611,6 +612,8 @@ |
612 | 613 | // if we want to show the response |
613 | 614 | $wgOut->addHTML( Xml::buildTable( $rows, array( 'class' => 'submitted-response' ) ) ); |
614 | 615 | } |
| 616 | + // unset edit token |
| 617 | + $this->fnPayflowUnsetEditToken(); |
615 | 618 | } |
616 | 619 | |
617 | 620 | /** |
— | — | @@ -626,6 +629,9 @@ |
627 | 630 | |
628 | 631 | // display response message |
629 | 632 | $wgOut->addHTML( '<h3 class="response_message">' . $declinedDefault . ' ' . $responseMsg . '</h3>' ); |
| 633 | + |
| 634 | + // unset edit token |
| 635 | + $this->fnPayflowUnsetEditToken(); |
630 | 636 | } |
631 | 637 | |
632 | 638 | /** |
— | — | @@ -641,6 +647,9 @@ |
642 | 648 | |
643 | 649 | // display response message |
644 | 650 | $wgOut->addHTML( '<h3 class="response_message">' . $declinedDefault . ' ' . $responseMsg . '</h3>' ); |
| 651 | + |
| 652 | + // unset edit token |
| 653 | + $this->fnPayflowUnsetEditToken(); |
645 | 654 | } |
646 | 655 | |
647 | 656 | function fnPayflowDisplayPending( $data, $responseArray, $responseMsg ) { |
— | — | @@ -669,6 +678,8 @@ |
670 | 679 | $wgOut->addHTML( '<h2 class="response_message">' . $thankyou . '</h2>' ); |
671 | 680 | $wgOut->addHTML( '<p>' . $responseMsg ); |
672 | 681 | |
| 682 | + // unset edit token |
| 683 | + $this->fnPayflowUnsetEditToken(); |
673 | 684 | } |
674 | 685 | |
675 | 686 | function fnPayflowSaveContributionTracking( &$data ) { |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoColumnLetter.css |
— | — | @@ -32,3 +32,12 @@ |
33 | 33 | float: left; |
34 | 34 | margin-right: 2em; |
35 | 35 | } |
| 36 | + |
| 37 | +#payflowpro_gateway-cc_form_letter_inside { |
| 38 | + padding-top: .5em; |
| 39 | +} |
| 40 | + |
| 41 | +#payflowpro_gateway-cc_otherways { |
| 42 | + padding-top: .5em; |
| 43 | + display: block; |
| 44 | +} |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoColumn.php |
— | — | @@ -29,7 +29,7 @@ |
30 | 30 | $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit')); |
31 | 31 | $form .= Xml::openElement( 'div', array( 'id' => 'mw-donate-submit-button' )); |
32 | 32 | //$form .= Xml::submitButton( wfMsg( 'payflowpro_gateway-submit-button' )); |
33 | | - $form .= Xml::openElement( 'input', array( 'class' => 'input-button button-navyblue', 'value' => wfMsg( 'payflowpro_gateway-submit-button'), 'onclick' => 'form.submit()')); |
| 33 | + $form .= Xml::openElement( 'input', array( 'class' => 'input-button button-navyblue', 'value' => wfMsg( 'payflowpro_gateway-submit-button'), 'onclick' => 'form.submit()', 'type' => 'submit')); |
34 | 34 | $form .= Xml::closeElement( 'div' ); |
35 | 35 | $form .= Xml::openElement( 'div', array( 'class' => 'mw-donate-submessage', 'id' => 'payflowpro_gateway-donate-submessage' ) ) . |
36 | 36 | wfMsg( 'payflowpro_gateway-donate-click' ); |
— | — | @@ -50,10 +50,9 @@ |
51 | 51 | $form .= Xml::tags( 'p', array( 'class' => '' ), Xml::openElement( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/rapidssl_ssl_certificate.gif" ))); |
52 | 52 | $form .= Xml::closeElement( 'div' ); |
53 | 53 | $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-donate-addl-info-text' )); |
54 | | - $form .= Xml::tags( 'p', array( 'class' => '' ), |
55 | | - wfMsg( 'payflowpro_gateway-credit-storage-processing' ) ) . |
56 | | - Xml::tags( 'p', array( 'class' => ''), |
57 | | - wfMsg( 'payflowpro_gateway-question-comment' ) ); |
| 54 | + $form .= Xml::tags( 'p', array( 'class' => '' ), wfMsg( 'payflowpro_gateway-otherways' )); |
| 55 | + $form .= Xml::tags( 'p', array( 'class' => '' ), wfMsg( 'payflowpro_gateway-credit-storage-processing' ) ); |
| 56 | + $form .= Xml::tags( 'p', array( 'class' => ''), wfMsg( 'payflowpro_gateway-question-comment' ) ); |
58 | 57 | $form .= Xml::closeElement( 'div' ); |
59 | 58 | $form .= Xml::closeElement( 'div' ); |
60 | 59 | |
— | — | @@ -210,12 +209,6 @@ |
211 | 210 | '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['card_num'] . '</span></td>'; |
212 | 211 | $form .= '</tr>'; |
213 | 212 | |
214 | | - // card error |
215 | | - $form .= '<tr>'; |
216 | | - $form .= '<td></td>'; |
217 | | - $form .= '<td>' . '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['card'] . '</span></td>'; |
218 | | - $form .= '</tr>'; |
219 | | - |
220 | 213 | // expiry |
221 | 214 | $form .= '<tr>'; |
222 | 215 | $form .= '<td>' . Xml::label( wfMsg( 'payflowpro_gateway-donor-expiration' ), 'expiration' ) . '</td>'; |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoColumnLetter.php |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | |
4 | 4 | class PayflowProGateway_Form_TwoColumnLetter extends PayflowProGateway_Form_TwoColumn { |
5 | 5 | |
6 | | - public function __construct( &$form_data, &$form_errors ) { |
| 6 | + public function __construct( &$form_data, &$form_errors ) { |
7 | 7 | global $wgOut, $wgScriptPath; |
8 | 8 | parent::__construct( $form_data, $form_errors ); |
9 | 9 | |
— | — | @@ -19,7 +19,8 @@ |
20 | 20 | $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-cc_form_container')); |
21 | 21 | |
22 | 22 | $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-cc_form_form', 'class' => 'payflowpro_gateway-cc_form_column')); |
23 | | - $form .= parent::generatePersonalContainerTop(); |
| 23 | + $form .= Xml::Tags( 'p', array( 'id' => 'payflowpro_gateway-cc_otherways' ), wfMsg( 'payflowpro_gateway-otherways' )); |
| 24 | + $form .= parent::generatePersonalContainerTop(); |
24 | 25 | $form .= parent::generatePersonalFields(); |
25 | 26 | $form .= Xml::closeElement( 'table' ); |
26 | 27 | $form .= Xml::closeElement( 'div' ); |
— | — | @@ -36,11 +37,12 @@ |
37 | 38 | $form = parent::generateFormSubmit(); |
38 | 39 | |
39 | 40 | $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-cc_form_letter', 'class' => 'payflowpro_gateway-cc_form_column')); |
40 | | - |
| 41 | + $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-cc_form_letter_inside' )); |
41 | 42 | $text_template = $wgRequest->getText( 'text_template' ); |
42 | 43 | if ( $wgRequest->getText( 'language' )) $text_template .= '/' . $wgRequest->getText( 'language' ); |
43 | 44 | |
44 | 45 | $form .= ( strlen( $text_template )) ? $wgOut->parse( '{{'.$text_template.'}}' ) : ''; |
| 46 | + $form .= Xml::closeElement( 'div' ); |
45 | 47 | $form .= Xml::closeElement( 'div' ); |
46 | 48 | |
47 | 49 | $form .=Xml::closeElement( 'div' ); |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.i18n.php |
— | — | @@ -13,7 +13,8 @@ |
14 | 14 | 'payflowprogateway' => 'Support Wikimedia', |
15 | 15 | 'payflowpro_gateway-desc' => 'PayPal Payflow Pro credit card processing', |
16 | 16 | 'payflowpro_gateway-accessible' => 'This page is only accessible from the donation page.', |
17 | | -# 'payflowpro_gateway-form-message' => '', |
| 17 | + 'payflowpro_gateway-form-message' => 'Use the form below to donate with a credit card, or ', |
| 18 | + 'payflowpro_gateway-paypal-button' => 'Donate via PayPal', |
18 | 19 | 'payflowpro_gateway-form-message-2' => 'To change amount or currency, return to <a href="https://www.mediawiki.org/index.php?title=Donate">the donation page</a>', |
19 | 20 | 'payflowpro_gateway-donor-legend' => 'Donor information', |
20 | 21 | 'payflowpro_gateway-card-legend' => 'Credit card information', |
— | — | @@ -94,8 +95,8 @@ |
95 | 96 | In some instances, the code is located on the left side of the card, but is always above the account number.</p><br />', |
96 | 97 | 'payflowpro_gateway-question-comment' => 'Questions or comments? Contact: <a href="mailto:donate@wikimedia.org">donate@wikimedia.org</a>', |
97 | 98 | 'payflowpro_gateway-donate-click' => 'After clicking "{{int:payflowpro_gateway-donor-submit}}", your credit card information will be processed.', |
98 | | - 'payflowpro_gateway-credit-storage-processing' => 'There are <a href="http://wikimediafoundation.org/wiki/Ways_to_Give/en">other ways to give, including PayPal, check, or mail</a>.<br /> |
99 | | -We do not store your credit card information, and your personal data is subject to our <a href="http://wikimediafoundation.org/wiki/Donor_Privacy_Policy">privacy policy</a>.', |
| 99 | + 'payflowpro_gateway-otherways' => 'There are <a href="http://wikimediafoundation.org/wiki/Ways_to_Give/en">other ways to give, including PayPal, check, or mail</a>.', |
| 100 | + 'payflowpro_gateway-credit-storage-processing' => 'We do not store your credit card information, and your personal data is subject to our <a href="http://wikimediafoundation.org/wiki/Donor_Privacy_Policy">privacy policy</a>.', |
100 | 101 | 'donate_interface-GBP' => 'GBP: British Pound', |
101 | 102 | 'donate_interface-EUR' => 'EUR: Euro', |
102 | 103 | 'donate_interface-USD' => 'USD: U.S. Dollar', |
— | — | @@ -103,7 +104,7 @@ |
104 | 105 | 'donate_interface-CAD' => 'CAD: Canadian Dollar', |
105 | 106 | 'donate_interface-JPY' => 'JPY: Japanese Yen', |
106 | 107 | 'payflowpro_gateway-token-mismatch' => 'Your session has expired. Please try filling out and submitting the form again.', |
107 | | - 'payflowpro_gateway-cc-form-header-personal' => 'Personal information', |
| 108 | + 'payflowpro_gateway-cc-form-header-personal' => 'Billing information', |
108 | 109 | 'payflowpro_gateway-cc-form-header-payment' => 'Payment information', |
109 | 110 | ); |
110 | 111 | |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.php |
— | — | @@ -85,6 +85,28 @@ |
86 | 86 | $wgPayflowGatewayUseHTTPProxy = FALSE; |
87 | 87 | $wgPayflowGatewayHTTPProxy = ''; |
88 | 88 | |
| 89 | +/** |
| 90 | + * Hooks required to interface with the donation extension (include <donate> on page) |
| 91 | + * |
| 92 | + * gwValue supplies the value of the form option, the name that appears on the form |
| 93 | + * and the currencies supported by the gateway in the $values array |
| 94 | + */ |
| 95 | +$wgHooks['DonationInterface_Value'][] = 'pfpGatewayValue'; |
| 96 | +$wgHooks['DonationInterface_Page'][] = 'pfpGatewayPage'; |
| 97 | +$wgUseAjax = true; |
| 98 | +$wgAjaxExportList[] = 'efPayflowGatewayCheckSession'; |
| 99 | + |
| 100 | +/** |
| 101 | + * Return whether or not payflowEditToken is set in the session |
| 102 | + */ |
| 103 | +function efPayflowGatewayCheckSession() { |
| 104 | + $token_set = ( isset( $_SESSION[ 'payflowEditToken' ] )) ? 'yes' : 'no'; |
| 105 | + $ajax = new AjaxResponse( $token_set ); |
| 106 | + // if we don't explicitly set the content type, things break |
| 107 | + $ajax->setContentType( 'text/plain' ); |
| 108 | + return $ajax; |
| 109 | +} |
| 110 | + |
89 | 111 | function payflowGatewayConnection() { |
90 | 112 | global $wgPayflowGatewayDBserver, $wgPayflowGatewayDBname; |
91 | 113 | global $wgPayflowGatewayDBuser, $wgPayflowGatewayDBpassword; |
— | — | @@ -103,14 +125,6 @@ |
104 | 126 | return $db; |
105 | 127 | } |
106 | 128 | |
107 | | -/** |
108 | | - * Hooks required to interface with the donation extension (include <donate> on page) |
109 | | - * |
110 | | - * gwValue supplies the value of the form option, the name that appears on the form |
111 | | - * and the currencies supported by the gateway in the $values array |
112 | | - */ |
113 | | -$wgHooks['DonationInterface_Value'][] = 'pfpGatewayValue'; |
114 | | -$wgHooks['DonationInterface_Page'][] = 'pfpGatewayPage'; |
115 | 129 | |
116 | 130 | /** |
117 | 131 | * Hook to register form value and display name of this gateway |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.css |
— | — | @@ -48,13 +48,6 @@ |
49 | 49 | text-align: left; |
50 | 50 | } |
51 | 51 | |
52 | | -/* |
53 | | -#payflow-table-donor label { |
54 | | - text-align: right; |
55 | | - display: block; |
56 | | -} |
57 | | -*/ |
58 | | - |
59 | 52 | #payflowpro_gateway-donate-addl-info { |
60 | 53 | clear: both; |
61 | 54 | } |
— | — | @@ -86,3 +79,7 @@ |
87 | 80 | vertical-align:middle; |
88 | 81 | width:204px; |
89 | 82 | } |
| 83 | + |
| 84 | +#ca-special { |
| 85 | + display: none; |
| 86 | +} |