https://www.mediawiki.org/wiki/Special:Code/MediaWiki/102188
Revision: 102188
Author: kaldari
Date: 2011-11-06 20:01:07 +0000 (Sun, 06 Nov 2011)
Log Message:
-----------
adding currency minimums to webitects js validation
Modified Paths:
--------------
trunk/extensions/DonationInterface/gateway_common/currencyRates.inc
trunk/extensions/DonationInterface/gateway_common/us-states.i18n.php
trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects.js
Modified: trunk/extensions/DonationInterface/gateway_common/currencyRates.inc
===================================================================
--- trunk/extensions/DonationInterface/gateway_common/currencyRates.inc
2011-11-06 19:59:46 UTC (rev 102187)
+++ trunk/extensions/DonationInterface/gateway_common/currencyRates.inc
2011-11-06 20:01:07 UTC (rev 102188)
@@ -5,6 +5,7 @@
* Last updated November 3, 2011 (rounded down)
*/
function getCurrencyRates() {
+ // If you change these, make sure to also update any JS validation
scripts
$currencyRates = array(
'AED' => '4',
'ARS' => '4',
Modified: trunk/extensions/DonationInterface/gateway_common/us-states.i18n.php
===================================================================
--- trunk/extensions/DonationInterface/gateway_common/us-states.i18n.php
2011-11-06 19:59:46 UTC (rev 102187)
+++ trunk/extensions/DonationInterface/gateway_common/us-states.i18n.php
2011-11-06 20:01:07 UTC (rev 102188)
@@ -65,7 +65,7 @@
'donate_interface-state-dropdown-WI' => 'Wisconsin',
'donate_interface-state-dropdown-WV' => 'West Virginia',
'donate_interface-state-dropdown-WY' => 'Wyoming',
- 'donate_interface-state-dropdown-AA' => 'AA',
- 'donate_interface-state-dropdown-AE' => 'AE',
- 'donate_interface-state-dropdown-AP' => 'AP',
+ 'donate_interface-state-dropdown-AA' => 'AA (Military)',
+ 'donate_interface-state-dropdown-AE' => 'AE (Military)',
+ 'donate_interface-state-dropdown-AP' => 'AP (Military)',
);
Modified:
trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects.js
===================================================================
---
trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects.js
2011-11-06 19:59:46 UTC (rev 102187)
+++
trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects.js
2011-11-06 20:01:07 UTC (rev 102188)
@@ -73,13 +73,96 @@
}
window.validateAmount = function() {
- // TODO: THIS NEEDS TO BE REPLACED WITH KALDARI'S CURRENCIES
+ // If you change these, also change in currencyRates.inc.
var minimums = {
- 'USD' : 1,
- 'CAD' : 1
+ 'AED': 4,
+ 'ARS': 4,
+ 'AUD': 1,
+ 'BBD': 2,
+ 'BDT': 76,
+ 'BGN': 1.4,
+ 'BHD': 0.4,
+ 'BMD': 1,
+ 'BND': 1.3,
+ 'BOB': 7,
+ 'BRL': 1.7,
+ 'BSD': 1,
+ 'BZD': 2,
+ 'CAD': 1,
+ 'CHF': 0.9,
+ 'CLP': 494,
+ 'CNY': 6,
+ 'COP': 1910,
+ 'CRC': 512,
+ 'CZK': 18,
+ 'DKK': 5,
+ 'DOP': 38,
+ 'DZD': 73,
+ 'EEK': 11,
+ 'EGP': 6,
+ 'EUR': 0.7,
+ 'GBP': 0.6,
+ 'GTQ': 7.8,
+ 'HKD': 7.7,
+ 'HNL': 19,
+ 'HRK': 5,
+ 'HUF': 219,
+ 'IDR': 8960,
+ 'ILS': 3.6,
+ 'INR': 49,
+ 'JMD': 85,
+ 'JOD': 0.7,
+ 'JPY': 78,
+ 'KES': 97,
+ 'KRW': 1127,
+ 'KYD': 0.8,
+ 'KZT': 147,
+ 'LBP': 1500,
+ 'LKR': 110,
+ 'LTL': 2.5,
+ 'LVL': 0.5,
+ 'MAD': 8.1,
+ 'MKD': 45,
+ 'MUR': 29,
+ 'MVR': 15,
+ 'MXN': 13,
+ 'MYR': 3,
+ 'NOK': 5.5,
+ 'NZD': 1.2,
+ 'OMR': 0.3,
+ 'PAB': 1,
+ 'PEN': 2.7,
+ 'PHP': 43,
+ 'PKR': 86,
+ 'PLN': 3,
+ 'PYG': 4190,
+ 'QAR': 3.6,
+ 'RON': 3.1,
+ 'RUB': 30,
+ 'SAR': 3.7,
+ 'SEK': 6.5,
+ 'SGD': 1.2,
+ 'SVC': 8.7,
+ 'THB': 30,
+ 'TJS': 4.7,
+ 'TND': 1.4,
+ 'TRY': 1.7,
+ 'TTD': 6,
+ 'TWD': 30,
+ 'UAH': 8,
+ 'USD': 1,
+ 'UYU': 19,
+ 'UZS': 1760,
+ 'VND': 21000,
+ 'XAF': 470,
+ 'XCD': 2.7,
+ 'XOF': 476,
+ 'ZAR': 7.8
};
var error = true;
var amount = $( 'input[name="amount"]' ).val(); // get the amount
+ // Normalize weird amount formats.
+ // Don't mess with these unless you know what you're doing.
amount = amount.replace( /[,.](\d)$/, '\:$10' );
amount = amount.replace( /[,.](\d)(\d)$/, '\:$1$2' );
amount = amount.replace( /[,.]/g, '' );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs