Cdentinger has uploaded a new change for review.
https://gerrit.wikimedia.org/r/253485
Change subject: js updates for mustache
......................................................................
js updates for mustache
Change-Id: I227687c96fc197f296be9495fe7c5ebb12c732dc
---
M adyen_gateway/forms/js/adyen.js
1 file changed, 21 insertions(+), 94 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface
refs/changes/85/253485/1
diff --git a/adyen_gateway/forms/js/adyen.js b/adyen_gateway/forms/js/adyen.js
index 562f568..e242122 100644
--- a/adyen_gateway/forms/js/adyen.js
+++ b/adyen_gateway/forms/js/adyen.js
@@ -1,11 +1,11 @@
-/*global amountErrors:true, billingErrors:true, paymentErrors:true,
validate_personal:true, validateAmount:true, displayCreditCardForm:true*/
-
window.displayCreditCardForm = function () {
$( '#overlay' ).show();
$( '#paymentContinueBtn' ).removeClass( 'enabled' );
- var currencyField, currency_code, stateField, state, countryField,
country, sendData,
- $payment, $pForm,
+ var sendData,
+ $payment,
+ $pForm,
+ currency_code = 'USD',
language = 'en', // default value is English
matches = document.location.href.match(/uselang=(\w+)/i); //
fine the real language
@@ -13,58 +13,31 @@
language = matches[1];
}
- currencyField = document.getElementById( 'input_currency_code' );
- currency_code = '';
- if ( currencyField && currencyField.type === 'select-one' ) { //
currency is a dropdown select
- currency_code = $( 'select#input_currency_code option:selected'
).val();
- } else {
- currency_code = $( 'input[name="currency_code"]' ).val();
- }
-
- stateField = document.getElementById( 'state' );
- state = '';
- if ( stateField && stateField.type === 'select-one' ) { // state is a
dropdown select
- state = $( 'select#state option:selected' ).val();
- } else {
- state = $( 'input[name="state"]' ).val();
- }
-
- countryField = document.getElementById( 'country' );
- country = '';
- if ( countryField && countryField.type === 'select-one' ) { // country
is a dropdown select
- country = $( 'select#country option:selected' ).val();
- } else {
- country = $( 'input[name="country"]' ).val();
- }
-
sendData = {
action: 'donate',
gateway: 'adyen',
currency_code: currency_code,
- amount: $( 'input[name="amount"]' ).val(),
- fname: $( 'input[name="fname"]' ).val(),
- lname: $( 'input[name="lname"]' ).val(),
- street: $( 'input[name="street"]' ).val(),
- city: $( 'input[name="city"]' ).val(),
- state: state,
- zip: $( 'input[name="zip"]' ).val(),
- emailAdd: $( 'input[name="emailAdd"]' ).val(),
- country: country,
+ amount: $( '#amount' ).val(),
+ fname: $( '#fname' ).val(),
+ lname: $( '#lname' ).val(),
+ street: $( '#street' ).val(),
+ city: $( '#city' ).val(),
+ state: $( '#state' ).val(),
+ zip: $( '#zip' ).val(),
+ emailAdd: $( '#emailAdd' ).val(),
+ country: $( '#country' ).val(),
payment_method: 'cc',
language: language,
- contribution_tracking_id: $(
'input[name="contribution_tracking_id"]' ).val(),
- utm_source: $( 'input[name="utm_source"]' ).val(),
- utm_campaign: $( 'input[name="utm_campaign"]' ).val(),
- utm_medium: $( 'input[name="utm_medium"]' ).val(),
- referrer: $( 'input[name="referrer"]' ).val(),
- recurring: $( 'input[name="recurring"]' ).val(),
+ card_type: $( 'input[name="cardtype"]:checked'
).val().toLowerCase(),
+ contribution_tracking_id: $( '#contribution_tracking_id'
).val(),
+ utm_source: $( '#utm_source' ).val(),
+ utm_campaign: $( '#utm_campaign' ).val(),
+ utm_medium: $( '#utm_medium' ).val(),
+ referrer: $( '#referrer' ).val(),
+ recurring: $( '#recurring' ).val(),
+ token: $( '#token' ).val(),
format: 'json'
};
-
- // If the field, street_supplemental, exists add it to sendData
- if ( $('input[name="street_supplemental"]').length ) {
- sendData.street_supplemental = $(
'input[name="street_supplemental"]' ).val();
- }
$.ajax( {
url: mw.util.wikiScript( 'api' ),
@@ -119,53 +92,7 @@
} );
};
-/*
- * The following variable are declared inline in webitects_2_3step.html:
- * amountErrors, billingErrors, paymentErrors, scriptPath, actionURL
- */
$( document ).ready( function () {
-
-// TODO: mustache errors
-// // check for RapidHtml errors and display, if any
-// var temp, e, f, g,
-// amountErrorString = '',
-// billingErrorString = '',
-// paymentErrorString = '';
-//
-// // generate formatted errors to display
-// temp = [];
-// for ( e in amountErrors ) {
-// if ( amountErrors[e] !== '' ) {
-// temp[temp.length] = amountErrors[e];
-// }
-// }
-// amountErrorString = temp.join( '<br />' );
-//
-// temp = [];
-// for ( f in billingErrors ) {
-// if ( billingErrors[f] !== '' ) {
-// temp[temp.length] = billingErrors[f];
-// }
-// }
-// billingErrorString = temp.join( '<br />' );
-//
-// temp = [];
-// for ( g in paymentErrors ) {
-// if ( paymentErrors[g] !== '' ) {
-// temp[temp.length] = paymentErrors[g];
-// }
-// }
-// paymentErrorString = temp.join( '<br />' );
-//
-// // show the errors
-// if ( amountErrorString !== '' ) {
-// $( '#topError' ).html( amountErrorString );
-// } else if ( billingErrorString !== '' ) {
-// $( '#topError' ).html( billingErrorString );
-// } else if ( paymentErrorString !== '' ) {
-// $( '#topError' ).html( paymentErrorString );
-// }
-
$( '#paymentContinueBtn' ).on( 'click', function () {
if ( window.validate_form( document.payment ) ) {
$( '#payment-form' ).animate( { height: '250px' }, 1000
);
--
To view, visit https://gerrit.wikimedia.org/r/253485
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I227687c96fc197f296be9495fe7c5ebb12c732dc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Cdentinger <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits