Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/html/webitects_1.html |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | html { overflow-y: scroll; } |
11 | 11 | */ |
12 | 12 | /* Accordion */ |
13 | | - #accordion h3 { background: #a4d4a6; border-bottom: 1px solid #5eac58; font-size: 1em; margin: 0; padding: 0.5em 0.9em; } |
| 13 | + #accordion h3 { background: #a4d4a6; border-bottom: 1px solid #5eac58; font-size: 1em; margin: 0; padding: 0.5em 0.9em; outline: 0; } |
14 | 14 | .accordion-content { padding: 0.9em; } |
15 | 15 | #step2accordion { display:none; } |
16 | 16 | |
— | — | @@ -77,7 +77,7 @@ |
78 | 78 | </div> |
79 | 79 | |
80 | 80 | <h3>2. Billing and payment</h3> |
81 | | - <div id="step2accordion" class="accordion-content"> |
| 81 | + <div class="accordion-content"> |
82 | 82 | <div id="errorMessages"></div> |
83 | 83 | <div class="name-fields"> |
84 | 84 | <span class="name-first"><input class="txt hint" id="fname" name="fname" title="First name" value="@fname" /></span> |
— | — | @@ -118,15 +118,15 @@ |
119 | 119 | <span class="label">Expiration date</span> |
120 | 120 | <select id="mos" name="mos"> |
121 | 121 | <option value="">Month</option> |
122 | | - <option value="1">01 - January</option> |
123 | | - <option value="2">02 - February</option> |
124 | | - <option value="3">03 - March</option> |
125 | | - <option value="4">04 - April</option> |
126 | | - <option value="5">05 - May</option> |
127 | | - <option value="6">06 - June</option> |
128 | | - <option value="7">07 - July</option> |
129 | | - <option value="8">08 - August</option> |
130 | | - <option value="9">09 - September</option> |
| 122 | + <option value="01">01 - January</option> |
| 123 | + <option value="02">02 - February</option> |
| 124 | + <option value="03">03 - March</option> |
| 125 | + <option value="04">04 - April</option> |
| 126 | + <option value="05">05 - May</option> |
| 127 | + <option value="06">06 - June</option> |
| 128 | + <option value="07">07 - July</option> |
| 129 | + <option value="08">08 - August</option> |
| 130 | + <option value="09">09 - September</option> |
131 | 131 | <option value="10">10 - October</option> |
132 | 132 | <option value="11">11 - November</option> |
133 | 133 | <option value="12">12 - December</option> |
— | — | @@ -161,12 +161,12 @@ |
162 | 162 | <p class="mute"><img alt="" src="@script_path/extensions/DonationInterface/payflowpro_gateway/includes/padlock.gif" /> Your credit card will be securely processed.</p> |
163 | 163 | </dd> |
164 | 164 | </dl> |
165 | | - <input type="hidden" name="gateway" value="payflowpro" /> |
| 165 | + <input type="hidden" name="gateway" value="payflowpro" id="gateway" /> |
166 | 166 | <input type="hidden" name="returnto" value="Thank_You/en" /> |
167 | 167 | |
168 | 168 | <input type="hidden" value="@amount" name="amount" /> |
169 | | - <input type="hidden" value="US" name="country" id="country" /> |
170 | | - |
| 169 | + <input type="hidden" value="@country" name="country" id="country" /> |
| 170 | + <input type="hidden" value="@expiration" name="expiration" /> |
171 | 171 | <input type="hidden" value="@currency_code" name="currency" /> |
172 | 172 | <input type="hidden" value="@utm_source" name="utm_source"/> |
173 | 173 | <input type="hidden" value="@utm_medium" name="utm_medium"/> |
— | — | @@ -206,6 +206,11 @@ |
207 | 207 | $j = $; |
208 | 208 | $.getScript('@script_path/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/js/jquery.ezpz_hint.min.js', function() { |
209 | 209 | $.getScript('@script_path/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/js/jquery.ui.min.js', function() { |
| 210 | + // Init accordion |
| 211 | + $("#accordion").accordion({ |
| 212 | + autoHeight: false |
| 213 | + }); |
| 214 | + |
210 | 215 | // check for RapidHtml errors and display, if any |
211 | 216 | var errors = ['#general','#retryMsg','#amount','#card_num','#card','#cvv','#fname', |
212 | 217 | '#lname','#city','#country','#street','#state','#zip','#emailAdd']; |
— | — | @@ -213,47 +218,45 @@ |
214 | 219 | var count = 0; |
215 | 220 | for( var i=0; i < errors.length; i++ ){ |
216 | 221 | if ( errors[i].length > 0 ){ |
217 | | - console.log(errors[i]); |
218 | 222 | count++; |
219 | 223 | if ( count > 1 ) |
220 | 224 | $('#errorMessages').append('<br />'); |
221 | 225 | $('#errorMessages').append(errors[i]); |
222 | 226 | } |
223 | 227 | } |
| 228 | + if( count > 0 ){ |
| 229 | + // show the second step with the error |
| 230 | + $("#accordion").accordion( "activate" , 1 ); |
| 231 | + } |
224 | 232 | // Inline labels |
225 | 233 | $(".hint").ezpz_hint(); |
226 | 234 | |
227 | | - // Init accordion |
228 | | - $("#accordion").accordion({ |
229 | | - autoHeight: false |
230 | | - }); |
231 | | - $("#cc").click(function(){ |
232 | | - console.log('Clicked: CC'); |
| 235 | + $("#cc").click(function(){ |
233 | 236 | if ( validateAmount(document.paypalcontribution) ){ |
234 | | - console.log('Amount: OK'); |
235 | | - console.log('Target: Credit Card'); |
236 | 237 | showAmount( $("input[name=amount]") ); |
237 | 238 | $("#accordion").accordion("activate", 1); |
238 | 239 | $("#change-amount").show(); |
239 | 240 | } |
240 | 241 | |
241 | 242 | }); |
242 | | - $("#pp").click(function(){ |
243 | | - console.log('Clicked: PP'); |
| 243 | + $("#pp").click(function(){ |
244 | 244 | if ( validateAmount(document.paypalcontribution) ){ |
245 | | - console.log('Amount: OK'); |
246 | | - console.log('Target: PayPal'); |
247 | 245 | // set the action to go to PayPal |
| 246 | + $("input[name=gateway]").val("paypal"); |
248 | 247 | document.paypalcontribution.action = "https://wikimediafoundation.org/wiki/Special:ContributionTracking/en"; |
249 | 248 | $("#loading").html("<img src='../images/loading.gif' /> Redirecting to PayPal...") |
250 | 249 | document.paypalcontribution.submit(); |
251 | 250 | } |
252 | 251 | }); |
253 | | - $("#submitcreditcard").click(function(){ |
254 | | - console.log('Clicked: Submit CC'); |
| 252 | + $("#submitcreditcard").click(function(){ |
| 253 | + // set country to US |
| 254 | + $("input[name=country]").val("US"); |
| 255 | + |
255 | 256 | if ( validate_form(document.paypalcontribution) ){ |
256 | | - console.log('Form: OK'); |
257 | | - console.log('Target: Submit Credit Card'); |
| 257 | + // set expiration date |
| 258 | + $("input[name=expiration]").val( |
| 259 | + $("select[name=mos]").val() + $("select[name=year]").val().substring(2,4) |
| 260 | + ) |
258 | 261 | |
259 | 262 | document.paypalcontribution.action = "@action"; |
260 | 263 | document.paypalcontribution.submit() |
— | — | @@ -295,6 +298,7 @@ |
296 | 299 | error = ( amount == null || isNaN( amount ) || amount.value <= 0 ); |
297 | 300 | // Check amount is at least the minimum |
298 | 301 | var currency = 'USD'; // hard-coded for these forms and tests |
| 302 | + $("input[name=currency]").val(currency); |
299 | 303 | if ( typeof( minimums[currency] ) == 'undefined' ) { |
300 | 304 | minimums[currency] = 1; |
301 | 305 | } |