Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/html/webitects_2_2step-US.html |
— | — | @@ -0,0 +1,215 @@ |
| 2 | +<script type="text/javascript"> |
| 3 | + mw.loader.load('pfp.form.rapidhtml.webitects_2step'); |
| 4 | + // these must go through RapidHTML and thus are inline |
| 5 | + var amountErrors = ['#general|escape','#retryMsg|escape','#amount|escape']; |
| 6 | + var billingErrors = ['#fname|escape','#lname|escape','#city|escape','#country|escape','#street|escape','#state|escape','#zip|escape','#emailAdd|escape']; |
| 7 | + var paymentErrors = ['#card_num|escape','#card_type|escape','#cvv|escape']; |
| 8 | + var actionURL = "@action"; |
| 9 | + var scriptPath = "@script_path"; |
| 10 | +</script> |
| 11 | +<!--[if lt IE 7]> |
| 12 | +<script type="text/javascript"> |
| 13 | + mw.loader.load('pfp.form.rapidhtml.webitects.ie6'); |
| 14 | +</script> |
| 15 | +<style type="text/css"> |
| 16 | + body{ |
| 17 | + behavior: url("@script_path/skins/vector/csshover.min.htc"); |
| 18 | + } |
| 19 | +</style><![endif]--> |
| 20 | +<!--[if IE 7]> |
| 21 | +<style> |
| 22 | + .gainlayout { |
| 23 | + zoom: 1; |
| 24 | + height: 1%; |
| 25 | + } |
| 26 | +</style> |
| 27 | +<![endif]--> |
| 28 | + |
| 29 | +<div class="ltr"> |
| 30 | + <table id="layouttable"> |
| 31 | + <tr> |
| 32 | + <td> |
| 33 | + <div id="appeal"> |
| 34 | + <div id="appeal-content"> |
| 35 | + <h2 id="appeal-head"> <span class="mw-headline">{{LanguageSwitch|2011FR/@appeal-title|@language}}</span></h2> |
| 36 | + <div id="appeal-body" class="plainlinks">{{LanguageSwitch|2011FR/@appeal|@language}}</div> |
| 37 | + </div> |
| 38 | + </div> |
| 39 | + </td> |
| 40 | + |
| 41 | + <td> |
| 42 | + <div id="donate"> |
| 43 | + <div id="donate-content"> |
| 44 | + <div id="donate-body" style="padding: 0 1em;"> |
| 45 | + <div id="step1header"><h3>%donate_interface-amount-legend% <span id="selected-amount"></span> <span class="mute" id="change-amount" style="display: none;">(<a href="#">%donate_interface-change%</a>)</span></h3></div> |
| 46 | + |
| 47 | + <form method="post" name="paypalcontribution"> |
| 48 | + <div id="step1wrapper"> |
| 49 | + <div id="amtErrorMessages" class="small"></div> |
| 50 | + <table id="amount-table-white"> |
| 51 | + <tr> |
| 52 | + <td><label><input id="amountRadio0" type="radio" name="amountRadio" value="5" /> <span id="amountSpan0">$5</span></label></td> |
| 53 | + <td><label><input id="amountRadio1" type="radio" name="amountRadio" value="10" /> <span id="amountSpan1">$10</span></label></td> |
| 54 | + <td><label><input id="amountRadio2" type="radio" name="amountRadio" value="20" /> <span id="amountSpan2">$20</span></label></td> |
| 55 | + <td><label><input id="amountRadio3" type="radio" name="amountRadio" value="50" /> <span id="amountSpan3">$50</span></label></td> |
| 56 | + </tr> |
| 57 | + <tr> |
| 58 | + <td><label><input id="amountRadio4" type="radio" name="amountRadio" value="75" /> <span id="amountSpan4">$75</span></label></td> |
| 59 | + <td><label><input id="amountRadio5" type="radio" name="amountRadio" value="100" /> <span id="amountSpan5">$100</span></label></td> |
| 60 | + <td><label><input id="amountRadio6" type="radio" name="amountRadio" value="250" /> <span id="amountSpan6">$250</span></label></td> |
| 61 | + <td><input type="radio" name="amountRadio" id="input_amount_other" value="other" /> <label><span id="amountSpanOther">$</span><input type="text" class="txt-sm hint" name="amountGiven" size="4" id="other-amount" title="%donate_interface-other%" placeholder="%donate_interface-other%" onfocus="this.form.input_amount_other.checked=true;"/></label></td> |
| 62 | + </tr> |
| 63 | + </table> |
| 64 | + |
| 65 | + <p class="donate-options"> |
| 66 | + <input class="btn" id="cc" type="button" value="%donate_interface-cc-button%" /><br /> |
| 67 | + <input class="btn" id="pp" type="button" value="%donate_interface-paypal-button%"/><span id='loading'></span> |
| 68 | + </p> |
| 69 | + </div> |
| 70 | + <div id="step2header"><h3>%donate_interface-billing-address% <span class="mute" id="change-billing" style="display: none;">(<a href="#">%donate_interface-change%</a>)</span></h3></div> |
| 71 | + <div id="step2wrapper"> |
| 72 | + <div id="billing-content" class="gainlayout"> |
| 73 | + <div id="billingErrorMessages" class="small"></div> |
| 74 | + <div id="paymentErrorMessages" class="small"></div> |
| 75 | + <div class="name-fields"> |
| 76 | + <span class="name-first"><input class="txt" id="fname" name="fname" title="%donate_interface-donor-fname%" value="@fname" placeholder="%donate_interface-donor-fname%"/></span> |
| 77 | + <span class="name-last"><input class="txt" id="lname" name="lname" title="%donate_interface-donor-lname%" value="@lname" placeholder="%donate_interface-donor-lname%"/></span> |
| 78 | + </div> |
| 79 | + <div class="loc-fields"> |
| 80 | + <span class="loc-street"><input class="txt" id="street" name="street" title="%donate_interface-donor-street%" value="@street" placeholder="%donate_interface-donor-street%"/></span> |
| 81 | + <span class="loc-city"><input class="txt" id="city" name="city" title="%donate_interface-donor-city%" value="@city" placeholder="%donate_interface-donor-city%"/></span> |
| 82 | + <span class="loc-state"> |
| 83 | + <select id="state" name="state" class="txt" value="@state" > |
| 84 | + <option value=""></option> |
| 85 | + <option value="AK">AK</option><option value="AL">AL</option><option value="AR">AR</option><option value="AZ">AZ</option><option value="CA">CA</option><option value="CO">CO</option><option value="CT">CT</option><option value="DC">DC</option><option value="DE">DE</option><option value="FL">FL</option><option value="GA">GA</option><option value="HI">HI</option><option value="IA">IA</option><option value="ID">ID</option><option value="IL">IL</option><option value="IN">IN</option><option value="KS">KS</option><option value="KY">KY</option><option value="LA">LA</option><option value="MA">MA</option><option value="MD">MD</option><option value="ME">ME</option><option value="MI">MI</option><option value="MN">MN</option><option value="MO">MO</option><option value="MS">MS</option><option value="MT">MT</option><option value="NC">NC</option><option value="ND">ND</option><option value="NE">NE</option><option value="NH">NH</option><option value="NJ">NJ</option><option value="NM">NM</option><option value="NV">NV</option><option value="NY">NY</option><option value="OH">OH</option><option value="OK">OK</option><option value="OR">OR</option><option value="PA">PA</option><option value="PR">PR</option><option value="RI">RI</option><option value="SC">SC</option><option value="SD">SD</option><option value="TN">TN</option><option value="TX">TX</option><option value="UT">UT</option><option value="VA">VA</option><option value="VT">VT</option><option value="WA">WA</option><option value="WI">WI</option><option value="WV">WV</option><option value="WY">WY</option><option value="AA">AA</option><option value="AE">AE</option><option value="AP">AP</option> |
| 86 | + </select> |
| 87 | + </span> |
| 88 | + <span class="loc-postal"><input class="txt" id="zip" name="zip" title="%donate_interface-zip%" value="@zip" placeholder="%donate_interface-zip%"/></span> <!-- TODO: use postal code on non-US --> |
| 89 | + </div> |
| 90 | + <p><input class="txt" title="%donate_interface-donor-email%" id="emailAdd" name="emailAdd" value="@emailAdd" placeholder="%donate_interface-donor-email%"/></p> |
| 91 | + |
| 92 | + |
| 93 | + <dl class=""> |
| 94 | + <dt><span class="label">Select credit card</span></dt> |
| 95 | + <dd class="field" style="margin-bottom: 0;"> |
| 96 | + <ul class="options-h" id="cards" style="margin: 0;"> |
| 97 | + <li><input id="cc-visa" name="cardtype" type="radio" value="Visa" class="cardradio" /> <label for="cc-visa"><img alt="Visa" src="@script_path/extensions/DonationInterface/gateway_forms/includes/card-visa.png" /></label></li> |
| 98 | + <li><input id="cc-mastercard" name="cardtype" type="radio" value="MasterCard" class="cardradio" /> <label for="cc-mastercard"><img alt="MasterCard" src="@script_path/extensions/DonationInterface/gateway_forms/includes/card-mastercard.png" /></label></li> |
| 99 | + <li><input id="cc-amex" name="cardtype" type="radio" value="American Express" class="cardradio" /> <label for="cc-amex"><img alt="American Express" src="@script_path/extensions/DonationInterface/gateway_forms/includes/card-amex.png" /></label></li> |
| 100 | + <li><input id="cc-discover" name="cardtype" type="radio" value="Discover" class="cardradio" /> <label for="cc-discover"><img alt="Discover" src="@script_path/extensions/DonationInterface/gateway_forms/includes/card-discover.png" /></label></li> |
| 101 | + </ul> |
| 102 | + </dd> |
| 103 | + </dl> |
| 104 | + </div> |
| 105 | + <!--</div>--> |
| 106 | + <!--<div id="step3header"><h3>Payment Information <span class="mute" id="change-payment" style="display: none;">(<a href="#">Change</a>)</span></h3></div>--> |
| 107 | + <!--<div id="step3wrapper" style="display: none;">--> |
| 108 | + <div id="payment" class="gainlayout"> |
| 109 | + |
| 110 | + <dl class="form"> |
| 111 | + <dt><span class="label"><label for="card_num">Card number</label></span></dt> |
| 112 | + <dd class="field"><input class="txt" id="card_num" name="card_num" value="@card_num"/></dd> |
| 113 | + |
| 114 | + <dt></dt> |
| 115 | + <dd class="field"> |
| 116 | + <div class="l" style="margin-right: 5%;"> |
| 117 | + <span class="label">Expiration date</span> |
| 118 | + <select id="mos" name="mos"> |
| 119 | + <option value="">Month</option> |
| 120 | + <option value="01">01 - January</option> |
| 121 | + <option value="02">02 - February</option> |
| 122 | + <option value="03">03 - March</option> |
| 123 | + <option value="04">04 - April</option> |
| 124 | + <option value="05">05 - May</option> |
| 125 | + <option value="06">06 - June</option> |
| 126 | + <option value="07">07 - July</option> |
| 127 | + <option value="08">08 - August</option> |
| 128 | + <option value="09">09 - September</option> |
| 129 | + <option value="10">10 - October</option> |
| 130 | + <option value="11">11 - November</option> |
| 131 | + <option value="12">12 - December</option> |
| 132 | + </select> |
| 133 | + |
| 134 | + <select id="year" name="year"> |
| 135 | + <option value="">Year</option> |
| 136 | + <option value="2011">2011</option> |
| 137 | + <option value="2012">2012</option> |
| 138 | + <option value="2013">2013</option> |
| 139 | + <option value="2014">2014</option> |
| 140 | + <option value="2015">2015</option> |
| 141 | + <option value="2016">2016</option> |
| 142 | + <option value="2017">2017</option> |
| 143 | + <option value="2018">2018</option> |
| 144 | + <option value="2019">2019</option> |
| 145 | + <option value="2020">2020</option> |
| 146 | + </select> |
| 147 | + </div> |
| 148 | + <div class="l"> |
| 149 | + <label class="label" for="cvv">Security code</label> |
| 150 | + <input class="txt-sm" id="cvv" name="cvv" value="@cvv"/> |
| 151 | + <a class="mute" href="#" id="where">Where?</a> |
| 152 | + </div> |
| 153 | + |
| 154 | + <div class="clear" id="codes" style="display: none;"><img alt="Security codes" src="@script_path/extensions/DonationInterface/gateway_forms/includes/security-code.png" /></div> |
| 155 | + </dd> |
| 156 | + |
| 157 | + <dt></dt> |
| 158 | + <dd class="field"> |
| 159 | + <input id="submitcreditcard" class="btn" type="button" value="Submit donation" /> |
| 160 | + <p class="mute"><img alt="" src="@script_path/extensions/DonationInterface/gateway_forms/includes/padlock.gif" /> Your credit card will be securely processed.</p> |
| 161 | + </dd> |
| 162 | + </dl> |
| 163 | + </div> |
| 164 | + </div> |
| 165 | + |
| 166 | + <input type="hidden" name="gateway" value="payflowpro" id="gateway" /> |
| 167 | + <input type="hidden" name="returnto" value="Thank_You/en" /> |
| 168 | + <input type="hidden" value="0" name="PaypalRedirect" id="PaypalRedirect"> |
| 169 | + <input type="hidden" value="@card" name="card" id="card"> |
| 170 | + |
| 171 | + <input type="hidden" value="@amount" name="amount" /> |
| 172 | + <input type="hidden" value="US" name="country" id="country" /> |
| 173 | + <input type="hidden" value="@expiration" name="expiration" id="expiration"/> |
| 174 | + <input type="hidden" value="@currency_code" name="currency_code" /> |
| 175 | + <input type="hidden" value="@utm_source" name="utm_source"/> |
| 176 | + <input type="hidden" value="@utm_medium" name="utm_medium"/> |
| 177 | + <input type="hidden" value="@utm_campaign" name="utm_campaign"/> |
| 178 | + <input type="hidden" value="@language" name="language"/> |
| 179 | + <input type="hidden" value="@referrer" name="referrer"/> |
| 180 | + <input type="hidden" value="@comment" name="comment"/> |
| 181 | + <input type="hidden" value="@comment-option" name="comment-option"/> |
| 182 | + <input type="hidden" value="@email-opt" name="email-opt"/> |
| 183 | + <input type="hidden" value="processed" name="payment_method"/> |
| 184 | + <input type="hidden" value="@token" name="token"/> |
| 185 | + <input type="hidden" value="@order_id" name="order_id"/> |
| 186 | + <input type="hidden" value="@numAttempt" name="numAttempt"/> |
| 187 | + <input type="hidden" value="@contribution_tracking_id" name="contribution_tracking_id"/> |
| 188 | + <input type="hidden" value="@data_hash" name="data_hash"/> |
| 189 | + <input type="hidden" value="@owa_session" name="owa_session"/> |
| 190 | + <input type="hidden" value="@owa_ref" name="owa_ref"/> |
| 191 | + <!-- new required fields --> |
| 192 | + <input type="hidden" value="@gateway" name="gateway"/> |
| 193 | + <input type="hidden" value="@payment_method" name="payment_method"/> |
| 194 | + </form> |
| 195 | + <div id="where-content"> |
| 196 | + {{LanguageSwitch|2011FR/core-appeal-whitebox-nodiv|@language}} |
| 197 | + </div> |
| 198 | + </div> |
| 199 | + </div> |
| 200 | + <p id="informationsharing">%donate_interface-informationsharing%</p> |
| 201 | + <!-- TODO: links inside the message or not? --> |
| 202 | + <ul id="moreinfolinks"> |
| 203 | + <li><a href="http://wikimediafoundation.org/wiki/Monthly_donations/en/US">%donate_interface-monthly-donation%</a></li><!-- TODO: localize the link --> |
| 204 | + <li>%donate_interface-otherways-short%</li><!-- TODO: localize the link --> |
| 205 | + <li><a href="http://wikimediafoundation.org/wiki/FAQ/en">%donate_interface-faqs%</a></li><!-- TODO: localize the link --> |
| 206 | + <!--<li><a href="">%donate_interface-tax-info%</a></li>--><!-- TODO: localize the link --> |
| 207 | + </ul> |
| 208 | + </div> |
| 209 | + </td> |
| 210 | + </tr> |
| 211 | + </table> |
| 212 | +</div> |
| 213 | + |
| 214 | +<!-- Wikimedia Project logo |
| 215 | +<li id="footer-copyrightico"><a href="https://www.mediawiki.org//wikimediafoundation.org/"><img src="//bits.wikimedia.org/images/wikimedia-button.png" width="88" height="31" alt="Wikimedia Foundation"/></a></li> |
| 216 | + --> |
Property changes on: trunk/extensions/DonationInterface/payflowpro_gateway/forms/html/webitects_2_2step-US.html |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 217 | + native |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/js/webitects_2_2step.js |
— | — | @@ -0,0 +1,216 @@ |
| 2 | +/* |
| 3 | + * The following variable are declared inline in webitects_2_3step.html: |
| 4 | + * amountErrors, billingErrors, paymentErrors, scriptPath, actionURL |
| 5 | + */ |
| 6 | +$( document ).ready( function () { |
| 7 | + |
| 8 | + // check for RapidHtml errors and display, if any |
| 9 | + var amountErrorString = "", |
| 10 | + billingErrorString = "", |
| 11 | + paymentErrorString = ""; |
| 12 | + |
| 13 | + // generate formatted errors to display |
| 14 | + var temp = []; |
| 15 | + for ( var e in amountErrors ) |
| 16 | + if ( amountErrors[e] != "" ) |
| 17 | + temp[temp.length] = amountErrors[e]; |
| 18 | + amountErrorString = temp.join( "<br />" ); |
| 19 | + |
| 20 | + temp = []; |
| 21 | + for ( var f in billingErrors ) |
| 22 | + if ( billingErrors[f] != "" ) |
| 23 | + temp[temp.length] = billingErrors[f]; |
| 24 | + billingErrorString = temp.join( "<br />" ); |
| 25 | + |
| 26 | + temp = []; |
| 27 | + for ( var g in paymentErrors ) |
| 28 | + if ( paymentErrors[g] != "" ) |
| 29 | + temp[temp.length] = paymentErrors[g]; |
| 30 | + paymentErrorString = temp.join( "<br />" ); |
| 31 | + |
| 32 | + // show the errors |
| 33 | + var prevError = false; |
| 34 | + if ( amountErrorString != "" ) { |
| 35 | + $( "#amtErrorMessages" ).html( amountErrorString ); |
| 36 | + prevError = true; |
| 37 | + showStep2(); // init the headers |
| 38 | +// showStep3(); |
| 39 | + showStep1(); // should be default, but ensure |
| 40 | + } |
| 41 | + if ( billingErrorString != "" ) { |
| 42 | + $( "#billingErrorMessages" ).html( billingErrorString ); |
| 43 | + if ( !prevError ) { |
| 44 | + showStep1(); // init the headers |
| 45 | +// showStep3(); |
| 46 | + showStep2(); |
| 47 | + prevError = true; |
| 48 | + } |
| 49 | + showAmount( $( 'input[name="amount"]' ) ); // lets go ahead and assume there is something to show |
| 50 | + } |
| 51 | + if ( paymentErrorString != "" ) { |
| 52 | + $( "#paymentErrorMessages" ).html( paymentErrorString ); |
| 53 | + if ( !prevError ) { |
| 54 | + showStep1(); // init the headers |
| 55 | + showStep2(); |
| 56 | +// showStep3(); |
| 57 | + } |
| 58 | + showAmount( $( 'input[name="amount"]' ) ); // lets go ahead and assume there is something to show |
| 59 | + } |
| 60 | + |
| 61 | + $( "#cc" ).click( function() { |
| 62 | + if ( validateAmount() ) { |
| 63 | + showAmount( $( 'input[name="amount"]' ) ); |
| 64 | + showStep2(); |
| 65 | + } |
| 66 | + } ); |
| 67 | + |
| 68 | + $( "#pp" ).click( function() { |
| 69 | + if ( validateAmount() ) { |
| 70 | + // set the action to go to PayPal |
| 71 | + $( 'input[name="gateway"]' ).val( "paypal" ); |
| 72 | + $( 'input[name="PaypalRedirect"]' ).val( "1" ); |
| 73 | + $( "#loading" ).html( "<img src=" + scriptPath + "'/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/images/loading-white.gif' /> Redirecting to PayPal…" ); |
| 74 | + document.paypalcontribution.action = actionURL; |
| 75 | + document.paypalcontribution.submit(); |
| 76 | + } |
| 77 | + } ); |
| 78 | +// $( "#paymentContinueBtn" ).live( "click", function() { |
| 79 | +// if ( validate_personal( document.paypalcontribution ) ) { |
| 80 | +// showStep3(); |
| 81 | +// } |
| 82 | +// } ); |
| 83 | + // Set the cards to progress to step 3 |
| 84 | +// $( ".cardradio" ).live( "click", function() { |
| 85 | +// if ( validate_personal( document.paypalcontribution ) ) { |
| 86 | +// showStep3(); |
| 87 | +// } |
| 88 | +// else { |
| 89 | + // show the continue button to indicate how to get to step 3 since they |
| 90 | + // have already clicked on a card image |
| 91 | +// $( "#paymentContinue" ).show(); |
| 92 | +// } |
| 93 | +// } ); |
| 94 | + |
| 95 | + $( "#submitcreditcard" ).click( function() { |
| 96 | + if ( validate_personal( document.paypalcontribution ) && validate_cc() ) { |
| 97 | + // set the hidden expiration date input from the two selects |
| 98 | + $( 'input[name="expiration"]' ).val( |
| 99 | + $( 'select[name="mos"]' ).val() + $( 'select[name="year"]' ).val().substring( 2, 4 ) |
| 100 | + ); |
| 101 | + document.paypalcontribution.action = actionURL; |
| 102 | + document.paypalcontribution.submit(); |
| 103 | + } |
| 104 | + } ); |
| 105 | + // init all of the header actions |
| 106 | + $( "#step1header" ).click( function() { |
| 107 | + showStep1(); |
| 108 | + } ); |
| 109 | + $( "#step2header" ).click( function() { |
| 110 | + showStep2(); |
| 111 | + } ); |
| 112 | + // Set selected amount to amount |
| 113 | + $( 'input[name="amountRadio"]' ).click( function() { |
| 114 | + setAmount( $( this ) ); |
| 115 | + } ); |
| 116 | + // reset the amount field when "other" is changed |
| 117 | + $( "#other-amount" ).change( function() { |
| 118 | + setAmount( $( this ) ); |
| 119 | + } ); |
| 120 | + |
| 121 | + // show the CVV help image on click |
| 122 | + $( "#where" ).click( function() { |
| 123 | + $( "#codes" ).toggle(); |
| 124 | + return false; |
| 125 | + } ); |
| 126 | + |
| 127 | +} ); |
| 128 | + |
| 129 | +function showStep1() { |
| 130 | + // show the correct sections |
| 131 | + $( "#step1wrapper" ).slideDown(); |
| 132 | + $( "#step2wrapper" ).slideUp(); |
| 133 | + $( "#change-amount" ).hide(); |
| 134 | + $( "#change-billing" ).show(); |
| 135 | + $( "#step1header" ).show(); // just in case |
| 136 | +} |
| 137 | + |
| 138 | +function showStep2() { |
| 139 | + // show the correct sections |
| 140 | + $( "#step1wrapper" ).slideUp(); |
| 141 | + $( "#step2wrapper" ).slideDown(); |
| 142 | + $( "#change-amount" ).show(); |
| 143 | + $( "#change-billing" ).hide(); |
| 144 | + $( "#step2header" ).show(); // just in case |
| 145 | +} |
| 146 | + |
| 147 | +// Fix behavior of images in labels |
| 148 | +// TODO: check that disabling this is okay in things other than Chrome |
| 149 | +// $("label img").live("click", function() { $("#" + $(this).parents( "label" ).attr( "for" )).click(); }); |
| 150 | + |
| 151 | +// set the hidden amount input to the value of the selected element |
| 152 | +function setAmount( e ) { |
| 153 | + $( 'input[name="amount"]' ).val( e.val() ); |
| 154 | +} |
| 155 | +// Display selected amount |
| 156 | +function showAmount( e ) { |
| 157 | + $( "#selected-amount" ).html( "($" + e.val() + ")" ); |
| 158 | + $( "#change-amount" ).show(); |
| 159 | +} |
| 160 | +function validateAmount() { |
| 161 | + |
| 162 | + // TODO: THIS NEEDS TO BE REPLACED WITH KALDARI'S CURRENCIES |
| 163 | + var minimums = { |
| 164 | + 'USD' : 1, |
| 165 | + 'CAD' : 1 |
| 166 | + }; |
| 167 | + var error = true; |
| 168 | + var amount = $( 'input[name="amount"]' ).val(); // get the amount |
| 169 | + amount = amount.replace( /[,.](\d)$/, '\:$10' ); |
| 170 | + amount = amount.replace( /[,.](\d)(\d)$/, '\:$1$2' ); |
| 171 | + amount = amount.replace( /[,.]/g, '' ); |
| 172 | + amount = amount.replace( /:/, '.' ); |
| 173 | + $( 'input[name="amount"]' ).val( amount ); // set the new amount back into the form |
| 174 | + |
| 175 | + // Check amount is a real number, sets error as true (good) if no issues |
| 176 | + error = ( amount == null || isNaN( amount ) || amount.value <= 0 ); |
| 177 | + |
| 178 | + // Check amount is at least the minimum |
| 179 | + var currency_code = $( 'input[name="currency_code"]' ).val(); |
| 180 | + if ( typeof( minimums[currency_code] ) == 'undefined' ) { |
| 181 | + minimums[currency_code] = 1; |
| 182 | + } |
| 183 | + if ( amount < minimums[currency_code] || error ) { |
| 184 | + alert( 'You must contribute at least $1'.replace( '$1', minimums[currency_code] + ' ' + currency_code ) ); |
| 185 | + error = true; |
| 186 | + } |
| 187 | + return !error; |
| 188 | +} |
| 189 | + |
| 190 | +function validate_cc() { |
| 191 | + // reset the errors |
| 192 | + $( "#paymentErrorMessages" ).html( '' ); |
| 193 | + var error = false; |
| 194 | + if ( $( 'input[name="card_num"]' ).val() == '' ) { |
| 195 | + $( "#paymentErrorMessages" ).append( "Please enter a valid credit card number" ); |
| 196 | + error = true; |
| 197 | + } |
| 198 | + if ( $( 'select[name="mos"]' ).val() == '' ) { |
| 199 | + if ( $( "#paymentErrorMessages" ).html() != "" ) |
| 200 | + $( "#paymentErrorMessages" ).append( "<br />" ); |
| 201 | + $( "#paymentErrorMessages" ).append( "Please enter a valid month for the expiration date" ); |
| 202 | + error = true; |
| 203 | + } |
| 204 | + if ( $( 'select[name="year"]' ).val() == '' ) { |
| 205 | + if ( $( "#paymentErrorMessages" ).html() != "" ) |
| 206 | + $( "#paymentErrorMessages" ).append( "<br />" ); |
| 207 | + $( "#paymentErrorMessages" ).append( "Please enter a valid year for the expiration date" ); |
| 208 | + error = true; |
| 209 | + } |
| 210 | + if ( $( 'input[name="cvv"]' ).val() == '' ) { |
| 211 | + if ( $( "#paymentErrorMessages" ).html() != "" ) |
| 212 | + $( "#paymentErrorMessages" ).append( "<br />" ); |
| 213 | + $( "#paymentErrorMessages" ).append( "Please enter a valid security code" ); |
| 214 | + error = true; |
| 215 | + } |
| 216 | + return !error; |
| 217 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/DonationInterface/payflowpro_gateway/forms/js/webitects_2_2step.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 218 | + native |
Index: trunk/extensions/DonationInterface/gateway_forms/rapidhtml/RapidHtmlResources.php |
— | — | @@ -108,6 +108,16 @@ |
109 | 109 | 'localBasePath' => dirname( __FILE__ ).'/../../payflowpro_gateway/forms', |
110 | 110 | 'remoteExtPath' => $wgPayflowRapidHtmlRemoteExtPath, |
111 | 111 | ); |
| 112 | +$wgResourceModules[ 'pfp.form.rapidhtml.webitects_2step' ] = array( |
| 113 | + 'styles' => '', |
| 114 | + 'scripts' => 'js/webitects_2_2step.js', |
| 115 | + 'dependencies' => array( |
| 116 | + 'di.form.rapidhtml.webitects', |
| 117 | + 'pfp.form.core.validate' |
| 118 | + ), |
| 119 | + 'localBasePath' => dirname( __FILE__ ).'/../../payflowpro_gateway/forms', |
| 120 | + 'remoteExtPath' => $wgPayflowRapidHtmlRemoteExtPath, |
| 121 | +); |
112 | 122 | $wgResourceModules[ 'pfp.form.rapidhtml.webitects.ie6' ] = array( |
113 | 123 | 'dependencies' => array( |
114 | 124 | 'di.form.rapidhtml.webitects.ie6', |