r100369 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100368‎ | r100369 | r100370 >
Date:20:39, 20 October 2011
Author:kaldari
Status:ok
Tags:fundraising 
Comment:
more API and AJAX stuff for lightbox form
Modified paths:
  • /trunk/extensions/DonationInterface/gateway_common/donation.api.php (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/css (added) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/js (added) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/forms/css/lightbox1.css (modified) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/forms/html/lightbox1.html (modified) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/forms/js/lightbox1.js (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/html/lightbox1.html
@@ -177,6 +177,7 @@
178178 <legend>Payment</legend>
179179 <div class="step-content">
180180 <div class="stuff">
 181+ <div id="card-errors"></div>
181182 <table>
182183 <tr>
183184 <td class="label">
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/css/lightbox1.css
@@ -195,7 +195,7 @@
196196 }
197197 .step-content {
198198 padding: 20px;
199 - height: 260px;
 199+ height: 280px;
200200 }
201201
202202 #steps form fieldset{
@@ -285,4 +285,12 @@
286286 bottom: 25px;
287287 right: 25px;
288288 margin: 0 !important;
 289+}
 290+#steps #card-errors {
 291+ font-size: 13px;
 292+ line-height: 15px;
 293+ color: #cc0000;
 294+}
 295+#steps #card-errors .error-msg {
 296+ margin-bottom: 1em;
289297 }
\ No newline at end of file
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/js/lightbox1.js
@@ -109,6 +109,10 @@
110110 }
111111
112112 function finalSubmit() {
 113+
 114+ // Reset the error display
 115+ $( '#card-errors' ).empty();
 116+
113117 var formErrors = false;
114118 for( var i = 1; i <= fieldsetCount; ++i ) {
115119 var error = validateStep(i);
@@ -158,16 +162,18 @@
159163 'url': mw.util.wikiScript( 'api' ),
160164 'data': sendData,
161165 'dataType': 'json',
162 - 'type': 'GET',
 166+ 'type': 'POST',
163167 'success': function( data ) {
 168+ console.debug( data );
164169 if ( data.result.errors ) {
165170 var errors = new Array();
166 - for( var key in data.result.errors ){
167 - errors.push( data.result.errors[key] );
 171+ $.each( data.result.errors, function( index, value ) {
 172+ $( '#card-errors' ).append( '<div class="error-msg">'+value+'</div>' );
 173+ } );
 174+ } else {
 175+ if ( data.result.returnurl ) {
 176+ window.location = data.result.returnurl;
168177 }
169 - alert ( errors.join( '\r\n' ) );
170 - } else {
171 - /* Load the thank you page */
172178 }
173179 }
174180 } );
Index: trunk/extensions/DonationInterface/gateway_common/donation.api.php
@@ -49,12 +49,17 @@
5050 $outputResult = array();
5151 $outputResult['message'] = $result['message'];
5252 $outputResult['status'] = $result['status'];
53 - if ( array_key_exists( 'RETURNURL', $result['data']['PAYMENT'] ) ) {
 53+ if ( array_key_exists( 'PAYMENT', $result['data'] )
 54+ && array_key_exists( 'RETURNURL', $result['data']['PAYMENT'] ) )
 55+ {
5456 $outputResult['returnurl'] = $result['data']['PAYMENT']['RETURNURL'];
5557 }
5658 if ( array_key_exists( 'FORMACTION', $result['data'] ) ) {
5759 $outputResult['formaction'] = $result['data']['FORMACTION'];
5860 }
 61+ if ( array_key_exists( 'RESPMSG', $result['data'] ) ) {
 62+ $outputResult['responsemsg'] = $result['data']['RESPMSG'];
 63+ }
5964 if ( $result['errors'] ) {
6065 $outputResult['errors'] = $result['errors'];
6166 }
@@ -111,7 +116,7 @@
112117 'fname' => 'Tester',
113118 'mname' => 'T.',
114119 'lname' => 'Testington',
115 - 'street' => '548 Market St.',
 120+ 'street' => '549 Market St.',
116121 'city' => 'San Francisco',
117122 'state' => 'CA',
118123 'zip' => '94104',

Status & tagging log