Many Pies

Many Pies

Tuesday, June 16, 2009

Validating Direct Debits with Blackbaud NetCommunity

There's a bug in NetCommunity 5.1 whereby it lets your donor specify a one-time Direct Debit payment, which when it is brought through to RE doesn't work properly as it isn't a Recurring Gift.

In addition, we don't want the donors to do recurring credit card gifts as the current version of RE - 7.85 - stores Credit Card info in the database. (An upcoming PCI compliant release won't do this.)

So I've written a bit of Javascript to check the frequency and payment type and give an error message. Unlike my previous script, it doesn't have a hardcoded prefix which is needed to find the ids of some of the page elements. Instead it looks at a variable which is part of the donation form to get the prefix. This may mean it won't work in other versions of NetCommunity.

function xyzCheckDD()
var xyzPrefix = '';
var ErrorText = 'Please use \"One time\" frequency with credit cards, 1st or 15th with Direct Debits';
//We look at one of the variables that's defined to find out the prefix for this page. If they go into four digits
// e.g. PC1001_ then this will need to change.
xyzPrefix = Page_Validators[0].controltovalidate.substring(0,6);

//Check frequency and Payment option. It doesn't have a unique id, so we find the checkbox, go up to the parent

bRecur = document.getElementById(xyzPrefix + 'Recurrence1_ddlFrequency').selectedIndex != "0";
bDD = document.getElementById(xyzPrefix + 'DonationCapture1_rdoPaymentOption_1').checked;
//This does an XOR - true if they are different
if( bRecur ? !bDD : bDD ) {
// Put some debug here if required
function runit2(){
Post a Comment