CheckByNet

/*
echeck.class, Copyright 2004 John Hogenmiller [email protected]
http://h.hsource.net/
This is an api to interface with ChecksByNet (http://www.checksbynet.com/), provided
by CrossCheck, Inc. This program is in no way (currently) endorsed by Crosscheck, Inc., nor is the author in any way affiliated with CrossCheck, Inc.
Distribution:
This program is released under the GNU Lesser General Public License.
(http://www.opensource.org/licenses/lgpl-license.php)
CONFIGURATION:
Go to the function post_echeck and change the $payto and $paytoid variables
to match what you have with ChecksByNet. Alternatively, you could pass these
in from the parent script. If ChecksByNet ever changes their
submission url, you'll have to change the $url variable.
EXAMPLE:
Note that in a production environment, you wouldn't want to pass $REQUEST in
to the post_echeck function as the end user would be able to change the amount,
payto, and paytoid at will. Ideally, you pull the cbn
variables out of
$REQUEST, do any regex checks you want to do on your side, and directly
set the amount from the server side.
post_echeck works by returning an array with the keys "approved" and "err".
$array['approved'] // If set, echeck was approved.
$array['err'] // Human readable text of all errors.
$array['RSPxxxx'] // Server generated error as key, human readable error as value.
Useful for parent scripts that want to do more with the error.
$ec = new echeck;
$result = $ec->post_echeck($_REQUEST);
if ($result[approved])
{ print "Echeck approved
n"; }
else
{ print "Declined:
n";
print $result[err];
}
VARIABLES:
Put all the variables into an array and pass that array to post_echeck.
Prefix all variables in the array with cbn

Example:
$checkno = 123;
$check['cbn_checknbr'] = $checkno;
$result = $ec->post_echeck($check);
Checksbynet requires the following variables FROM THE CUSTOMER:
Check Number Value: checknbr Needs to be greater than 99 / 6 Max
Customer's First Name: writerfirst 15 Max (only for personal checks)
Customer's Last Name: writerlast 29 Max
Customer's Business Name: writername 50 Max (only for business checks)
Customer's Address: writeraddr Street address required / 50 Max
City: writercity 30 Max
State: writerst 2 characters required
Zip: writerzip 5 digits required
Bank Name: bankname 50 Max
Bank City: bankcity 30 Max
Bank State: bankst 2 characters required
Bank Zip: bankzip 5 digits required or can be blank
MICR: micr 80 Max
Customer's Driver's License: idnbr Do not include dashes or spaces / 40 Max
Driver's License State: idst 2 characters required
Customer's Phone Number: phone 10 digits required / 14 max
Customer's Email: email "@" and "." required / 50 Max
They also require these variables FROM THE MERCHANT:
Check Dollar Amount Value: checkamt Needs to be greater than $1.00/ 10 Max characters
These variables are required by the MERCHANT, but can be set in the post_echeck
function, and do not need to be passed in from the parent program.:
Pay to: payto Who the check is being made out to. 50 Max
Pay to id: paytoid Merchant id number
*/
class echeck
{
function post_echeck($check)
{
$url = 'https://cross.checksbynet.com/response.asp';
if ($check[cbn_payto])
{ $payto = urlencode($check[cbn_payto]); }
else { $payto = urlencode("Valued CrossCheck Merchant"); }
if ($check[cbn_paytoid])
{ $paytoid = urlencode($check[cbn_paytoid]); }
else { $paytoid = "12345"; }
// For initial testing, you may want to NULL out the paytoid
$paytoid = 0;
$params =
"payto=$payto"
. "&checknbr=". urlencode($check['cbn_checknbr'])
. "&checkamt=". urlencode($check['cbn_checkamt'])
. "&writeraddr=". urlencode($check['cbn_writeraddr'])
. "&writercity=". urlencode($check['cbn_writercity'])
. "&writerst=". urlencode($check['cbn_writerst'])
. "&writerzip=". urlencode($check['cbn_writerzip'])
. "&bankname=". urlencode($check['cbn_bankname'])
. "&bankcity=". urlencode($check['cbn_bankcity'])
. "&bankst=". urlencode($check['cbn_bankst'])
. "&micr=". urlencode($check['cbn_micr'])
. "&idnbr=". urlencode($check['cbn_idnbr'])
. "&idst=". urlencode($check['cbn_idst'])
. "&phone=". urlencode($check['cbn_phone'])
. "&email=". urlencode($check['cbn_email']);
if ($check['cbn_bankzip']) { $params .= "&bankzip=". $check['cbn_bankzip']; }
if ($check['cbn_writername']) { $params .= "&writername=". $check['cbn_writername']; }
else { $params .= "&writerfirst=". $check['cbn_writerfirst'] . "&writerlast=". $check['cbn_writerlast']; }
if ($paytoid) { $params .= "&paytoid=". $paytoid; }
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
// curl_setopt($ch, CURLOPT_USERAGENT, $defined_vars['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$return=curl_exec($ch);
curl_close ($ch);
$goodresults = $this->quotesplit($return);
foreach ($goodresults as $key => $value)
{
$result[$value] = "ECHECK: Unknown error"; // All known return codes will replace this.
if ($value == 'RSP0051') { $result[err] .= "ECHECK: Configuration error: invalid payto/paytoid";
$result[$value] .= "ECHECK: Configuration error: invalid payto/paytoid"; }
if ($value == 'RSP1101') { $result[err] .= "ECHECK: Bad/blank check number
n";
$result[$value] = "ECHECK: Bad/blank check number
n"; }
if ($value == 'RSP1102') { $result[err] .= "ECHECK: Bad/blank check dollar amount
n";
$result[$value] = "ECHECK: Bad/blank check dollar amount
n"; }
if ($value == 'RSP1201') { $result[err] .= "ECHECK: Bad/blank entry for customer name
n";
$result[$value] = "ECHECK: Bad/blank entry for customer name
n"; }
if ($value == 'RSP1202') { $result[err] .= "ECHECK: Bad/blank address for customer $check[cbn_writeraddr]
n";
$result[$value] = "ECHECK: Bad/blank address for customer $check[cbn_writeraddr]
n"; }
if ($value == 'RSP1203') { $result[err] .= "ECHECK: Bad/blank city for customer
n";
$result[$value] = "ECHECK: Bad/blank city for customer
n"; }
if ($value == 'RSP1204') { $result[err] .= "ECHECK: Bad/blank state for customer
n";
$result[$value] = "ECHECK: Bad/blank state for customer
n"; }
if ($value == 'RSP1205') { $result[err] .= "ECHECK: Bad/blank zip code for customer
n";
$result[$value] = "ECHECK: Bad/blank zip code for customer
n"; }
if ($value == 'RSP1301') { $result[err] .= "ECHECK: Bad/blank bank name
n";
$result[$value] = "ECHECK: Bad/blank bank name
n"; }
if ($value == 'RSP1302') { $result[err] .= "ECHECK: Bad/blank city for bank
n";
$result[$value] = "ECHECK: Bad/blank city for bank
n"; }
if ($value == 'RSP1303') { $result[err] .= "ECHECK: Bad/blank state for bank
n";
$result[$value] = "ECHECK: Bad/blank state for bank
n"; }
if ($value == 'RSP1304') { $result[err] .= "ECHECK: Bad/blank zip code for bank
n";
$result[$value] = "ECHECK: Bad/blank zip code for bank
n"; }
if ($value == 'RSP1311') { $result[err] .= "ECHECK: Bad/blank account number
n";
$result[$value] = "ECHECK: Bad/blank account number
n"; }
if ($value == 'RSP1312') { $result[err] .= "ECHECK: Bad/blank routing number
n";
$result[$value] = "ECHECK: Bad/blank routing number
n"; }
if ($value == 'RSP1313') { $result[err] .= "ECHECK: Bad/blank micr number
n";
$result[$value] = "ECHECK: Bad/blank micr number
n"; }
if ($value == 'RSP1401') { $result[err] .= "ECHECK: Bad/blank driver's license number
n";
$result[$value] = "ECHECK: Bad/blank driver's license number
n"; }
if ($value == 'RSP1402') { $result[err] .= "ECHECK: Bad/blank state for driver's license
n";
$result[$value] = "ECHECK: Bad/blank state for driver's license
n"; }
if ($value == 'RSP1501') { $result[err] .= "ECHECK: Bad/blank phone number for customer
n";
$result[$value] = "ECHECK: Bad/blank phone number for customer
n"; }
if ($value == 'RSP1502') { $result[err] .= "ECHECK: Bad/blank email address for customer
n";
$result[$value] = "ECHECK: Bad/blank email address for customer
n"; }
if ($value == 'RSP0000') { $result[approved] = 1; $result[err] = 0; }
if ($value == 'RSP0001') { $result[approved] = 0; $result[err] .= "ECHECK: Declined
n";
$result[$value] = "ECHECK: ECHECK: Declined
n"; }
if ($value == 'RSP0020') { $result[err] .= "ECHECK: Check duplication error. We have approved this same check number from the same account in recent history.
n";
$result[$value] = "ECHECK: Check duplication error. We have approved this same check number from the same account in recent history.
n"; }
if ($value == 'RSP9999') { $result[err] .= "ECHECK: Unable to process checks at this time
n";
$result[$value] = "ECHECK: Unable to process checks at this time
n"; }
// Enable the below line for testing
if ($value == 'RSP0010') { $result[approved] = 1; $result[err] = 0;
$result[$value] = "ECHECK: Test completed.";}
}
if (!$result[err] && !$result[approved]) { $result[err] .= "ECHECK: Undefined error, not approved"; }
return($result);
} #end function post_echeck
function quotesplit($s)
{
$r = Array();
$p = 0;
$l = strlen($s);
while ($p < $l) {
while (($p < $l) && (strpos(" rtn",$s[$p]) !== false)) $p++;
if ($s[$p] == '"') {
$p++;
$q = $p;
while (($p < $l) && ($s[$p] != '"')) {
if ($s[$p] == '\') { $p+=2; continue; }
$p++;
}
$r[] = stripslashes(substr($s, $q, $p-$q));
$p++;
while (($p < $l) && (strpos(" rtn",$s[$p]) !== false)) $p++;
$p++;
} else if ($s[$p] == "'") {
$p++;
$q = $p;
while (($p < $l) && ($s[$p] != "'")) {
if ($s[$p] == '\') { $p+=2; continue; }
$p++;
}
$r[] = stripslashes(substr($s, $q, $p-$q));
$p++;
while (($p < $l) && (strpos(" rtn",$s[$p]) !== false)) $p++;
$p++;
} else {
$q = $p;
while (($p < $l) && (strpos(",;",$s[$p]) === false)) {
$p++;
}
$r[] = stripslashes(trim(substr($s, $q, $p-$q)));
while (($p < $l) && (strpos(" rtn",$s[$p]) !== false)) $p++;
$p++;
}
}
return $r;
} # end function quotesplit
} # end class echeck
?>

132

I guess I just never realized how many hot women were out there wanting to meet me. Here's an example:

Hiiiiii!!!... : )
My name is Karen Hopkins; my email account wasn't functioning properly. I have been
trying to get a hold of you, though I can never seem to send the email out with out
doing
something stupid. As you can see I am not that good with computers, or anything that
has
to do with technology. However my friend Kate knows every bits and pieces of about
computers, so she helps me with email, website and so on. Actually I am starting to
get
the hang of it   = Wink_^ =. Anyways, the reason I am emailing you is because I have
seen your profile on line. My website is finally ready with my new pictures and
updates.
Here is my website http://www.chilax4one.com/CC/index.htm I hope you like what you
see, I have been trying to get my self a modeling carrier but it seems as though
people
find something wrong with me ; (. Well…. Hmmm, anyways… If you do decide to get a
hold of me, I have my email addy on my page; by the way if you're not a serious
individual please don't bother getting in touch with me. I am looking for someone
who I
can have a good conversation with, or anyone who wants to have a simple good
time  hehe.. ohh and don't be mean!!...
I hope we can get in touch. I am usually online.
Karen Hopkins,
::)

131

My life is not a movie.

  1. I didn't grow up on the mean streats of anything.
  2. I don't know anyone that has grown up on the mean streets.
  3. I've been shot at, but it wasn't really that life altering or scary.
  4. I've never given a speech to rally a defeated group of people to fight for
    some unattainable cause.
  5. I've never had to fight for some unattainable cause.
  6. I do not have a nemesis.
  7. I have not belonged to, or met anyone that has belonged to a secret organization
    entrusted with the sacred task of protecting something or other (or stopping an
    ancient evil from rising, or to fight some other secret organization).
  8. I have never dramatically entered a room and finished someone elses sentence.
  9. I have never arrived just in the nick of time to save someone's life (or for that
    matter, too late to save someone's life, or in fact, in plenty of time).
  10. I have nver given a ride to a female (or for the record, a male) stranger that
    then tried to seduce/kill me.
  11. No one has ever, and I mean ever, came crashing through any or my windows.
  12. I have never had to give medical aid to anyone because they couldn't go to the
    hospital. (That is not to say that I haven't given medical aid before though).
  13. I don't have any dark, repressed secrets that I can gradually reveal to a
    potential girlfriend that I haven't pushed away like everyone else for some reason.
  14. I've never had to "lay low" for a little bit.
  15. While driving non-stop for a few days, I will occasionally have to stop to get
    things like gasoline and use the restroom.
  16. If while using the restroom, some nefarious character chases me out of the restroom
    at gunpoint, I will (some time soon) need to actually finish using the restroom.
  17. I do not regularly carry a sword.