r100395 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100394‎ | r100395 | r100396 >
Date:23:58, 20 October 2011
Author:kaldari
Status:ok
Tags:fundraising 
Comment:
beginning to create version of webitects_2_3step form for globalcollect
Modified paths:
  • /trunk/extensions/DonationInterface/gateway_common/donation.api.php (modified) (history)
  • /trunk/extensions/DonationInterface/gateway_forms/rapidhtml/RapidHtmlResources.php (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects_2_3step.js (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/gateway_forms/rapidhtml/RapidHtmlResources.php
@@ -5,7 +5,7 @@
66 * This file is included in DonationInterfa/payflowpro_gateway.php
77 */
88
9 -$wgPayflowRapidHtmlRemoteExtPath = 'DonationInterface/payflowpro_gateway/forms/rapidhtml';
 9+$wgPayflowRapidHtmlRemoteExtPath = 'DonationInterface/gateway_forms/rapidhtml';
1010
1111 /**
1212 * LIGHTBOX
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects_2_3step.js
@@ -84,7 +84,50 @@
8585 // Set the cards to progress to step 3
8686 $( ".cardradio" ).live( "click", function() {
8787 if ( validate_personal( document.paypalcontribution ) ) {
88 - showStep3();
 88+ var language = 'en'; // default value
 89+ var matches = document.location.href.match(/uselang=(\w+)/i);
 90+ if ( matches[1] ) {
 91+ language = matches[1];
 92+ }
 93+ var sendData = {
 94+ 'action': 'donate',
 95+ 'gateway': 'globalcollect',
 96+ 'currency': 'USD',
 97+ 'amount': $( "input[name='amount']" ).val(),
 98+ 'fname': $( "input[name='fname']" ).val(),
 99+ 'lname': $( "input[name='lname']" ).val(),
 100+ 'street': $( "input[name='street']" ).val(),
 101+ 'city': $( "input[name='city']" ).val(),
 102+ 'state': $( "input[name='state']" ).val(),
 103+ 'zip': $( "input[name='zip']" ).val(),
 104+ 'emailAdd': $( "input[name='emailAdd']" ).val(),
 105+ 'country': $( "input[name='country']" ).val(),
 106+ 'payment_method': 'card',
 107+ 'language': language,
 108+ 'card_type': $( "input[name='cardtype']" ).val().toLowerCase(),
 109+ 'format': 'json'
 110+ };
 111+
 112+ $.ajax( {
 113+ 'url': mw.util.wikiScript( 'api' ),
 114+ 'data': sendData,
 115+ 'dataType': 'json',
 116+ 'type': 'GET',
 117+ 'success': function( data ) {
 118+ if ( data.result.errors ) {
 119+ var errors = new Array();
 120+ $.each( data.result.errors, function( index, value ) {
 121+ alert( value );
 122+ } );
 123+ } else {
 124+ if ( data.result.returnurl ) {
 125+ // Insert the iframe into the form
 126+ showStep3();
 127+ }
 128+ }
 129+ }
 130+ } );
 131+
89132 }
90133 else {
91134 // show the continue button to indicate how to get to step 3 since they
Index: trunk/extensions/DonationInterface/gateway_common/donation.api.php
@@ -49,21 +49,24 @@
5050 $outputResult = array();
5151 $outputResult['message'] = $result['message'];
5252 $outputResult['status'] = $result['status'];
53 - if ( array_key_exists( 'PAYMENT', $result['data'] )
54 - && array_key_exists( 'RETURNURL', $result['data']['PAYMENT'] ) )
55 - {
56 - $outputResult['returnurl'] = $result['data']['PAYMENT']['RETURNURL'];
 53+
 54+ if ( array_key_exists( 'data', $result ) ) {
 55+ if ( array_key_exists( 'PAYMENT', $result['data'] )
 56+ && array_key_exists( 'RETURNURL', $result['data']['PAYMENT'] ) )
 57+ {
 58+ $outputResult['returnurl'] = $result['data']['PAYMENT']['RETURNURL'];
 59+ }
 60+ if ( array_key_exists( 'FORMACTION', $result['data'] ) ) {
 61+ $outputResult['formaction'] = $result['data']['FORMACTION'];
 62+ }
 63+ if ( array_key_exists( 'RESPMSG', $result['data'] ) ) {
 64+ $outputResult['responsemsg'] = $result['data']['RESPMSG'];
 65+ }
5766 }
58 - if ( array_key_exists( 'FORMACTION', $result['data'] ) ) {
59 - $outputResult['formaction'] = $result['data']['FORMACTION'];
60 - }
61 - if ( array_key_exists( 'RESPMSG', $result['data'] ) ) {
62 - $outputResult['responsemsg'] = $result['data']['RESPMSG'];
63 - }
6467 if ( $result['errors'] ) {
6568 $outputResult['errors'] = $result['errors'];
6669 }
67 -
 70+
6871 if ( $this->donationData ) {
6972 $this->getResult()->addValue( null, 'request', $this->donationData );
7073 }

Status & tagging log