hideRecurringBeginDate = "0";
hideRecurringEndDate = 1;
if(typeof String.prototype.endsWith !== 'function') {
String.prototype.endsWith = function(suffix) {
return this.indexOf(suffix, this.length - suffix.length) !== -1;
}
}
// Informational: sample event listener handlers provided for client development ref: IATS_RaiseEvent
//12/22/2018 older ie browsers not currently patched by Microsoft as tested on browserstack do not support window.addEventListener
if (window) { if (!window.addEventListener) { window.addEventListener = function(message, embeddedFunction) { }; } } // work around
window.addEventListener('IATS_TRANSACTIONSUCCESS', function(e){
// console.log(e.data);
// alert("IATS_TRANSACTIONSUCCESS");
});
window.addEventListener('IATS_TRANSACTIONFAILURE', function(e){
// console.log(e.data);
// alert("IATS_TRANSACTIONFAILURE:");
});
window.addEventListener('IATS_RECURRINGTRANSACTIONSUCCESS', function(e){
// alert("IATS_RECURRINGTRANSACTIONSUCCESS");
// console.log(e.data);
});
window.addEventListener('IATS_RECURRINGTRANSACTIONFAILURE', function(e){
// console.log(e.data);
// alert("IATS_RECURRINGTRANSACTIONFAILURE");
});
// IE 8 forEach fix
if (!Array.prototype.forEach)
{
Array.prototype.forEach = function (fn, scope)
{
for (var i = 0, len = this.length; i < len; ++i)
{
fn.call(scope || this, this[i], i, this);
}
}
}
// IE 8 indexOf utility
if (!Array.prototype.indexOf)
{
Array.prototype.indexOf = function(elt /*, from*/)
{
var len = this.length >>> 0;
var from = Number(arguments[1]) || 0;
from = (from < 0)
? Math.ceil(from)
: Math.floor(from);
if (from < 0)
from += len;
for (; from < len; from++)
{
if (from in this &&
this[from] === elt)
return from;
}
return -1;
};
}
var hasCaptcha;
function IATS_RaiseEvent(eventType, transID, amount, errorcode){
var event; // The custom event that will be created
//modern browser
if(typeof CustomEvent === 'function'){
event = new CustomEvent(eventType, {
//details: details,
bubbles: true,
cancelable: true
});
//newest IE
} else if (document.createEvent) {
event = document.createEvent('CustomEvent');
event.initCustomEvent(eventType, true, true,null);
//older version of IE
} else {
event = document.createEventObject();
event.eventType = eventType;
}
event.data = {eventType: eventType, transID:transID, amount:amount, errorcode: errorcode};
event.eventName = eventType;
if (document.createEvent) {
window.dispatchEvent(event);
}
else if (window.fireEvent) {
window.fireEvent("on" + event.eventType, event);
}
}
function IATS_RaiseTransactionSuccessEvent(transID, amount, errorcode){
IATS_RaiseEvent('IATS_TRANSACTIONSUCCESS', transID, amount, errorcode);
}
function IATS_RaiseTransactionFailureEvent(transID, amount, errorcode){
IATS_RaiseEvent('IATS_TRANSACTIONFAILURE', transID, amount, errorcode);
}
function IATS_RaiseTransactionRecurringSuccessEvent(transID, amount, errorcode){
IATS_RaiseEvent('IATS_RECURRINGTRANSACTIONSUCCESS', transID, amount, errorcode);
}
function IATS_RaiseTransactionRecurringFailureEvent(transID, amount, errorcode){
IATS_RaiseEvent('IATS_RECURRINGTRANSACTIONFAILURE', transID, amount, errorcode);
}
// This function will allow or restrict characters per the regex sent at the point
// the control is being built. "Allow" or "restrict" attributes will be added to the controls.
function IATSRestrictCharacters(myfield, e) {
if (!e) var e = window.event
if (e.keyCode) code = e.keyCode;
else if (e.which) code = e.which;
var character = String.fromCharCode(code);
// Get the source element.
var elem;
if (e.srcElement) elem = e.srcElement;
else if (e.target) elem = e.target;
// Get the element's regex value.
var allow = elem.getAttribute("allow");
var restrict = elem.getAttribute("restrict");
if (allow != null) {
var regex = new RegExp(allow);
if (regex.test(e.key)) {
return true;
} else {
//alert("Restricted Character = '" + character + "' \n" + "Code = " + code + "\n" + "e.key = " + e.key);
return false;
}
}
else if (restrict != null) {
var regex = new RegExp(restrict);
//alert("regex = " + regex);
if (regex.test(e.key)) {
//alert("Restricted Character = '" + character + "' \n" + "Code = " + code + "\n" + "e.key = " + e.key);
return false;
} else {
return true;
}
}
}
theIATSPaymentBoxCore = new function IATSPaymentBoxCore()
{
this.titleOptionIndex = -1;
//Add UK version
this.version = "NA";
this.currency = "1";
this.ShowTlsMessage = "False"
//Image URL
this.serverURL = "www.iatspayments.com";
if(this.version=="UK")
this.serverURL = "www.uk.iatspayments.com";
this.getScript = IATSGetScript;
this.Script = this.getScript();
if (this.Script==null)
return;
// Title and Description.
this.Title = "Donate to Preserve Democracy";
this.Description = "";
this.DirectDebitPage1 = "";
this.DirectDebitPage2 = "";
this.DirectDebitPage3 = "";
this.DirectDebitPage4 = "";
this.DirectDebitPage5 = "";
// For Amount List
this.EventPaymentCurrencySign="$";
this.EventPaymentCurrencySignAfterAmount="";
this.AmountListTitle = "Pick below to make this a recurring gift";
this.AmountList = [{Desc:" ",Amount:"20.00",QtyLabel:"",Qty:0,DefaultChecked:"",QtyMax:""}
,{Desc:" ",Amount:"100.00",QtyLabel:"",Qty:0,DefaultChecked:"Checked",QtyMax:""}
,{Desc:" ",Amount:"500.00",QtyLabel:"",Qty:0,DefaultChecked:"",QtyMax:""}
,{Desc:" ",Amount:"1000.00",QtyLabel:"",Qty:0,DefaultChecked:"",QtyMax:""}
,{Desc:" ",Amount:"2500.00",QtyLabel:"",Qty:0,DefaultChecked:"",QtyMax:""}
];
this.AmountOtherList = [{Label:"Other ",MinimumLabel1:"Minimum is $1.00",Minimum:1.00,MinimumErrorMessage:"Input amount must be more than minimum",Default:""}
];
this.ShoppingCartList = [{"AmountID":1,"AmountLabel":"","Price":20.00,"SKU":"Quick SKU","QuantityLabel":"Qty","QuantityDefault":0,"Option":[]},{"AmountID":2,"AmountLabel":"","Price":100.00,"SKU":"Quick SKU","QuantityLabel":"Qty","QuantityDefault":0,"Option":[]},{"AmountID":3,"AmountLabel":"","Price":500.00,"SKU":"Quick SKU","QuantityLabel":"Qty","QuantityDefault":0,"Option":[]},{"AmountID":4,"AmountLabel":"","Price":1000.00,"SKU":"Quick SKU","QuantityLabel":"Qty","QuantityDefault":0,"Option":[]},{"AmountID":5,"AmountLabel":"","Price":2500.00,"SKU":"Quick SKU","QuantityLabel":"Qty","QuantityDefault":0,"Option":[]}];
this.ShoppingCartItemCounter = 0;
this.ShoppingCartTotal = 0.00;
this.EnableShoppingCart = "0";
this.AmountEnableMultiSelection = "1";
this.AmountEnableQty = "0";
this.ProcessButtonLabel = "Donate";
this.AgencyCodeHash = "BFCFB6B3D67D20A36359688F78DCB8DF40BC3783";
// For Profile Items
this.ProfileListTitle = "Donor Information";
this.PrifileItemList = [{Desc:"Title",Name:"Title",Visible:0,Required:0,Type:"Text",MiniLen:1,ErrorMsg:"Title is Required",Value:"",MaxLen:"29"}
,{Desc:"First Name",Name:"FirstName",Visible:1,Required:1,Type:"Text",MiniLen:1,ErrorMsg:"First Name is Required",Value:"",MaxLen:"39"}
,{Desc:"Last Name",Name:"LastName",Visible:1,Required:1,Type:"Text",MiniLen:1,ErrorMsg:"Last Name is Required",Value:"",MaxLen:"39"}
,{Desc:"CompanyOrganization Name",Name:"CompanyName",Visible:0,Required:0,Type:"Text",MiniLen:1,ErrorMsg:"Please input Company Name",Value:"",MaxLen:"100"}
,{Desc:"Address",Name:"Address",Visible:1,Required:1,Type:"Text",MiniLen:1,ErrorMsg:"Address is Required",Value:"",MaxLen:"99"}
,{Desc:"City",Name:"City",Visible:1,Required:1,Type:"Text",MiniLen:1,ErrorMsg:"City is Required",Value:"",MaxLen:"39"}
,{Desc:"Country",Name:"Country",Visible:0,Required:0,Type:"Text",MiniLen:1,ErrorMsg:"",Value:"",MaxLen:"39"}
,{Desc:"StateProvince",Name:"State",Visible:1,Required:1,Type:"Text",MiniLen:1,ErrorMsg:"StateProvince is Required",Value:"",MaxLen:"39"}
,{Desc:"ZipPostal Code",Name:"ZipCode",Visible:1,Required:1,Type:"Text",MiniLen:1,ErrorMsg:"ZipPostal Code is Required",Value:"",MaxLen:"10"}
,{Desc:"Phone",Name:"Phone",Visible:1,Required:0,Type:"Text",MiniLen:1,ErrorMsg:"Phone is Invalid",Value:"",MaxLen:"39"}
,{Desc:"Mobile",Name:"Phone2",Visible:1,Required:0,Type:"Text",MiniLen:1,ErrorMsg:"Mobile is Invalid",Value:"",MaxLen:"39"}
,{Desc:"Fax",Name:"Fax",Visible:0,Required:0,Type:"Text",MiniLen:1,ErrorMsg:"",Value:"",MaxLen:"39"}
,{Desc:"Email",Name:"EMail",Visible:1,Required:1,Type:"Text",MiniLen:1,ErrorMsg:"Email is Required",Value:"",MaxLen:"256"}
,{Desc:"Please Re-enter Email",Name:"ReEnterEmail",Visible:1,Required:1,Type:"Text",MiniLen:1,ErrorMsg:"Email address entries must match.",Value:"",MaxLen:"256"}
,{Desc:"Comment",Name:"Comment",Visible:0,Required:0,Type:"Text",MiniLen:1,ErrorMsg:"",Value:"",MaxLen:"250"}
];
this.PrifileItemList_Items = [{Desc:"I'm Donating Because",Name:"Item1",Visible:1,Required:0,Type:"Text",MiniLen:1,ErrorMsg:"",Value:"",MaxLen:"250",EnableSelect:"0",SelectItems:"",EnableMoreInfo:"0",MoreInfo:""}
,{Desc:"",Name:"Item2",Visible:0,Required:0,Type:"Text",MiniLen:1,ErrorMsg:"",Value:"",MaxLen:"250",EnableSelect:"0",SelectItems:"Where it is most needed@###@@###@General Fund",EnableMoreInfo:"0",MoreInfo:""}
,{Desc:"",Name:"Item3",Visible:0,Required:0,Type:"Text",MiniLen:1,ErrorMsg:"",Value:"",MaxLen:"250",EnableSelect:"0",SelectItems:"",EnableMoreInfo:"0",MoreInfo:""}
,{Desc:"Item 4",Name:"Item4",Visible:0,Required:0,Type:"Text",MiniLen:1,ErrorMsg:"Item 4 is Required",Value:"",MaxLen:"250",EnableSelect:"0",SelectItems:"",EnableMoreInfo:"0",MoreInfo:""}
,{Desc:"Item 5",Name:"Item5",Visible:0,Required:0,Type:"Text",MiniLen:1,ErrorMsg:"Item 5 is Required",Value:"",MaxLen:"250",EnableSelect:"0",SelectItems:"",EnableMoreInfo:"0",MoreInfo:""}
,{Desc:"Item 6",Name:"Item6",Visible:0,Required:0,Type:"Text",MiniLen:1,ErrorMsg:"Item 6 is Required",Value:"",MaxLen:"250",EnableSelect:"0",SelectItems:"",EnableMoreInfo:"0",MoreInfo:""}
,{Desc:"Item 7",Name:"Item7",Visible:0,Required:0,Type:"Text",MiniLen:1,ErrorMsg:"Item 7 is Required",Value:"",MaxLen:"250",EnableSelect:"0",SelectItems:"",EnableMoreInfo:"0",MoreInfo:""}
,{Desc:"Item 8",Name:"Item8",Visible:0,Required:0,Type:"Text",MiniLen:1,ErrorMsg:"Item 8 is Required",Value:"",MaxLen:"250",EnableSelect:"0",SelectItems:"",EnableMoreInfo:"0",MoreInfo:""}
,{Desc:"Item 9",Name:"Item9",Visible:0,Required:0,Type:"Text",MiniLen:1,ErrorMsg:"Item 9 is Required",Value:"",MaxLen:"250",EnableSelect:"0",SelectItems:"",EnableMoreInfo:"0",MoreInfo:""}
,{Desc:"Item 10",Name:"Item10",Visible:0,Required:0,Type:"Text",MiniLen:1,ErrorMsg:"Item 10 is Required",Value:"",MaxLen:"250",EnableSelect:"0",SelectItems:"",EnableMoreInfo:"0",MoreInfo:""}
,{Desc:"Item 11",Name:"Item11",Visible:0,Required:0,Type:"Text",MiniLen:1,ErrorMsg:"Item 11 is Required",Value:"",MaxLen:"250",EnableSelect:"0",SelectItems:"",EnableMoreInfo:"0",MoreInfo:""}
,{Desc:"Item 12",Name:"Item12",Visible:0,Required:0,Type:"Text",MiniLen:1,ErrorMsg:"Item 12 is Required",Value:"",MaxLen:"250",EnableSelect:"0",SelectItems:"",EnableMoreInfo:"0",MoreInfo:""}
,{Desc:"Item 13",Name:"Item13",Visible:0,Required:0,Type:"Text",MiniLen:1,ErrorMsg:"Item 13 is Required",Value:"",MaxLen:"250",EnableSelect:"0",SelectItems:"",EnableMoreInfo:"0",MoreInfo:""}
,{Desc:"Item 14",Name:"Item14",Visible:0,Required:0,Type:"Text",MiniLen:1,ErrorMsg:"Item 14 is Required",Value:"",MaxLen:"250",EnableSelect:"0",SelectItems:"",EnableMoreInfo:"0",MoreInfo:""}
,{Desc:"Item 15",Name:"Item15",Visible:0,Required:0,Type:"Text",MiniLen:1,ErrorMsg:"Item 15 is Required",Value:"",MaxLen:"250",EnableSelect:"0",SelectItems:"",EnableMoreInfo:"0",MoreInfo:""}
];
this.RejectList = [{Code:"1",Message:"Process permission denied."}
,{Code:"4",Message:"Incorrect expiration date."}
,{Code:"5",Message:"Invalid transaction information. Verify and re-enter information."}
,{Code:"12",Message:"Incorrect CVV2 or expiry date."}
,{Code:"15",Message:"General decline. Please call the number on the back of the credit card."}
,{Code:"19",Message:"Incorrect CVV2 security code."}
,{Code:"40",Message:"Invalid card/account number."}
,{Code:"41",Message:"Invalid expiry date."}
,{Code:"43",Message:"Incorrect card holder's address."}
];
this.RejectDefaultMessage = "General decline.";
this.ClientZipcodeError = "";
this.ClientEmailError = "";
// For Payment Info
this.EventPaymentNote = "Bold field is required input";
this.PaymentAccountNumberDesc = "Card Number";
this.PaymentExpiryDesc = "Expiry";
this.PaymentCVV2Desc = "CVV2"
this.PaymentCVV2Required = "Checked"
this.AccountNumberErrorMessage="Card Number is Required";
this.CVV2ErrorMessage="CVV2 is Required";
this.ExpiryDateErrorMessage="Expiry is Required";
// For ACH
this.USRoutingNoErrorMessage = "Routing No. is Required";
this.USRoutingNoLabel = "Routing No.";
this.USAccountNoErrorMessage = "Account No. is Required";
this.ReEnterUSAccountNoErrorMessage = "Account number entries must match.";
this.CANTransitNoErrorMessage = "Transit No. is Required";
this.CANBankNoErrorMessage = "Bank No. is Required";
this.CANAccountNoErrorMessage = "Account No. is Required";
this.ReEnterCANAccountNoErrorMessage = "Account number entries must match.";
this.USAccountNoLabel = "Account No.";
this.ReEnterUSAccountNoLabel = "Re-enter Account No.";
this.CANTransitNoLabel = "Transit No.";
this.CANBankNoLabel = "Bank No.";
this.CANAccountNoLabel = "Account No.";
this.ReEnterCANAccountNoLabel = "Re-enter Account No.";
this.UKBankNoErrorMessage = "Bank Code is Required";
this.UKSortNoErrorMessage = "Sort code is Required";
this.UKAccountNoErrorMessage = "Account No. is Required";
this.ReEnterUKAccountNoErrorMessage = "Account number entries must match.";
this.UKBankNoLabel = "Bank Code";
this.UKSortNoLabel = "Sort Code";
this.UKAccountNoLabel = "Account No.";
this.ReEnterUKAccountNoLabel = "Re-enter Account No.";
this.UKSEPABankIdLabel = "";
this.UKSEPABankIdErrorMessage = "";
this.NoDecimal = "";
this.AccountTypeLabel = "Account Type";
this.CheckingLabel = "Checking";
this.SavingLabel = "Savings";
//alert(this.UKBankNoLabel);
this.ConnectingToServerMessage = "Connecting to https://www.iatspayments.com to process.";
this.BackButtonText = "Back";
this.YourDataIsSecureText = "Learn More";
this.YourDataIsSecureImage = "//www.iatspayments.com/paymentbox/img/b_your_data_is_secure.png";
this.ErrorMessage = "Please correct error and resubmit.";
// For layout
this.BasicLayoutClassName = "IATS_PaymentLabelOnTop";
//Option of items using dropdown list and radio buttons
this.ItemFormat = "DropdownList";
// for Country
// Add international country
this.StateFlag = false;
this.CountryList = [{Name:"United States", Code:"US"},
{Name:"Canada", Code:"CA"},
{Name:"United Kingdom", Code:"GB"},
{Name:"Aaland Islands", Code:"AX"},
{Name:"Afghanistan", Code:"AF"},
{Name:"Albania", Code:"AL"},
{Name:"Algeria", Code:"DZ"},
{Name:"American Samoa", Code:"AS"},
{Name:"Andorra", Code:"AD"},
{Name:"Angola", Code:"AO"},
{Name:"Anguilla", Code:"AI"},
{Name:"Antarctica", Code:"AQ"},
{Name:"Antigua and Barbuda", Code:"AG"},
{Name:"Argentina", Code:"AR"},
{Name:"Armenia", Code:"AM"},
{Name:"Aruba", Code:"AW"},
{Name:"Australia", Code:"AU"},
{Name:"Austria", Code:"AT"},
{Name:"Azerbaijan", Code:"AZ"},
{Name:"Bahamas", Code:"BS"},
{Name:"Bahrain", Code:"BH"},
{Name:"Bangladesh", Code:"BD"},
{Name:"Barbados", Code:"BB"},
{Name:"Belarus", Code:"BY"},
{Name:"Belgium", Code:"BE"},
{Name:"Belize", Code:"BZ"},
{Name:"Benin", Code:"BJ"},
{Name:"Bermuda", Code:"BM"},
{Name:"Bhutan", Code:"BT"},
{Name:"Bolivia", Code:"BO"},
{Name:"Bosnia and Herzegowina", Code:"BA"},
{Name:"Botswana", Code:"BW"},
{Name:"Bouvet Island", Code:"BV"},
{Name:"Brazil", Code:"BR"},
{Name:"British Indian Ocean Territory", Code:"IO"},
{Name:"British Virgin Islands", Code:"VG"},
{Name:"Brunei Darussalam", Code:"BN"},
{Name:"Bulgaria", Code:"BG"},
{Name:"Burkina Faso", Code:"BF"},
{Name:"Burundi", Code:"BI"},
{Name:"Cambodia", Code:"KH"},
{Name:"Cameroon", Code:"CM"},
{Name:"Cape Verde", Code:"CV"},
{Name:"Cayman Islands", Code:"KY"},
{Name:"Central African Republic", Code:"CF"},
{Name:"Chad", Code:"TD"},
{Name:"Chile", Code:"CL"},
{Name:"China", Code:"CN"},
{Name:"Christmas Island", Code:"CX"},
{Name:"Cocos Islands", Code:"CC"},
{Name:"Colombia", Code:"CO"},
{Name:"Comoros", Code:"KM"},
{Name:"Congo Democratic Republic", Code:"CD"},
{Name:"Congo Republic", Code:"CG"},
{Name:"Cook Islands", Code:"CK"},
{Name:"Costa rica", Code:"CR"},
{Name:"Cote divoire", Code:"CI"},
{Name:"Croatia", Code:"HR"},
{Name:"Cuba", Code:"CU"},
{Name:"Cyprus", Code:"CY"},
{Name:"Czech Republic", Code:"CZ"},
{Name:"Denmark", Code:"DK"},
{Name:"Djibouti", Code:"DJ"},
{Name:"Dominica", Code:"DM"},
{Name:"Dominican Republic", Code:"DO"},
{Name:"Ecuador", Code:"EC"},
{Name:"Egypt", Code:"EG"},
{Name:"El Salvador", Code:"SV"},
{Name:"Equatorial Guinea", Code:"GQ"},
{Name:"Eritrea", Code:"ER"},
{Name:"Estonia", Code:"EE"},
{Name:"Ethiopia", Code:"ET"},
{Name:"Falkland Islands", Code:"FK"},
{Name:"Faroe Islands", Code:"FO"},
{Name:"Fiji", Code:"BJ"},
{Name:"Finland", Code:"FI"},
{Name:"France", Code:"FR"},
{Name:"French Guiana", Code:"GF"},
{Name:"French Polynesia", Code:"PF"},
{Name:"French Southern Territories", Code:"TF"},
{Name:"Gabon", Code:"GA"},
{Name:"Gambia", Code:"GM"},
{Name:"Georgia", Code:"GE"},
{Name:"Germany", Code:"DE"},
{Name:"Ghana", Code:"GH"},
{Name:"Gibraltar", Code:"GI"},
{Name:"Greece", Code:"GR"},
{Name:"Greenland", Code:"GL"},
{Name:"Grenada", Code:"GD"},
{Name:"Guadeloupe", Code:"GP"},
{Name:"Guam", Code:"GU"},
{Name:"Guatemala", Code:"GT"},
{Name:"Guinea", Code:"GN"},
{Name:"Guinea-Bissau", Code:"GW"},
{Name:"Guyana", Code:"GY"},
{Name:"Haiti", Code:"HT"},
{Name:"Heard and McDonald Islands", Code:"HM"},
{Name:"Honduras", Code:"HN"},
{Name:"Hong Kong", Code:"HK"},
{Name:"Hungary", Code:"HU"},
{Name:"Iceland", Code:"IS"},
{Name:"India", Code:"IN"},
{Name:"Indonesia", Code:"ID"},
{Name:"Ireland", Code:"IE"},
{Name:"Iran", Code:"IR"},
{Name:"Iraq", Code:"IQ"},
{Name:"Isle of Man", Code:"IM"},
{Name:"Israel", Code:"IL"},
{Name:"Italy", Code:"IT"},
{Name:"Jamaica", Code:"JM"},
{Name:"Japan", Code:"JP"},
{Name:"Jordan", Code:"JO"},
{Name:"Kazakhstan", Code:"KZ"},
{Name:"Kenya", Code:"KE"},
{Name:"Kiribati", Code:"KI"},
{Name:"Kuwait", Code:"KW"},
{Name:"Kyrgyzstan", Code:"KG"},
{Name:"Lao Peoples Democratic Republic", Code:"LA"},
{Name:"Latvia", Code:"LV"},
{Name:"Lebanon", Code:"LB"},
{Name:"Lesotho", Code:"LS"},
{Name:"Liberia", Code:"LR"},
{Name:"Libya", Code:"LY"},
{Name:"Liechtenstein", Code:"LI"},
{Name:"Lithuania", Code:"LT"},
{Name:"Luxembourg", Code:"LU"},
{Name:"Macau", Code:"MO"},
{Name:"Macedonia", Code:"MK"},
{Name:"Madagascar", Code:"MG"},
{Name:"Malawi", Code:"MW"},
{Name:"Malaysia", Code:"MY"},
{Name:"Maldives", Code:"MV"},
{Name:"Mali", Code:"ML"},
{Name:"Malta", Code:"MT"},
{Name:"Marshall Islands", Code:"MH"},
{Name:"Martinique", Code:"MQ"},
{Name:"Mauritania", Code:"MR"},
{Name:"Mauritius", Code:"MU"},
{Name:"Mayotte", Code:"YT"},
{Name:"Mexico", Code:"MX"},
{Name:"Micronesia", Code:"FM"},
{Name:"Moldova", Code:"MD"},
{Name:"Monaco", Code:"MC"},
{Name:"Mongolia", Code:"MN"},
{Name:"Montserrat", Code:"MS"},
{Name:"Morocco", Code:"MA"},
{Name:"Mozambique", Code:"MZ"},
{Name:"Myanmar", Code:"MM"},
{Name:"Namibia", Code:"NA"},
{Name:"Netherlands", Code:"NL"},
{Name:"Netherlands Antilles", Code:"AN"},
{Name:"Republic of Nauru", Code:"NR"},
{Name:"Nepal", Code:"NP"},
{Name:"New Caledonia", Code:"NC"},
{Name:"New Zealand", Code:"NZ"},
{Name:"Nicaragua", Code:"NI"},
{Name:"Niger", Code:"NE"},
{Name:"Nigeria", Code:"NG"},
{Name:"Niue", Code:"NU"},
{Name:"Norfolk Island", Code:"NF"},
{Name:"North Korea", Code:"KP"},
{Name:"Northern Mariana Islands", Code:"MP"},
{Name:"Norway", Code:"NO"},
{Name:"Oman", Code:"OM"},
{Name:"Pakistan", Code:"PK"},
{Name:"Palau", Code:"PW"},
{Name:"Palestinian Territory", Code:"PS"},
{Name:"Panama", Code:"PA"},
{Name:"Papua New Guinea", Code:"PG"},
{Name:"Paraguay", Code:"PY"},
{Name:"Peru", Code:"PE"},
{Name:"Philippines", Code:"PH"},
{Name:"Pitcairn", Code:"PN"},
{Name:"Poland", Code:"PL"},
{Name:"Portugal", Code:"PT"},
{Name:"Puerto Rico", Code:"PR"},
{Name:"Qatar", Code:"QA"},
{Name:"Reunion", Code:"RE"},
{Name:"Romania", Code:"RO"},
{Name:"Russian Federation", Code:"RU"},
{Name:"Rwanda", Code:"RW"},
{Name:"Sehara, Western", Code:"EH"},
{Name:"Saint Barthelemy", Code:"BL"},
{Name:"Saint Helena", Code:"SH"},
{Name:"Saint Kitts and Nevis", Code:"KN"},
{Name:"Saint Lucia", Code:"LC"},
{Name:"Saint Martin", Code:"MF"},
{Name:"S Pierre & Miquelon", Code:"PM"},
{Name:"S Vincent & Grenadines", Code:"VC"},
{Name:"Samoa", Code:"WS"},
{Name:"San Marino", Code:"SM"},
{Name:"Sao Tome and Principe", Code:"ST"},
{Name:"Saudi Arabia", Code:"SA"},
{Name:"Senegal", Code:"SN"},
{Name:"Serbia", Code:"RS"},
{Name:"Seychelles", Code:"SC"},
{Name:"Sierra Leone", Code:"SL"},
{Name:"Singapore", Code:"SG"},
{Name:"Slovakia", Code:"SK"},
{Name:"Slovenia", Code:"SI"},
{Name:"Solomon Islands", Code:"SB"},
{Name:"Somalia", Code:"SO"},
{Name:"South Africa", Code:"ZA"},
{Name:"South Korea", Code:"KR"},
{Name:"S.George & S.Sandwich", Code:"GS"},
{Name:"Spain", Code:"ES"},
{Name:"Sri Lanka", Code:"LK"},
{Name:"Sudan", Code:"SD"},
{Name:"Suriname", Code:"SR"},
{Name:"Svalbard & Jan Mayen Is.", Code:"SJ"},
{Name:"Swaziland", Code:"SZ"},
{Name:"Sweden", Code:"SE"},
{Name:"Switzerland", Code:"CH"},
{Name:"Syrian Arab Republic", Code:"SY"},
{Name:"Taiwan", Code:"TW"},
{Name:"Tajikistan", Code:"TJ"},
{Name:"Tanzania, United Rep. of", Code:"TZ"},
{Name:"Thailand", Code:"TH"},
{Name:"Timor-Leste", Code:"TL"},
{Name:"Togo", Code:"TG"},
{Name:"Tokelau", Code:"TK"},
{Name:"Trinidad & Tobago", Code:"TT"},
{Name:"Tunisia", Code:"TN"},
{Name:"Turkey", Code:"TR"},
{Name:"Turkmenistan", Code:"TM"},
{Name:"Turks and Caicos Islands", Code:"TC"},
{Name:"Tuvalu", Code:"TC"},
{Name:"Tuvalu", Code:"TV"},
{Name:"Uganda", Code:"UG"},
{Name:"Ukraine", Code:"UA"},
{Name:"United Arab Emirates", Code:"AE"},
{Name:"Uruguay", Code:"UY"},
{Name:"US Virgin Islands", Code:"VI"},
{Name:"Uzbekistan", Code:"UZ"},
{Name:"Vanuatu", Code:"VU"},
{Name:"Venezuela", Code:"VE"},
{Name:"Viet Nam", Code:"VN"},
{Name:"Western Sahara", Code:"EH"},
{Name:"Yemen", Code:"YE"},
{Name:"Zambia", Code:"ZM"},
{Name:"Zimbabwe", Code:"ZW"}];
this.CountryList2 = [{Name:"United States", Code:"USA"},
{Name:"Canada", Code:"CAN"}];
// for State
this.USAStateList = [{Name:"Alabama", Code:"AL"},
{Name:"Alaska", Code:"AK"},
{Name:"Arizona", Code:"AZ"},
{Name:"Arkansas", Code:"AR"},
{Name:"California", Code:"CA"},
{Name:"Colorado", Code:"CO"},
{Name:"Connecticut", Code:"CT"},
{Name:"Delaware", Code:"DE"},
{Name:"District of Columbia", Code:"DC"},
{Name:"Florida", Code:"FL"},
{Name:"Georgia", Code:"GA"},
{Name:"Hawaii", Code:"HI"},
{Name:"Idaho", Code:"ID"},
{Name:"Illinois", Code:"IL"},
{Name:"Indiana", Code:"IN"},
{Name:"Iowa", Code:"IA"},
{Name:"Kansas", Code:"KS"},
{Name:"Kentucky", Code:"KY"},
{Name:"Louisiana", Code:"LA"},
{Name:"Maine", Code:"ME"},
{Name:"Maryland", Code:"MD"},
{Name:"Massachusetts", Code:"MA"},
{Name:"Michigan", Code:"MI"},
{Name:"Minnesota", Code:"MN"},
{Name:"Mississippi", Code:"MS"},
{Name:"Missouri", Code:"MO"},
{Name:"Montana", Code:"MT"},
{Name:"Nebraska", Code:"NE"},
{Name:"Nevada", Code:"NV"},
{Name:"New Hampshire", Code:"NH"},
{Name:"New Jersey", Code:"NJ"},
{Name:"New Mexico", Code:"NM"},
{Name:"New York", Code:"NY"},
{Name:"North Carolina", Code:"NC"},
{Name:"North Dakota", Code:"ND"},
{Name:"Ohio", Code:"OH"},
{Name:"Oklahoma", Code:"OK"},
{Name:"Oregon", Code:"OR"},
{Name:"Pennsylvania", Code:"PA"},
{Name:"Rhode Island", Code:"RI"},
{Name:"South Carolina", Code:"SC"},
{Name:"South Dakota", Code:"SD"},
{Name:"Tennessee", Code:"TN"},
{Name:"Texas", Code:"TX"},
{Name:"Utah", Code:"UT"},
{Name:"Vermont", Code:"VT"},
{Name:"Virginia", Code:"VA"},
{Name:"Washington", Code:"WA"},
{Name:"West Virginia", Code:"WV"},
{Name:"Wisconsin", Code:"WI"},
{Name:"Wyoming", Code:"WY"}];
this.CANStateList = [{Name:"Alberta", Code:"AB"},
{Name:"British Columbia", Code:"BC"},
{Name:"Manitoba", Code:"MB"},
{Name:"New Brunswick", Code:"NB"},
{Name:"Newfoundland and Labrador", Code:"NL"},
{Name:"Northwest Territories", Code:"NT"},
{Name:"Nova Scotia", Code:"NS"},
{Name:"Nunavut", Code:"NU"},
{Name:"Ontario", Code:"ON"},
{Name:"Prince Edward Island", Code:"PE"},
{Name:"Quebec", Code:"QC"},
{Name:"Saskatchewan", Code:"SK"},
{Name:"Yukon", Code:"YT"}];
this.UKStateList = [{Name:"Avon", Code:"Avon"},
{Name:"Beds", Code:"Beds"},
{Name:"Berks", Code:"Berks"},
{Name:"Bristol", Code:"Bristol"},
{Name:"Bucks", Code:"Bucks"},
{Name:"Cambridgeshire and Isle of Ely", Code:"Cambridgeshire and Isle of Ely"},
{Name:"Cambs", Code:"Cambs"},
{Name:"Cheshire", Code:"Cheshire"},
{Name:"Cleveland", Code:"Cleveland"},
{Name:"Co Antrim", Code:"Co Antrim"},
{Name:"Co Armagh", Code:"Co Armagh"},
{Name:"Co Down", Code:"Co Down"},
{Name:"Co Durham", Code:"Co Durham"},
{Name:"Co Fermanagh", Code:"Co Fermanagh"},
{Name:"Co Tyrone", Code:"Co Tyrone"},
{Name:"Cornwall", Code:"Cornwall"},
{Name:"Cumberland", Code:"Cumberland"},
{Name:"Cumbria", Code:"Cumbria"},
{Name:"Derbyshire", Code:"Derbyshire"},
{Name:"Devon", Code:"Devon"},
{Name:"Dorset", Code:"Dorset"},
{Name:"Durham", Code:"Durham"},
{Name:"E Sussex", Code:"E Sussex"},
{Name:"East Suffolk", Code:"East Suffolk"},
{Name:"Essex", Code:"Essex"},
{Name:"Glos", Code:"Glos"},
{Name:"Greater London", Code:"Greater London"},
{Name:"Greater Manchester", Code:"Greater Manchester"},
{Name:"Hampshire", Code:"Hampshire"},
{Name:"Hants", Code:"Hants"},
{Name:"Hereford and Worcester", Code:"Hereford and Worcester"},
{Name:"Herefordshire", Code:"Herefordshire"},
{Name:"Hertfordshire", Code:"Hertfordshire"},
{Name:"Herts", Code:"Herts"},
{Name:"Humberside", Code:"Humberside"},
{Name:"Huntingdon and Peterborough", Code:"Huntingdon and Peterborough"},
{Name:"Huntingdonshire", Code:"Huntingdonshire"},
{Name:"Isle of Ely", Code:"Isle of Ely"},
{Name:"Isle of Wight", Code:"Isle of Wight"},
{Name:"Kent", Code:"Kent"},
{Name:"Lancs", Code:"Lancs"},
{Name:"Leics", Code:"Leics"},
{Name:"Lincs", Code:"Lincs"},
{Name:"M Glam", Code:"M Glam"},
{Name:"Merseyside", Code:"Merseyside"},
{Name:"Middx", Code:"Middx"},
{Name:"N Humberside", Code:"N Humberside"},
{Name:"N Yorkshire", Code:"N Yorkshire"},
{Name:"Norfolk", Code:"Norfolk"},
{Name:"Northamptonshire", Code:"Northamptonshire"},
{Name:"Northants", Code:"Northants"},
{Name:"Northd", Code:"Northd"},
{Name:"Notts", Code:"Notts"},
{Name:"Oxon", Code:"Oxon"},
{Name:"Rutland", Code:"Rutland"},
{Name:"S Glam", Code:"S Glam"},
{Name:"S Humberside", Code:"S Humberside"},
{Name:"S Yorkshire", Code:"S Yorkshire"},
{Name:"Shropshire", Code:"Shropshire"},
{Name:"Soke of Peterborough", Code:"Soke of Peterborough"},
{Name:"Somerset", Code:"Somerset"},
{Name:"Staffs", Code:"Staffs"},
{Name:"Suffolk", Code:"Suffolk"},
{Name:"Surrey", Code:"Surrey"},
{Name:"Sussex", Code:"Sussex"},
{Name:"Tyne & Wear", Code:"Tyne & Wear"},
{Name:"Warks", Code:"Warks"},
{Name:"W Glam", Code:"W Glam"},
{Name:"W Midlands", Code:"W Midlands"},
{Name:"W Sussex", Code:"W Sussex"},
{Name:"W Yorkshire", Code:"W Yorkshire"},
{Name:"West Suffolk", Code:"West Suffolk"},
{Name:"Westmorland", Code:"Westmorland"},
{Name:"Wilts", Code:"Wilts"},
{Name:"Worcs", Code:"Worcs"},
{Name:"Yorkshire", Code:"Yorkshire"},
{Name:"OTHER", Code:"OTHER"}];
this.SwitchBinList = [{Num:"4903", Length:16},
{BIN:"4903", Length:18},
{BIN:"4903", Length:19},
{BIN:"4911", Length:16},
{BIN:"4911", Length:18},
{BIN:"4911", Length:19},
{BIN:"4936", Length:16},
{BIN:"4936", Length:18},
{BIN:"4936", Length:19},
{BIN:"564182", Length:18},
{BIN:"564182", Length:19},
{BIN:"6333", Length:16},
{BIN:"6333", Length:18},
{BIN:"6333", Length:19},
{BIN:"6759", Length:16},
{BIN:"6759", Length:18},
{BIN:"6759", Length:19},
{BIN:"6334", Length:16},
{BIN:"6334", Length:18},
{BIN:"6334", Length:19},
{BIN:"6767", Length:16},
{BIN:"6767", Length:18},
{BIN:"6767", Length:19}];
this.PaymentBoxProcessServer = "https://iatspayments.com/";
this.PaymentBoxPID = "PA17E64C0BDED98E06"
//AURA Template begin
this.PaymentBoxTID = ""
this.ProcessKey = ""
this.ProcessOption = ""
this.SelectedStyleSheet = "https://iatspayments.com/PaymentBox/css/Modern-Current.css?v=170717";
// For recurring
this.WeekList = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
this.DateList = ["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31"];
// Approval Message
this.ApprovalResponseHeader = "Thanks for helping Preserve Democracy. Here are your donation details:";
this.ApprovalResponseFooter = "";
this.ApprovalResponseCodeDesc = "Approval Code";
this.ApprovalResponseAmountDesc = "You have donated a total of $";
this.DeclineResponseHeader = "This transaction has been declined";
this.DeclineResponseFooter = "Please check your payment information and try again";
this.DeclineResponseCodeDesc = "Reason of decline";
this.SendEmailConfirmationLabel = "I would like to receive email.";
this.SendEmailConfirmation = "";
this.ReoccurringResponseHeader = "Thanks for helping Preserve Democracy. Your recurring donation has been setup successfully.";
this.ReoccurringResponseFooter = "";
this.ReoccurringResponseCodeDesc = "Customer Code:";
this.ReoccurringLabel = "Recurring";
this.ReoccurringVisible = "CHECKED";
this.SinglePaymentVisible = "CHECKED";
this.SinglePaymentLabel = "One Time";
this.MonthlyRecurringBeginDate1 = "";
this.MonthlyRecurringBeginDate2 = "";
this.MonthlyRecurringDate1Visible = "CHECKED";
this.MonthlyRecurringDate2Visible = "CHECKED";
this.WeeklyVisible = "Checked";
this.MonthlyVisible = "Checked";
this.QuarterlyVisible = "Checked";
this.AnnuallyVisible = "Checked";
this.WeeklyLabel = "Weekly";
this.MonthlyLabel = "Monthly";
this.QuarterlyLabel = "Quarterly";
this.AnnuallyLabel = "Annually ";
this.RestrictDates = "";
this.ScheduleTypeDefault = "1";
//console.log("At the start, this.ScheduleTypeDefault = " + this.ScheduleTypeDefault);
// Parameters incoming from the script method, which should be overwritten by their URL version here.
// Note: 'ScheduleType' from script/URL parameters should override the 'ScheduleTypeDefault' setting from the AURA setup page.
//this.ScheduleType = "";
//this.BeginDate= "";
//this.EndDate = "";
//console.log("At the start, we have ScheduleType = " + this.ScheduleType + ", BeginDate = " + this.BeginDate + ", and EndDate = " + this.EndDate);
// Recurring Begin/End date defaults and constraints.
this.UseCurrentDate = [{"useCurrentDate":"ON","scheduleType":"Monthly"},{"useCurrentDate":"ON","scheduleType":"Weekly"},{"useCurrentDate":"ON","scheduleType":"Quarterly"},{"useCurrentDate":"ON","scheduleType":"Annually"}];
this.RecurBeginDates = [{"beginDay":"1","beginMonth":"","scheduleType":"Monthly","dateIndex":1},{"beginDay":"0","beginMonth":"","scheduleType":"Monthly","dateIndex":2},{"beginDay":"1","beginMonth":"","scheduleType":"Weekly","dateIndex":1},{"beginDay":"1","beginMonth":"1","scheduleType":"Quarterly","dateIndex":1},{"beginDay":"0","beginMonth":"1","scheduleType":"Quarterly","dateIndex":2},{"beginDay":"1","beginMonth":"1","scheduleType":"Annually","dateIndex":1},{"beginDay":"0","beginMonth":"1","scheduleType":"Annually","dateIndex":2}];
this.RecurEndDates = [{"endNumber":"50","endType":"2","scheduleType":"Monthly"},{"endNumber":"50","endType":"2","scheduleType":"Weekly"},{"endNumber":"50","endType":"2","scheduleType":"Quarterly"},{"endNumber":"50","endType":"2","scheduleType":"Annually"}];
//console.log("UseCurrentDate: ");
//this.UseCurrentDate.forEach(function (element, index) {
// console.log(element);
//});
//console.log("RecurBeginDates: ");
//this.RecurBeginDates.forEach(function (element, index) {
// console.log(element);
//});
//console.log("RecurEndDates: ");
//this.RecurEndDates.forEach(function (element, index) {
// console.log(element);
//});
//console.log("UseCurrentDate: " + this.UseCurrentDate);
//console.log("RecurBeginDates: " + this.RecurBeginDates);
//console.log("RecurEndDates: " + this.RecurEndDates);
//this.debugLog = "";
//console.log("Debug Log: " + this.debugLog);
this.ReoccurringInformationLabel = "";
this.ReoccurringList = [{Desc:"Schedule Type",Name:"ScheduleType",Visible:1,Required:1,Type:"Text",MiniLen:1,ErrorMsg:"",Value:"",MaxLen:"11"}
,{Desc:"Begin Date",Name:"BeginDate",Visible:1,Required:0,Type:"Text",MiniLen:1,ErrorMsg:"Begin date must be today or later",Value:"",MaxLen:"11"}
,{Desc:"End Date",Name:"EndDate",Visible:0,Required:0,Type:"Text",MiniLen:1,ErrorMsg:"End date must be later than begin date",Value:"",MaxLen:"11"}
]; // This contains ScheduleType, BeginDate, and EndDate data extracted from the client parameters using the script method from the .cs script.
this.showReoccurring = showReoccurring;
this.showScheduleDate = showScheduleDate;
this.createReoccurringDiv = IATSCreateReoccurringDiv;
this.createSendEmailDiv = IATSCreateSendEmailDiv;
// CAPTCHA
this.createCAPTCHADiv = IATSCreateCAPTCHADiv;
this.enableCAPTCHA = "1";
this.captchatheme = "light";
this.RecaptchaSiteKey = "6LdEeUwUAAAAACFjx63s6auf9g8PH9QgwmLzJjoi";
//Get Client's Parameters.
this.clientparameters = decodeURIComponent("");
// Processing Fee
this.processingFee_Enabled = "1";
this.processingFee_Message = "Click here to cover the processing fee so we can use your TOTAL donation to help Preserve Democracy!";
this.processingFee_Percent = "3.20";
this.auraLink_PageTitle = "Support Preserve Democracy";
this.auraLink_PageDescription = "";
this.auraLink_FormPosition = "Center";
this.auraLink_FormColor = "#ffffff";
this.auraLink_FormTransparency = "1";
this.auraLink_BackgroundColor = "#ffffff";
this.auraLink_LogoPosition = "Left";
this.auraLink_BackgroundImagePath = "";
this.auraLink_CustomLogoPath = "https://www.iatspayments.com/paymentbox/cache/AuImage/5PRG/lo_picture2_jpg.jpg";
this.auraLink_BackgroundImgPosition = "center center";
this.auraLink_BackgroundImgAttachment = "";
this.auraLink_BackgroundImgRepeat = "no-repeat";
this.auraLink_BackgroundImgHeight = "";
this.auraLink_BackgroundImgWidth = "";
this.auraLink_Header = "";
this.auraLink_HeaderSize = "40px";
this.auraLink_HeaderFont = "Helvetica";
this.auraLink_HeaderAlignment = "Select";
this.auraLink_HeaderColor = "#003566";
this.auraLink_SubHeaderText = "";
this.auraLink_SubHeaderSize = "10px";
this.auraLink_SubHeaderFont = "Select";
this.auraLink_SubHeaderAlignment = "Select";
this.auraLink_SubHeaderColor = "#3a6ea6";
this.auraLink_CustomHtml = "";
this.clientCustomFields = [];
this.createUKDirectDebitDiv1 = IATSCreateUKDirectDebitDiv1;
this.createUKDirectDebitDiv2 = IATSCreateUKDirectDebitDiv2;
this.createUKDirectDebitDiv3 = IATSCreateUKDirectDebitDiv3;
this.createUKDirectDebitDiv4 = IATSCreateUKDirectDebitDiv4;
this.createUKDirectDebitDiv5 = IATSCreateUKDirectDebitDiv5;
this.createNACHPolicyDiv = IATSCreateNACHPolicyDiv;
this.closeNACHPolicyStatement = IATSCloseNACHPolicyStatement;
this.closeNACHRecourceStatement = IATSCloseNACHRecourceStatement;
this.createNACHRecourseDiv = IATSCreateNACHRecourseDiv;
this.createShareLinkDiv = IATSCreateShareLinkDiv;
this.checkRecurringBeginDate = IATSCheckRecurringBeginDate;
this.checkRecurringEndDate = IATSCheckRecurringEndDate;
this.checkZipCode = IATScheckZipCode;
this.validEmail = IATSvalidEmail;
this.IsEmailMatch = IATSIsEmailMatch;
// If there are client parameters coming from the "script method", they are coming in here.
this.recurringCheck = false;
//console.log("At the start, this.recurringCheck = " + this.recurringCheck);
this.hideRecurringCheckbox = 0;
this.redirectTime = 7000;
this.hideCVV = 0;
this.bankWithdrawalChecked = 0;
this.HideAmountInfo = "0";
this.TotalAmount = "0";
this.TotalDescription = "Total is";
this.defaultTotal = (Math.round(this.TotalAmount*100)/100).toFixed(2);
this.EventPaymentWidth = "900";
this.EventStyleSheet = "";
this.ThirdStyleSheet = "https://iatspayments.com/PaymentBox/css/IATSPaymentBoxThird.css?PID=PA17E64C0BDED98E06&Version=NA&cb=33375";
this.EventPostBackURL = "";
this.RedirectURL = "www.iatspayments.com";
// ACH
this.USCheckVisible = "CHECKED";
this.CANCheckVisible = "";
this.UKCheckVisible = "";
this.USCheckLabel = "Bank Withdrawal";
this.UKCheckLabel = "Bank Withdrawal";
this.CANCheckLabel = "Bank Withdrawal";
this.CreditCardLabel = "Credit Card";
this.AgentCode = "5PRG80";
// CC optional
this.CreditCardVisible = "CHECKED";
// Default amount checked.
this.AmountDefaultChecked = "Checked";
this.AmountDefaultCheckedError = "Please select at least one amount item.";
this.DefaultSocialLinks = "CHECKED";
this.FormURL = "www.preservedemocracy.com";
this.FormURLTitle = "Preserve Democracy";
this.EmailFriendMessage = "I just donated to Preserve Democracy! Elections must be accessible to all Americans. Help stop those trying to corrupt democracy through voter suppression. Donate today!";
this.AdvancedShare = "";
this.Snippet = "";
this.iatsForm = null;
this.createPaymentBoxScriptDiv = IATSCreatePaymentBoxScriptDiv;
this.createPaymentBoxDiv = IATSCreatePaymentBoxDiv;
this.createPaymentBoxForm = IATSCreatePaymentBoxForm;
this.createPaymentBoxInnerDiv = IATSCreatePaymentBoxInnerDiv;
this.createPaymentBoxHeaderDiv = IATSCreatePaymentBoxHeaderDiv;
this.createPaymentBoxContentDiv = IATSCreatePaymentBoxContentDiv;
this.createPaymentBoxAmountListDiv = IATSCreatePaymentBoxAmountListDiv;
this.createPaymentBoxPaymentDiv = IATSCreatePaymentBoxPaymentDiv;
this.createPaymentBoxErrorMsgDiv = IATSCreatePaymentBoxErrorMsgDiv;
this.createPaymentBoxFooterDiv = IATSCreatePaymentBoxFooterDiv;
this.countryOnSelect = IATSCountryOnSelect;
this.processTransaction = IATSProcessTransaction;
this.backToReInput = IATSBackToReInput;
this.cCNumfieldCheck = IATSCCNumfieldCheck;
this.cCNumfieldCheckIPad = IATSCCNumfieldCheckIPad;
this.iATSAmountQtyCheck = IATSAmountQtyCheck;
this.iATSGetTotal = IATSGetTotal;
this.showAndUpdateResponse = IATSShowAndUpdateResponse;
this.UKDirectDebitGetPayer = IATSUKDirectDebitGetPayer;
this.createPaymentBoxResponseDiv = IATSCreatePaymentBoxResponseDiv;
this.validatePaymentInput = IATSValidatePaymentInput;
this.stringTrim = IATSStringTrim;
this.installEventStyleSheet = IATSInstallEventStyleSheet;
this.LimitCommentText = limitText;
this.showScript = IATSShowScript;
this.iATSGetElementsByNameFilterByValue = IATSGetElementsByNameFilterByValue;
this.iATSTurnOffOtherMinErrors = IATSTurnOffOtherMinErrors;
this.iATSTurnOnOtherMinErrors = IATSTurnOnOtherMinErrors;
this.iATSClearUncheckedOtherBoxes = IATSClearUncheckedOtherBoxes;
this.recurringUpdateBeginEndDateDefaults = IATSRecurringUpdateBeginEndDateDefaults;
this.createElement = IATSCreateElement;
this.OpenCNDHelpImg = IATSOpenCNDHelpImg;
this.OpenUSHelpImg = IATSOpenUSHelpImg;
this.OpenCVV2Img = IATSOpenCVV2Img;
this.OpenUKHelpImg = IATSOpenUKHelpImg;
this.OpenSEPAHelpImg = IATSOpenSEPAHelpImg;
this.openMoreInfoDiv = OpenMoreInfoDiv;
this.ShowText = IATSShowText;
this.HideText = IATSHideText;
//console.log("Before extraction, ReoccurringList: ");
//this.ReoccurringList.forEach(function (element, index) {
// console.log("Name " + element.Name + ", Value = " + element.Value);
//});
//Currently, URL method cannot display all default parameters pre-setup by clients.
//Some parameter values (e.g., TotalDescription, TotalAmount, and HideCVV) are missing on the web page even if clients have set up their default values.
//The reason is because these parameters from URL method are not extracted and handled in this file.
//The code below will extract these parameters such that their default values will be displayed on the web page.
if (this.clientparameters.length > 0)
{
var parameters = ["TotalDescription", "TotalAmount", "RedirectTime", "HideAmountInfo",
"HideWeekly", "HideMonthly", "HideQuarterly", "HideAnnually", "HideCVV", "HideRecurringBeginDate", "HideRecurringEndDate", "RecurringChecked", "BankWithdrawalChecked",
"ScheduleType", "BeginDate", "EndDate"];
for (var i = 0; i < parameters.length; i++)
{
var name = parameters[i];
var index = this.clientparameters.indexOf(name+"=");
var value = "";
if (index >= 0)
{
var next = this.clientparameters.indexOf("&", index);
if (next > 0)
{
value = this.clientparameters.substring(index+name.length+1, next);
}
// If it can't find another "&" sign, it is the last parameter, so read until the end of the 'clientparameter' string.
else
{
value = this.clientparameters.substring(index+name.length+1, this.clientparameters.length);
}
switch (name)
{
case 'TotalDescription':
this.TotalDescription = value;
break;
case 'TotalAmount':
this.TotalAmount = value;
this.defaultTotal = (Math.round(this.TotalAmount*100)/100).toFixed(2);
break;
case 'RedirectTime':
this.redirectTime = value;
break;
case 'HideAmountInfo':
this.HideAmountInfo = value.toUpperCase() == 'TRUE' ? 1 : this.HideAmountInfo;
break;
case 'HideWeekly':
this.WeeklyVisible = value.toUpperCase() == 'TRUE' ? "" : this.WeeklyVisible;
break;
case 'HideMonthly':
this.MonthlyVisible = value.toUpperCase() == 'TRUE' ? "" : this.MonthlyVisible;
break;
case 'HideQuarterly':
this.QuarterlyVisible = value.toUpperCase() == 'TRUE' ? "" : this.QuarterlyVisible;
break;
case 'HideAnnually':
this.AnnuallyVisible = value.toUpperCase() == 'TRUE' ? "" : this.AnnuallyVisible;
break;
case 'HideCVV':
this.hideCVV = value.toUpperCase() == 'TRUE' ? 1 : this.hideCVV;
break;
case "HideRecurringBeginDate":
window.hideRecurringBeginDate = value.toUpperCase() == 'TRUE' ? 1 : window.hideRecurringBeginDate;
break;
case "HideRecurringEndDate":
window.hideRecurringEndDate = value.toUpperCase() == 'TRUE' ? 1 : window.hideRecurringEndDate;
break;
case "RecurringChecked":
this.recurringCheck = value.toUpperCase() == 'TRUE' ? true : false
break;
case "BankWithdrawalChecked":
this.bankWithdrawalChecked = value.toUpperCase() == 'TRUE' ? 1 : this.bankWithdrawalChecked;
break;
case 'ScheduleType':
this.ReoccurringList[0].Value = value;
break;
case 'BeginDate':
this.ReoccurringList[1].Value = value;
break;
case 'EndDate':
this.ReoccurringList[2].Value = value;
break;
default:
break;
}
}
}
}
//console.log("After extraction, ReoccurringList: ");
//this.ReoccurringList.forEach(function (element, index) {
// console.log("Name " + element.Name + ", Value = " + element.Value);
// console.log("Checkdate on above: " + checkdate(element.Value));
//});
//console.log("Checkdate: dog : " + checkdate("dog"));
//console.log("Checkdate: 0101/2020 : " + checkdate("0101/2020"));
//console.log("Checkdate: 01012020 : " + checkdate("01012020"));
//console.log("Checkdate: empty string : " + checkdate(""));
// ACH
this.SelectPaymentType = IATSSelectPaymentType;
this.UKDirectDebit = IATSUKDirectDebit;
this.SelectPaymentFrequency = IATSSelectPaymentFrequency;
this.installEventStyleSheet();
// *** Note: The entire form 'div' is built with this line.
// Anything that references elements inside this should probably be called after it is built.
var div = this.iatsPaymentBoxDiv = this.createPaymentBoxDiv();
this.Script.parentNode.insertBefore(div, this.Script);
// Form building is now done.
var scriptdiv = this.createPaymentBoxScriptDiv();
this.Script.parentNode.insertBefore(scriptdiv, this.Script);
// Note: all BeginDate and EndDate values get set here.
// Use this to update the dropdown lists once the form has been built. If there are script or URL parameters, they will have to get added after this function runs.
IATSRecurringUpdateBeginEndDateDefaults(this);
// At this point we would like to override the MVCWeb parameters with some either the script or URL parameters.
// Set BeginDate and EndDate back to the script/URL parameter if it is not empty and passes validation.
// Set ScheduleType if it matches a valid option value. Otherwise, no option is selected (selectedIndex = -1).
for (var i = 0; i<3; i++)
{
// We should skip the remaining evaluations if the ReoccurringList[i] item is blank. This means no URL or script method value was assigned by the client.
// If we don't skip setting values when we get an empty string, the loop will start assigning empty values and overwriting the desired MVCWeb values.
if (this.ReoccurringList[i].Value.length == 0)
continue;
// Get the field that we will be editing: 'ScheduleType', 'BeginDate', or 'EndDate'.
var field = document.getElementById("IATS_Payment_" + this.ReoccurringList[i].Name);
if (this.ReoccurringList[i].Name == "ScheduleType")
{
// Assign ScheduleType information with no validation. Note: It must match the option case exactly.
field.value = this.ReoccurringList[i].Value;
}
if (this.ReoccurringList[i].Name == "BeginDate" || this.ReoccurringList[i].Name == "EndDate")
{
// If the date passed validation, set the corresponding field to that value. If the string fails validation, do nothing and leave it as the default value given by the Aura Setup Page.
// Note: an empty string will fail validation, but empty strings will also trigger the 'continue' command at the start and will never reach this far into the loop.
if (checkdate(this.ReoccurringList[i].Value))
{
field.value = this.ReoccurringList[i].Value;
}
}
}
// Hide cvv2 when check recurring
if(document.getElementById("IATS_Payment_ReoccurringCheck")!=null)
{
// Don't use the variable from the .cs file ('RecurringDefaultCheck') because it will always return false.
document.getElementById("IATS_Payment_ReoccurringCheck").checked = this.recurringCheck;
if(document.getElementById("IATS_Payment_ReoccurringCheck").checked==true && document.getElementById("IATS_Payment_CVV2Div")!=null)
document.getElementById("IATS_Payment_CVV2Div").style.display="none";
}
if(this.HideAmountInfo==0)
{
IATSGetTotal();
}
// This will show or hide the 'Recurring' input fields when set from "RecurringChecked". Also used with .onclick() for "One Time" and "Recurring" buttons.
showReoccurring();
// This will show the credit card or bank withdrawal div when set from "BankWithdrawalChecked". Also used with .onclick() for "Credit Card" and "Bank Withdrawal" buttons.
IATSSelectPaymentType();
if(document.all) { document.onmousemove = function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}; }
else { document.onmousemove = function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;} }
// Get Client's Parameters - for prepopulating input fields.
for (var i=0; i=0)
{
var index2 = this.clientparameters.indexOf("&",index1);
if(this.PrifileItemList[i].Name=="State")
var field = document.getElementById("IATS_PaymentItemInput_State2");
else var field = document.getElementById("IATS_PaymentItemInput_" + this.PrifileItemList[i].Name);
if (field!=null)
{
var fieldValue;
var index3 = this.clientparameters.indexOf("=",index1);
if (index2>=0)
fieldValue = this.clientparameters.substring(index3+1,index2);
else
fieldValue = this.clientparameters.substring(index3+1);
//Truncate the field value based on its max length
fieldValue = fieldValue.substring(0,this.PrifileItemList[i].MaxLen)
field.value = fieldValue;
}
if (index2>=0)
{
if (index1==0)
this.clientparameters=this.clientparameters.substring(index2+1);
else
this.clientparameters=this.clientparameters.substring(0,index1-1) + this.clientparameters.substring(index2);
}
else
{
if (index1==0)
this.clientparameters="";
else
this.clientparameters=this.clientparameters.substring(0,index1-1);
}
}
}
// Copy from the previous for loop and loop through the items 1-15
for (var i=0;i=0)
{
var index2 = this.clientparameters.indexOf("&",index1);
var field = document.getElementById("IATS_PaymentItemInput_" + this.PrifileItemList_Items[i].Name);
if (field!=null)
{
var fieldValue;
var index3 = this.clientparameters.indexOf("=",index1);
if (index2>=0)
fieldValue = this.clientparameters.substring(index3+1,index2);
else
fieldValue = this.clientparameters.substring(index3+1);
//Truncate the field value based on its max length
fieldValue = fieldValue.substring(0,this.PrifileItemList_Items[i].MaxLen)
field.value = fieldValue;
}
if (index2>=0)
{
if (index1==0)
this.clientparameters=this.clientparameters.substring(index2+1);
else
this.clientparameters=this.clientparameters.substring(0,index1-1) + this.clientparameters.substring(index2);
}
else
{
if (index1==0)
this.clientparameters="";
else
this.clientparameters=this.clientparameters.substring(0,index1-1);
}
}
}
// Extract client parameters for ReoccurringList (ScheduleType, BeginDate, and EndDate)
// Therefore, URL method will display default parameters on the web page just like JaveScript method.
// Note: Assigning 'field.value' will likely fail when resrict dates is on and the input box for Begin/End Date is now a dropdown menu.
// Note 2: This function will only trigger if the parameters appear in the URL, and only in this case do we want it to overwrite 'ScheduleType', 'BeginDate', and 'EndDate'.
// In all cases, we want these 3 values to be assigned to the corresponding elements, whether or not they appeared in the URL.
// Note 3: This function sets the values late (i.e. after the form has already been built). Thus, if a URL parameter exists, it will be set after all other setting methods have been used.
//for (var i = 0; i < this.ReoccurringList.length; i++)
//{
// var name = this.ReoccurringList[i].Name;
// var index = this.clientparameters.indexOf(name+"=");
// //console.log(document.getElementById("IATS_Payment_" + name));
// if (index > 0)
// {
// var next = this.clientparameters.indexOf("&", index);
// var field = document.getElementById("IATS_Payment_" + name);
// if (next > 0)
// {
// console.log("Next > 0, setting " + name + " to " + this.clientparameters.substring(index+name.length+1, next));
// field.value = this.clientparameters.substring(index+name.length+1, next);
// }
// else
// {
// console.log("Else hit, setting " + name + " to " + this.clientparameters.substring(index+name.length+1, this.clientparameters.length));
// field.value = this.clientparameters.substring(index+name.length+1, this.clientparameters.length);
// }
// }
//}
var EnableMobileCSS = "Checked";
if(EnableMobileCSS.toUpperCase()=="CHECKED"){
installViewPort();
}
}
//Get reject message
function getRejectMessage(rejectcode)
{
var rejectmessage = "";
var flag = false;
for(var i = 0; i < theIATSPaymentBoxCore.RejectList.length; ++i)
{
if(theIATSPaymentBoxCore.RejectList[i].Code == rejectcode)
{
rejectmessage = theIATSPaymentBoxCore.RejectList[i].Message;
flag = true;
break;
}
}
if(flag == false)
rejectmessage = theIATSPaymentBoxCore.RejectDefaultMessage;
return rejectmessage;
}
function installViewPort()
{
var head= document.getElementsByTagName('head')[0];
var meta= document.createElement('meta');
meta.name = 'viewport';
meta.content = 'width=device-width, initial-scale=1';
head.appendChild(meta);
}
// Restrict the dollar amount field to numbers only.
function isNumberKey(evt)
{
evt = evt || window.event;
var charCode = e.keyCode || e.which;
//var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}
function IATSvalidEmail()
{
if(document.getElementById("IATS_PaymentItemInput_EMail")!=null)
{
var email = document.getElementById("IATS_PaymentItemInput_EMail");
var emailError = document.getElementById("IATS_PaymentItemErrorMesssage_EMail");
if (email.value.length == 0) // Empty email. Set client-supplied message and don't check for valid formatting.
{
if (emailError != null)
emailError.innerHTML = theIATSPaymentBoxCore.ClientEmailError;
return true; // This function treats empty emails as valid. Min length checking is done elsewhere.
}
else // Email is not empty. Check for validity.
{
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,100})$/;
if(reg.test(email.value.replace(/^\s*/,"").replace(/\s*$/,"")) == false) // This regex trims the whitespace from the email before validation.
{
if (emailError != null)
emailError.innerHTML = "Please enter a valid email address.";
return false;
}
else return true;
}
}
else return true;
}
function IATSIsEmailMatch()
{
if(document.getElementById("IATS_PaymentItemInput_EMail")!=null && document.getElementById("IATS_PaymentItemInput_ReEnterEmail")!=null)
{
var email1 = document.getElementById("IATS_PaymentItemInput_EMail").value;
var email2 = document.getElementById("IATS_PaymentItemInput_ReEnterEmail").value;
if(email1!=email2)
return false;
else
return true;
}
else return true;
}
function IATSIsSocialSecurityNumber(value)
{
var reg = /\d{3,}-\d{2}-\d{4,}/;
return reg.test(value);
}
function IATSCreateElement(elementtype, name, elementinnerHtml)
{
var IE = false;
var element = null;
if (name!="")
{
try
{
if (IE)
{
try
{
element = document.createElement('<' + elementtype + ' name="' + name + '" />');
}
catch(e)
{
}
if(!element)
{
element = document.createElement(elementtype);
element.setAttribute("name", name);
}
}
else
{
element = document.createElement(elementtype);
element.setAttribute("name", name);
}
}
catch (e)
{
}
}
else
{
element = document.createElement(elementtype);
}
if(!element)
{
return;
}
if (elementinnerHtml!== '')
{
if (elementtype.toUpperCase() == 'OPTION')
element.text = elementinnerHtml;
else
element.innerHTML = elementinnerHtml;
}
return element;
};
function hexToRgb(hex, opacity) {
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ?
'rgba(' + parseInt(result[1], 16).toString() + ',' + parseInt(result[2], 16).toString() + ',' + parseInt(result[3], 16).toString() + ',' + parseFloat(opacity).toString() + ')' : null;
}
function IATSCreatePaymentBoxDiv()
{
var div;
div = this.createElement("div","","");
div.className = "IATS_Div";
div.setAttribute("id", "IATS_PaymentBoxDiv");
if (this.EventPaymentWidth>100)
{
div.style.width = this.EventPaymentWidth+"px";
}
// Only run below code if its a stand alone aura form
var auracont = document.getElementById("auraContainer");
if (auracont && !this.auraLink_CustomHtml) {
if (this.auraLink_PageTitle)
window.document.title = this.auraLink_PageTitle;
if (this.auraLink_SubHeaderText) {
var p2 = this.createElement("p","","");
p2.innerHTML = this.auraLink_SubHeaderText;
if (this.auraLink_SubHeaderSize)
p2.style.fontSize = this.auraLink_SubHeaderSize;
if (this.auraLink_SubHeaderColor)
p2.style.color = this.auraLink_SubHeaderColor;
if (this.auraLink_SubHeaderFont)
p2.style.fontFamily = this.auraLink_SubHeaderFont;
if (this.auraLink_SubHeaderAlignment)
p2.style.textAlign = this.auraLink_SubHeaderAlignment;
div.insertBefore(p2, div.childNodes[0]);
}
if (this.auraLink_CustomLogoPath || this.auraLink_Header) {
var headerdiv = this.createElement("div","","");
headerdiv.style.marginBottom = "10px";
if (this.auraLink_CustomLogoPath) {
var logoImg = this.createElement("img","","");
logoImg.setAttribute("src", this.auraLink_CustomLogoPath);
logoImg.style.maxHeight = "100px";
logoImg.style.maxWidth = "250px";
var dimg = logoImg.cloneNode(true);
dimg.style.visibility = "hidden";
logoImg.style.cssFloat = "Left";
dimg.style.cssFloat = "Right";
if (this.auraLink_LogoPosition == "Right") {
logoImg.style.cssFloat = "Right";
dimg.style.cssFloat = "Left";
}
headerdiv.appendChild(logoImg);
headerdiv.appendChild(dimg);
}
if (this.auraLink_Header) {
var h1 = this.createElement("h1","",this.auraLink_Header);
if (this.auraLink_HeaderColor)
h1.style.color = this.auraLink_HeaderColor;
if (this.auraLink_HeaderSize)
h1.style.fontSize = this.auraLink_HeaderSize;
if (this.auraLink_HeaderFont)
h1.style.fontFamily = this.auraLink_HeaderFont;
if (this.auraLink_HeaderAlignment)
h1.style.textAlign = this.auraLink_HeaderAlignment;
headerdiv.appendChild(h1);
}
auracont.insertBefore(headerdiv, auracont.childNodes[0]);
}
if (this.auraLink_FormPosition && this.auraLink_FormPosition != "Select"){
auracont.style.textAlign = this.auraLink_FormPosition;
div.style.display = "inline-block";
}
if (this.auraLink_FormColor) {
if (this.auraLink_FormTransparency == "1")
div.style.background = this.auraLink_FormColor;
else
div.style.background = hexToRgb(this.auraLink_FormColor, this.auraLink_FormTransparency);
}
if (this.auraLink_BackgroundColor)
document.body.style.backgroundColor = this.auraLink_BackgroundColor;
if (this.auraLink_BackgroundImagePath) {
var imgurl = "url('" + this.auraLink_BackgroundImagePath + "')";
document.body.style.background = imgurl;
var metaTag=document.createElement('meta');
metaTag.name = "viewport"
metaTag.content = "width=device-width, initial-scale=1.0, maximum-scale=1.0"
var headele = document.getElementsByTagName('head')[0];
headele.insertBefore(metaTag, headele.childNodes[0]);
if (this.auraLink_BackgroundImgAttachment && this.auraLink_BackgroundImgAttachment != "")
document.body.style.backgroundAttachment = this.auraLink_BackgroundImgAttachment;
if (this.auraLink_BackgroundImgPosition && this.auraLink_BackgroundImgPosition != "") {
if (this.auraLink_BackgroundImgPosition && this.auraLink_BackgroundImgPosition != "stretch") {
document.body.style.backgroundPosition = this.auraLink_BackgroundImgPosition;
if (this.auraLink_BackgroundImgRepeat && this.auraLink_BackgroundImgRepeat != "select")
document.body.style.backgroundRepeat = this.auraLink_BackgroundImgRepeat;
}
else{
document.body.style.backgroundSize = "100% 100%";
}
} else {
}
}
}
// End stand alone section
var form = this.createPaymentBoxForm();
div.appendChild(form);
if (this.auraLink_CustomHtml && auracont){
document.body.innerHTML = this.auraLink_CustomHtml;
var wm = document.getElementById("wrapperMain");
var wa = document.getElementById("wrapperAura");
wm.replaceChild(div, wa);
return wa;
} else {
return div;
}
}
function CheckScriptLoaded(url, ext) {
var scripts = document.getElementsByTagName('script');
for (var i = scripts.length; i--;) {
if (scripts[i].src.indexOf(url) >= 0 && scripts[i].src.indexOf(ext) >= 0) return true;
}
return false;
}
function IATSCreatePaymentBoxScriptDiv()
{
var div;
div = this.createElement("div","","");
div.setAttribute("id", "IATSPaymentBoxScriptDiv");
div.style.display="none";
return div;
}
function IATSCreatePaymentBoxForm()
{
var form;
if (this.Script==null)
return;
var parentObj = this.Script.parentNode;
var foundForm = 0;
while(parentObj!=null && parentObj!=undefined)
{
if (parentObj.tagName==undefined)
break;
if (parentObj.tagName.toUpperCase()=="BODY")
{
break;
}
if (parentObj.tagName.toUpperCase()=="FORM")
{
foundForm = 1;
break;
}
parentObj = parentObj.parentNode;
}
if (foundForm)
{
form = this.createElement("div","IATSPaymentBoxForm","");
form.setAttribute("id", "IATSPaymentBoxForm");
form.setAttribute("name", "IATSPaymentBoxForm");
//Find the form.
this.iatsForm = parentObj;
var div = this.createPaymentBoxInnerDiv();
form.appendChild(div);
}
else
{
form = this.createElement("form","IATSPaymentBoxForm","");
form.setAttribute("id", "IATSPaymentBoxForm");
form.setAttribute("name", "IATSPaymentBoxForm");
form.setAttribute("action", "javascript:");
//Find the form.
this.iatsForm = form;
var div = this.createPaymentBoxInnerDiv();
form.appendChild(div);
}
return form;
}
function IATSCreatePaymentBoxInnerDiv()
{
var div;
div = this.createElement("div","","");
div.className = "IATS_InnerDiv";
var childDiv;
childDiv = this.createPaymentBoxHeaderDiv();
div.appendChild(childDiv);
childDiv = this.createPaymentBoxContentDiv();
div.appendChild(childDiv);
//add auraid redirect postback.
var auraID = this.createElement("input","IATS_Payment_AuraID","");
auraID.setAttribute("id","IATS_Payment_AuraID");
auraID.setAttribute("name","IATS_Payment_AuraID");
auraID.setAttribute("type","hidden");
auraID.value = this.PaymentBoxPID;
div.appendChild(auraID);
var last4 = this.createElement("input","IATS_Payment_AccountNumber4","");
last4.setAttribute("id","IATS_Payment_AccountNumber4");
last4.setAttribute("name","IATS_Payment_AccountNumber4");
last4.setAttribute("type","hidden");
div.appendChild(last4);
//create UK Direct debit pages for GBP currency only
if(this.version == "UK" && this.currency == "3")
{
childDiv = this.createUKDirectDebitDiv1();
div.appendChild(childDiv);
childDiv = this.createUKDirectDebitDiv2();
div.appendChild(childDiv);
childDiv = this.createUKDirectDebitDiv3();
div.appendChild(childDiv);
childDiv = this.createUKDirectDebitDiv4();
div.appendChild(childDiv);
childDiv = this.createUKDirectDebitDiv5();
div.appendChild(childDiv);
}
var auracont = document.getElementById("auraContainer")
if (this.auraLink_FormColor && auracont) {
if (this.auraLink_FormTransparency == "1")
div.style.background = this.auraLink_FormColor;
else
div.style.background = hexToRgb(this.auraLink_FormColor, this.auraLink_FormTransparency);
}
return div;
}
function IATSCreatePaymentBoxHeaderDiv()
{
var div;
div = this.createElement("div","","");
div.className = "IATS_HeaderDiv";
return div;
}
function showReoccurring()
{
//console.log("showReoccurring ran.");
if(document.getElementById('IATS_Payment_ReoccurringCheck')!=null)
{
//console.log("document.getElementById('IATS_Payment_ReoccurringCheck').checked = " + document.getElementById('IATS_Payment_ReoccurringCheck').checked);
if(document.getElementById('IATS_Payment_ReoccurringCheck').checked)
{
document.getElementById("IATS_Payment_ReoccurringSettingDiv").style.display = 'block';
if(document.getElementById("IATS_Payment_CVV2Div")!=null)
document.getElementById("IATS_Payment_CVV2Div").style.display="none";
if(document.getElementById("IATS_Payment_ACHAgreementDiv")!=null) // Display checkbox only for reoccuring payment
document.getElementById("IATS_Payment_ACHAgreementDiv").style.display="block";
}
else
{
document.getElementById("IATS_Payment_ReoccurringSettingDiv").style.display = 'none';
if(document.getElementById("IATS_Payment_CVV2Div")!=null)
document.getElementById("IATS_Payment_CVV2Div").style.display="block";
if(document.getElementById("IATS_Payment_ACHAgreementDiv")!=null) // Display checkbox only for reoccuring payment
{
document.getElementById("IATS_Payment_ACHAgreementDiv").style.display="none";
document.getElementById("IATS_Payment_ACHAgreementCheckbox").checked = false;
}
}
var _version = "NA";
if(_version == "UK")
IATSUKACHRecurringDisplay();
}
}
function IATSUKACHRecurringDisplay()
{
var _version = "NA";
var _currency = "1";
if(document.getElementById('IATS_Payment_ReoccurringCheck').checked)
{
if(document.getElementById('IATS_Payment_DebitCardPayment').checked && _version == "UK")
{
//Only disable the Weekly and Quarterly options for GBP
if(_currency == "3")
{
var option1 = document.getElementById('IATS_Payment_RecurringWeeklyOption');
var option2 = document.getElementById('IATS_Payment_RecurringQuarterlyOption');
if(option1!=null)
document.getElementById('IATS_Payment_ScheduleType').removeChild(option1);
if(option2!=null)
document.getElementById('IATS_Payment_ScheduleType').removeChild(option2);
}
//Hide the Begin and End date fields for GBP currency only
if(_currency == "3")
{
document.getElementById('IATS_ReoccurringDiv_BeginDate').style.display = "none";
document.getElementById('IATS_ReoccurringDiv_EndDate').style.display = "none";
}
else
{
if(window.hideRecurringBeginDate != 1)
{
document.getElementById('IATS_ReoccurringDiv_BeginDate').style.display = "block";
}
if(window.hideRecurringEndDate != 1)
{
document.getElementById('IATS_ReoccurringDiv_EndDate').style.display = "block";
}
}
}
else
{
if(typeof(theIATSPaymentBoxCore)=="undefined") {return;}
if(document.getElementById('IATS_Payment_RecurringWeeklyOption')==null && theIATSPaymentBoxCore.WeeklyVisible.toUpperCase()=="CHECKED")
{
var option_weekly = document.createElement("OPTION");
option_weekly.value = "Weekly";
option_weekly.text = "Weekly";
option_weekly.setAttribute("id", "IATS_Payment_RecurringWeeklyOption");
document.getElementById('IATS_Payment_ScheduleType').options.add(option_weekly);
}
if(document.getElementById('IATS_Payment_RecurringQuarterlyOption')==null && theIATSPaymentBoxCore.QuarterlyVisible.toUpperCase()=="CHECKED")
{
var option_quarterly = document.createElement("OPTION");
option_quarterly.value = "Quarterly";
option_quarterly.text = "Quarterly";
option_quarterly.setAttribute("id", "IATS_Payment_RecurringQuarterlyOption");
document.getElementById('IATS_Payment_ScheduleType').options.add(option_quarterly);
}
if(window.hideRecurringBeginDate != 1)
{
document.getElementById('IATS_ReoccurringDiv_BeginDate').style.display = "block";
}
if(window.hideRecurringEndDate != 1)
{
document.getElementById('IATS_ReoccurringDiv_EndDate').style.display = "block";
}
}
}
}
function showScheduleDate()
{
var selectdate = document.getElementById('IATS_Payment_ScheduleDate'); // This is the only occurance of this ID in this document....
selectdate.options.length=0;
if(document.getElementById('IATS_Payment_ScheduleType').value == 'Weekly')
{
for(i=0;i<7;i++)
{
var pOption=document.createElement("OPTION");
pOption.value=i+1;
pOption.text=theIATSPaymentBoxCore.WeekList[i]
selectdate.options.add(pOption);
}
}
else if(document.getElementById('IATS_Payment_ScheduleType').value == 'Monthly')
{
for(i=1;i<32;i++)
{
var pOption = document.createElement("option");
pOption.value = i;
pOption.text = i;
selectdate.options.add(pOption);
}
}
}
function IATSSelectPaymentType()
{
var paymentType1 = document.getElementById('IATS_Payment_CreditCardPayment');
var paymentType2 = document.getElementById('IATS_Payment_DebitCardPayment');
if(paymentType1!=null && paymentType1.checked)
{
if(document.getElementById('IATS_Payment_CreditCardDiv')!=null)
document.getElementById('IATS_Payment_CreditCardDiv').style.display = "block";
if(document.getElementById('IATS_Payment_DebitDiv')!=null)
document.getElementById('IATS_Payment_DebitDiv').style.display = "none";
}
else if(paymentType2!=null && paymentType2.checked)
{
if(document.getElementById('IATS_Payment_CreditCardDiv')!=null)
document.getElementById('IATS_Payment_CreditCardDiv').style.display = "none";
if(document.getElementById('IATS_Payment_DebitDiv')!=null)
document.getElementById('IATS_Payment_DebitDiv').style.display = "block";
}
var _version = "NA";
if(_version == "UK")
IATSUKACHRecurringDisplay();
}
// This function is called when the buttons "One Time" or "Recurring" are clicked.
// For NA, it loads or hides the 'IATS_Payment_ReoccurringSettingDiv' div.
function IATSSelectPaymentFrequency()
{
var paymentFrquency1 = document.getElementById('IATS_Payment_RecurringPayment');
var paymentFrquency2 = document.getElementById('IATS_Payment_SinglePayment');
if(paymentFrquency1!=null && paymentFrquency1.checked)
{
document.getElementById('IATS_Payment_ReoccurringCheck').checked = true;
showReoccurring();
if(theIATSPaymentBoxCore.UKCheckVisible=="CHECKED" && theIATSPaymentBoxCore.CreditCardVisible=="CHECKED")
document.getElementById("IATS_Payment_AccountTypeDiv").style.display = "block";
IATSSelectPaymentType();
}
else if(paymentFrquency2!=null && paymentFrquency2.checked)
{
document.getElementById('IATS_Payment_ReoccurringCheck').checked = false;
showReoccurring();
if(theIATSPaymentBoxCore.version=="UK")
{
document.getElementById("IATS_Payment_AccountTypeDiv").style.display = "none";
if(document.getElementById('IATS_Payment_DebitDiv')!=null)
{
document.getElementById('IATS_Payment_DebitDiv').style.display = "none";
}
if(theIATSPaymentBoxCore.CreditCardVisible=="CHECKED")
document.getElementById('IATS_Payment_CreditCardDiv').style.display = "block";
}
else
{
if(theIATSPaymentBoxCore.UKCheckVisible=="CHECKED" && theIATSPaymentBoxCore.CreditCardVisible=="CHECKED")
document.getElementById("IATS_Payment_AccountTypeDiv").style.display = "block";
IATSSelectPaymentType();
}
}
document.getElementById('IATS_Payment_PaymentAccountInputDiv').style.display = "block";
}
function IATSUKDirectDebit()
{
if(theIATSPaymentBoxCore.version == "UK" && theIATSPaymentBoxCore.currency == "3" && document.getElementById("IATS_Payment_ACHAgreementCheckbox")!=null )
{
if(document.getElementById("IATS_Payment_ACHAgreementCheckbox").checked)
{
if(IATSValidatePaymentInput()==false)
{
document.getElementById("IATS_Payment_ACHAgreementCheckbox").checked = false;
return;
}
if(document.getElementById("IATS_Payment_DirectDebitPage1Div")!=null)
document.getElementById("IATS_Payment_DirectDebitPage1Div").style.display="block";
if(document.getElementById("IATS_ContentSectionDiv")!=null)
document.getElementById("IATS_ContentSectionDiv").style.display="none";
//Can't use document.location.protocol in template file. must define it in this file
document.getElementById("IATS_Payment_DirectDebitPage1Img1").src="https://"+theIATSPaymentBoxCore.serverURL+"/paymentbox/img/bacs_approved.png";
document.getElementById("IATS_Payment_DirectDebitPage1Img3").src="https://"+theIATSPaymentBoxCore.serverURL+"/paymentbox/img/iats_logo.jpg";
document.getElementById("IATS_Payment_DirectDebitPage1Img2").src="https://"+theIATSPaymentBoxCore.serverURL+"/paymentbox/img/DirectDebit_logo.png";
document.getElementById("IATS_Payment_DirectDebitPage2Img1").src="https://"+theIATSPaymentBoxCore.serverURL+"/paymentbox/img/bacs_approved.png";
document.getElementById("IATS_Payment_DirectDebitPage2Img3").src="https://"+theIATSPaymentBoxCore.serverURL+"/paymentbox/img/iats_logo.jpg";
document.getElementById("IATS_Payment_DirectDebitPage2Img2").src="https://"+theIATSPaymentBoxCore.serverURL+"/paymentbox/img/DirectDebit_logo.png";
document.getElementById("IATS_Payment_DirectDebitPage3Img1").src="https://"+theIATSPaymentBoxCore.serverURL+"/paymentbox/img/bacs_approved.png";
document.getElementById("IATS_Payment_DirectDebitPage3Img3").src="https://"+theIATSPaymentBoxCore.serverURL+"/paymentbox/img/iats_logo.jpg";
document.getElementById("IATS_Payment_DirectDebitPage3Img2").src="https://"+theIATSPaymentBoxCore.serverURL+"/paymentbox/img/DirectDebit_logo.png";
document.getElementById("IATS_Payment_DirectDebitPage4Img1").src="https://"+theIATSPaymentBoxCore.serverURL+"/paymentbox/img/bacs_approved.png";
document.getElementById("IATS_Payment_DirectDebitPage4Img3").src="https://"+theIATSPaymentBoxCore.serverURL+"/paymentbox/img/iats_logo.jpg";
document.getElementById("IATS_Payment_DirectDebitPage4Img2").src="https://"+theIATSPaymentBoxCore.serverURL+"/paymentbox/img/DirectDebit_logo.png";
document.getElementById("IATS_Payment_DirectDebitPage5Img1").src="https://"+theIATSPaymentBoxCore.serverURL+"/paymentbox/img/bacs_approved.png";
document.getElementById("IATS_Payment_DirectDebitPage5Img3").src="https://"+theIATSPaymentBoxCore.serverURL+"/paymentbox/img/iats_logo.jpg";
document.getElementById("IATS_Payment_DirectDebitPage5Img2").src="https://"+theIATSPaymentBoxCore.serverURL+"/paymentbox/img/DirectDebit_logo.png";
scroll(0,0);
}
}
}
// Show help for ACH check format
function IATSOpenCNDHelpImg()
{
var imgurl = "https://www.iatspayments.com/paymentbox/img/CAN.jpg";
var content="";
window1=window.open("","_blank","menubar=1,resizable=1,width=350,height=250");
window1.document.write(content);
window1.moveTo(550,200);
window1.opener = null;
return false;
}
function IATSOpenUSHelpImg()
{
var imgurl = "https://www.iatspayments.com/paymentbox/img/US.jpg";
var content="";
var window1=window.open("","_blank","menubar=1,resizable=1,width=350,height=250");
window1.document.write(content);
window1.moveTo(550,200);
window1.opener = null;
return false;
}
function IATSOpenCVV2Img()
{
var imgLang = '';
var imgurl = "https://www.iatspayments.com/paymentbox/img/cvv2.jpg";
if (imgLang.toUpperCase() == "FR")
imgurl = "https://www.iatspayments.com/paymentbox/img/cvv2_fr.jpg";
window1=window.open(imgurl,"_blank","menubar=1,resizable=1,width=350,height=250");
window1.moveTo(550,200);
window1.opener = null;
return false;
}
function IATSOpenUKHelpImg()
{
var imgurl = "https://www.uk.iatspayments.com/paymentbox/img/UK.jpg";
var content="";
window1=window.open("","_blank","menubar=1,resizable=1,width=350,height=250");
window1.document.write(content);
window1.moveTo(550,200);
window1.opener = null;
return false;
}
function IATSOpenSEPAHelpImg()
{
var imgurl = "https://www.uk.iatspayments.com/paymentbox/img/SEPA.png";
window1=window.open(imgurl,"_blank","menubar=1,resizable=1,width=700,height=400");
window1.moveTo(550,200);
window1.opener = null;
return false;
}
function IATSOpenTLSHelp()
{
settings = "toolbar=no,location=no,directories=no," +
"status=no,menubar=no,scrollbars=yes," +
"resizable=yes,width=800,height=800";
NewWindow=window.open('http://content.iatspayments.com/tls-being-retired', 'TLSWin', settings);
}
function IATSOpenUpgradeBrowserHelp()
{
settings = "toolbar=no,location=no,directories=no," +
"status=no,menubar=no,scrollbars=yes," +
"resizable=yes,width=800,height=800";
NewWindow=window.open('http://content.iatspayments.com/tls-browser-in-need-of-updates','TLSWin',settings);
}
function IATSValidCCNumber(ccNum)
{
if(ccNum.length<2)
return false;
var m = 0;
var n = 0;
for(var i=ccNum.length-2;i>=0;i--)
{
if(n==0)
{
m = m+2*(ccNum.charCodeAt(i)-48);
if (2*(ccNum.charCodeAt(i)-48)>9)
m++;
n++;
}
else
{
m = m +1*(ccNum.charCodeAt(i)-48);
n = 0;
}
}
m = 10 - m % 10;
if (m==10) m=0;
if(m!=ccNum.charCodeAt(ccNum.length-1)-48)
return false;
else return true;
}
function IATSCreatePaymentBoxContentDiv()
{
var div;
div = this.createElement("div","","");
div.className = "IATS_ContentDiv";
div.setAttribute("id", "IATS_ContentSectionDiv");
// form label
var eventTitle = this.createElement("label","",this.Title);
eventTitle.className = "IATS_EventTitle";
div.appendChild(eventTitle);
// event description
var eventdescription = this.createElement("span","",this.Description);
eventdescription.className = "IATS_EventDescription";
div.appendChild(eventdescription);
// amount list
var amountList = this.createPaymentBoxAmountListDiv();
div.appendChild(amountList);
// payment
var paymentlist = this.createPaymentBoxPaymentDiv();
div.appendChild(paymentlist);
// error msg
var errorMsg = this.createPaymentBoxErrorMsgDiv();
div.appendChild(errorMsg);
if(this.SendEmailConfirmation=="CHECKED")
{
var sendemaildiv = this.createSendEmailDiv();
div.appendChild(sendemaildiv);
}
// CAPTCHA
if (this.enableCAPTCHA == "1")
{
var captcha = this.createCAPTCHADiv();
div.appendChild(captcha);
hasCaptcha = true;
}
// action
var action = this.createElement("span","","");
action.className = "IATS_Action";
var classvalue=this.BasicLayoutClassName;
var Inputlabel = this.createElement("label","","");
Inputlabel.className = classvalue;
Inputlabel.setAttribute("for", "IATS_Action_Button");
div.appendChild(Inputlabel);
var actionButton = this.createElement("button","",this.ProcessButtonLabel);
actionButton.className = "IATS_Action";
actionButton.action = "javascript";
actionButton.setAttribute("id", "IATS_ProcessAction_Button");
actionButton.setAttribute("type","button");
actionButton.value = this.ProcessButtonLabel;
actionButton.onclick = this.processTransaction;
action.appendChild(actionButton);
actionButton = this.createElement("button","",this.BackButtonText);
actionButton.className = "IATS_Action";
actionButton.action = "javascript";
actionButton.value = "Back";
actionButton.setAttribute("id", "IATS_BackAction_Button");
actionButton.setAttribute("type","button");
actionButton.style.display="none";
actionButton.onclick = this.backToReInput;
action.appendChild(actionButton);
div.appendChild(action);
//display security message.
var connectmessage = this.createElement("span","",this.ConnectingToServerMessage);
connectmessage.value = this.ConnectingToServerMessage;
connectmessage.style.display = 'none';
connectmessage.setAttribute("id","IATS_Payment_ConnectMessage");
div.appendChild(connectmessage);
// Add Share Link div
var childDiv;
if(this.DefaultSocialLinks=="CHECKED" || this.AdvancedShare=="CHECKED")
{
childDiv = this.createShareLinkDiv();
div.appendChild(childDiv);
}
var _lang = '';
var _imgurl = "";
if (_lang.toUpperCase() == "FR")
_imgurl = "https://www.iatspayments.com/paymentbox/img/b_your_data_is_secure_fr.png";
else
_imgurl = "https://www.iatspayments.com/paymentbox/img/b_your_data_is_secure.png";
var secure=this.createElement("div","","");
secure.className="IATS_SecureDataDiv";
div.appendChild(secure);
// footer
var footer = this.createPaymentBoxFooterDiv();
div.appendChild(footer);
return div;
}
function IATSCreatePaymentBoxAmountListDiv()
{
var div;
div = this.createElement("div","","");
div.className = "IATS_AmountDiv";
div.setAttribute("id", "IATS_AmountSectionDiv");
var radioDiv;
var RadioButton,RadioButtonlabel;
var OtherInput, otherMinLabel;
var QtyDiv,QtyLabel,QtyInput;
var increaseButton,decreaseButton;
var totalDiv, totalAmount;
var AmountListTitle = this.createElement("span","",this.AmountListTitle);
AmountListTitle.className = "IATS_AmountSectionTitle";
div.appendChild(AmountListTitle);
// Get any custom amounts
if (this.clientCustomFields && this.clientCustomFields.length > 0)
IATSCreateCustomAmountFields(this.clientCustomFields, this.EventPaymentCurrencySign, div);
if(this.HideAmountInfo == 0)
{
//new shopping cart.
if(this.EnableShoppingCart=="1")
{
var shoppingcartDiv = this.createElement("div","","");
shoppingcartDiv.className = "IATS_ShoppingCartItemDiv";
div.appendChild(shoppingcartDiv);
var shoppingcartUl = this.createElement("ul","","");
shoppingcartUl.className = "IATS_ShoppingCartList1";
shoppingcartDiv.appendChild(shoppingcartUl);
for(var i=0;i 0) {
var totalPrice = 0.00;
for(var i = 0; i < priceElements.length; i++) {
totalPrice += parseFloat(priceElements[i].getAttribute("price"));
}
totalPrice = IATSGetProcessingFeeTotal(procFeeEnabled, totalPrice, procFeePercent);
totalPrice = Math.round(totalPrice*100)/100;
document.getElementById("IATS_TotalAmount").innerHTML = totalPrice.toFixed(2);
}
};
tdElement.appendChild(RadioButton);
RadioButton = this.createElement("input","","");
RadioButton.setAttribute("type", "hidden");
RadioButton.setAttribute("id","IATS_ProcessingFee_OrigAmount");
tdElement.appendChild(RadioButton);
RadioButton = this.createElement("input","","");
RadioButton.setAttribute("type", "hidden");
RadioButton.setAttribute("id","IATS_ProcessingFee_Percent");
tdElement.appendChild(RadioButton);
// Label
spanLabel = this.createElement("span","",this.processingFee_Message);
spanLabel.setAttribute("class", "IATS_AmountSpan");
tdElement.appendChild(spanLabel);
}
return div;
}
for (i=0;i max)
{
if(amountQtyMaxError != null)
amountQtyMaxError.style.display = "block"; // Show the error.
}
else
{
if(amountQtyMaxError != null)
amountQtyMaxError.style.display = "none"; // Hide the error.
}
theIATSPaymentBoxCore.iATSGetTotal();
}
})();
QtyDiv.appendChild(QtyInput);
// #4.4 - decrease quantity button
decreaseButton = this.createElement("button","","-");
decreaseButton.setAttribute("type","button");
decreaseButton.className = "IATS_IncreaseQty";
decreaseButton.onclick = (function IATSDecreaseQty()
{
var j = i;
return function(e)
{
var qtyInput = document.getElementById("IATS_Payment_Qty"+j);
if(qtyInput !=null && qtyInput .value>0)
{
document.getElementById("IATS_Payment_Qty"+j).value--;
theIATSPaymentBoxCore.iATSGetTotal();
// Update the error message.
var max = parseInt(theIATSPaymentBoxCore.AmountList[j].QtyMax);
if(isNaN(max))
max = 999999; // Empty string will be parsed to NaN, so make limit 9999.
var amountQtyMaxError = document.getElementById("IATS_Payment_QtyMaxError" + j);
// Set the value to the max if a value larger than the max is entered.
if (qtyInput.value > max)
{
if(amountQtyMaxError != null)
amountQtyMaxError.style.display = "block"; // Show the error.
}
else
{
if(amountQtyMaxError != null)
amountQtyMaxError.style.display = "none"; // Hide the error.
}
}
};
})();
QtyDiv.appendChild(decreaseButton);
// #4.5 - quantity error
var classValue = this.BasicLayoutClassName + " IATS_PaymentItemErrorMessage";
var errorValue = "Maximum is " + this.AmountList[i].QtyMax
var ErrorMsg = this.createElement("span","",errorValue);
ErrorMsg.className = classValue;
ErrorMsg.setAttribute("name", "IATS_Payment_QtyMaxError");
ErrorMsg.setAttribute("id", "IATS_Payment_QtyMaxError" + i);
QtyDiv.appendChild(ErrorMsg);
// #4.6 - max value hidden field
QtyMax = this.createElement("label","",this.AmountList[i].QtyMax);
QtyMax.style.display = "none";
QtyMax.setAttribute("name","IATS_Payment_QtyMax");
QtyMax.setAttribute("value",this.AmountList[i].QtyMax);
QtyDiv.appendChild(QtyMax);
}
// Create entries for all 'Other' amounts stored in an array called 'AmountOtherList'.
for(var i=0;i < this.AmountOtherList.length;i++)
{
// #0 - div
radioDiv = this.createElement("div","","");
radioDiv.className = "IATS_AmountItemDiv";
radioDiv.setAttribute("id", "IATS_AmountListItemDiv_Other"+i); // This id is being made unique, though the 'payment' items have no id for their encapsulating 'div' elements.
div.appendChild(radioDiv);
// #1 - label
RadioButtonlabel = this.createElement("label","","");
RadioButtonlabel.className = "IATS_RadioAmtLabel"; // Regular and 'Other' amounts share the same label.
RadioButtonlabel.setAttribute("for", "IATS_Amount_Other"+i); // Matches radio button ID
RadioButtonlabel.setAttribute("id","IATS_AmountName_Order_Other"+i); // Unique ID
RadioButtonlabel.value = this.AmountOtherList[i].Label; // I don't think this value is used. Only checkbox and textbox values are used.
radioDiv.appendChild(RadioButtonlabel);
// #2 - input: checkbox or radio button
RadioButton = this.createElement("input","IATS_NewAmountListItem","");
RadioButton.className = "IATS_RadioAmtButton";
if(this.AmountEnableMultiSelection == "1")
RadioButton.setAttribute("type", "checkbox");
else
RadioButton.setAttribute("type", "radio");
RadioButton.setAttribute("name", "IATS_NewAmountListItem"); // This name is used by regular and 'Other' amounts.
RadioButton.setAttribute("id", "IATS_Amount_Other"+i);
RadioButton.setAttribute("value", "OtherAmount"); // This value is only used for branching in logic, so we will leave it the same for all 'Other' items.
if(this.AmountDefaultChecked.toUpperCase()=="CHECKED" && this.AmountOtherList[i].Default.toUpperCase()=="CHECKED")
RadioButton.defaultChecked = true;
RadioButton.onclick = function IATSClickOtherCheckbox() // On a click of the checkbox you need to clear unchecked boxes and update total.
{
theIATSPaymentBoxCore.iATSClearUncheckedOtherBoxes();
theIATSPaymentBoxCore.iATSGetTotal();
};
RadioButtonlabel.appendChild(RadioButton);
// #2.1 - span
spanLabel = this.createElement("span","",this.AmountOtherList[i].Label);
spanLabel.setAttribute("class", "IATS_AmountSpan");
RadioButtonlabel.appendChild(spanLabel);
// #3 - input - textbox
OtherInput = this.createElement("input","IATS_AmountListItem_NewOtherAmount","");
OtherInput.className = "IATS_OtherAmount";
OtherInput.setAttribute("id", "IATS_AmountListItem_NewOtherAmount"+i); // Unique ID
OtherInput.onblur = (function IATSClickOtherAmount() // Check the associated checkbox if input text box is clicked.
{
var j = i; // Necessary to capture this snapshot of 'i'.
return function (e) // Extra reading: javascript closure.
{
document.getElementById("IATS_Amount_Other"+j).checked = true;
theIATSPaymentBoxCore.iATSClearUncheckedOtherBoxes(); // This is necessary to clear unchecked boxes when radio buttons are enabled.
theIATSPaymentBoxCore.iATSGetTotal();
}
})();
OtherInput.onkeypress = function isNumberKey(evt) // Restrict non-numbers and minus (-) symbol.
{
evt = evt || window.event;
var charCode = evt.keyCode || evt.which;
if (charCode > 31 && (charCode < 46 || charCode > 57 || charCode==47))
return false;
return true;
};
OtherInput.onkeyup = this.iATSGetTotal; // Updates total as customer types amount into box.
var procFeeEnabled = this.processingFee_Enabled;
var procFeePercent = this.processingFee_Percent;
OtherInput.onfocusout = function() {
var totalPrice = parseFloat(IATSGetProcessingFeeTotal(procFeeEnabled, document.getElementById("IATS_Payment_TotalAmount").innerHTML, procFeePercent).toFixed(2));
totalPrice = Math.round(totalPrice*100)/100;
document.getElementById("IATS_Payment_TotalAmount").innerHTML = totalPrice;
document.getElementById("IATS_Payment_TotalAmount").setAttribute("value",totalPrice.toFixed(2));
}
radioDiv.appendChild(OtherInput);
// #4 - minimum label
if(this.AmountOtherList[i].Minimum != "0" ) // If there is no minimum, don't write a minimum label.
{
otherMinLabel = this.createElement("span","",this.AmountOtherList[i].MinimumLabel1);
var classvalue = this.BasicLayoutClassName;
classvalue = classvalue + " IATS_OtherAmtMinimum";
otherMinLabel.className = classvalue;
radioDiv.appendChild(otherMinLabel);
}
// #5 - minimum error message
otherMinError = this.createElement("span","",this.AmountOtherList[i].MinimumErrorMessage);
otherMinError.className = this.BasicLayoutClassName + " IATS_PaymentMinimumErrorMessage";;
otherMinError.setAttribute("id", "IATS_PaymentItemErrorMesssage_Min"+i); // This id has to be unique so that the error can be turned on and off.
radioDiv.appendChild(otherMinError);
} // end of 'Other' for-loop
}
if (this.processingFee_Enabled == "1") {
radioDiv = this.createElement("div","","");
radioDiv.className = "IATS_AmountItemDiv";
div.appendChild(radioDiv);
// #0.1 - table
tableElement = this.createElement("table","","");
tableElement.setAttribute("width", "100%");
radioDiv.appendChild(tableElement);
trElement = this.createElement("tr","","");
tableElement.appendChild(trElement);
tdElement = this.createElement("td","","");
// Spacer
RadioButtonlabel = this.createElement("label","","");
RadioButtonlabel.className = "IATS_RadioAmtLabel";
RadioButtonlabel.setAttribute("for", "IATS_ProcessingFee");
RadioButtonlabel.setAttribute("id", "IATS_ProcessingFee");
tdElement.appendChild(RadioButtonlabel);
trElement.appendChild(tdElement);
// #2 - input
RadioButton = this.createElement("input","IATS_ProcessingFeeCheck","");
RadioButton.className = "IATS_RadioAmtButton";
RadioButton.setAttribute("type", "checkbox");
RadioButton.setAttribute("name", "IATS_ProcessingFeeCheck");
RadioButton.setAttribute("id", "IATS_ProcessingFeeCheck");
RadioButton.onclick = function IATSClickProcFee() // This is necessary to clear 'Other' boxes when a regular amount is clicked in radio button mode.
{
theIATSPaymentBoxCore.iATSGetTotal();
};
tdElement.appendChild(RadioButton);
RadioButton = this.createElement("input","","");
RadioButton.setAttribute("type", "hidden");
RadioButton.setAttribute("id","IATS_ProcessingFee_OrigAmount");
tdElement.appendChild(RadioButton);
RadioButton = this.createElement("input","","");
RadioButton.setAttribute("type", "hidden");
RadioButton.setAttribute("id","IATS_ProcessingFee_Percent");
tdElement.appendChild(RadioButton);
// Label
spanLabel = this.createElement("span","",this.processingFee_Message);
spanLabel.setAttribute("class", "IATS_AmountSpan");
tdElement.appendChild(spanLabel);
}
if(this.HideAmountInfo == 0)
{
totalDiv = this.createElement("div","","Total: "+this.EventPaymentCurrencySign);
totalDiv.className = "IATS_TotalDiv";
if(this.AmountEnableQty == "1" || this.AmountEnableMultiSelection == "1" || this.processingFee_Enabled == "1" || (this.clientCustomFields && this.clientCustomFields != ""))
totalDiv.style.display = "block";
else totalDiv.style.display = "none";
div.appendChild(totalDiv);
totalAmount = this.createElement("span","","0.00");
totalAmount.setAttribute("id","IATS_Payment_TotalAmount");
totalAmount.setAttribute("value","0.00");
totalDiv.appendChild(totalAmount);
var currency = this.createElement("span",""," " + GetCurrency());
totalDiv.appendChild(currency);
var iatsTotalAmount = this.createElement("input","","");
iatsTotalAmount.setAttribute("name","IATS_AmountListItem");
iatsTotalAmount.setAttribute("id","IATS_AmountListItem");
iatsTotalAmount.style.display = "none";
iatsTotalAmount.value = 0.00;
totalDiv.appendChild(iatsTotalAmount);
var iatsOtherAmount = this.createElement("input","","");
iatsOtherAmount.setAttribute("name","IATS_AmountListItem_OtherAmount");
iatsOtherAmount.setAttribute("id","IATS_AmountListItem_OtherAmount");
iatsOtherAmount.style.display = "none";
totalDiv.appendChild(iatsOtherAmount);
}
else
{
totalDiv = this.createElement("div","", this.TotalDescription+" "+this.EventPaymentCurrencySign);
totalDiv.className = "IATS_DefaultTotalDiv";
div.appendChild(totalDiv);
totalAmount = this.createElement("span","",this.defaultTotal);
totalAmount.setAttribute("id","IATS_Payment_TotalAmount");
totalAmount.setAttribute("value",this.defaultTotal);
totalAmount.innerHTML = this.defaultTotal+" "+this.EventPaymentCurrencySignAfterAmount;
totalDiv.appendChild(totalAmount);
var iatsTotalAmount = this.createElement("input","","");
iatsTotalAmount.setAttribute("name","IATS_AmountListItem");
iatsTotalAmount.setAttribute("id","IATS_AmountListItem");
iatsTotalAmount.style.display = "none";
iatsTotalAmount.value = 0.00;
totalDiv.appendChild(iatsTotalAmount);
var iatsOtherAmount = this.createElement("input","","");
iatsOtherAmount.setAttribute("name","IATS_AmountListItem_OtherAmount");
iatsOtherAmount.setAttribute("id","IATS_AmountListItem_OtherAmount");
iatsOtherAmount.style.display = "none";
totalDiv.appendChild(iatsOtherAmount);
}
var nonAmountErrorMsg = this.createElement("span","",this.AmountDefaultCheckedError);
nonAmountErrorMsg.className = this.BasicLayoutClassName+" IATS_PaymentMinimumErrorMessage";;
nonAmountErrorMsg.setAttribute("id", "IATS_PaymentItemErrorMesssage_NonAmount");
div.appendChild(nonAmountErrorMsg);
return div;
}
// Iterate through all 'Other' amounts and clear input fields for unchecked boxes.
function IATSClearUncheckedOtherBoxes()
{
var otherCheckboxes = IATSGetElementsByNameFilterByValue("IATS_NewAmountListItem","OtherAmount"); // Get all checkbox elements belonging to an 'OtherAmount'.
var otherInputs = document.getElementsByName("IATS_AmountListItem_NewOtherAmount"); // Get all input elements belonging to an 'OtherAmount'.
if(otherCheckboxes.length == otherInputs.length) // Should always be equal.
{
for(var i=0; i12 || parseFloat(monthfield)<=0 || parseFloat(dayfield)<=0 ||
parseFloat(yearfield)>2100 || parseFloat(yearfield)<=2009)
return false;
else
{
if(parseFloat(monthfield)==1 || parseFloat(monthfield)==3 || parseFloat(monthfield)==5 || parseFloat(monthfield)==7 || parseFloat(monthfield)==8 || parseFloat(monthfield)==10 || parseFloat(monthfield)==12)
{
if(parseInt(dayfield)>31)
return false;
else returnval=true;
}
else if(parseFloat(monthfield)==4 || parseFloat(monthfield)==6 || parseFloat(monthfield)==9 || parseFloat(monthfield)==11)
{
if(parseInt(dayfield)>30)
return false;
else returnval=true;
}
else if(parseFloat(monthfield)=='2' && parseInt(yearfield)%4==0)
{
if(parseInt(dayfield)>29)
return false;
else returnval=true;
}
else if(parseInt(dayfield)>28)
return false;
else returnval=true;
}
}
if (returnval==false) input.select();
return returnval;
}
// Check for valid zip/postal code.
function IATScheckZipCode()
{
var country;
if(document.getElementById("IATS_PaymentItemDiv_Country").style.display=="none")
country = null;
else country = document.getElementById("IATS_PaymentItemInput_Country");
var zipCode = document.getElementById("IATS_PaymentItemInput_ZipCode");
var zipError = document.getElementById("IATS_PaymentItemErrorMesssage_ZipCode");
if(zipCode==null || country==null)
return true;
// Empty zipcode. Set client-supplied message and don't check for country.
if (zipCode.value.length == 0)
{
if (zipError != null)
zipError.innerHTML = theIATSPaymentBoxCore.ClientZipcodeError;
return true; // This function treats empty zipcodes as valid. Min length checking is done elsewhere.
}
else if (country.value.toUpperCase()=="UNITED STATES" || country.value.toUpperCase()=="US")
{
// Valid case 1: Five-digit US zipcode, i.e. 12345
if (zipCode.value.length == 5 && IsNumeric(zipCode.value))
return true;
// Valid case 2: Zip+4 format, i.e. 12345-6789
else if (zipCode.value.length == 10 && IsNumeric(zipCode.value.substring(0,5)) && zipCode.value.charAt(5) == '-' && IsNumeric(zipCode.value.substring(6)))
return true;
// Invalid U.S. Zipcode
else
{
if (zipError != null)
zipError.innerHTML = "ZIP Code must be '12345' or '12345-6789' format.";
return false;
}
}
else if (country.value.toUpperCase()=="CANADA" || country.value.toUpperCase()=="CA")
{
var tempZipCode = zipCode.value.split(' ').join(''); // Remove whitespace without modifying original value.
if(tempZipCode.length == 6 &&
IsNumeric(tempZipCode.charAt(1)) && IsNumeric(tempZipCode.charAt(3)) && IsNumeric(tempZipCode.charAt(5)) &&
IsAlphabetic(tempZipCode.charAt(0)) && IsAlphabetic(tempZipCode.charAt(2)) && IsAlphabetic(tempZipCode.charAt(4)))
{
return true;
}
else
{
if (zipError != null)
zipError.innerHTML = "Postal Code must be A1B 2C3 format.";
return false;
}
}
else return true; // All other countries
}
function IsNumeric (text)
{
var validExp = /^[0-9]+$/;
var validText = true;
if(!text.match(validExp))
validText = false;
return validText;
}
function IsAlphabetic (text)
{
var validExp = /^[a-zA-Z]+$/;
var validText = true;
if(!text.match(validExp))
validText = false;
return validText;
}
function IATSShowSecurityForm(lang)
{
var content="";
}
else
{
content += "
Transaction Security
";
content += "All Communications initiated by this form are transmitted via Secure Sockets Layer (SSL). ";
content += "The SSL protocol is the industry standard method for creating an encrypted, secure connection between your web browser and a web server.";
content += "
";
content += "About This Form
This form is issued by iATS Payments, Inc. to process transactions.
";
content += "About iATS Payments, Inc";
content += "
iATS Payments is a Level 1 Payment Card Industry (PCI) certified company and ensures all transactions are handled with absolute security.";
content += "
Suite 600-1188 West Georgia Street, Vancouver, BC";
content += "
Email: iats@iatspayments.com";
content += "
Toll Free: 1-888-955-5455 (Option 1)";
content += "
Fax: 604-682-1715
";
content += "www.iatspayments.com";
content += "
";
}
var window1=window.open("","_blank","location=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,width=400,height=600");
window1.document.write(content);
window1.moveTo(550,200);
window1.opener = null;
return false;
}
function IATSShowScript()
{
if(document.getElementById("IATS_EmbedScript").style.display=="none")
{
document.getElementById("IATS_EmbedScript").style.display="block";
document.getElementById("IATS_EmbedScriptButton").style.display="none";
}
else
{
document.getElementById("IATS_EmbedScript").style.display="none";
document.getElementById("IATS_EmbedScriptButton").style.display="block";
}
}
function IATSCreateShareLinkDiv()
{
var shareLinkDiv = this.createElement("div","IATS_Payment_ShareLinkDiv","");
shareLinkDiv.setAttribute("id","IATS_Payment_ShareLinkDiv");
shareLinkDiv.className="IATS_SocialMediaDiv";
if(this.DefaultSocialLinks=="CHECKED")
{
var _child = this.createElement("a","","SHARE: ");
shareLinkDiv.appendChild(_child);
var _url = this.FormURL;
var _title = this.FormURLTitle;
var _email = this.EmailFriendMessage;
_titel = _title.replace(/
/g,"\r\n");
_email = _email.replace(/
/g,"\r\n");
var _imgurl = "https://"+this.serverURL+"/paymentbox/img/b_share_email.png";
_child = this.createElement("a",""," |");
_child.setAttribute("href","mailto:?subject="+_title+"&body="+_email);
_child.setAttribute("target","_blank");
_child.className = "IATS_SocialLink";
shareLinkDiv.appendChild(_child);
_imgurl = "https://"+this.serverURL+"/paymentbox/img/b_share_facebook.png";
_child = this.createElement("a",""," |");
_child.setAttribute("href","http://www.facebook.com/share.php?u="+escape(_url+"?t="+escape(_title)));
_child.className = "IATS_SocialLink";
_child.setAttribute("target","_blank");
shareLinkDiv.appendChild(_child);
_imgurl = "https://" + this.serverURL + "/paymentbox/img/b_share_twitter.png";
_child = this.createElement("a","","");
_child.setAttribute("href","http://twitter.com/share?url="+_url+"&text="+_title);
_child.className = "IATS_SocialLink";
_child.setAttribute("target","_blank");
shareLinkDiv.appendChild(_child);
}
if(this.AdvancedShare=="CHECKED")
{
var _ShareDiv = this.createElement("div","","");
_ShareDiv.setAttribute("id","IATS_EmbedScriptButton");
_ShareDiv.className = "IATS_EmbedFormDiv";
var _imgurl = "https://"+this.serverURL+"/paymentbox/img/b_embed_this_form.png";
var _child = this.createElement("a","","");
_child.setAttribute("id","IATS_EmbedScriptButton");
_child.onclick=this.showScript;
_ShareDiv.appendChild(_child);
shareLinkDiv.appendChild(_ShareDiv);
_ShareDiv = this.createElement("div","","");
_ShareDiv.setAttribute("id","IATS_EmbedScript");
_ShareDiv.style.display="none";
_child = this.createElement("input","IATS_FormScript","");
_child.setAttribute("type", "text");
_child.setAttribute("id","IATS_FormScript");
_child.className = "IATS_EmbedFormScript";
_child.value=this.Snippet;
_child.style.readonly=true;
_ShareDiv.appendChild(_child);
_imgurl = "https://"+this.serverURL+"/paymentbox/img/ico_embed_this_form.png";
_child = this.createElement("a","","");
_child.onclick = this.showScript;
_ShareDiv.appendChild(_child);
shareLinkDiv.appendChild(_ShareDiv);
}
return shareLinkDiv;
}
function IATSCreateNACHPolicyDiv()
{
var cancelPolicy = this.createElement("div","","Direct debit cancellation policy, Learn More »");
cancelPolicy.className="IATS_SecureDataDiv";
cancelPolicy.setAttribute("id","IATS_ACHCancellationStmDiv");
return cancelPolicy;
}
function IATSCloseNACHPolicyStatement()
{
if(document.getElementById("IATS_NACHPolicyMoreInfoDiv")!=null)
document.getElementById("IATS_NACHPolicyMoreInfoDiv").style.display='none';
}
function IATSCloseNACHRecourceStatement()
{
if(document.getElementById("IATS_NACHStatementDiv")!=null)
document.getElementById("IATS_NACHStatementDiv").style.display='none';
}
function IATSCreateNACHRecourseDiv()
{
var cancelPolicy = this.createElement("div","","Recourse Statement, " + this.YourDataIsSecureText + " »");
cancelPolicy.className="IATS_SecureDataDiv";
cancelPolicy.setAttribute("id","IATS_ACHRecourseStmDiv");
return cancelPolicy;
}
function AssignPosition(d) {
if(self.pageYOffset) {
rX = self.pageXOffset;
rY = self.pageYOffset;
}
else if(document.documentElement && document.documentElement.scrollTop) {
rX = document.documentElement.scrollLeft;
rY = document.documentElement.scrollTop;
}
else if(document.body) {
rX = document.body.scrollLeft;
rY = document.body.scrollTop;
}
if(document.all) {
cX += rX;
cY += rY;
}
if(document.all)
{
d.style.left = (cX) + "px";
d.style.top = (cY) + "px";
}
else
{
d.style.left = (cX+5) + "px";
d.style.top = (cY+5) + "px";
}
}
function IATSHideText() {
document.getElementById("IATS_NACHPolicyMoreInfoDiv").style.display = "none";
}
function IATSShowText() {
var dd = document.getElementById("IATS_NACHPolicyMoreInfoDiv");
AssignPosition(dd);
dd.style.display = "block";
}
function findPos(obj)
{
var curleft = curtop = 0;
if (obj.offsetParent)
{
do {
curleft += obj.offsetLeft;
curtop += obj.offsetTop;
} while (obj = obj.offsetParent);
}
return [curleft,curtop-80];
}
function OpenMoreInfoDiv(f,field)
{
var panel;
panel = document.getElementById(field+"MoreInfoDiv");
panel.style.top = findPos(f)[1]+"px";
panel.style.display = "block";
}
function OpenACHPolicyStatement(f)
{
var MessageString='';
var AgentID="";
var TempStr='';
var pane1;
var Name, Value, n, Item, Item2,a;
pane1 = document.getElementById("IATS_NACHPolicyMoreInfoDiv");
pane1.style.top = findPos(f)[1]+"px";
pane1.style.left = findPos(f)[0]+"px";
pane1.style.display = "block";
}
function OpenACHRecourseStatement(f)
{
var MessageString='';
var AgentID="";
var TempStr='';
var pane1;
var Name, Value, n, Item, Item2,a;
pane1 = document.getElementById("IATS_NACHStatementDiv");
pane1.style.top = findPos(f)[1]+"px";
pane1.style.left = findPos(f)[0]+"px";
pane1.style.display = "block";
}
//UKDirectDebit
function IATSCreateUKDirectDebitDiv1()
{
var DirectDebitDiv = this.createElement("div","IATS_DirectDebitDiv",this.DirectDebitPage1);
DirectDebitDiv.className="IATS_DirectDebitDiv";
DirectDebitDiv.setAttribute("id","IATS_Payment_DirectDebitPage1Div");
DirectDebitDiv.style.display = "none";
return DirectDebitDiv;
}
function IATSCreateUKDirectDebitDiv2()
{
var DirectDebitDiv = this.createElement("div","IATS_DirectDebitDiv",this.DirectDebitPage2);
DirectDebitDiv.className="IATS_DirectDebitDiv";
DirectDebitDiv.setAttribute("id","IATS_Payment_DirectDebitPage2Div");
DirectDebitDiv.style.display = "none";
return DirectDebitDiv;
}
function IATSCreateUKDirectDebitDiv3()
{
var DirectDebitDiv = this.createElement("div","IATS_DirectDebitDiv",this.DirectDebitPage3);
DirectDebitDiv.className="IATS_DirectDebitDiv";
DirectDebitDiv.setAttribute("id","IATS_Payment_DirectDebitPage3Div");
DirectDebitDiv.style.display = "none";
return DirectDebitDiv;
}
function IATSCreateUKDirectDebitDiv4()
{
var DirectDebitDiv = this.createElement("div","IATS_DirectDebitDiv",this.DirectDebitPage4);
DirectDebitDiv.className="IATS_DirectDebitDiv";
DirectDebitDiv.setAttribute("id","IATS_Payment_DirectDebitPage4Div");
DirectDebitDiv.style.display = "none";
return DirectDebitDiv;
}
function IATSCreateUKDirectDebitDiv5()
{
var DirectDebitDiv = this.createElement("div","IATS_DirectDebitDiv",this.DirectDebitPage5);
DirectDebitDiv.className="IATS_DirectDebitDiv";
DirectDebitDiv.setAttribute("id","IATS_Payment_DirectDebitPage5Div");
DirectDebitDiv.style.display = "none";
return DirectDebitDiv;
}
function IATSCreateSendEmailDiv()
{
var sendemaildiv = this.createElement("div","IATS_Payment_SendEmailDiv","");
sendemaildiv.setAttribute("id","IATS_Payment_SendEmailDiv");
sendemaildiv.className = "IATS_Payment_SendEmailDiv";
sendemaildiv.style.display = 'none';
var sendemail = this.createElement("input","IATS_Payment_SendEmailCheck","");
sendemail.setAttribute("type","checkbox");
sendemail.setAttribute("id","IATS_Payment_SendEmailCheck");
sendemail.setAttribute("checked","true");
//Conver the issue with setAttribute('checked') doesn't work in IE.
sendemail.setAttribute("defaultChecked","defaultChecked");
sendemaildiv.appendChild(sendemail);
var sendemaillabel = this.createElement("label","",this.SendEmailConfirmationLabel);
sendemaildiv.appendChild(sendemaillabel);
return sendemaildiv;
}
function IATSCreateReoccurringDiv()
{
var reoccurringDiv = this.createElement("div","IATS_Payment_ReoccurringDiv","");
reoccurringDiv.setAttribute("id","IATS_Payment_ReoccurringDiv");
//reoccurringDiv.setAttribute("style", "padding-left: 1.5cm");
reoccurringDiv.className = "IATS_PaymentDiv";
// This checkbox is checked when the "Recurring" radio button is checked.
// The function 'showRecurring' checks the value of this checkbox - NOT the value of the "Recurring" radio button - when showing or hiding the Recurring div.
var reoccurring = this.createElement("input","IATS_Payment_ReoccurringCheck","");
reoccurring.setAttribute("type","checkbox");
reoccurring.setAttribute("id","IATS_Payment_ReoccurringCheck");
reoccurring.onclick=this.showReoccurring;
reoccurring.style.display = 'none';
// Previously we checked the 'IATS_Payment_RecurringPayment' Recurring radio button, but now we must also check this input box to trigger the showing of Recurring when it is defaulted on.
reoccurring.checked = this.recurringCheck;
reoccurringDiv.appendChild(reoccurring);
var reoccurringlabel = this.createElement("label","",this.ReoccurringLabel); // When is this label used?
reoccurringlabel.style.display = 'none';
reoccurringDiv.appendChild(reoccurringlabel);
var reoccurringsettingdiv = this.createElement("div","IATS_Payment_ReoccurringSettingDiv",""); // Toggled when "Recurring" radio button clicked.
reoccurringsettingdiv.setAttribute("id","IATS_Payment_ReoccurringSettingDiv");
if (this.recurringCheck == true){
reoccurringsettingdiv.style.display="block";
//console.log(reoccurringsettingdiv.getAttribute('id') + " = " + reoccurringsettingdiv.style.display);
}
else
reoccurringsettingdiv.style.display="none";
reoccurringDiv.appendChild(reoccurringsettingdiv);
var totalDiv = this.createElement("div","","Total: "+this.EventPaymentCurrencySign);
totalDiv.className = "IATS_RecurringTotalDiv";
totalDiv.style.display = "none";
reoccurringsettingdiv.appendChild(totalDiv);
var totalAmount = this.createElement("span","","0.00");
totalAmount.setAttribute("id","IATS_Payment_RecurringTotalAmount"); // Why is this different from 'IATS_Payment_TotalAmount'?
totalAmount.setAttribute("value","0");
totalDiv.appendChild(totalAmount);
var InputDiv,classvalue,Inputlabel,Input;
var scheduletype;
for (i=0;i 0)
{
var info; // Use this variable to refer to the information we'll be using to set the Begin/End Dates.
// When we run this loop to initialize the Begin/End fields, 'theIATSPaymentBoxCore' will still be undefined.
// In that case, will be be using the supplied reference, 'incoming' and access its fields.
if (typeof(theIATSPaymentBoxCore) == "undefined")
{
/*console.log("theIATSPaymentBoxCore == undefined");*/
if (incoming != null)
{
info = incoming;
/*console.log("Luckily, incoming is not null and info = incoming. Info is: " + info);*/
}
}
else
{
/*console.log("theIATSPaymentBoxCore is not undefined. It is: " + theIATSPaymentBoxCore);
// Even though 'incoming' isn't null, it contains no information for some reason. Don't use it - use 'theIATSPaymentBoxCore' instead.
if (incoming != null)
console.log("theIATSPaymentBoxCore is not undefined and incoming isn't null.");
else
console.log("theIATSPaymentBoxCore is not undefined and incoming is null.");*/
info = theIATSPaymentBoxCore;
}
// If RestrictDates is on, you need to make a dropdown.
// Note: If the form has not been saved with the update, 'RestrictDates' will be defaulted to an empty string and it will never enter this loop.
// It should skip to the next loop and input the current date as the default for each schedule type.
if (info.RestrictDates.toUpperCase() == "CHECKED")
{
IATSRemoveOptions(beginDate); // Clear the dropdown list of all options.
// Do we have UseCurrentDate set to true? If so, set the current date. If not, set the dates from the supplied info.
//console.log("Schedule index:" + schedule.selectedIndex);
//console.log("Schedule innerHTML: " + schedule[schedule.selectedIndex].value);
// Go through all of the beginDate object values. If the scheduleType matches the selected element, check if UseCurrentDate is on or off.
info.UseCurrentDate.forEach(function (currentDateElement, index) {
//console.log("Matching: " + element.scheduleType + " and " + schedule[schedule.selectedIndex].value + " gives us " + (element.scheduleType == schedule[schedule.selectedIndex].value));
// Once this matches, we can actually check the 'UseCurrentDate' setting of the selected option.
if(currentDateElement.scheduleType == schedule[schedule.selectedIndex].value)
{
// Check if UseCurrentDate is on for this ScheduleType.
//console.log("Status of useCurrentDate for " + element.scheduleType + ": " + element.useCurrentDate)
if(currentDateElement.useCurrentDate == "ON")
{
// Add today's date as the only selectable option for this ScheduleType.
var option = document.createElement("option");
option.value = IATSParseDateToString(new Date(), info.version);
option.innerHTML = option.value;
beginDate.options.add(option);
// Set the end date based on the correct offset from this current date.
if (endDate != null)
IATSSetRecurringEndDate(info);
}
// UseCurrentDate == "OFF"
else
{
// Note: If "UseCurrentDate" is not defaulted to "ON", then we will be protected by the forEach in case an empty RecurBeginDate array is read here. No elements will be read.
// We're not going to use the current date. Instead we are going to populate it with all the dates whose ScheduleType matches the currently selected one.
// Go through all recurring Begin Dates and add all the options that match.
info.RecurBeginDates.forEach(function (beginDateElement, index)
{
// If the incoming day is of value "0", we do not want to add this as an option.
if (beginDateElement.beginDay == "0")
{
//console.log("We got a day of 0. Do not add this element.");
return;
}
// Once the ScheduleType matches, add this as a date option to the list. Repeat for all elements where ScheduleType matches.
if(beginDateElement.scheduleType == schedule[schedule.selectedIndex].value)
{
//console.log(beginDateElement);
// This will return a different value based on each 'scheduleType'.
var option = document.createElement("option");
option.value = IATSParseDateToString(IATSGetNextDate(beginDateElement.beginDay, beginDateElement.beginMonth, beginDateElement.scheduleType), info.version);
option.innerHTML = option.value;
//option.innerHTML += beginDateElement.scheduleType == "Weekly" ? (" (" + IATSGetDayOfWeek(beginDateElement.beginDay) + ") ") : "";
beginDate.options.add(option);
if (endDate != null)
IATSSetRecurringEndDate(info);
}
});
}
}
});
}
// Restrict dates is OFF, so populate the text field with the date.
// Note: it is possible that you get no incoming begin dates because the form has not been saved with the new format yet.
// If this is the case, you will need to set it to the current date as it used to be.
else
{
// Go through all of the beginDate object values. If the scheduleType matches the selected element, check if UseCurrentDate is on or off.
// If there is no info coming in, then 'UseCurrentDate' will have been set to "ON" by default.
// This will replicate the old default behaviour of setting the input box to the current date.
info.UseCurrentDate.forEach(function (currentDateElement, index) {
//console.log("Matching: " + element.scheduleType + " and " + schedule[schedule.selectedIndex].value + " gives us " + (element.scheduleType == schedule[schedule.selectedIndex].value));
// Once this matches, we can actually check the 'UseCurrentDate' setting of the selected option.
if(currentDateElement.scheduleType == schedule[schedule.selectedIndex].value)
{
// Check if UseCurrentDate is on for this ScheduleType.
//console.log("Status of useCurrentDate for " + element.scheduleType + ": " + element.useCurrentDate)
if(currentDateElement.useCurrentDate == "ON")
{
// If no data came in, this will have been set to ON.
// Set the input field to today's date.
var today = new Date();
beginDate.value = IATSParseDateToString(today, info.version);
//var input = IATSParseDateToString(today, info.version);
}
else if (currentDateElement.useCurrentDate == "OFF")
{
// Go through all of the recurring BeginDates and add the first one that matches.
info.RecurBeginDates.forEach(function (beginDateElement, index)
{
// Once the ScheduleType matches, add this as a date option to the list. This will only match once when 'dateIndex' == 1.
if(beginDateElement.scheduleType == schedule[schedule.selectedIndex].value && beginDateElement.dateIndex == 1)
{
// console.log("dateIndex: " + beginDateElement.dateIndex + ", beginDay: " + beginDateElement.beginDay + ", beginMonth: " + beginDateElement.beginMonth + ", scheduleType: " + beginDateElement.scheduleType);
// Set the date to the first (default) option the user chose on the setup form. Stop after this.
beginDate.value = IATSParseDateToString(IATSGetNextDate(beginDateElement.beginDay, beginDateElement.beginMonth, beginDateElement.scheduleType), info.version);
}
});
}
// Set the end date.
if (endDate != null)
IATSSetRecurringEndDate(info);
}
});
}
// Update the End Date according to this index
}
else
{
console.log("IATSRecurringUpdateBeginEndDateDefaults: Schedule is null");
}
}
// Remove all options from a dropdown menu.
function IATSRemoveOptions (selectBox)
{
var i;
for(i=selectBox.options.length-1; i>=0; i--)
{
selectBox.remove(i);
}
}
// Take an int from 1-7 and return the day of the week it represents.
function IATSGetDayOfWeek (day)
{
var weekday = new Array(7);
weekday[0]= "Sunday";
weekday[1] = "Monday";
weekday[2] = "Tuesday";
weekday[3] = "Wednesday";
weekday[4] = "Thursday";
weekday[5] = "Friday";
weekday[6] = "Saturday";
if (day > 0 && day <= 7)
return weekday[day-1];
else
return "Weekday out of scope.";
}
// Get the last day of the month for any given month in the range [1-12]. Borrowed from WebMCV 'iatspagehandler.js'.
function IATSGetLastDayOfMonth (month)
{
var year = new Date().getFullYear(); // Get the current year, as this will affect the days in February.
var isLeapYear = ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0);
// Month will be in the form 1-12
return [31, (isLeapYear ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][(month - 1) % 12];
}
// Return the next valid date (today included) given a set of constraints.
// If 'scheduleType' = "Weekly", return the next date with a suitable day of the week.
// If it's "Monthly", return the next date with that number.
// "Quarterly" and "Annually" are the same - return the next date with the given day and month.
// 'day': [1,31]
// 'month': [1,12]
function IATSGetNextDate(day, month, scheduleType)
{
var nextDate = new Date(); // Starts out as today's date.
/*//console.log("We were supplied day: " + day + ", month: " + month + ", scheduleType: " + scheduleType);*/
// Get the next date whose day matches the supplied day of the week.
// 1-7 corresponds to Sunday-Saturday.
if (scheduleType == "Weekly")
{
// Get the next date, including today, that matches the request day of the week. Yes, every piece of the algorithm is necessary.
// The difference (day - nextDate.getDay() + 1) is the difference between the supplied day we want [1-7] and the date we have [0-6]. The (+ 1) component sets the cycles to the same phase.
// The ((+ 7) % 7) part on its own adds nothing, but when the previous term is negative, this effectively makes it the absolute value. Otherwise there is a 50% chance you will be selecting a date in the past.
nextDate.setDate(nextDate.getDate() + (day - (nextDate.getDay() + 1) + 7) % 7 );
}
else if (scheduleType == "Monthly")
{
// Return the next date, including today, that starts with the number supplied.
// If the date is higher than today's date, but does not exist in the current month, pick the last day of the current month.
// Max is 29, today is 29, asked for 30 or 31 - give them today, 29.
// Max is 31, today is 30, ask for 30 - give them today.
// Max is 31, today is 31, ask for 30 - give them 30th of next month.
// If the date is higher than or equal to today's date, stay in the current month.
// If the date is lower than today's date, go to the next month.
//nextDate.setMonth(11);
//nextDate.setDate(31);
// .setMonth(month, day) - if month is 12, it results in the first month of the next year. 'day' is an optional parameter.
//console.log("Issue: nextDate.getMonth() + 1 = " + (nextDate.getMonth() + 1) + ". (month - 1) % 12 = " + (((nextDate.getMonth() + 1) - 1)% 12));
//console.log("Today's date is: " + nextDate + ". It has " + IATSGetLastDayOfMonth(nextDate.getMonth() + 1) + " days in it.");
// Is the date less than this date number? If so, we must move to the next month because you can't go back in time to hit it in this month.
if (day < nextDate.getDate())
{
nextDate.setMonth(nextDate.getMonth() + 1);
//console.log("We need date " + day + " but today's date is " + nextDate.getDate() + ". We will go forward a month.");
if (IATSGetLastDayOfMonth(nextDate.getMonth() + 1) < day)
{
//console.log("Next month has " + IATSGetLastDayOfMonth(nextDate.getMonth() + 1) + " days in it. It is less than the number we need (" + day + "), so we will set it to the last day of that month (" + IATSGetLastDayOfMonth(nextDate.getMonth() + 1) + ").");
nextDate.setDate(IATSGetLastDayOfMonth(nextDate.getMonth() + 1));
}
else
{
//console.log("Next month has " + IATSGetLastDayOfMonth(nextDate.getMonth() + 1) + " days in it. It is the same or more than the number we need (" + day + "), so we will set it to " + day + ".");
nextDate.setDate(day);
}
}
// Day is greater than this date number, so stay within this month. Choose the last day if necessary.
else
{
//console.log("We need date " + day + " but today's date is " + nextDate.getDate() + ". We will stay in this month.");
if (IATSGetLastDayOfMonth(nextDate.getMonth() + 1) < day)
{
//console.log("This month has " + IATSGetLastDayOfMonth(nextDate.getMonth() + 1) + " days in it. It is less than the number we need (" + day + "), so we will set it to the last day of this month (" + IATSGetLastDayOfMonth(nextDate.getMonth() + 1) + ").");
nextDate.setDate(IATSGetLastDayOfMonth(nextDate.getMonth() + 1));
}
else
{
//console.log("This month has " + IATSGetLastDayOfMonth(nextDate.getMonth() + 1) + " days in it. It is the same or more than the number we need (" + day + "), so we will set it to " + day + ".");
nextDate.setDate(day);
}
}
}
// Do Quarterly and Annually settings.
else
{
// The way these come in, the months and days should already be valid.
// If a bug crops up, you can put error checking here, but hopefully it will not be needed.
// We still need to check if the proposed date would be in the past, in which case we would have to set it to next year.
// You will also have to account for someone selecting February 29 on a leap year, and making sure that it is actually on February 28 the next year.
var todayDate = new Date();
var nextDate = new Date();
nextDate.setFullYear(nextDate.getFullYear(), (month - 1), day);
if (nextDate < todayDate)
{
//testDate.setFullYear(testDate.getFullYear() + 1);
//console.log("testDate is before nextDate. We will have to set it to next year: " + testDate);
nextDate.setFullYear(nextDate.getFullYear() + 1, (month - 1), day);
}
else
{
//console.log("testDate is the same or equal to nextDate. We can leave it as this year: " + testDate);
nextDate.setFullYear(nextDate.getFullYear(), (month - 1), day);
}
}
//console.log("Returning for " + scheduleType + " the date: " + nextDate);
return nextDate;
}
// Parse the value from the BeginDate value and come up with an end date.
function IATSSetRecurringEndDate (incoming)
{
// Might have an issue here with the End date being either from 'theIATSPaymentBoxCore', or from 'this'.
// This is because we want it to work on load and on click.
// When this is called on page load, you need to pass in parameters that contain reference to 'theIATSPaymentBoxCore' before it is fully built.
// When this is called on BeginDate option change, you can simply reference 'theIATSPaymentBoxCore'.
// Check if BeginDate is null - if not, grab its value.
// Check if EndDate is null - if not, fill it in.
var schedule = document.getElementById('IATS_Payment_ScheduleType');
var beginDate = document.getElementById('IATS_Payment_BeginDate');
var endDate = document.getElementById('IATS_Payment_EndDate');
var info; // Set this to either the 'incoming' variable or to 'theIATSPaymentBoxCore.
if (typeof(theIATSPaymentBoxCore) == "undefined")
{
//console.log("SetRecurringEndDate: theIATSPaymentBoxCore is undefined.");
if (incoming != null)
{
var info = incoming;
//console.log("Fortunately, 'incoming' is not null. It is: " + info);
}
else
{
//console.log("Error: SetRecurringEndDate: theIATSPaymentBoxCore is undefined and incoming is null. We have no information to work with.");
}
}
else
{
info = theIATSPaymentBoxCore;
//console.log("SetRecurringEndDate: Looks like theIATSPaymentBoxCore is defined. It is: " + info);
}
// Go through each EndDate element until you find the one that matches the current schedule type.
if (schedule != null && beginDate != null && endDate != null)
{
info.RecurEndDates.forEach( function(endDateElement, index) {
//console.log("IATSSetRecurringEndDate: endDateElement.scheduleType = " + endDateElement.scheduleType);
if(endDateElement.scheduleType == schedule[schedule.selectedIndex].value)
{
//console.log("IATSSetRecurringEndDate: matching endDateElement.scheduleType = " + endDateElement.scheduleType);
// We have found the correct EndDate element. Get its information and transfer it to the EndDate box.
// Get a javascript Date() object representing the BeginDate.
var outDate = IATSParseStringToDate(beginDate.value, info.version);
// Add the appropriate amount of time to it.
// Decide if we are adding weeks, months, or years.
//console.log("Started with " + outDate);
// Weeks
if (endDateElement.endType == "0")
{
outDate.setDate(outDate.getDate() + parseInt(endDateElement.endNumber) * 7);
//console.log("Added " + endDateElement.endNumber + " weeks to get " + outDate);
}
// Months - note: this will not work with edge cases. Adding one month to Oct 31 makes you go to Dec 31.
else if (endDateElement.endType == "1")
{
outDate.setMonth(outDate.getMonth() + parseInt(endDateElement.endNumber));
//console.log("Added " + endDateElement.endNumber + " months to get " + outDate);
}
// Years
else
{
outDate.setFullYear(outDate.getFullYear() + parseInt(endDateElement.endNumber));
//console.log("Added " + endDateElement.endNumber + " years to get " + outDate);
}
// Set the endDate input to this new value.
endDate.value = IATSParseDateToString(outDate, info.version);
}
});
}
}
// Parse a date string and return a javascript Date() object.
function IATSParseStringToDate(dateString, version)
{
var outputDate = new Date();
// Parse the string and set the outputDate to these values.
var day = dateString.split("/")[1];
var month = dateString.split("/")[0];
var year = dateString.split("/")[2];
if(version == "UK")
{
day = dateString.split("/")[0];
month = dateString.split("/")[1];
}
outputDate.setFullYear(year, month - 1, day);
return outputDate;
}
// Take a javascript 'Date' object and returns a string that is used by the IATS AURA system.
function IATSParseDateToString (dateObject, version)
{
// 'dateObject' = Javascript date object
// version = "NA" or "UK"
// Make sure leading zeroes are included if the month number is a single digit.
var month = (dateObject.getMonth() + 1) < 10 ? "0" + (dateObject.getMonth() + 1) : (dateObject.getMonth() + 1);
var day = dateObject.getDate() < 10 ? "0" + dateObject.getDate() : dateObject.getDate();
var year = dateObject.getFullYear();
var dateStr;
if(version == "UK")
dateStr = day+'/'+month+'/'+year;
else
dateStr = month+'/'+day+'/'+year;
return dateStr;
}
function IATSParsingSelectItems(str)
{
var selectItemsList = str.split("@###@");
return selectItemsList;
}
// Option of items using dropdown list and radio buttons
function BuildEnableSelectItemDropdownList(itemDiv, theItem, classValue)
{
var elementSelect = IATSCreateElement("select","IATS_PaymentItemInput_"+theItem.Name,"");
elementSelect.setAttribute("id", "IATS_PaymentItemInput_"+theItem.Name);
elementSelect.setAttribute("class", classValue);
itemDiv.appendChild(elementSelect);
// Default option with empty value
var emptyoption = IATSCreateElement("option","","-Select");
emptyoption.value = "";
elementSelect.add(emptyoption);
// parse each line of the Item into answers; then make each answer an option of the select
var answers = IATSParsingSelectItems(theItem.SelectItems);
var answerRe = /^(.*)\[((http|https):\/\/.*)\]\s*$/;
for (j=0;j2){
if (result[j].indexOf("|") >= 0)
result[j] = result[j].split("|")[0];
answerLabel = result[1];
}
if (answers[j].indexOf("|") >= 0)
answerLabel = answerLabel.split("|")[0];
var option = IATSCreateElement("option","",answerLabel);
if (answers[j].indexOf("|") >= 0)
option.value = answers[j].split("|")[1];
else
option.value = answerLabel;
if(result && result.length>2){
option.setAttribute("data-redirectURL", result[2]);
}
elementSelect.add(option);
}
}
function IATSSetSelectedOptionStyles(id, selectedText)
{
var optionDiv = document.getElementById(id);
var optionArray = optionDiv.getElementsByTagName('div');
var upperString = selectedText.toUpperCase();
for(var i=0; i -1 || upperString == ""){
optionArray[i].style.display="block";
}else{
optionArray[i].style.display="none";
}
optionArray[i].className = optionArray[i].className.replace( /(?:^|\s)IATS_TitleSelectBoxOptionSelected(?!\S)/g , '' );
}
}
function clickOption()
{
var titleInput = document.getElementById("IATS_PaymentItemInput_Title");
titleInput.value = this.innerHTML;
IATSHideOptionDiv();
}
function IATSTitleKeyDown(e)
{
if (e == undefined) { return; }
// useless code ie8 var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0; e.charCode fails and function aborts
var key = 0;
if (e.charCode)
{
key = e.charCode;
}
if (e.keyCode)
{
key = e.keyCode;
}
var optionDiv = document.getElementById("IATS_PaymentItemInput_TitleOption");
var titleInput = document.getElementById("IATS_PaymentItemInput_Title");
var optionArray = optionDiv.getElementsByTagName('div');
if(key == 13) {
e.preventDefault();
var option = optionArray[theIATSPaymentBoxCore.titleOptionIndex];
if(option!=undefined){
titleInput.value = option.innerHTML;
IATSHideOptionDiv();
}
return;
}
if(key == 38){
e.preventDefault();
//increment
if(theIATSPaymentBoxCore.titleOptionIndex>0){
var index = theIATSPaymentBoxCore.titleOptionIndex;
for(var i=index-1; i>=0; i--){
if(optionArray[index].style.display=="block"){
index=i;
break;
}
}
theIATSPaymentBoxCore.titleOptionIndex = index;
}
for(var i=0; i=0 && optionArray[i].style.display=="block" && i>index){
index=i;
break;
}
}
theIATSPaymentBoxCore.titleOptionIndex = index;
for(var i=0; i");
_image.href="#";
_image.onmouseover = (function IATSShowText()
{
var j = i;
return function (e)
{
var dd = document.getElementById("IATS_Payment_Item"+(j+1)+"MoreInfoDiv");
AssignPosition(dd);
dd.style.display = "block";
}
})();
_image.onmouseout = (function IATSHideText()
{
var j = i;
return function (e)
{
document.getElementById("IATS_Payment_Item"+(j+1)+"MoreInfoDiv").style.display = "none";
}
})();
Inputlabel.appendChild(_image);
var _moreInfoDiv = this.createElement("div","",this.PrifileItemList_Items[i].MoreInfo);
_moreInfoDiv.className = "IATS_LearMoreDiv";
_moreInfoDiv.setAttribute("id","IATS_Payment_"+this.PrifileItemList_Items[i].Name+"MoreInfoDiv");
_moreInfoDiv.style.display = 'none';
//Inputlabel.appendChild(_moreInfoDiv);
document.body.appendChild(_moreInfoDiv);
}
classvalue="IATS_PaymentInputField";
if (this.PrifileItemList_Items[i].Required == 1)
classvalue=classvalue + " IATS_InputRequired";
// Option of items using dropdown list, radio buttons, or multi-selection
if(this.PrifileItemList_Items[i].EnableSelect == 1)
{
var answers = IATSParsingSelectItems(this.PrifileItemList_Items[i].SelectItems);
Input = this.createElement("div","","");
InputDiv.appendChild(Input);
if (this.ItemFormat == "DropdownList")
{
BuildEnableSelectItemDropdownList(Input, this.PrifileItemList_Items[i], classvalue);
}
else // this.ItemFormat == "RadioButtons" or "MultiSelect"
{
var answerRe = /^(.*)\[((http|https):\/\/.*)\]\s*$/;
var selectedRadio;
for (j=0;j= 0)
answerLabel = answers[j].split("|")[0];
if(result && result.length > 2){
answerLabel = result[1];
}
// #0 - div
SelectItemsDiv=this.createElement("div","","");
if(this.BasicLayoutClassName=="IATS_PaymentLabelOnTop")
SelectItemsDiv.className = "IATS_SelectItemsSubDivOnTop";
else SelectItemsDiv.className = "IATS_SelectItemsSubDiv";
// #1 - checkbox or radio button
selectedRadio = null;
RadioButton = this.createElement("input","IATS_PaymentItemInput_"+this.PrifileItemList_Items[i].Name,"");
if (this.ItemFormat == "MultiSelect")
RadioButton.setAttribute("type","checkbox");
else // "RadioButtons"
RadioButton.setAttribute("type", "radio");
RadioButton.setAttribute("name", "IATS_PaymentItemInput_"+this.PrifileItemList_Items[i].Name);
RadioButton.setAttribute("id", "IATS_PaymentItemInput_"+this.PrifileItemList_Items[i].Name+"Order_"+j);
if (answers[j].indexOf("|") >= 0 && this.ItemFormat != "MultiSelect")
RadioButton.value = answers[j].split("|")[0];
else
RadioButton.value = answerLabel;
RadioButton.onclick = function(){
if(selectedRadio != undefined && selectedRadio == this){
this.checked = false;
selectedRadio = null;
}else{
selectedRadio = this;
}
};
if(result && result.length > 2){
RadioButton.setAttribute("data-redirectURL", result[2]);
}
RadioButtonlabel = this.createElement("label","",answerLabel);
RadioButtonlabel.setAttribute("for", "IATS_PaymentItemInput_"+this.PrifileItemList_Items[i].Name+"Order_"+j);
SelectItemsDiv.appendChild(RadioButton);
SelectItemsDiv.appendChild(RadioButtonlabel);
if (answers[j].indexOf("|") >= 0) {
RadioButton = this.createElement("input");
RadioButton.setAttribute("name", "IATS_Payment_SelectItemsValue_" + (j + 1));
RadioButton.setAttribute("id", "IATS_Payment_SelectItemsValue_" + (j + 1));
RadioButton.setAttribute("type","hidden");
RadioButton.setAttribute("value", answers[j].split("|")[1]);
SelectItemsDiv.appendChild(RadioButton);
}
Input.appendChild(SelectItemsDiv);
}
}
}
else
{
Input = this.createElement("input","IATS_PaymentItemInput_"+this.PrifileItemList_Items[i].Name,"");
Input.className = classvalue;
Input.setAttribute("id", "IATS_PaymentItemInput_"+this.PrifileItemList_Items[i].Name);
Input.setAttribute("maxLength", this.PrifileItemList_Items[i].MaxLen);
Input.value=this.PrifileItemList_Items[i].Value;
InputDiv.appendChild(Input);
}
classvalue = this.BasicLayoutClassName;
classvalue = classvalue+" IATS_PaymentItemErrorMessage";
var ErrorMsg = this.createElement("span","",this.PrifileItemList_Items[i].ErrorMsg);
ErrorMsg.className = classvalue;
ErrorMsg.setAttribute("id", "IATS_PaymentItemErrorMesssage_"+this.PrifileItemList_Items[i].Name);
InputDiv.appendChild(ErrorMsg);
}
// This is where we are going to create the client custom fields for the payment area
if (this.clientCustomFields && this.clientCustomFields.length > 0)
IATSCreateCustomPaymentFields(this.clientCustomFields, div);
//UK ACH format (what does this mean?)
// Create the div that holds the "One Time" and "Recurring" buttons.
var displayPaymentOption = false;
InputDiv = this.createElement("div","","");
InputDiv.className = "IATS_PaymentFrequencyItemDiv";
InputDiv.setAttribute("id","IATS_Payment_PaymentFrequencyDiv");
if(this.ReoccurringVisible!="CHECKED" || this.SinglePaymentVisible!="CHECKED")
InputDiv.style.display = "none";
else InputDiv.style.display = "block";
div.appendChild(InputDiv);
// Create the "One Time" radio button.
var RadioButton = this.createElement("input","IATS_Payment_PaymentFrequency","");
RadioButton.className = "IATS_RadioPaymentButton";
RadioButton.setAttribute("type", "radio");
RadioButton.setAttribute("name", "IATS_Payment_PaymentFrequency");
RadioButton.setAttribute("id", "IATS_Payment_SinglePayment");
RadioButton.value = "Single";
RadioButton.defaultChecked = false;
if(this.ReoccurringVisible!="CHECKED" && this.SinglePaymentVisible=="CHECKED")
{
RadioButton.checked = true;
displayPaymentOption = true;
}
RadioButton.onclick = this.SelectPaymentFrequency;
InputDiv.appendChild(RadioButton);
// Create a label for the "One Time" radio button.
var RadioButtonlabel = this.createElement("label","",this.SinglePaymentLabel);
RadioButtonlabel.className = "IATS_RadioPaymentLabel";
RadioButtonlabel.setAttribute("for", "IATS_Payment_SinglePayment");
InputDiv.appendChild(RadioButtonlabel);
// Create the "Recurring" radio button.
RadioButton = this.createElement("input","IATS_Payment_PaymentFrequency","");
RadioButton.className = "IATS_RadioPaymentButton";
RadioButton.setAttribute("type", "radio");
RadioButton.setAttribute("name", "IATS_Payment_PaymentFrequency");
RadioButton.setAttribute("id", "IATS_Payment_RecurringPayment");
RadioButton.value = "Recurring";
RadioButton.defaultChecked = false;
//console.log("Deciding if we should 'displayPaymentOption'. 'this.recurringCheck' = " + this.recurringCheck);
//console.log("ReoccurringVisible = " + this.ReoccurringVisible + ", SinglePaymentVisible = " + this.SinglePaymentVisible + ", recurringCheck = " + this.recurringCheck);
if(this.ReoccurringVisible=="CHECKED" && (this.SinglePaymentVisible!="CHECKED" || this.recurringCheck == true))
{
//console.log("Going to 'displayPaymentOption'");
// In addition to checking this button, the hidden checkbox, inserted into the form for obscure reasons, must also be checked off.
// This has to be done within the createReoccurringDiv() function, as only this button will run 'showReoccurring()', which shows and hides the Recurring info.
RadioButton.checked = true;
displayPaymentOption = true;
}
RadioButton.onclick = this.SelectPaymentFrequency;
InputDiv.appendChild(RadioButton);
// Create a label for the "Recurring" radio button.
RadioButtonlabel = this.createElement("label","",this.ReoccurringLabel);
RadioButtonlabel.className = "IATS_RadioPaymentLabel";
RadioButtonlabel.setAttribute("for", "IATS_Payment_RecurringPayment");
InputDiv.appendChild(RadioButtonlabel);
// Create payment option div, containing Credit Card, Bank Card, and Recurring divs.
InputDiv = this.createElement("div","","");
var paymentInputDiv = this.createElement("div","","");
paymentInputDiv.setAttribute("id","IATS_Payment_PaymentAccountInputDiv");
paymentInputDiv.style.display = "none";
if(displayPaymentOption)
paymentInputDiv.style.display = "block";
div.appendChild(paymentInputDiv);
if(this.version=="UK" &&(this.ReoccurringVisible!="CHECKED" && this.SinglePaymentVisible=="CHECKED"))
this.UKCheckVisible="";
// This is the div that contains the "Credit Card" and "Bank Withdrawal" radio buttons.
InputDiv.className = "IATS_PaymentTypeItemDiv";
InputDiv.setAttribute("id","IATS_Payment_AccountTypeDiv");
InputDiv.style.display = "none";
if(this.CreditCardVisible=="CHECKED" && (this.USCheckVisible=="CHECKED" || this.CANCheckVisible=="CHECKED" || this.UKCheckVisible=="CHECKED"))
InputDiv.style.display = "block";
paymentInputDiv.appendChild(InputDiv);
// This is the div that contains the credit card information input boxes.
var RadioButton = this.createElement("input","IATS_Payment_PaymentType","");
RadioButton.className = "IATS_RadioPaymentButton";
RadioButton.setAttribute("type", "radio");
RadioButton.setAttribute("name", "IATS_Payment_PaymentType");
RadioButton.setAttribute("id", "IATS_Payment_CreditCardPayment");
RadioButton.value = "CreditCard";
if(this.CreditCardVisible=="CHECKED")
{
//console.log("this.CreditCardVisible = " + this.CreditCardVisible);
RadioButton.defaultChecked = true;
}
else RadioButton.defaultChecked = false;
RadioButton.onclick = this.SelectPaymentType;
InputDiv.appendChild(RadioButton);
//console.log("Credit card button checked state is " + RadioButton.checked);
//Add mop of redirect post.
var methodOfPayment = this.createElement("input", "IATS_Payment_PaymentMethod","");
methodOfPayment.setAttribute("type","hidden");
methodOfPayment.setAttribute("name","IATS_Payment_PaymentMethod");
methodOfPayment.setAttribute("id","IATS_Payment_PaymentMethod");
InputDiv.appendChild(methodOfPayment);
var RadioButtonlabel = this.createElement("label","",this.CreditCardLabel);
RadioButtonlabel.className = "IATS_RadioPaymentLabel";
RadioButtonlabel.setAttribute("for", "IATS_Payment_CreditCardPayment");
InputDiv.appendChild(RadioButtonlabel);
RadioButton = this.createElement("input","IATS_Payment_PaymentType","");
RadioButton.className = "IATS_RadioPaymentButton";
RadioButton.setAttribute("type", "radio");
RadioButton.setAttribute("name", "IATS_Payment_PaymentType");
RadioButton.setAttribute("id", "IATS_Payment_DebitCardPayment");
RadioButton.value = "DebitCard";
//console.log("this.USCheckVisible = " + this.USCheckVisible + ", this.CANCheckVisible = " + this.CANCheckVisible + ", this.UKCheckVisible = " + this.UKCheckVisible
// + ", this.CreditCardVisible = " + this.CreditCardVisible + ", this.bankWithdrawalChecked = " + this.bankWithdrawalChecked);
if( ((this.USCheckVisible=="CHECKED" || this.CANCheckVisible=="CHECKED" || this.UKCheckVisible=="CHECKED") && this.CreditCardVisible!="CHECKED") || this.bankWithdrawalChecked == 1)
{
RadioButton.defaultChecked = true;
}
else RadioButton.defaultChecked = false;
//console.log("Back Withdrawal button checked state is " + RadioButton.checked);
RadioButton.onclick = this.SelectPaymentType;
InputDiv.appendChild(RadioButton);
var ACHLabel;
if(this.USCheckVisible=="CHECKED")
ACHLabel = this.USCheckLabel;
else if(this.CANCheckVisible=="CHECKED")
ACHLabel = this.CANCheckLabel;
else
ACHLabel = this.UKCheckLabel;
RadioButtonlabel = this.createElement("label","",ACHLabel);
RadioButtonlabel.className = "IATS_RadioPaymentLabel";
RadioButtonlabel.setAttribute("for", "IATS_Payment_DebitCardPayment");
InputDiv.appendChild(RadioButtonlabel);
// The entire 'Recurring' div is created here.
var reoccurringlist = this.createReoccurringDiv();
paymentInputDiv.appendChild(reoccurringlist);
if(this.CreditCardVisible=="CHECKED")
{
var CreditCardInputDiv=this.createElement("div","","");
CreditCardInputDiv.className="IATS_PaymentItemDiv";
CreditCardInputDiv.setAttribute("id","IATS_Payment_CreditCardDiv");
paymentInputDiv.appendChild(CreditCardInputDiv);
// account number
InputDiv = this.createElement("div","","");
InputDiv.className = "IATS_PaymentItemDiv";
InputDiv.setAttribute("id", "IATS_Payment_AccountNumberDiv");
CreditCardInputDiv.appendChild(InputDiv);
var browser = navigator.userAgent;
classvalue=this.BasicLayoutClassName;
classvalue=classvalue + " IATS_InputRequired";
Inputlabel = this.createElement("label","",this.PaymentAccountNumberDesc);
Inputlabel.className = classvalue;
Inputlabel.setAttribute("for", "IATS_Payment_AccountNumber");
InputDiv.appendChild(Inputlabel);
classvalue="IATS_AccountNumberField";
classvalue=classvalue + " IATS_InputRequired";
Input = this.createElement("input","IATS_Payment_AccountNumber","");
Input.className = classvalue;
Input.setAttribute("type", "Input");
Input.setAttribute("id", "IATS_Payment_AccountNumber");
Input.setAttribute("maxLength", 19);
if(browser.indexOf("MSIE")>-1){
Input.onkeydown = function(e){ if (!e) {e = window.event;} return formatCCNumberField("IATS_Payment_AccountNumber");};
}else{
Input.oninput=function(){return formatCCNumberField("IATS_Payment_AccountNumber");};
}
InputDiv.appendChild(Input);
classvalue=this.BasicLayoutClassName;
classvalue = classvalue+" IATS_PaymentItemErrorMessage";
var ErrorMsg = this.createElement("span","",this.AccountNumberErrorMessage);
ErrorMsg.className = classvalue;
ErrorMsg.setAttribute("id", "IATS_Payment_AccountNumberErrorMessage");
InputDiv.appendChild(ErrorMsg);
// Expiry Date
InputDiv = this.createElement("div","","");
InputDiv.className = "IATS_PaymentItemDiv";
InputDiv.setAttribute("id", "IATS_Payment_ExpiryDateDiv");
CreditCardInputDiv.appendChild(InputDiv);
classvalue=this.BasicLayoutClassName;
classvalue=classvalue + " IATS_InputRequired";
Inputlabel = this.createElement("label","",this.PaymentExpiryDesc);
Inputlabel.className = classvalue;
Inputlabel.setAttribute("for", "IATS_Payment_ExpiryDate");
InputDiv.appendChild(Inputlabel);
classvalue="IATS_ExpiryMonthField";
classvalue=classvalue + " IATS_InputRequired";
Input = this.createElement("select","IATS_Payment_ExpiryMonth","");
Input.className = classvalue;
Input.setAttribute("id", "IATS_Payment_ExpiryMonth");
for (i=1; i<= 12; i++)
{
Input.options[i-1] = new Option(i,i);
}
Input.selectedIndex = 0;
InputDiv.appendChild(Input);
classvalue="IATS_ExpiryYearField";
classvalue=classvalue + " IATS_InputRequired";
Input = this.createElement("select","IATS_Payment_ExpiryYear","");
Input.className = classvalue;
Input.setAttribute("id", "IATS_Payment_ExpiryYear");
var date = new Date();
var n=0;
for (i=date.getFullYear(); i<= date.getFullYear() + 10; i++)
{
Input.options[n] = new Option(i,i);
n++;
}
Input.selectedIndex = 1;
InputDiv.appendChild(Input);
classvalue=this.BasicLayoutClassName;
classvalue = classvalue+" IATS_PaymentItemErrorMessage";
var ErrorMsg = this.createElement("span","",this.ExpiryDateErrorMessage);
ErrorMsg.className = classvalue;
ErrorMsg.setAttribute("id", "IATS_Payment_ExpiryDateErrorMessage");
InputDiv.appendChild(ErrorMsg);
//CVV2
if(this.hideCVV!=1)
{
InputDiv = this.createElement("div","","");
InputDiv.className = "IATS_PaymentItemDiv";
InputDiv.setAttribute("id", "IATS_Payment_CVV2Div");
//InputDiv.style.display = 'none';
CreditCardInputDiv.appendChild(InputDiv);
classvalue=this.BasicLayoutClassName;
classvalue=classvalue + " IATS_InputRequired";
Inputlabel = this.createElement("label","",this.PaymentCVV2Desc);
Inputlabel.className = classvalue;
Inputlabel.setAttribute("for", "IATS_Payment_CVV2");
InputDiv.appendChild(Inputlabel);
var imgurl = "https://www.iatspayments.com/paymentbox/img/help2.gif";
classvalue="IATS_CVV2Field";
classvalue=classvalue + " IATS_InputRequired";
Input = this.createElement("input","IATS_Payment_CVV2","");
Input.className = classvalue;
Input.setAttribute("type", "text");
Input.setAttribute("id", "IATS_Payment_CVV2");
Input.setAttribute("maxLength", 4);
InputDiv.appendChild(Input);
image=this.createElement("a","","");
image.href="#";
image.onclick=this.OpenCVV2Img;
InputDiv.appendChild(image);
classvalue=this.BasicLayoutClassName;
classvalue = classvalue+" IATS_PaymentItemErrorMessage";
var ErrorMsg = this.createElement("span","",this.CVV2ErrorMessage);
ErrorMsg.className = classvalue;
ErrorMsg.setAttribute("id", "IATS_Payment_CVV2ErrorMessage");
InputDiv.appendChild(ErrorMsg);
}
}
// Account number for ACH
InputDiv = this.createElement("div","","");
InputDiv.className = "IATS_PaymentItemDiv";
InputDiv.setAttribute("id", "IATS_Payment_DebitDiv");
InputDiv.style.display="none";
if((this.USCheckVisible=="CHECKED" || this.CANCheckVisible=="CHECKED" || this.UKCheckVisible=="CHECKED" ) && this.CreditCardVisible!="CHECKED")
InputDiv.style.display="block";
paymentInputDiv.appendChild(InputDiv);
var imgurl = "https://www.iatspayments.com/paymentbox/img/help2.gif";
if(this.USCheckVisible=="CHECKED" || (this.bankWithdrawalChecked == true && this.version == "NA" && this.currency == "1" ))
{
//US ACH Account Number
var InputAccount = this.createElement("div","","");
InputAccount.className = "IATS_PaymentItemDiv";
InputAccount.setAttribute("id", "IATS_Payment_USACHRoutingNoDiv");
InputDiv.appendChild(InputAccount);
Inputlabel = this.createElement("label","",this.USRoutingNoLabel);
classvalue=this.BasicLayoutClassName;
classvalue=classvalue + " IATS_InputRequired";
Inputlabel.className = classvalue;
Inputlabel.setAttribute("for", "IATS_Payment_USDebitAccount1");
InputAccount.appendChild(Inputlabel);
Input = this.createElement("input","IATS_Payment_USDebitAccount1","");
classvalue = "IATS_ACHInput";
classvalue = classvalue + " IATS_InputRequired";
Input.className = classvalue;
Input.setAttribute("id", "IATS_Payment_USDebitAccount1");
Input.setAttribute("type", "text");
Input.setAttribute("maxLength", 9);
InputAccount.appendChild(Input);
var image=this.createElement("a","","");
image.href="#";
image.onclick=this.OpenUSHelpImg;
InputAccount.appendChild(image);
classvalue=this.BasicLayoutClassName;
classvalue = classvalue+" IATS_PaymentItemErrorMessage";
var ErrorMsg = this.createElement("span","",this.USRoutingNoErrorMessage);
ErrorMsg.className = classvalue;
ErrorMsg.setAttribute("id", "IATS_Payment_USDebitAccount1ErrorMessage");
InputAccount.appendChild(ErrorMsg);
InputAccount = this.createElement("div","","");
InputAccount.className = "IATS_PaymentItemDiv";
InputAccount.setAttribute("id", "IATS_Payment_USACHAccountNoDiv");
InputDiv.appendChild(InputAccount);
Inputlabel = this.createElement("label","",this.USAccountNoLabel);
classvalue = this.BasicLayoutClassName;
classvalue = classvalue + " IATS_InputRequired";
Inputlabel.className = classvalue;
Inputlabel.setAttribute("for", "IATS_Payment_USDebitAccount2");
InputAccount.appendChild(Inputlabel);
Input = this.createElement("input","IATS_Payment_USDebitAccount2","");
classvalue = "IATS_ACHInput";
classvalue = classvalue + " IATS_InputRequired";
Input.className = classvalue;
Input.setAttribute("id", "IATS_Payment_USDebitAccount2");
Input.setAttribute("type", "Input");
Input.setAttribute("maxLength",17);
InputAccount.appendChild(Input);
image=this.createElement("a","","");
image.href="#";
image.onclick=this.OpenUSHelpImg;
InputAccount.appendChild(image);
classvalue=this.BasicLayoutClassName;
classvalue = classvalue+" IATS_PaymentItemErrorMessage";
var ErrorMsg = this.createElement("span","",this.USAccountNoErrorMessage);
ErrorMsg.className = classvalue;
ErrorMsg.setAttribute("id", "IATS_Payment_USDebitAccount2ErrorMessage");
InputAccount.appendChild(ErrorMsg);
if(this.ReEnterUSAccountNoLabel!='')
{
InputAccount = this.createElement("div","","");
InputAccount.className = "IATS_PaymentItemDiv";
InputAccount.setAttribute("id", "IATS_Payment_ReEnterUSACHAccountNoDiv");
InputDiv.appendChild(InputAccount);
Inputlabel = this.createElement("label","",this.ReEnterUSAccountNoLabel);
classvalue = this.BasicLayoutClassName;
classvalue = classvalue + " IATS_InputRequired";
Inputlabel.className = classvalue;
Inputlabel.setAttribute("for", "IATS_Payment_ReEnterUSDebitAccount2");
InputAccount.appendChild(Inputlabel);
Input = this.createElement("input","IATS_Payment_ReEnterUSDebitAccount2","");
classvalue = "IATS_ACHInput";
classvalue = classvalue + " IATS_InputRequired";
Input.className = classvalue;
Input.setAttribute("id", "IATS_Payment_ReEnterUSDebitAccount2");
Input.setAttribute("type", "Input");
Input.setAttribute("maxLength",17);
InputAccount.appendChild(Input);
image=this.createElement("a","","");
image.href="#";
image.onclick=this.OpenUSHelpImg;
InputAccount.appendChild(image);
classvalue=this.BasicLayoutClassName;
classvalue = classvalue+" IATS_PaymentItemErrorMessage";
var ErrorMsg = this.createElement("span","",this.ReEnterUSAccountNoErrorMessage);
ErrorMsg.className = classvalue;
ErrorMsg.setAttribute("id", "IATS_Payment_ReEnterUSDebitAccount2ErrorMessage");
InputAccount.appendChild(ErrorMsg);
}
}
else if(this.CANCheckVisible=="CHECKED" || (this.bankWithdrawalChecked == true && this.version == "NA" && this.currency == "0" ))
{
//CAN ACH Account Number
var InputAccount = this.createElement("div","","");
InputAccount.className = "IATS_PaymentItemDiv";
InputAccount.setAttribute("id", "IATS_Payment_CANACHTransitNoDiv");
InputDiv.appendChild(InputAccount);
Inputlabel = this.createElement("label","",this.CANTransitNoLabel);
Inputlabel.className = this.BasicLayoutClassName + " IATS_InputRequired";;
Inputlabel.setAttribute("for", "IATS_Payment_CANDebitAccount1");
InputAccount.appendChild(Inputlabel);
Input = this.createElement("input","IATS_Payment_CANDebitAccount1","");
classvalue = "IATS_ACHInput";
classvalue = classvalue + " IATS_InputRequired";
Input.className = classvalue;
Input.setAttribute("id", "IATS_Payment_CANDebitAccount1");
Input.setAttribute("type", "Input");
Input.setAttribute("maxLength",5);
InputAccount.appendChild(Input);
image=this.createElement("a","","");
image.href="#";
image.onclick=this.OpenCNDHelpImg;
InputAccount.appendChild(image);
classvalue=this.BasicLayoutClassName;
classvalue = classvalue+" IATS_PaymentItemErrorMessage";
var ErrorMsg = this.createElement("span","",this.CANTransitNoErrorMessage);
ErrorMsg.className = classvalue;
ErrorMsg.setAttribute("id", "IATS_Payment_CANDebitAccount1ErrorMessage");
InputAccount.appendChild(ErrorMsg);
InputAccount = this.createElement("div","","");
InputAccount.className = "IATS_PaymentItemDiv";
InputAccount.setAttribute("id", "IATS_Payment_CANACHBankNoDiv");
InputDiv.appendChild(InputAccount);
Inputlabel = this.createElement("label","",this.CANBankNoLabel);
Inputlabel.className = this.BasicLayoutClassName + " IATS_InputRequired";;
Inputlabel.setAttribute("for", "IATS_Payment_CANDebitAccount2");
InputAccount.appendChild(Inputlabel);
Input = this.createElement("input","IATS_Payment_CANDebitAccount2","");
classvalue = "IATS_ACHInput";
classvalue = classvalue + " IATS_InputRequired";
Input.className = classvalue;
Input.setAttribute("id", "IATS_Payment_CANDebitAccount2");
Input.setAttribute("type", "Input");
Input.setAttribute("maxLength",3);
InputAccount.appendChild(Input);
image=this.createElement("a","","");
image.href="#";
image.onclick=this.OpenCNDHelpImg;
InputAccount.appendChild(image);
classvalue=this.BasicLayoutClassName;
classvalue = classvalue+" IATS_PaymentItemErrorMessage";
var ErrorMsg = this.createElement("span","",this.CANBankNoErrorMessage);
ErrorMsg.className = classvalue;
ErrorMsg.setAttribute("id", "IATS_Payment_CANDebitAccount2ErrorMessage");
InputAccount.appendChild(ErrorMsg);
InputAccount = this.createElement("div","","");
InputAccount.className = "IATS_PaymentItemDiv";
InputAccount.setAttribute("id", "IATS_Payment_CANACHAccountNoDiv");
InputDiv.appendChild(InputAccount);
Inputlabel = this.createElement("label","",this.CANAccountNoLabel);
Inputlabel.className = this.BasicLayoutClassName + " IATS_InputRequired";;
Inputlabel.setAttribute("for", "IATS_Payment_CANDebitAccount2");
InputAccount.appendChild(Inputlabel);
Input = this.createElement("input","IATS_Payment_CANDebitAccount3","");
classvalue = "IATS_ACHInput";
classvalue = classvalue + " IATS_InputRequired";
Input.className = classvalue;
Input.setAttribute("id", "IATS_Payment_CANDebitAccount3");
Input.setAttribute("type", "Input");
Input.setAttribute("maxLength",12);
InputAccount.appendChild(Input);
image=this.createElement("a","","");
image.href="#";
image.onclick=this.OpenCNDHelpImg;
InputAccount.appendChild(image);
classvalue=this.BasicLayoutClassName;
classvalue = classvalue+" IATS_PaymentItemErrorMessage";
var ErrorMsg = this.createElement("span","",this.CANAccountNoErrorMessage);
ErrorMsg.className = classvalue;
ErrorMsg.setAttribute("id", "IATS_Payment_CANDebitAccount3ErrorMessage");
InputAccount.appendChild(ErrorMsg);
if(this.ReEnterCANAccountNoLabel!='')
{
InputAccount = this.createElement("div","","");
InputAccount.className = "IATS_PaymentItemDiv";
InputAccount.setAttribute("id", "IATS_Payment_ReEnterCANACHAccountNoDiv");
InputDiv.appendChild(InputAccount);
Inputlabel = this.createElement("label","",this.ReEnterCANAccountNoLabel);
Inputlabel.className = this.BasicLayoutClassName + " IATS_InputRequired";;
Inputlabel.setAttribute("for", "IATS_Payment_ReEnterCANDebitAccount3");
InputAccount.appendChild(Inputlabel);
Input = this.createElement("input","IATS_Payment_ReEnterCANDebitAccount3","");
classvalue = "IATS_ACHInput";
classvalue = classvalue + " IATS_InputRequired";
Input.className = classvalue;
Input.setAttribute("id", "IATS_Payment_ReEnterCANDebitAccount3");
Input.setAttribute("type", "Input");
Input.setAttribute("maxLength",12);
InputAccount.appendChild(Input);
image=this.createElement("a","","");
image.href="#";
image.onclick=this.OpenCNDHelpImg;
InputAccount.appendChild(image);
classvalue=this.BasicLayoutClassName;
classvalue = classvalue+" IATS_PaymentItemErrorMessage";
var ErrorMsg = this.createElement("span","",this.ReEnterCANAccountNoErrorMessage);
ErrorMsg.className = classvalue;
ErrorMsg.setAttribute("id", "IATS_Payment_ReEnterCANDebitAccount3ErrorMessage");
InputAccount.appendChild(ErrorMsg);
}
}
else
{
//Sort No
InputAccount = this.createElement("div","","");
InputAccount.className = "IATS_PaymentItemDiv";
InputAccount.setAttribute("id", "IATS_Payment_UKACHSortNoDiv");
InputAccount.style.display='none';
InputDiv.appendChild(InputAccount);
Inputlabel = this.createElement("label","",this.UKSortNoLabel);
Inputlabel.className = this.BasicLayoutClassName + " IATS_InputRequired";
Inputlabel.setAttribute("for", "IATS_Payment_UKDebitAccount2");
InputAccount.appendChild(Inputlabel);
Input = this.createElement("input","IATS_Payment_UKDebitAccount2","");
classvalue = "IATS_ACHInput";
classvalue = classvalue + " IATS_InputRequired";
Input.className = classvalue;
Input.setAttribute("id", "IATS_Payment_UKDebitAccount2");
Input.setAttribute("type", "Input");
Input.setAttribute("maxLength",6);
InputAccount.appendChild(Input);
image=this.createElement("a","","");
image.href="#";
if(currency == "2") {
image.onclick=this.OpenSEPAHelpImg;
}
else {
image.onclick=this.OpenUKHelpImg;
}
InputAccount.appendChild(image);
classvalue=this.BasicLayoutClassName;
classvalue = classvalue+" IATS_PaymentItemErrorMessage";
var ErrorMsg = this.createElement("span","",this.UKSortNoErrorMessage);
ErrorMsg.className = classvalue;
ErrorMsg.setAttribute("id", "IATS_Payment_UKDebitAccount2ErrorMessage");
InputAccount.appendChild(ErrorMsg);
//SEPA Bank Id
InputAccount = this.createElement("div","","");
InputAccount.className = "IATS_PaymentItemDiv";
InputAccount.setAttribute("id", "IATS_Payment_UKACHSEPABankIdDiv");
//Hide the SEPA Bank Id for all currencies but Euro
if(currency != "2") {
InputAccount.style.display='none';
}
InputDiv.appendChild(InputAccount);
Inputlabel = this.createElement("label","",this.UKSEPABankIdLabel);
Inputlabel.className = this.BasicLayoutClassName + " IATS_InputRequired";
Inputlabel.setAttribute("for", "IATS_Payment_UKDebitAccount4");
InputAccount.appendChild(Inputlabel);
Input = this.createElement("input","IATS_Payment_UKDebitAccount5","");
classvalue = "IATS_ACHInput";
classvalue = classvalue + " IATS_InputRequired";
Input.className = classvalue;
Input.setAttribute("id", "IATS_Payment_UKDebitAccount4");
Input.setAttribute("type", "Input");
Input.setAttribute("maxLength",35);
InputAccount.appendChild(Input);
image=this.createElement("a","","");
image.href="#";
if(currency == "2") {
image.onclick=this.OpenSEPAHelpImg;
}
else {
image.onclick=this.OpenUKHelpImg;
}
InputAccount.appendChild(image);
classvalue=this.BasicLayoutClassName;
classvalue = classvalue+" IATS_PaymentItemErrorMessage";
var ErrorMsg = this.createElement("span","",this.UKSEPABankIdErrorMessage);
ErrorMsg.className = classvalue;
ErrorMsg.setAttribute("id", "IATS_Payment_UKDebitAccount5ErrorMessage");
InputAccount.appendChild(ErrorMsg);
//Account No
InputAccount = this.createElement("div","","");
InputAccount.className = "IATS_PaymentItemDiv";
InputAccount.setAttribute("id", "IATS_Payment_UKACHAccountNoDiv");
//Hide the Account No for GBP currency only
if(currency == "3") {
InputAccount.style.display='none';
}
InputDiv.appendChild(InputAccount);
Inputlabel = this.createElement("label","",this.UKAccountNoLabel);
Inputlabel.className = this.BasicLayoutClassName + " IATS_InputRequired";;
Inputlabel.setAttribute("for", "IATS_Payment_UKDebitAccount2");
InputAccount.appendChild(Inputlabel);
Input = this.createElement("input","IATS_Payment_UKDebitAccount3","");
classvalue = "IATS_ACHInput";
classvalue = classvalue + " IATS_InputRequired";
Input.className = classvalue;
Input.setAttribute("id", "IATS_Payment_UKDebitAccount3");
Input.setAttribute("type", "Input");
if(currency == "2") {
Input.setAttribute("maxLength",35);
}
else {
Input.setAttribute("maxLength",15);
}
InputAccount.appendChild(Input);
image=this.createElement("a","","");
image.href="#";
if(currency == "2") {
image.onclick=this.OpenSEPAHelpImg;
}
else {
image.onclick=this.OpenUKHelpImg;
}
InputAccount.appendChild(image);
classvalue=this.BasicLayoutClassName;
classvalue = classvalue+" IATS_PaymentItemErrorMessage";
var ErrorMsg = this.createElement("span","",this.UKAccountNoErrorMessage);
ErrorMsg.className = classvalue;
ErrorMsg.setAttribute("id", "IATS_Payment_UKDebitAccount3ErrorMessage");
InputAccount.appendChild(ErrorMsg);
if(this.ReEnterUKAccountNoLabel!='')
{
InputAccount = this.createElement("div","","");
InputAccount.className = "IATS_PaymentItemDiv";
InputAccount.setAttribute("id", "IATS_Payment_ReEnterUKACHAccountNoDiv");
//Hide the Re-Enter Account No for GBP currency only
if(currency == "3")
{
InputAccount.style.display='none';
}
InputDiv.appendChild(InputAccount);
Inputlabel = this.createElement("label","",this.ReEnterUKAccountNoLabel);
Inputlabel.className = this.BasicLayoutClassName + " IATS_InputRequired";;
Inputlabel.setAttribute("for", "IATS_Payment_ReEnterUKDebitAccount3");
InputAccount.appendChild(Inputlabel);
Input = this.createElement("input","IATS_Payment_ReEnterUKDebitAccount3","");
classvalue = "IATS_ACHInput";
classvalue = classvalue + " IATS_InputRequired";
Input.className = classvalue;
Input.setAttribute("id", "IATS_Payment_ReEnterUKDebitAccount3");
Input.setAttribute("type", "Input");
if(currency == "2") {
Input.setAttribute("maxLength",35);
}
else {
Input.setAttribute("maxLength",15);
}
InputAccount.appendChild(Input);
image=this.createElement("a","","");
image.href="#";
if(currency == "2") {
image.onclick=this.OpenSEPAHelpImg;
}
else {
image.onclick=this.OpenUKHelpImg;
}
InputAccount.appendChild(image);
classvalue=this.BasicLayoutClassName;
classvalue = classvalue+" IATS_PaymentItemErrorMessage";
var ErrorMsg = this.createElement("span","",this.ReEnterUKAccountNoErrorMessage);
ErrorMsg.className = classvalue;
ErrorMsg.setAttribute("id", "IATS_Payment_ReEnterUKDebitAccount3ErrorMessage");
InputAccount.appendChild(ErrorMsg);
}
}
//Account Type - Don't show it for UK & SEPA
if (!(this.version == "UK" && this.currency == "2"))
{
InputDiv1 = this.createElement("div","","");
InputDiv1.className = "IATS_PaymentItemDiv";
InputDiv1.setAttribute("id", "IATS_Payment_ACHAccountTypeDiv");
if(this.UKCheckVisible=="CHECKED" && currency == "3")
InputDiv1.style.display = 'none';
InputDiv.appendChild(InputDiv1);
classvalue=this.BasicLayoutClassName;
classvalue=classvalue + " IATS_InputRequired";
Inputlabel = this.createElement("label","",this.AccountTypeLabel);
Inputlabel.className = classvalue;
Inputlabel.setAttribute("for","IATS_Payment_DebitAccountType");
InputDiv1.appendChild(Inputlabel);
Input = this.createElement("select","IATS_Payment_DebitAccountType","");
classvalue="IATS_ACHInput";
classvalue=classvalue + " IATS_InputRequired";
Input.className = classvalue;
Input.setAttribute("id","IATS_Payment_DebitAccountType");
Input.options[0]=new Option(this.CheckingLabel,"CHECKING");
Input.options[1]=new Option(this.SavingLabel,"SAVING");
Input.selectedIndex=0;
InputDiv1.appendChild(Input);
classvalue=this.BasicLayoutClassName;
classvalue = classvalue+" IATS_PaymentItemErrorMessage";
var ErrorMsg = this.createElement("span","",this.AccountNumberErrorMessage);
ErrorMsg.className = classvalue;
ErrorMsg.setAttribute("id", "IATS_Payment_DebitAccountTypeErrorMessage");
InputDiv1.appendChild(ErrorMsg);
}
// NACHA
InputDiv1 = this.createElement("div","","");
InputDiv1.className = "IATS_PaymentItemDiv";
InputDiv1.setAttribute("id", "IATS_Payment_ACHAgreementDiv");
InputDiv.appendChild(InputDiv1);
Input = this.createElement("input","IATS_Payment_ACHAgreementCheckbox","");
Input.setAttribute("type","checkbox");
Input.setAttribute("id","IATS_Payment_ACHAgreementCheckbox");
Input.onclick = this.UKDirectDebit;
InputDiv1.appendChild(Input);
var _text;
if(this.version == "UK" && this.currency == "3")
{
_text = "Click here to proceed with direct debit application";
}
else if(this.version == "UK" && this.currency == "2")
{
_text = "By signing this mandate form, you authorize (A) iATS Payments to send instructions to your bank to debit your account and (B) your bank to debit your account "
+ "in accordance with the instructions from iATS Payments. As part of your rights, you are entitled to a refund from your bank under the terms and conditions of "
+ "your agreement with your bank. A refund must be claimed within 8 weeks starting from the date on which your account was debited. Note: Your rights regarding "
+ "this mandate are explained in a statement that you can obtain from your bank.";
}
else
{
_text = "By clicking the provided checkbox, I authorize electronic debits from my bank account in the amount displayed above. ";
_text = _text + "This authorization is to remain in full force and effect unless I provide written notification within an appropriate time frame. ";
}
Inputlabel = this.createElement("label","", _text);
InputDiv1.appendChild(Inputlabel);
classvalue=this.BasicLayoutClassName;
classvalue = classvalue+" IATS_PaymentItemErrorMessage";
var ErrorMsg = this.createElement("span","","Please check the box to agree to the terms in order to continue your payment.");
ErrorMsg.className = classvalue;
ErrorMsg.setAttribute("id", "IATS_Payment_ACHAgreementCheckboxErrorMessage");
InputDiv1.appendChild(ErrorMsg);
if(this.version!="UK")
{
// NACH
InputDiv1 = this.createNACHPolicyDiv();
InputDiv.appendChild(InputDiv1);
InputDiv1 = this.createNACHRecourseDiv();
InputDiv.appendChild(InputDiv1);
//Cancellation Policy
InputDiv1 = this.createElement("div","IATS_NACHPolicyMoreInfoDiv","");
InputDiv1.setAttribute("id","IATS_NACHPolicyMoreInfoDiv");
InputDiv1.className="IATS_LearMoreDiv";
InputDiv1.style.display="none";
document.body.appendChild(InputDiv1);
var text="Cancellation Policy:
";
text=text+"Your Payor's PAD agreement may be cancelled provided notice is received 30 days before the next scheduled PAD. ";
text=text+"If any of the above details are incorrect, please contact us immediately. ";
text=text+"If the details are correct, you do not need to do anything further and your Pre-Authorized Debits will be processed and start on the Payment Start Date indicated.";
text=text+"
close";
var securitystatement = this.createElement("p","IATS_Payment_NACHPolicy",text);
InputDiv1.appendChild(securitystatement);
//Recourse Statement
InputDiv1 = this.createElement("div","IATS_NACHStatementDiv","");
InputDiv1.setAttribute("id","IATS_NACHStatementDiv");
InputDiv1.className="IATS_LearMoreDiv";
InputDiv1.style.display="none";
document.body.appendChild(InputDiv1);
var text="Recourse Statement:
";
text=text+"You have certain recourse rights if any debit does not comply with these terms. ";
text=text+"For example, you have the right to receive a reimbursement for any PAD that is not authorized or is not consistent with this PAD agreement. ";
if(this.USCheckVisible=="CHECKED")
text=text+"To obtain more information on your recourse rights, contact your financial institution or visit www.nacha.org. ";
else if(this.CANCheckVisible=="CHECKED")
text=text+"To obtain more information on your recourse rights, contact your financial institution or visit www.cdnpay.ca. ";
else
text=text+"To obtain more information on your recourse rights, contact your financial institution. ";
text=text+"
close";
var securitystatement = this.createElement("p","IATS_Payment_NACHStatement",text);
InputDiv1.appendChild(securitystatement);
}
var TransID = this.createElement("input","IATS_Payment_TransID","");
TransID.setAttribute("id","IATS_Payment_TransID");
TransID.setAttribute("type","hidden");
InputDiv.appendChild(TransID);
var iatsSessionId = this.createElement("input","IATS_Payment_SessionId","");
iatsSessionId.setAttribute("id","IATS_Payment_SessionId");
iatsSessionId.setAttribute("type","hidden");
iatsSessionId.setAttribute("value",'638672886182294857-e1736141-4e4f-4519-8f7b-99874afe14aa');
InputDiv.appendChild(iatsSessionId);
var agencyCodeHash = this.createElement("input","IATS_Payment_AgencyCodeHash","");
agencyCodeHash.setAttribute("id","IATS_Payment_AgencyCodeHash");
agencyCodeHash.setAttribute("type","hidden");
agencyCodeHash.setAttribute("value",this.AgencyCodeHash);
agencyCodeHash.value=this.AgencyCodeHash;
InputDiv.appendChild(agencyCodeHash);
var AuthResult = this.createElement("input","IATS_Payment_Result","");
AuthResult.setAttribute("id","IATS_Payment_Result");
AuthResult.setAttribute("type","hidden");
InputDiv.appendChild(AuthResult);
var AuthResultDetail = this.createElement("input","IATS_Payment_ResultDetail","");
AuthResultDetail.setAttribute("id","IATS_Payment_ResultDetail");
AuthResultDetail.setAttribute("type","hidden");
InputDiv.appendChild(AuthResultDetail);
return div;
}
function IATSCreatePaymentBoxErrorMsgDiv()
{
var div;
div = this.createElement("div","","");
div.className = "IATS_ErrorMsgDiv";
div.setAttribute("id", "IATS_ErrorMsgSectionDiv");
// test msg
var ErrorMessage = this.createElement("span","","ErrorMsgDiv Description");
ErrorMessage.className = "IATS_ErrorMessage";
ErrorMessage.setAttribute("id", "IATS_ErrorMessageSpan");
div.appendChild(ErrorMessage);
return div;
}
function IATSCreatePaymentBoxFooterDiv()
{
var div;
div = this.createElement("div","","");
div.className = "IATS_FooterDiv";
return div;
}
function limitText() // Limits 'comment' text field on some older browsers that don't support HTML 'maxlength' attribute.
{
var limitField = document.getElementById("IATS_PaymentItemInput_Comment");
limitNum=250;
if(limitField!=null)
{
if (limitField.value.length > limitNum)
{
limitField.value = limitField.value.substring(0, limitNum);
}
}
}
//shopping cart
function IATSEmptySelectList(select)
{
var len = select.options.length;
for(var i =0;i -1)
value = field.options[field.selectedIndex].value;
else
value = "";
}
}
parameters = parameters + "&" + name + "=" + encodeURIComponent(value);
}
}
// Encode all Item 1-15 values. Their labels will be extracted from a SQL query ran when the C++ server processes the request.
for (i=0;i 1) {
if (listItem[j].parentElement.getElementsByTagName("input")[1].type == "hidden" && listItem[j].parentElement.getElementsByTagName("input")[1].name.indexOf("IATS_Payment_SelectItemsValue_") >= 0)
hasSubItemValues = true;
}
if (listItem[j].checked)
{
if (itemCount == 0){
parameters += "&" + name + "=";
subItemValuesString += "&" + name + "_Value" + "=";
}
if (itemCount > 0) {
parameters += encodeURIComponent(", "); // Separate multiple items.
subItemValuesString += encodeURIComponent(", ");
}
parameters += encodeURIComponent(listItem[j].value);
if (hasSubItemValues) {
subItemValuesString += encodeURIComponent(listItem[j].parentElement.getElementsByTagName("input")[1].defaultValue);
}
hasSubItemValues = false;
itemCount++;
}
}
parameters = parameters + subItemValuesString;
//console.log(parameters);
}
}
}
}
parameters = parameters + "&AgentCode=" + theIATSPaymentBoxCore.AgentCode;
parameters = parameters + "&IATS_Payment_SessionId=638672886182294857-e1736141-4e4f-4519-8f7b-99874afe14aa"
if (theIATSPaymentBoxCore.validatePaymentInput()==false) return;
if(document.getElementById("IATS_Payment_CreditCardPayment")!=null && document.getElementById("IATS_Payment_CreditCardPayment").checked)
{
CardNumber = document.getElementById("IATS_Payment_AccountNumber").value.replace(/\s+/g, '');
CVV2 = document.getElementById("IATS_Payment_CVV2")==null?"":document.getElementById("IATS_Payment_CVV2").value;
var obj = document.getElementById("IATS_Payment_ExpiryMonth");
CCExp = obj.options[obj.selectedIndex].value;
obj = document.getElementById("IATS_Payment_ExpiryYear");
CCExp = CCExp+ "/" + obj.options[obj.selectedIndex].value.substring(2,4);
if (CCExp.length<=4)
CCExp = "0"+CCExp;
var CVV2 = document.getElementById("IATS_Payment_CVV2")==null?"":document.getElementById("IATS_Payment_CVV2").value;
MOP="";
if (CardNumber.substring(0,1)=="4") MOP = 'VISA';
else if (CardNumber.substring(0,1)=="5") MOP = 'MC';
// New BINs for MC
else if (CardNumber.length == 16 && CardNumber.substring(0,1)=="2")
{
var binNum = parseInt(CardNumber.substring(0, 6));
if (binNum >= 222100 && binNum <= 272099)
MOP = 'MC';
}
else if (CardNumber.substring(0,2)=="37" || CardNumber.substring(0,2)=="34") MOP = 'AMX';
else if (CardNumber.substring(0,2)=="30" || CardNumber.substring(0,2)=="36" || CardNumber.substring(0,2)=="38" )
MOP = 'DC';
else if (CardNumber.substring(0,4)=="6011" || CardNumber.substring(0,2)=="65" || CardNumber.substring(0,2)=="81" || CardNumber.substring(0,2)=="36")
MOP = 'DSC';
for(var _j=0;_j 4)
{
CardNumberLast4 = CardNumber.substring(CardNumber.length-4);
document.getElementById("IATS_Payment_AccountNumber4").value = CardNumberLast4;
}
parameters = parameters + "&IATS_Payment_AccountNumber4=" + CardNumberLast4;
}
else if(document.getElementById("IATS_Payment_DebitCardPayment")!=null && document.getElementById("IATS_Payment_DebitCardPayment").checked)
{
if(document.getElementById("IATS_Payment_USDebitAccount1")!=null)
accountnumber = accountnumber + document.getElementById("IATS_Payment_USDebitAccount1").value;
if(document.getElementById("IATS_Payment_USDebitAccount2")!=null)
accountnumber = accountnumber + document.getElementById("IATS_Payment_USDebitAccount2").value;
if(document.getElementById("IATS_Payment_CANDebitAccount1")!=null)
accountnumber = accountnumber + document.getElementById("IATS_Payment_CANDebitAccount2").value;
if(document.getElementById("IATS_Payment_CANDebitAccount2")!=null)
accountnumber = accountnumber + document.getElementById("IATS_Payment_CANDebitAccount1").value;
if(document.getElementById("IATS_Payment_CANDebitAccount3")!=null)
accountnumber = accountnumber + document.getElementById("IATS_Payment_CANDebitAccount3").value;
if(document.getElementById("IATS_Payment_UKDebitAccount2")!=null)
accountnumber = accountnumber + document.getElementById("IATS_Payment_UKDebitAccount2").value;
if(document.getElementById("IATS_Payment_UKDebitAccount3")!=null)
accountnumber = accountnumber + document.getElementById("IATS_Payment_UKDebitAccount3").value;
if(document.getElementById("IATS_Payment_UKDebitAccount4")!=null)
parameters = parameters + "&SEPABankId=" + document.getElementById("IATS_Payment_UKDebitAccount4").value;
if(document.getElementById("IATS_Payment_DebitAccountType")!=null)
AccountType = document.getElementById("IATS_Payment_DebitAccountType").value;
else
AccountType = "CHECKING";
parameters = parameters + "&MOP=ACHEFT";
parameters = parameters + "&AccountNumber=" + accountnumber;
parameters = parameters + "&AccountType=" + AccountType;
CardNumberLast4="";
if (accountnumber && accountnumber.length > 4)
{
CardNumberLast4 = accountnumber.substring(accountnumber.length-4);
document.getElementById("IATS_Payment_AccountNumber4").value = CardNumberLast4;
}
parameters = parameters + "&IATS_Payment_AccountNumber4=" + CardNumberLast4;
if(document.getElementById("IATS_Payment_ACHAgreementCheckbox")!=null && document.getElementById("IATS_Payment_ACHAgreementCheckbox").checked)
parameters = parameters + "&ACHAgreementCheck=1";
else parameters + "&ACHAgreementCheck=0";
}
var Total = "0";
//new shopping cart
if(theIATSPaymentBoxCore.EnableShoppingCart=="1")
{
parameters = parameters + "&EnableShoppingCart=true";
var items = document.getElementById("IATS_Payments_ShoppingCart").querySelectorAll(".IATS_ShoppingCartItemUL");
for(var i = 0; i < items.length; i++)
{
var item = items[i];
var item_sku = item.getAttribute("shoppingcartitem_sku");
var item_price = item.getAttribute("shoppingcartitem_price");
var item_qty = item.querySelectorAll(".IATS_QtyInputShort")[0].value;
var item_name = item.querySelectorAll(".IATS_ShoppingCartItemName")[0].innerHTML;
var item_option1 = item.querySelectorAll(".IATS_ShoppingCartItemOption1Name")[0].innerHTML;
var item_option2 = item.querySelectorAll(".IATS_ShoppingCartItemOption2Name")[0].innerHTML;
parameters = parameters + "&Amt" + i + "SKU=" + item_sku;
parameters = parameters + "&Amt" + i + "Value=" + item_price;
parameters = parameters + "&Amt" + i + "Quantity=" + item_qty;
parameters = parameters + "&Amt" + i + "Name=" + encodeURIComponent(item_name);
parameters = parameters + "&Amt" + i + "Option1=" + encodeURIComponent(item_option1);
parameters = parameters + "&Amt" + i + "Option2=" + encodeURIComponent(item_option2);
}
if (document.getElementById("IATS_ProcessingFeeCheck") && document.getElementById("IATS_ProcessingFeeCheck").checked){
var finalTotal = parseFloat(theIATSPaymentBoxCore.ShoppingCartTotal) + parseFloat(document.getElementById("IATS_ProcessingFeeCheck").value);
parameters = parameters + "&Total=" + finalTotal;
} else {
parameters = parameters + "&Total=" + theIATSPaymentBoxCore.ShoppingCartTotal;
}
}
else
{
if(theIATSPaymentBoxCore.HideAmountInfo==0)
{
if (document.getElementsByName("IATS_NewAmountListItem")!=null)
{
if (typeof(document.getElementsByName("IATS_NewAmountListItem").length)!=="undefined") // If it is null, I don't think the 'else' condition of will work.
{
var otherCount = 0; // Count number of 'Other' items in form
var listItem = document.getElementsByName("IATS_NewAmountListItem"); // Grabs regular and 'Other' items
for (var i=0; i 4)
{
CardNumberLast4 = CardNumber.substring(CardNumber.length-4);
}
parameters = parameters + "&IATS_Payment_AccountNumber4=" + CardNumberLast4;
}
else if(document.getElementById("IATS_Payment_DebitCardPayment")!=null && document.getElementById("IATS_Payment_DebitCardPayment").checked)
{
parameters = parameters + "&MOP1=ACHEFT";
parameters = parameters + "&AccountNumber1=" + accountnumber;
parameters = parameters + "&AccountType1=" + AccountType;
CardNumberLast4="";
if (accountnumber && accountnumber.length > 4)
{
CardNumberLast4 = accountnumber.substring(accountnumber.length-4);
}
}
if(theIATSPaymentBoxCore.EnableShoppingCart=="1") {
parameters = parameters + "&Amount1=" + document.getElementById("IATS_TotalAmount").innerHTML;
}
else {
parameters = parameters + "&Amount1=" + document.getElementById("IATS_AmountListItem").value;
}
for (i=0;i0 && errorcode<50 && errorcode!="TIMEOUT")
{
switch(errorcode) {
case 1:
AuthMessage="Process permission denied";
break;
case 4:
AuthMessage="Incorrect expiration date.";
break;
case 5:
AuthMessage="Invalid transaction information. Verify and re-enter information.";
break;
case 12:
AuthMessage="Incorrect CVV2 or Expiry date";
break;
case 15:
AuthMessage="General Decline";
break;
case 16:
AuthMessage="General Decline";
break;
case 19:
AuthMessage="Incorrect CVV2";
break;
case 40:
AuthMessage="Invalid Card/Account Number.";
break;
case 41:
AuthMessage="Invalid Expiry Date.";
break;
case 43:
AuthMessage="Incorrect Card holder's Address";
break;
default:
AuthMessage="General Decline";
}
}
}
else if (TransactionStatus == 9)
{
//for UK customer code result only.
errorcode = errorcode;
}
//console.log('What is the TransactionStatus at this point? ' + TransactionStatus);
if (TransactionStatus!=1 && TransactionStatus!=2 && TransactionStatus!=9)
{
TransactionStatus = 2;
AuthMessage = "System Error";
}
//console.log("TransactionStatus: " + TransactionStatus);
//console.log("AuthMessage: " + AuthMessage);
//console.log("Amount: " + Amount);
//console.log("TransID: " + TransID);
//console.log("errorcode: " + errorcode);
theIATSPaymentBoxCore.showAndUpdateResponse(TransactionStatus, AuthMessage,Amount, TransID,errorcode);
}
}
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
xhr.send(parameters);
}
// Updated to support latest browswer
function IATSDetectBrowser(){
var ua= navigator.userAgent, tem;
var M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
if(/trident/i.test(M[1])){
tem= /\brv[ :]+(\d+)/g.exec(ua) || [];
return 'MSIE '+(tem[1] || '');
}
if(M[1]=== 'Chrome'){
tem= ua.match(/\b(OPR|Edge)\/(\d+)/);
if(tem!= null) return tem.slice(1).join(' ').replace('OPR', 'Opera');
}
M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
if((tem= ua.match(/version\/(\d+)/i))!= null) M.splice(1, 1, tem[1]);
return M.join(' ');
}
function IATSCCNumfieldCheck(field,nextFieldID,e)
{
e = e || window.event;
var code = e.keyCode || e.which;
if (code<48 || code>57)
return false;
var findBrowser='"'+IATSDetectBrowser()+'"';
if(findBrowser.indexOf("MSIE")!=-1||findBrowser.indexOf("Netscape")!=-1||findBrowser.indexOf("Opera")!=-1||findBrowser.indexOf("Edge")!=-1)
{
if(field.value.length >= field.maxLength){
if(nextFieldID != null)
document.getElementById(nextFieldID).focus();
}
}
else
{
if(field.value.length >= field.maxLength-1){
if(nextFieldID != null)
document.getElementById(nextFieldID).focus();
}
}
return true;
}
function formatCCNumberField(elementId)
{
var currentVal = document.getElementById(elementId).value;
currentVal = currentVal.replace(/\D/g,'');
var isAMX = false;
if(currentVal.length>4 && currentVal.charAt(0) == 3 && (currentVal.charAt(1)==4 || currentVal.charAt(1)==7) ){
isAMX = true;
}
if(currentVal.length>4){
currentVal = currentVal.substring(0,4)+' '+currentVal.substring(4, currentVal.length);
}
if(isAMX){
if(currentVal.length>11){
currentVal = currentVal.substring(0,11)+' '+currentVal.substring(11, currentVal.length);
}
if(currentVal.length>17){
currentVal = currentVal.substring(0,17);
}
}else{
if(currentVal.length>9){
currentVal = currentVal.substring(0,9)+' '+currentVal.substring(9, currentVal.length);
}
if(currentVal.length>14){
currentVal = currentVal.substring(0,14)+' '+currentVal.substring(14, currentVal.length);
}
if(currentVal.length>19){
currentVal = currentVal.substring(0,19);
}
}
document.getElementById(elementId).value = currentVal;
return true;
}
function IATSCCNumfieldCheckIPad(e, elementId)
{
e = e || window.event;
var code = e.keyCode || e.which;
var currentVal = document.getElementById(elementId).value;
if(code>=96 && code<=105){
code = code - 48;
}
//number range: 48 - 57, 96 - 105
if (code>=48 && code<=57){
if(currentVal.length==3 || currentVal.length==8 || currentVal.length==13){
document.getElementById(elementId).value = currentVal + String.fromCharCode(code) + ' ';
e.preventDefault();
}else if(currentVal.length==4 || currentVal.length==9 || currentVal.length==14){
document.getElementById(elementId).value = currentVal + ' ' + String.fromCharCode(code);
e.preventDefault();
}
}else{
if(code==8){
if(currentVal.length==5 || currentVal.length==6 || currentVal.length==10 || currentVal.length==11 || currentVal.length==15 || currentVal.length==16 ){
document.getElementById(elementId).value = currentVal.substr(0, currentVal.length-1);
}
}else if(code==37||code==39){
}else{
e.preventDefault();
}
}
}
function IATSAmountQtyCheck(e)
{
e = e|| window.event;
var code = e.keyCode || e.which;
if(code!=8 && (code<48 || code>57))
{
e.returnValue = false;
if(e.preventDefault) e.preventDefault();
}
}
function IATSGetProcessingFeeTotal(isEnabled, total, processingFeePercent) {
var newTotal = total;
if (isEnabled == "1") {
if (document.getElementById("IATS_ProcessingFeeCheck")){
if (document.getElementById("IATS_ProcessingFeeCheck").checked){
var fee = parseFloat((processingFeePercent / 100) * total).toFixed(2);
document.getElementById("IATS_ProcessingFeeCheck").value = fee;
document.getElementById("IATS_ProcessingFee_OrigAmount").value = total;
document.getElementById("IATS_ProcessingFee_Percent").value = processingFeePercent;
newTotal = parseFloat(total) + parseFloat(fee);
} else {
document.getElementById("IATS_ProcessingFeeCheck").value = 0.00;
}
}
}
return newTotal;
}
function IATSGetTotal()
{
var total = 0;
var enabledQty = "0";
var NoDecimal = "";
if (!this.clientCustomFields) {
this.clientCustomFields = "0000000000";
}
if (document.getElementsByName("IATS_NewAmountListItem")!=null)
{
// Note: All predefined payment items and 'Other' items are named 'IATS_NewAmountListItem', so this will grab all of them.
if (typeof(document.getElementsByName("IATS_NewAmountListItem").length)!=="undefined" || document.getElementById("IATS_Amount_Order_0")!=null)
{
if (typeof(document.getElementsByName("IATS_NewAmountListItem").length)!=="undefined")
{
var otherCount = 0; // Count number of 'Other' items in form
var listItem = document.getElementsByName("IATS_NewAmountListItem"); // Grabs regular and 'Other' items
for (var i=0; i < listItem.length; i++)
{
if (listItem[i].checked)
{
if (listItem[i].value != "OtherAmount")
{
if(enabledQty == "1")
total = total + listItem[i].value * document.getElementById("IATS_Payment_Qty"+i).value;
else total = total + listItem[i].value *1;
}
else
{
if(!isNaN(parseFloat(document.getElementById("IATS_AmountListItem_NewOtherAmount" + otherCount).value)))
total = parseFloat(total) + parseFloat(document.getElementById("IATS_AmountListItem_NewOtherAmount" + otherCount).value);
}
}
// If the item is not checked but it is an 'Other' item, the counter must still be incremented.
if (listItem[i].value == "OtherAmount")
otherCount++;
}
}
else // I don't think this code can get hit.
{
if(document.getElementById("IATS_Amount_Order_0").checked)
{
if(enabledQty == "1")
total = total + document.getElementById("IATS_Amount_Order_0").value * document.getElementById("IATS_Payment_Qty0").value;
else total = total + document.getElementById("IATS_Amount_Order_0").value *1;
}
}
}
// I don't think this is ever hit.
else
{
var radio = document.getElementById("IATS_Amount_Other0");
if (radio!=null)
{
if (radio.checked)
{
if(!isNaN(parseFloat(document.getElementById("IATS_AmountListItem_NewOtherAmount0").value)))
total = parseFloat(document.getElementById("IATS_AmountListItem_NewOtherAmount0").value);
}
}
radio = document.getElementById("IATS_Amount_Order_0");
if (radio!=null)
{
if (radio.checked)
{
total =document.getElementById("IATS_Amount_Order_0").value;
}
}
}
}
// Get the processing fee
total = IATSGetProcessingFeeTotal(this.processingFee_Enabled == "1", total, this.processingFee_Percent);
total = Math.round(total*100)/100;
total = total.toFixed(2);
var totalString = total;
if(NoDecimal=="Checked" && totalString.endsWith(".00")){
totalString = totalString.substring(0, totalString.length-3);
}
if(document.getElementById("IATS_Payment_TotalAmount")!=null)
{
if (typeof(document.getElementById("IATS_Payment_TotalAmount").innerText)==="undefined")
document.getElementById("IATS_Payment_TotalAmount").innerHTML = totalString;
else document.getElementById("IATS_Payment_TotalAmount").innerText = totalString;
// Update the value attribute of TotalAmount correctly
document.getElementById("IATS_Payment_TotalAmount").setAttribute("value", total);
document.getElementById("IATS_AmountListItem").value = total;
if(document.getElementById("IATS_Payment_RecurringTotalAmount")!=null)
{
if (typeof(document.getElementById("IATS_Payment_RecurringTotalAmount").innerText)==="undefined")
document.getElementById("IATS_Payment_RecurringTotalAmount").innerHTML = totalString;
else document.getElementById("IATS_Payment_RecurringTotalAmount").innerText = totalString;
}
document.getElementById("IATS_AmountListItem").value = total;
}
}
function IATSGetScript()
{
var script = null;
var scripts = document.getElementsByTagName('script');
var i;
for (i=0;i =0 || urlstr.indexOf('iatspaymentbox.aspx')>=0) // the name must be the same name of the started script.
{
script = scripts[i];
break;
}
}
}
return script;
}
function IATSCreatePaymentBoxResponseDiv()
{
var div;
div = this.createElement("div","IATS_ResponseSectionDiv","");
div.className = "IATS_ResponseDiv";
div.setAttribute("id", "IATS_ResponseSectionDiv");
var contentdiv = document.getElementById("IATS_ContentSectionDiv");
var ErrorDiv = document.getElementById("IATS_ErrorMsgSectionDiv");
if (div!=null)
{
contentdiv.insertBefore(div, ErrorDiv);
}
var ResponseDiv;
ResponseDiv = this.createElement("div","","");
ResponseDiv.className = "IATS_ResponseItemDiv";
div.appendChild(ResponseDiv);
var ResponseHeader = this.createElement("span","","");
ResponseHeader.className = "IATS_ResponseHeader";
ResponseHeader.setAttribute("id", "IATS_ResponseHeaderSpan");
ResponseDiv.appendChild(ResponseHeader);
ResponseDiv = this.createElement("div","","");
ResponseDiv.className = "IATS_ResponseItemDiv";
div.appendChild(ResponseDiv);
var ResponseStatus = this.createElement("span","","");
ResponseStatus.className = "IATS_ResponseStatus";
ResponseStatus.setAttribute("id", "IATS_ResponseStatusSpan");
ResponseDiv.appendChild(ResponseStatus);
ResponseDiv = this.createElement("div","","");
ResponseDiv.className = "IATS_ResponseItemDiv";
div.appendChild(ResponseDiv);
var ResponseStatus = this.createElement("span","","");
ResponseStatus.className = "IATS_ResponseStatus";
ResponseStatus.style.display = "none";
ResponseStatus.setAttribute("id", "IATS_ResponseAmountSpan");
ResponseDiv.appendChild(ResponseStatus);
ResponseDiv = this.createElement("div","","");
ResponseDiv.className = "IATS_ResponseItemDiv";
div.appendChild(ResponseDiv);
var ResponseFooter = this.createElement("span","","");
ResponseFooter.className = "IATS_ResponseFooter";
ResponseFooter.setAttribute("id", "IATS_ResponseFooterSpan");
ResponseDiv.appendChild(ResponseFooter);
ResponseDiv = this.createElement("div","","");
ResponseDiv.className = "IATS_ResponseItemDiv";
ResponseDiv.style.display="none";
div.appendChild(ResponseDiv);
var ResponsePostBack = this.createElement("span","","");
ResponsePostBack.setAttribute("id","IATS_ResponsePostBack");
ResponsePostBack.innerHTML = "";
ResponseDiv.appendChild(ResponsePostBack);
return div;
}
function eventPostBack1()
{
var xmlhtpp = new XMLHttpRequest();
xmlhttp.open('POST', 'processPostBack.aspx',true);
alert("test");
//Callback function
xmlhttp.onreadystatechange = function(){
if(xmlhttp.readyState==4)
{
if(xmlhttp.status == 200)
alert("11");
else alert("22");
}
}
//send the post request
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlhttp.Send();
}
function IATSUKDirectDebitGetPayer(referenceNum, bankAddr1, bankAddr2,bankAddr3,bankAddr4,bankAddr5,bankAddr6, error, errorMesg)
{
if(error == "OK")
{
document.getElementById("IATS_Payment_DirectDebitReferenceNum").innerHTML = referenceNum;
document.getElementById("IATS_Payment_DirectDebitPage3SummaryReferenceNum").innerHTML = referenceNum;
document.getElementById("IATS_Payment_DirectDebitPage4ReferenceNum").innerHTML = referenceNum;
document.getElementById("IATS_Payment_DirectDebitBankAddress1").innerHTML = bankAddr1;
document.getElementById("IATS_Payment_DirectDebitBankAddress2").innerHTML = bankAddr2;
document.getElementById("IATS_Payment_DirectDebitBankAddress3").innerHTML = bankAddr3;
document.getElementById("IATS_Payment_DirectDebitBankAddress4").innerHTML = bankAddr4;
document.getElementById("IATS_Payment_DirectDebitBankAddress5").innerHTML = bankAddr5;
document.getElementById("IATS_Payment_DirectDebitBankAddress6").innerHTML = bankAddr6;
document.getElementById("UKDirectDebitPage2ErrorMessage").style.display="none";
document.getElementById("IATS_Payment_DirectDebitPage2Div").style.display="none";
document.getElementById("IATS_Payment_DirectDebitPage3Div").style.display="block";
}
else
{
document.getElementById("IATS_Payment_DirectDebitPage2Div").style.display="block";
document.getElementById("IATS_Payment_DirectDebitPage3Div").style.display="none";
document.getElementById("UKDirectDebitPage2ErrorMessage").style.display="block";
if( errorMesg == "")
{
errorMesg = "The account details or payer details you entered are incorrect. ";
}
document.getElementById("UKDirectDebitPage2ErrorMessage").innerHTML = errorMesg;
}
}
function IATSShowAndUpdateResponse(authStatus, authCode, Amount, TransID,errorcode)
{
var _result;
var theDiv = document.getElementById("IATS_PaymentSectionDiv");
if (theDiv!=null)
{
theDiv.style.display = "none";
}
theDiv = document.getElementById("IATS_AmountSectionDiv");
if (theDiv!=null)
{
theDiv.style.display = "none";
}
theDiv = document.getElementById("IATS_Payment_ReoccurringDiv");
if(theDiv!=null)
{
theDiv.style.display = "none";
}
theDiv = document.getElementById("IATS_Payment_SendEmailDiv");
if(theDiv!=null)
{
theDiv.style.display = "none";
}
theDiv = document.getElementById("IATS_ResponseSectionDiv");
if (theDiv!=null)
{
theDiv.style.display = "block";
}
else
{
theIATSPaymentBoxCore.createPaymentBoxResponseDiv();
}
var PaymentBoxDiv = document.getElementById("IATS_PaymentBoxDiv");
if (PaymentBoxDiv!=null)
{
if (this.EventPaymentWidth > 100) {
PaymentBoxDiv.style.width = this.EventPaymentWidth;
}
}
var theSpan = document.getElementById("IATS_ResponseHeaderSpan");
if(theSpan!=null)
{
if(document.getElementById("IATSNewDeclineHeaderDiv")!=null)
{
theSpan.removeChild(document.getElementById("IATSNewDeclineHeaderDiv"));
}
}
theSpan = document.getElementById("IATS_ResponseFooterSpan");
if(theSpan!=null)
{
if(document.getElementById("IATSNewDeclineFooterDiv")!=null)
{
theSpan.removeChild(document.getElementById("IATSNewDeclineFooterDiv"));
}
}
theSpan = document.getElementById("IATS_ResponseStatusSpan");
if(theSpan!=null)
{
if(document.getElementById("IATSNewDeclineCodeiv")!=null)
{
theSpan.removeChild(document.getElementById("IATSNewDeclineCodeiv"));
}
}
var isRecurring = document.getElementById("IATS_Payment_RecurringPayment").checked;
//console.log("isRecurring = " + isRecurring + ", authStatus = " + authStatus);
if (authStatus==1) //approve
{
IATS_RaiseTransactionSuccessEvent(TransID, Amount, errorcode);
_result = "OK";
theSpan = document.getElementById("IATS_ResponseHeaderSpan");
if (typeof(theSpan.innerHTML)==="undefined")
{
theSpan.innerHTML = this.ApprovalResponseHeader;
theSpan = document.getElementById("IATS_ResponseFooterSpan");
theSpan.innerHTML = this.ApprovalResponseFooter;
theSpan = document.getElementById("IATS_ResponseStatusSpan");
theSpan.innerHTML = this.ApprovalResponseCodeDesc+" "+authCode;
theSpan = document.getElementById("IATS_ResponseAmountSpan");
theSpan.innerHTML = this.ApprovalResponseAmountDesc+Amount;
theSpan.style.display="block";
}
else
{
//Create a block level element to cover innerhtml issue in IE7 and IE8.
var newApprovalHeaderDiv = this.createElement("div","","");
newApprovalHeaderDiv.innerHTML = this.ApprovalResponseHeader;
theSpan.appendChild(newApprovalHeaderDiv);
theSpan = document.getElementById("IATS_ResponseFooterSpan");
var newApprovalFooterDiv = this.createElement("div","","");
newApprovalFooterDiv.innerHTML = this.ApprovalResponseFooter;
theSpan.appendChild(newApprovalFooterDiv);
theSpan = document.getElementById("IATS_ResponseStatusSpan");
var newApprovalCodeDiv = this.createElement("div","","");
newApprovalCodeDiv.innerHTML = this.ApprovalResponseCodeDesc+" "+authCode;
theSpan.appendChild(newApprovalCodeDiv);
theSpan = document.getElementById("IATS_ResponseAmountSpan");
var newApprovalAmountDiv = this.createElement("div","","");
newApprovalAmountDiv.innerHTML = this.ApprovalResponseAmountDesc+Amount;
theSpan.appendChild(newApprovalAmountDiv);
theSpan.style.display="block";
}
}
else
{
if (authStatus==2) //decline
{
if(isRecurring){
IATS_RaiseTransactionRecurringFailureEvent(TransID, Amount, errorcode);
}else{
IATS_RaiseTransactionFailureEvent(TransID, Amount, errorcode);
}
_result = "REJECT"+errorcode;
theSpan = document.getElementById("IATS_ResponseHeaderSpan");
authCode = getRejectMessage(errorcode);
if (typeof(theSpan.innerHTML)==="undefined")
{
theSpan.innerHTML = this.DeclineResponseHeader;
theSpan = document.getElementById("IATS_ResponseFooterSpan");
theSpan.innerHTML = this.DeclineResponseFooter;
theSpan = document.getElementById("IATS_ResponseStatusSpan");
theSpan.innerHTML = this.DeclineResponseCodeDesc+" "+authCode;
theSpan = document.getElementById("IATS_ResponseAmountSpan");
theSpan.style.display="none";
}
else
{
if(document.getElementById("IATSNewDeclineHeaderDiv")!=null)
{
theSpan.removeChild(document.getElementById("IATSNewDeclineHeaderDiv"));
}
var newDeclineHeaderDiv = this.createElement("div","","");
newDeclineHeaderDiv.setAttribute("id", "IATSNewDeclineHeaderDiv");
newDeclineHeaderDiv.innerHTML = this.DeclineResponseHeader;
theSpan.appendChild(newDeclineHeaderDiv);
theSpan = document.getElementById("IATS_ResponseFooterSpan");
if(document.getElementById("IATSNewDeclineFooterDiv")!=null)
{
theSpan.removeChild(document.getElementById("IATSNewDeclineFooterDiv"));
}
var newDeclineFooterDiv = this.createElement("div","","");
newDeclineFooterDiv.setAttribute("id", "IATSNewDeclineFooterDiv");
newDeclineFooterDiv.innerHTML = this.DeclineResponseFooter;
theSpan.appendChild(newDeclineFooterDiv);
theSpan = document.getElementById("IATS_ResponseStatusSpan");
if(document.getElementById("IATSNewDeclineCodeiv")!=null)
{
theSpan.removeChild(document.getElementById("IATSNewDeclineCodeiv"));
}
var newDeclineCodeiv = this.createElement("div","","");
newDeclineCodeiv.setAttribute("id", "IATSNewDeclineCodeiv");
if (errorcode === 20 || errorcode === 21)
newDeclineCodeiv.innerHTML = "3DS Authentication Failure";
else
newDeclineCodeiv.innerHTML = this.DeclineResponseCodeDesc+" "+authCode;
theSpan.appendChild(newDeclineCodeiv);
theSpan = document.getElementById("IATS_ResponseAmountSpan");
theSpan.style.display="none";
}
}
else if(authStatus==9)
{
IATS_RaiseTransactionRecurringSuccessEvent(TransID, Amount, errorcode);
_result = "RECURRING";
theSpan = document.getElementById("IATS_ResponseHeaderSpan");
var UKDirectDebitError = document.getElementById("IATS_Payment_DirectDebitPage5Error");
if (typeof(theSpan.innerHTML)==="undefined")
{
theSpan.innerHTML = this.ReoccurringResponseHeader;
theSpan = document.getElementById("IATS_ResponseFooterSpan");
theSpan.innerHTML = this.ReoccurringResponseFooter;
theSpan = document.getElementById("IATS_ResponseStatusSpan");
theSpan.innerHTML = this.ReoccurringResponseCodeDesc+" "+authCode;
theSpan = document.getElementById("IATS_ResponseAmountSpan");
theSpan.style.display="none";
//Display UK direct debit create customer code error
if(UKDirectDebitError!=null && errorcode!="OK")
{
UKDirectDebitError.innerHTML = errorcode;
}
}
else
{
var newReccurringHeaderDiv = this.createElement("div","","");
newReccurringHeaderDiv.innerHTML = this.ReoccurringResponseHeader;
theSpan.appendChild(newReccurringHeaderDiv);
theSpan = document.getElementById("IATS_ResponseFooterSpan");
var newRecurringFooterDiv = this.createElement("div","","");
newRecurringFooterDiv.innerHTML = this.ReoccurringResponseFooter;
theSpan.appendChild(newRecurringFooterDiv);
theSpan = document.getElementById("IATS_ResponseStatusSpan");
var newRecurringCodeDiv = this.createElement("div","","");
newRecurringCodeDiv.innerHTML = this.ReoccurringResponseCodeDesc+" "+authCode;
theSpan.appendChild(newRecurringCodeDiv);
theSpan = document.getElementById("IATS_ResponseAmountSpan");
theSpan.style.display="none";
//Display UK direct debit create customer code error
if(UKDirectDebitError!=null && errorcode!="OK")
{
UKDirectDebitError.innerHTML = errorcode;
}
}
}
}
// add post back
if(document.getElementById("IATS_Payment_TransID")!=null)
document.getElementById("IATS_Payment_TransID").value = TransID;
if(document.getElementById("IATS_Payment_ResultDetail")!=null)
document.getElementById("IATS_Payment_ResultDetail").value = authCode;
if(document.getElementById("IATS_Payment_Result")!=null)
document.getElementById("IATS_Payment_Result").value = _result;
var captchaDiv = document.getElementById("IATS_CAPTCHADiv");
if (captchaDiv!=null)
{
captchaDiv.style.display="none";
}
var theButton = document.getElementById("IATS_ProcessAction_Button");
if (theButton!=null)
{
theButton.style.display="none";
}
theButton = document.getElementById("IATS_BackAction_Button");
if (authStatus==2 && theButton!=null)
{
theButton.disabled = false;
theButton.style.display="block";
}
else
{
theButton.disabled = false;
theButton.style.display="none";
}
if (errorcode==9999)
{
div = document.getElementById("IATS_ErrorMsgSectionDiv");
if (div!=null) {
div.style.visibility = "visible";
}
span = document.getElementById("IATS_ErrorMessageSpan");
if (span!=null) {
span.innerHTML = "Incorrect captcha input, try again please.";
}
document.getElementById('IATS_BackAction_Button').click();
}
else
{
var hasItemRedirectLinks = false;
var allElements = document.getElementsByTagName('*');
for (var i = 0, n = allElements.length; i < n; i++)
{
if (allElements[i].getAttribute("data-redirectURL") !== null)
{
hasItemRedirectLinks = true;
break;
}
}
if(theIATSPaymentBoxCore.EventPostBackURL!="" || theIATSPaymentBoxCore.RedirectURL!="" || hasItemRedirectLinks)
{
theSpan = document.getElementById("IATS_ResponsePostBack");
//Erase ccnum,cvv2 and expiry date
if(document.getElementById("IATS_Payment_CreditCardPayment")!=null && document.getElementById("IATS_Payment_CreditCardPayment").checked)
{
document.getElementById("IATS_Payment_AccountNumber").value="";
document.getElementById("IATS_Payment_CVV2").value="";
}
if(document.getElementById("IATS_Payment_DebitCardPayment")!=null && document.getElementById("IATS_Payment_DebitCardPayment").checked)
{
if(theIATSPaymentBoxCore.USCheckVisible=="CHECKED")
{
document.getElementById("IATS_Payment_USDebitAccount1").value="";
document.getElementById("IATS_Payment_USDebitAccount2").value="";
}
if(theIATSPaymentBoxCore.CANCheckVisible=="CHECKED")
{
document.getElementById("IATS_Payment_CANDebitAccount1").value="";
document.getElementById("IATS_Payment_CANDebitAccount2").value="";
document.getElementById("IATS_Payment_CANDebitAccount3").value="";
}
if(theIATSPaymentBoxCore.UKCheckVisible=="CHECKED")
{
document.getElementById("IATS_Payment_UKDebitAccount2").value="";
document.getElementById("IATS_Payment_UKDebitAccount3").value="";
}
document.getElementById("IATS_Payment_DebitAccountType").value="";
}
location.href = '#IATS_PaymentBoxDiv';
if(theIATSPaymentBoxCore.RedirectURL!="")
{
if(authStatus==1 || authStatus==9)
theIATSPaymentBoxCore.iatsForm.target="";
else theIATSPaymentBoxCore.iatsForm.target="postbackresult";
}
if (theIATSPaymentBoxCore.redirectTime!=0)
{
var t = setTimeout("IATSRedirect()",theIATSPaymentBoxCore.redirectTime);
}
else // call direct
{
theDiv = document.getElementById("IATS_ResponseSectionDiv");
if (theDiv!=null)
{
theDiv.style.display = "none";
}
IATSRedirect();
}
}
else
{
location.href = '#IATS_PaymentBoxDiv';
}
}
}
function IATSRedirect()
{
var redirectURL = theIATSPaymentBoxCore.RedirectURL;
var redirectFound = false;
for (i=0;i -1){
country = element.options[element.selectedIndex].value;
}
redirectURL.replace('#IATS_PaymentItemInput_Country',country);
//state
var state = '';
if(document.getElementById("IATS_PaymentItemInput_State").style.display=="none"){
state = document.getElementById("IATS_PaymentItemInput_State2").value;
}else{
element = document.getElementById("IATS_PaymentItemInput_State");
if(element.selectedIndex > -1){
state = element.options[element.selectedIndex].value;
}
}
redirectURL.replace('#IATS_PaymentItemInput_State',state);
//zipcode
element = document.getElementById('IATS_PaymentItemInput_ZipCode');
var zipCode = element.value;
redirectURL.replace('#IATS_PaymentItemInput_ZipCode',zipCode);
//phone
element = document.getElementById('IATS_PaymentItemInput_Phone');
var phone = element.value;
redirectURL.replace('#IATS_PaymentItemInput_Phone',phone);
//mobile
var element = document.getElementById('IATS_PaymentItemInput_Phone2');
var mobile = element.value;
redirectURL.replace('#IATS_PaymentItemInput_Phone2',mobile);
//fax
element = document.getElementById('IATS_PaymentItemInput_Fax');
var fax = element.value;
redirectURL.replace('#IATS_PaymentItemInput_Fax',fax);
//email
element = document.getElementById('IATS_PaymentItemInput_EMail');
var email = element.value;
redirectURL.replace('#IATS_PaymentItemInput_EMail',email);
window.location = redirectURL;
return;
}
if(redirectURL!="")
{
theIATSPaymentBoxCore.iatsForm.method="POST";
theIATSPaymentBoxCore.iatsForm.action=redirectURL;
if(document.getElementById("IATS_FormScript")!=null)
document.getElementById("IATS_FormScript").value = ""
theIATSPaymentBoxCore.iatsForm.submit();
IATSLogging('IATSPaymentBoxCore - REDIRECT', encodeURI(redirectURL));
theIATSPaymentBoxCore.iatsForm.action="";
if(document.getElementById("IATS_FormScript")!=null)
document.getElementById("IATS_FormScript").value = this.Snippet;
}
}
function IATSLogging(header,message){
var xhr = new XMLHttpRequest();
var pth = "https://www.iatspayments.com/paymentBox/log.aspx?" + 'h=' + header + '&m=' + message;
xhr.open("POST", pth, true);
xhr.send();
}
function IATSStringTrim(stringToTrim) {
return stringToTrim.replace(/^\s+|\s+$/g,"");
}
// Grab all elements by a given name and filter by a given value. Return the resulting array.
function IATSGetElementsByNameFilterByValue(name,value)
{
var allElements = document.getElementsByName(name);
var results = [];
for(var i=0; i 0)
{
for (var i=0; i 0)
{
qtyMax = parseInt(amountQtyMaxList[i].innerHTML); // Try to get max amount.
}
if (!isNaN(qtyMax) && (amountQtyList[i].value > qtyMax) && amountCheckedList[i].checked == true) // Ignore unchecked amounts or ones where max is not an integer.
{
if(amountQtyMaxErrorList[i] != null)
amountQtyMaxErrorList[i].style.display = "block";
validationOK = false; // Fail the validation.
}
else
{
if(amountQtyMaxErrorList[i] != null)
amountQtyMaxErrorList[i].style.display = "none"; // Pass the validation.
}
}
}
// 'Other' amount check.
var otherCheckboxes = IATSGetElementsByNameFilterByValue("IATS_NewAmountListItem","OtherAmount"); // Get all checkbox elements belonging to an 'OtherAmount'.
var otherInputs = document.getElementsByName("IATS_AmountListItem_NewOtherAmount"); // Get all input elements belonging to an 'OtherAmount'.
for (var i=0; i -1)
value = field.options[field.selectedIndex].value;
else
value = "";
}
}
if (name == "ZipCode")
profileItemValid = IATScheckZipCode(); // Checks zipcode and sets appropriate errors without displaying them.
else if (name == "EMail")
profileItemValid = IATSvalidEmail(); // Checks email.
else if (name == "ReEnterEmail")
profileItemValid = IATSIsEmailMatch(); // False if both email fields exist and don't match. Otherwise true.
if (IATSIsSocialSecurityNumber(value))
profileItemValid = false;
// Conditions for failure:
// 1. Item is visible and fails validation (regardless of 'required' status)
// 2. Item is visible, required and fails min length validation.
if (theIATSPaymentBoxCore.PrifileItemList[i].Visible!=0 &&
((theIATSPaymentBoxCore.PrifileItemList[i].Required!=0 && theIATSPaymentBoxCore.stringTrim(value).length (document.getElementById('IATS_Payment_ExpiryYear').value))
{
InvalidExpiryDate = true;
}
if(today.getFullYear() == (document.getElementById('IATS_Payment_ExpiryYear').value))
{
if((today.getMonth()+1) > document.getElementById('IATS_Payment_ExpiryMonth').value)
{
InvalidExpiryDate = true;
}
}
if (InvalidExpiryDate==true)
{
div = document.getElementById("IATS_Payment_ExpiryDateDiv");
span = document.getElementById("IATS_Payment_ExpiryDateErrorMessage");
if (span!=null)
span.style.display = "block";
validationOK = false;
}
else
{
div = document.getElementById("IATS_Payment_ExpiryDateDiv");
if (div!=null)
div.style.background = "";
span = document.getElementById("IATS_Payment_ExpiryDateErrorMessage");
if (span!=null)
span.style.display = "none";
}
}
//For ACH
else if(document.getElementById("IATS_Payment_DebitCardPayment")!=null && document.getElementById("IATS_Payment_DebitCardPayment").checked)
{
// NACHA
if(document.getElementById("IATS_Payment_ACHAgreementCheckbox")!=null &&
document.getElementById("IATS_Payment_ACHAgreementCheckbox").checked == false &&
document.getElementById("IATS_Payment_RecurringPayment")!=null &&
document.getElementById("IATS_Payment_RecurringPayment").checked == true) // display checkbox only for reoccuring payment
{
if(document.getElementById("IATS_Payment_ACHAgreementCheckboxErrorMessage")!=null)
document.getElementById("IATS_Payment_ACHAgreementCheckboxErrorMessage").style.display = "block";
validationOK = false;
}
else
{
if(document.getElementById("IATS_Payment_ACHAgreementCheckboxErrorMessage")!=null)
document.getElementById("IATS_Payment_ACHAgreementCheckboxErrorMessage").style.display = "none";
}
// For US ACH
if(document.getElementById("IATS_Payment_USDebitAccount1")!=null &&
(document.getElementById("IATS_Payment_USDebitAccount1").value.length!=9))
{
if(document.getElementById("IATS_Payment_USDebitAccount1ErrorMessage")!=null)
document.getElementById("IATS_Payment_USDebitAccount1ErrorMessage").style.display = "block";
validationOK = false;
}
else
{
if(document.getElementById("IATS_Payment_USDebitAccount1ErrorMessage")!=null)
document.getElementById("IATS_Payment_USDebitAccount1ErrorMessage").style.display = "none";
}
//Validate SEPA Bank Id for UK and Euro
if(version == "UK" && currency == "2" && document.getElementById("IATS_Payment_UKDebitAccount4")!=null &&
(document.getElementById("IATS_Payment_UKDebitAccount4").value.length < 5))
{
if(document.getElementById("IATS_Payment_UKDebitAccount5ErrorMessage")!=null)
document.getElementById("IATS_Payment_UKDebitAccount5ErrorMessage").style.display = "block";
validationOK = false;
}
else
{
if(document.getElementById("IATS_Payment_UKDebitAccount5ErrorMessage")!=null)
document.getElementById("IATS_Payment_UKDebitAccount5ErrorMessage").style.display = "none";
}
//Validate UK ACH Account Number field if it's not GBP
if(currency != "3" && document.getElementById("IATS_Payment_UKDebitAccount3")!=null &&
(document.getElementById("IATS_Payment_UKDebitAccount3").value.length < 5))
{
if(document.getElementById("IATS_Payment_UKDebitAccount3ErrorMessage")!=null)
document.getElementById("IATS_Payment_UKDebitAccount3ErrorMessage").style.display = "block";
validationOK = false;
}
else
{
if(document.getElementById("IATS_Payment_UKDebitAccount3ErrorMessage")!=null)
document.getElementById("IATS_Payment_UKDebitAccount3ErrorMessage").style.display = "none";
}
if(document.getElementById("IATS_Payment_USDebitAccount2")!=null &&
(document.getElementById("IATS_Payment_USDebitAccount2").value.length>17 || document.getElementById("IATS_Payment_USDebitAccount2").value.length<3))
{
if(document.getElementById("IATS_Payment_USDebitAccount2ErrorMessage")!=null)
document.getElementById("IATS_Payment_USDebitAccount2ErrorMessage").style.display = "block";
validationOK = false;
}
else
{
if(document.getElementById("IATS_Payment_USDebitAccount2ErrorMessage")!=null)
document.getElementById("IATS_Payment_USDebitAccount2ErrorMessage").style.display = "none";
}
if(document.getElementById("IATS_Payment_ReEnterUSDebitAccount2")!=null &&
document.getElementById("IATS_Payment_USDebitAccount2").value != document.getElementById("IATS_Payment_ReEnterUSDebitAccount2").value)
{
if(document.getElementById("IATS_Payment_ReEnterUSDebitAccount2ErrorMessage")!=null)
document.getElementById("IATS_Payment_ReEnterUSDebitAccount2ErrorMessage").style.display = "block";
validationOK = false;
}
else
{
if(document.getElementById("IATS_Payment_ReEnterUSDebitAccount2ErrorMessage")!=null)
document.getElementById("IATS_Payment_ReEnterUSDebitAccount2ErrorMessage").style.display = "none";
}
//Validate UK Re-enter Account Number field if it's not GBP
if(currency != "3" && document.getElementById("IATS_Payment_ReEnterUKDebitAccount3")!=null &&
document.getElementById("IATS_Payment_UKDebitAccount3").value != document.getElementById("IATS_Payment_ReEnterUKDebitAccount3").value)
{
if(document.getElementById("IATS_Payment_ReEnterUKDebitAccount3ErrorMessage")!=null)
document.getElementById("IATS_Payment_ReEnterUKDebitAccount3ErrorMessage").style.display = "block";
validationOK = false;
}
else
{
if(document.getElementById("IATS_Payment_ReEnterUKDebitAccount3ErrorMessage")!=null)
document.getElementById("IATS_Payment_ReEnterUKDebitAccount3ErrorMessage").style.display = "none";
}
// for CAN ACH
if(document.getElementById("IATS_Payment_CANDebitAccount1")!=null &&
(document.getElementById("IATS_Payment_CANDebitAccount1").value.length!=5))
{
if(document.getElementById("IATS_Payment_CANDebitAccount1ErrorMessage")!=null)
document.getElementById("IATS_Payment_CANDebitAccount1ErrorMessage").style.display = "block";
validationOK = false;
}
else
{
if(document.getElementById("IATS_Payment_CANDebitAccount1ErrorMessage")!=null)
document.getElementById("IATS_Payment_CANDebitAccount1ErrorMessage").style.display = "none";
}
if(document.getElementById("IATS_Payment_CANDebitAccount2")!=null &&
(document.getElementById("IATS_Payment_CANDebitAccount2").value.length!=3))
{
if(document.getElementById("IATS_Payment_CANDebitAccount2ErrorMessage")!=null)
document.getElementById("IATS_Payment_CANDebitAccount2ErrorMessage").style.display = "block";
validationOK = false;
}
else
{
if(document.getElementById("IATS_Payment_CANDebitAccount2ErrorMessage")!=null)
document.getElementById("IATS_Payment_CANDebitAccount2ErrorMessage").style.display = "none";
}
if(document.getElementById("IATS_Payment_CANDebitAccount3")!=null &&
(document.getElementById("IATS_Payment_CANDebitAccount3").value.length>12 || document.getElementById("IATS_Payment_CANDebitAccount3").value.length<1))
{
if(document.getElementById("IATS_Payment_CANDebitAccount3ErrorMessage")!=null)
document.getElementById("IATS_Payment_CANDebitAccount3ErrorMessage").style.display = "block";
validationOK = false;
}
else
{
if(document.getElementById("IATS_Payment_CANDebitAccount3ErrorMessage")!=null)
document.getElementById("IATS_Payment_CANDebitAccount3ErrorMessage").style.display = "none";
}
if(document.getElementById("IATS_Payment_ReEnterCANDebitAccount3")!=null &&
document.getElementById("IATS_Payment_CANDebitAccount3").value != document.getElementById("IATS_Payment_ReEnterCANDebitAccount3").value)
{
if(document.getElementById("IATS_Payment_ReEnterCANDebitAccount3ErrorMessage")!=null)
document.getElementById("IATS_Payment_ReEnterCANDebitAccount3ErrorMessage").style.display = "block";
validationOK = false;
}
else
{
if(document.getElementById("IATS_Payment_ReEnterCANDebitAccount3ErrorMessage")!=null)
document.getElementById("IATS_Payment_ReEnterCANDebitAccount3ErrorMessage").style.display = "none";
}
}
if (validationOK==false) {
document.getElementById("IATS_ProcessAction_Button").disabled = false;
div = document.getElementById("IATS_ErrorMsgSectionDiv");
if (div!=null)
div.style.visibility = "visible";
span = document.getElementById("IATS_ErrorMessageSpan");
if (span!=null) {
span.innerHTML = theIATSPaymentBoxCore.ErrorMessage;
}
}
else {
div = document.getElementById("IATS_ErrorMsgSectionDiv");
if (div!=null)
div.style.visibility = "hidden";
}
if(document.getElementById('IATS_Payment_ReoccurringCheck')!=null && document.getElementById('IATS_Payment_ReoccurringCheck').checked)
{
for (i=0;i4)
{
linksarray = document.getElementsByTagName("link");
for ( var i in linksarray)
{
if (linksarray[i].href === this.EventStyleSheet)
{
return;
}
}
theStyleSheet = document.createElement('link');
theStyleSheet.setAttribute('type', 'text/css');
theStyleSheet.setAttribute('href', this.EventStyleSheet);
theStyleSheet.setAttribute('rel', 'stylesheet');
head.appendChild(theStyleSheet);
}
linksarray = document.getElementsByTagName("link");
for ( var i in linksarray)
{
if (linksarray[i].href === this.ThirdStyleSheet)
{
return;
}
}
theStyleSheet = document.createElement('link');
theStyleSheet.setAttribute('type', 'text/css');
theStyleSheet.setAttribute('href', this.ThirdStyleSheet);
theStyleSheet.setAttribute('rel', 'stylesheet');
head.appendChild(theStyleSheet);
}
function IATSCreateCAPTCHADiv()
{
var CAPTCHADiv = this.createElement("div","IATS_CAPTCHADiv","");
CAPTCHADiv.setAttribute("id","IATS_CAPTCHADiv");
return CAPTCHADiv;
}
function GetVerifyCAPTCHAParameters()
{
var parameters;
if (document.getElementById("IATS_CAPTCHADiv")!=null && typeof(grecaptcha) != "undefined")
{
parameters = "&EnableCAPTCHA=1";
//parameters=parameters + "&ChallengeField=" + grecaptcha.getResponse(widgetId1);
parameters=parameters + "&ResponseField=" + grecaptcha.getResponse(widgetId1);
}
else
parameters = "&EnableCAPTCHA=0";
return parameters;
}
function decodeHtml(html) {
var txt = document.createElement("textarea");
txt.innerHTML = html;
return txt.value;
}
function GetCurrency() {
var currency = "1";
var currencyText = "";
if (currency == 0) {
currencyText = "CAD";
} else if (currency == 1) {
currencyText = "USD";
} else if (currency == 2) {
currencyText = "GBP";
}
return currencyText;
}