49 require_once(
'LogSSO.i');
50 require_once(
'cutrusted.i');
51 require_once(
'SSOEncryption.i');
60 if (empty($CKITEM) || empty($CKHASH)) {
61 # error Invalid Request (missing parameters) 62 NoImage(
"Invalid Request (missing parameters)", $adm);
65 #[CKITEM]= "${Cu}|${Cn}|${accounttype}|${cert}|${tracenumber}"; 66 #[CKHASH]= sha1("${Cu}${Cn}${accounttype}${cert}${tracenumber}cierto"); 156 if ( $CKARCHIVE ==
"1" || $CKARCHIVE ==
"2") {
157 if ( $CKARCHIVE ==
"1" ) {
158 # got here from admin with all lookup parameters in CKITEM 160 $ckitem = hcu_decrypturl($CKITEM,$chk_key);
161 list ($iCu,$img,$check,$amount,$date,$rt,$micr,$iCn,$sk) = explode(
"|",$ckitem,9);
162 } elseif ( $CKARCHIVE ==
"2" ) {
163 # got here hcuArchiveCheck with all lookup parameters in CKITEM 164 # CKITEM is hcu_encrypted 165 $ckitem = hcu_decrypturl($CKITEM,$chk_key);
166 list ($iCu,$img,$check,$amount,$date,$rt,$micr,$iCn,$sk) = explode(
"|",$ckitem,9);
168 if ( $CKHASH != sha1(
"{$iCu}{$img}{$check}{$amount}{$date}{$rt}{$micr}{$CKARCHIVE}{$iCn}cierto") ) {
169 # error Invalid Request (corrupt parameters) 170 NoImage(
"Invalid Request (corrupt parameters) ", $adm);
175 $sql =
"select ckhexkey, ckorgid, ckurl 176 from cuadmin where cu='$iCu'";
178 $sth = db_query($sql,$dbh);
179 list ($ckhexkey, $ckorgid, $ckurl)=db_fetch_array($sth,0);
181 # got here from hcuHistory 182 # CKITEM hcu_encrypted for transport in the _REQUEST 183 $ckitem = hcu_decrypturl($CKITEM,$chk_key);
184 list ($iCu,$iCn,$iAt,$iCt,$iTrace) = explode(
"|",$ckitem,5);
186 if ($CKHASH != sha1(
"${iCu}${iCn}${iAt}${iCt}${iTrace}cierto")) {
187 # error Invalid Request (corrupt parameters) 188 NoImage(
"Invalid Request (corrupt parameters) ", $adm);
192 $sql =
"select trim(rt) as rt, 193 trim(img) as img, ckhexkey, ckorgid, ckurl 194 from cuadmin where cu='$iCu'";
196 $sth = db_query($sql,$dbh);
197 list ($rt,$img,$ckhexkey,$ckorgid,$ckurl)=db_fetch_array($sth,0);
199 $sql =
"select trim(micraccount) as micr, 200 trim(checknumber) as check, 203 to_char(date,'mm/dd/yyyy') as date 204 from ${iCu}accounthistory h join ${iCu}accountbalance b on 205 (h.accountnumber = b.accountnumber and h.accounttype=b.accounttype 206 and h.certnumber = b.certnumber) where h.accountnumber='$iCn' 207 and h.accounttype='$iAt' and h.certnumber='$iCt' and 208 h.tracenumber = '$iTrace';";
210 $sth = db_query($sql,$dbh);
211 list ($micr,$check,$sk,$amount,$date)=db_fetch_array($sth,0);
212 $amount=sprintf(
"%.2f",abs($amount));
214 # override micr and rt if needed 215 # clear the 'micr overridden' flag 217 $sql =
"select trim(rt), trim(micraccount) 218 from cuovermicr where cu='$iCu' and accountnumber='$iCn' 219 and accounttype='$iAt' and startcheck <= " . intval($check) .
220 " order by startcheck desc limit 1";
221 $sth = db_query($sql,$dbh);
223 if (db_num_rows($sth) == 1 ) {
224 # we got a hit, override the micr and rt 225 # set a 'micr overridden' flag so we don't discard the changes later 226 # (ISUCU / Scenic Falls) 227 list($rt, $micr) = db_fetch_array($sth,0);
230 # HB_ENV['Fset3'] is set from member banking, but not from admin 231 # presumably admin folks would type correct info, not rely on override? 232 if ($HB_ENV[
'Fset3'] & GetFlagsetValue(
'CU3_SORTKEY_MICR')) {
233 # now override date / micr from history record if sortkey contains a comma 234 if (preg_match(
'/,/',$sk)) {
235 list($date36,$micr36) = explode(
',',trim($sk),2);
236 $date=base_convert(
"$date36",36,10);
237 # base convert loses leading zeros, so put 'em back 238 $date = substr(
"000000$date",-6,6);
240 # mmddyy to mm/dd/yyyy 241 $date = substr($date,0,2) .
"/" . substr($date,2,2) .
"/20" . substr($date,4,2);
242 $micr=base_convert(
"$micr36",36,10);
245 if (
"$sk" ==
'ECHECK' ) {
246 NoImage(
"This is an electronic check. An online image is not available. Please contact the Credit Union if you need a copy of the check for a dispute. ", $adm);
251 header(
"Expires: Sat 20 May 1995 03:32:38 GMT");
252 header(
"Pragma: no-cache");
253 header(
"Cache-Control: no-cache, must-revalidate");
255 $CKSIDE = (trim($CKSIDE) ==
"" ?
"F" : trim($CKSIDE));
272 if ($Cu ==
"COFCU") {
273 # COFCU converted from FIS_IMGCTR to CATALYST 11/13/18. Old images are expected 274 # to be ported to Catalyst, but that hasn't happened yet 276 $ymd = ( substr($date, 6, 4) . substr($date, 0, 2) . substr($date, 3, 2));
277 if ($ymd <
'20181113') {
278 NoImage(
"Images prior to November 13, 2018 are not available. Please contact credit union for assistance.");
283 if ($Cu ==
"MISSFCU") {
284 # MISSFCU will convert from CORPAM to SYNERGENT effective 05/22/2017 286 $ymd = ( substr($date, 6, 4) . substr($date, 0, 2) . substr($date, 3, 2));
287 if ($ymd <
'20170522') {
289 $ckhexkey =
'60e07c67ef3eee2744abebf562332464';
293 if ($Cu ==
'ISUCU') {
294 if (trim($sortkey) !=
'') {
295 # checks clearing under PTFCU rt# will have alternate micr in sortkey 296 # and will get images from WESCORP interface 300 } elseif (strlen($iCn) == 8 && substr($iCn,0,2) ==
'75') {
302 # Scenic Falls member 303 $micr = substr($iCn,2);
307 # always pad to 12 char beginning with 7300000 for isucu retrieval from catalyst 308 if (strlen(trim($micr)) < 12 ) {
309 $micr =
"73" . substr(
"0000000000" . trim($micr), -10, 10);
330 $trusted = cutrusted_read($dbh, array(
'Cu' => $iCu,
'trustedid' =>
'HcuCheckImages'));
331 if ($trusted[
'status'][
'Response'] ==
'false') {
332 NoImage(
"Feature not set up correctly", $adm);
349 $parms = $trusted[
"data"];
350 $loggingFlag = trim($parms[
"hcuLogging"]);
352 if (strlen($loggingFlag) > 0) {
353 $enable = $loggingFlag == -1;
356 $loggingFlag = str_replace(
" ",
"", $loggingFlag);
357 $testArray = explode(
",", $loggingFlag);
358 $enable = in_array($iCn, $testArray);
364 $parms[
"logging"] =
"enabled";
365 $parms[
"environment"] = array(
"Cu" => $iCu,
368 "userIP" => $_SERVER[
'REMOTE_ADDR'],
379 # don't need anything from the database -- nothing there we use 400 # these require monitor values - make sure we have something 401 if (
"${ckhexkey}${ckorgid}${ckurl}" ==
"") {
402 # error feature not set 403 NoImage(
"Invalid Request (feature parameters not set)", $adm);
408 function NoImage($whynot, $adm) {
409 # re-write this to return error structure? 413 <?xml version=
"1.0"?><!DOCTYPE html>
414 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:lang=
"en" lang=
"en">
416 <title>{$MC->msg(
'Cleared Check Detail')}</title>
417 <meta name=
"robots" content=
"noindex,nofollow" />
418 <meta http-equiv=
"X-UA-Compatible" content=
"IE=8" />
422 if ($adm !=
"1") { setIncludeFiles( FALSE, TRUE,
"default", FALSE ); }
425 <script language=\
"JavaScript\"><!-- 437 top.window.resizeTo((screen.availWidth * .85),(screen.availHeight * .85)); 439 else if (document.layers||document.getElementById) 441 if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth) 443 top.window.outerHeight = (screen.availHeight * .85); 444 top.window.outerWidth = (screen.availWidth * .85); 453 <div style='text-align:center;'> 454 <div class="k-block k-error-colored
"> 455 <div class="k-header k-error-colored
">{$MC->msg('Cleared Check Detail')}</div> 456 <div class="container_12
" style='padding: 5px;'> 457 <div class="grid_12
"></div> 459 <div class="clear
"></div> 460 <div class="grid_12
">{$MC->msg('CLEARED CHECK')}</div> 461 <div class="clear
"></div> 463 <div class="grid_12
">{$whynot}</div> 464 <div class="clear
"></div> 471 # set default height and width for image 480 $ymd = ( substr($date, 6, 4) . substr($date, 0, 2) . substr($date, 3, 2)); 481 $view = strtolower($CKSIDE); 484 $src =
"fn=ce&id=${ckorgid}&acct=${micr}&check=${check}&amt=${amount}&side=${view}&date=${ymd}";
485 $front = RawImage($img, $server, $src, $Cu);
493 NoImage(
"Your account is not set up to view check images. (No MICR)<br>Please contact the credit union for assistance.");
497 $ymd = ( substr($date,6,4) . substr($date,0,2) . substr($date,3,2));
498 $view = strtolower($CKSIDE);
501 $amt = str_replace(
".",
"", $amount);
502 $src =
"?fn=ci&id=$ckorgid&acct=${micr}&check=$check&date=$ymd&side=$view&amt=$amt&index=1";
503 $front = RawImage($img, $server, $src, $Cu);
508 $fb = (trim($CKSIDE) ==
"F" ?
"1" :
"2");
509 $mvi_query = gmdate(
'Y-m-d H:i:s') .
",Checks,$micr,$check,$date,$date,$fb";
515 $mvi_data = encrypt_mvi_openssl($mvi_query, $ckhexkey);
517 $front =
"$ckurl?contenttype=jpg&data=$mvi_data";
518 $front = RawImage($img,
'', $front, $Cu);
527 for ($i = 0; $i < strlen($ckhexkey); $i+=2) {
528 $key .= chr(hexdec(substr($ckhexkey, $i, 2)));
538 if (($Cu ==
'SPCTFCU' || $Cu ==
'SNOCOPE') &&
"$sk" >
'') {
541 $text =
"${tn}${amount}${check}${date}${rt}${ckorgid}";
544 $urlacct =
"Account=$micr&";
545 $text =
"${micr}${amount}${check}${date}${rt}${ckorgid}";
548 $mac = hash_hmac(
'MD5', $text, $key);
550 $front =
"https://image.swcorp.org/cgi-bin/$ckurl?${urlacct}Amount=$amount&Serial=$check&Date=$date&CUID=$rt&RQSTRID=$ckorgid&Sequence=$tn&ImageFB=$CKSIDE&MAC=$mac";
551 $front = RawImage($img,
'', $front, $Cu);
559 for ($i = 0; $i < strlen($ckhexkey); $i+=2) {
560 $key .= chr(hexdec(substr($ckhexkey, $i, 2)));
564 NoImage(
"Your account is not set up to view check images. (No MICR)<br>Please contact the credit union for assistance.");
568 $amt = str_replace(
".",
"", $amount);
569 $text =
"${micr}${amt}${check}${date}${rt}";
570 $mac = hash_hmac(
'MD5', $text, $key);
572 if (!empty($ckurl)) {
573 $front =
"{$ckurl}?RT=$rt&PDATE=$date&ACCT=$micr&AMT=$amt&CKNUM=$check&F_B=$CKSIDE&MAC=$mac";
575 #$front = "https://www.secorp.org/homebanking/hbimage.asp?RT=$rt&PDATE=$date&ACCT=$micr&AMT=$amt&CKNUM=$check&F_B=$CKSIDE&MAC=$mac"; 576 $front =
"https://ww70.corpone.org/homebanking/hbimage.asp?RT=$rt&PDATE=$date&ACCT=$micr&AMT=$amt&CKNUM=$check&F_B=$CKSIDE&MAC=$mac";
577 # changed 4/8/2019. DeltaCU appears to work well; VRCU works when a correct micr is present, but it isn't always 578 # on April 1 2019 change URL to https://ww70.corpone.org/homebanking/hbimage.asp and update DELTACU and VRCU to NOT override the default URL 580 # Following URL is apparently from an old change that didn't work -- left it here so we don't lose the history 581 #$front = "https://members.corpone.org/homebanking/hbimage.asp?RT=$rt&PDATE=$date&ACCT=$micr&AMT=$amt&CKNUM=$check&F_B=$CKSIDE&MAC=$mac"; 583 $front = RawImage($img,
'', $front, $Cu);
593 $ymd = ( substr($date, 6, 4) . substr($date, 0, 2) . substr($date, 3, 2));
594 if ($ymd <
'20100702') {
595 NoImage(
"Images are not available for checks clearing prior to July 2, 2010<br>Please contact the credit union for assistance.");
600 if (substr($micr, 0, 4) !=
'2190') {
601 $micr =
'2190' . substr(
"0000000000000$micr", -9, 9);
606 $dstamp = strtotime(
"$date");
607 $fiveback = date(
"m/d/Y", $dstamp - (86400 * 5));
608 $date =
"{$fiveback}::{$date}";
613 for ($i = 0; $i < strlen($ckhexkey); $i+=2) {
614 $key .= chr(hexdec(substr($ckhexkey, $i, 2)));
617 $text =
"${micr}${amount}${check}${date}${rt}";
618 $mac = hash_hmac(
'MD5', $text, $key);
620 $front =
"https://hb.creditunionimages.com/homebanking/hbimage.asp?RT=$rt&PDATE=$date&ACCT=$micr&AMT=$amount&CKNUM=$check&F_B=$CKSIDE&MAC=$mac";
621 $front = RawImage($img,
'', $front, $Cu);
632 $ymd = ( substr($date, 6, 4) . substr($date, 0, 2) . substr($date, 3, 2));
633 if ($ymd <
'20100614') {
634 NoImage(
"Images are not available for checks clearing prior to June 14, 2010<br>Please contact the credit union for assistance.");
639 # Middle Tennessee is posting a day late, so adjust 640 # but only if this request is not from the admin side 641 if ($inc_adm ==
"") {
642 $ymd = BumpDate($date);
643 $qdate = substr($ymd,4,2) .
"/" . substr($ymd,6,2) .
"/" . substr($ymd,0,4);
648 # 8/8/11 don't let request go through if no micr -- might show check from wrong accounts 649 if (trim($micr) ==
'') {
650 NoImage(
"Your account is not set up correctly to view images (missing micr).<br>Please contact the credit union for assistance.");
653 if (($Cu ==
'HSCU') && (substr($micr, 0, 7) !=
'7106300')) {
654 $micr =
"7106300$micr";
658 for ($i = 0; $i < strlen($ckhexkey); $i+=2) {
659 $key .= chr(hexdec(substr($ckhexkey, $i, 2)));
662 # VOLCORP is apparently treating RT# as numeric, not string, so 663 # leading zero on our side disappears on their side and causes hash 664 # mismatch ('Authentication Error'). So we'll play nice and drop the 665 # zero here. VOLCORP is working on an upgrade that will fix this problem. 667 $rt = ltrim($rt,
'0');
669 $amt = str_replace(
".",
"", $amount);
670 $text =
"${micr}${amt}${check}${qdate}${rt}";
671 $mac = hash_hmac(
'MD5', $text, $key);
673 # $front = "https://www.volcorp.org/homebanking/hbimage.asp?RT=$rt&PDATE=$qdate&ACCT=$micr&AMT=$amt&CKNUM=$check&F_B=$CKSIDE&MAC=$mac"; 674 # Volcorp redesigned website; url (hostname) changes as below 675 $front =
"https://eservices.volcorp.org/homebanking/hbimage.asp?RT=$rt&PDATE=$qdate&ACCT=$micr&AMT=$amt&CKNUM=$check&F_B=$CKSIDE&MAC=$mac";
676 $front = RawImage($img,
'', $front, $Cu);
681 if ($Cu ==
'SONOMA') {
682 $ymd = ( substr($date, 6, 4) . substr($date, 0, 2) . substr($date, 3, 2));
684 if ($ymd <
'20140616') {
685 NoImage(
"Images are not available online for checks clearing prior to June 16, 2014<br>Please contact Sonoma Federal Credit Union at 707 527-6216 for assistance.");
688 # $ovmicr set when admin micr override is used 689 # don't change the micr again if it is already overridden 691 if (substr($micr, 0, 8) !=
'82600000' && $micr <>
'100108') {
692 $micr = substr(
"82600000", 0, 14 - strlen($micr)) . $micr;
698 for ($i = 0; $i < strlen($ckhexkey); $i+=2) {
699 $key .= chr(hexdec(substr($ckhexkey, $i, 2)));
702 $amt = str_replace(
".",
"", $amount);
703 $text =
"${micr}${amt}${check}${date}${rt}";
704 $mac = hash_hmac(
'MD5', $text, $key);
706 $front =
"https://images.corpam.org/homebanking/hbimage.asp?RT=$rt&PDATE=$date&ACCT=$micr&AMT=$amt&CKNUM=$check&F_B=$CKSIDE&MAC=$mac";
707 $front = RawImage($img,
'', $front, $Cu);
715 if ($Cu ==
'ALCU' &&
"$sk" ==
'ECHECK') {
716 NoImage(
"This is an electronic check. An online image is not available. Please contact the Credit Union if you need a copy of the check for a dispute. ");
719 if (($Cu ==
'ISUCU') && (trim($sk) !=
'')) {
724 if (($Cu ==
'PRRFCU') && (substr($micr, 0, 2) !=
'79')) {
727 $server=
"https://image.wescorp.org/scripts/afs/afswebapi/afswebapi.dll?";
728 $src =
"StreamImage&CUID=$rt&Account=${micr}&Serial=$check&Amount=${amount}&ImageFB=$CKSIDE$idate";
729 $front = RawImage($img, $server, $src, $Cu);
734 $ymd = ( substr($date, 6, 4) . substr($date, 0, 2) . substr($date, 3, 2));
735 if ($Cu ==
"LEFCU") {
736 if ($ymd >
'20111130' && $ymd <
'20111213' && $inc_adm ==
"") {
738 # L'Oreal switched to MidAtlantic Dec 1, but posted on wrong day until 12/14 739 # so for those dates back up 1 business day -- but only if not an adm request 741 $dstamp = strtotime(
"$date");
742 $wday = date(
"w", $dstamp); # day of week 0=Sunday
744 case 1: # Monday, back up to Friday
745 $ymd = date(
"Ymd", $dstamp - (86400 * 3));
747 default: # back up one day
748 $ymd = date(
"Ymd", $dstamp - 86400);
756 if ((substr($micr, 0, 3) !=
'013')) {
757 $micr =
'013' . substr($micr, -7, 7);
764 $ID = hash(
'MD5', ($micr .
"DMS20070314" . $rt . $tn . $ymd . $amount . $check));
765 $filename =
"https://images.midatlanticcorporate.org/image/checkimage_w.asp?aba=$rt&accountnumber=${micr}&amount=$amount&date=$ymd&serialnumber=$check&frontback=ON&tracernumber=$tn&id=$ID";
767 if (HCU_array_key_value(
"logging", $parms) ==
"enabled") {
768 $logParms = $parms[
"environment"];
769 $logParms[
"token"] =
'';
770 $logParms[
"txnId"] = time();
771 $logParms[
"logPoint"] =
"Mac CK";
772 $logParms[
"request"] =
"ID: $ID \n$filename";
773 $logParms[
"reply"] =
"";
774 LogSSOActivity($logParms);
777 header(
"Location: $filename");
778 print $MC->msg(
"Loading Data");
783 $ymd = ( substr($date, 6, 4) . substr($date, 0, 2) . substr($date, 3, 2));
786 if ((substr($micr, 0, 3) !=
'013')) {
787 $micr =
'013' . substr($micr, -7, 7);
794 $ID = hash(
'MD5', ($micr .
"DMS20070314" . $rt . $tn . $ymd . $amount . $check));
795 $ImageFB = ($CKSIDE ==
'B' ?
'ON' :
'OFF');
796 $server =
"https://images.midatlanticcorporate.org/image/checkimage.asp?";
797 $src =
"aba=$rt&accountnumber=${micr}&amount=$amount&date=$ymd&serialnumber=$check&frontback=$ImageFB&tracernumber=$tn&id=$ID";
798 $front = RawImage($img, $server, $src, $Cu);
806 $server =
"https://ww10.corpone.org/showdraft/DIshowdraft.asp?";
807 $src =
"rt=$rt&rs=$ckhexkey&ac=$micr&sn=$check&am=$amount&dc=$date&face=$CKSIDE";
808 $front = RawImage($img, $server, $src, $Cu);
813 # 7/17/14 add ArchiveConfig to url string. 815 $server =
"https://Ryan.mnipc.com/scripts/afs/afswebapi/afswebapi.dll?StreamImage?";
816 $src =
"RT=$rt&Account=${micr}&Serial=$check&Amount=$amount&ImageFB=$CKSIDE&ArchiveConfig=$ckurl";
817 $front = RawImage($img, $server, $src, $Cu);
822 # this is the new interface from Alloya in partnership with Catalyst 823 # 12/19/16 older Alloya interface renamed ALLOYA_VS 824 # copied Catalyst interface & modified URL 825 # also dropped conditional code to use $tn trace number instead of micr account 826 # see CATALYST if you need that back 827 # also copied the 'bail if no micr' block from older ALLOYA interface... kinda like it 828 # but it won't work if you re-engage the trace number block 831 NoImage(
"Your account is not set up to view check images. (No MICR)<br>Please contact the credit union for assistance.");
837 for ($i = 0; $i < strlen($ckhexkey); $i+=2) {
838 $key .= chr(hexdec(substr($ckhexkey, $i, 2)));
840 $ymd = ( substr($date, 6, 4) . substr($date, 0, 2) . substr($date, 3, 2));
841 # Alloya interface drops leading zero from rt# 842 $rt = ltrim($rt,
'0');
843 $text =
"${micr}${amount}${check}${ymd}${rt}${ckorgid}";
844 $mac = hash_hmac(
'MD5', $text, $key);
846 $front =
"https://imageview.alloyacorp.org/NetHomeBanking/$ckurl?Account=$micr&Amount=$amount&Serial=$check&Date=$ymd&CUID=$rt&RQSTRID=$ckorgid&ImageFB=$CKSIDE&MAC=$mac";
847 $front = RawImage($img,
'', $front, $Cu);
856 NoImage(
"Your account is not set up to view check images. (No MICR)<br>Please contact the credit union for assistance.");
860 $ymd = ( substr($date, 6, 4) . substr($date, 0, 2) . substr($date, 3, 2));
861 $amt = str_replace(
".",
"", $amount); # decimal point implied
865 $src =
"fn=iteminq&id=$ckorgid&acct=${micr}&check=$check&date=$ymd&side=$CKSIDE&amt=$amt&index=1";
866 $front = RawImage($img, $server, $src, $Cu);
870 $front = democheck($CKSIDE);
880 if (($Cu ==
'WEBERCU') && (trim($sk) !=
'')) {
884 $server =
"https://imageconnect.suncorp.coop/scripts/afs/afswebapi/afswebapi.dll?StreamImage?";
885 $src =
"TR=$rt&Account=${micr}&Serial=$check&Amount=${amount}&ImageFB=$CKSIDE";
886 $front = RawImage($img, $server, $src, $Cu);
891 if ($Cu ==
"KRAFTCOR") {
892 # KRAFTCOR switched to MISSOURI. Older checks not available 894 $ymd = ( substr($date, 6, 4) . substr($date, 0, 2) . substr($date, 3, 2));
895 if ($ymd <
'20151201') {
896 NoImage(
"Online images are not available for checks clearing prior to 12/01/2015.<br>Please contact the credit union for assistance.");
900 $server =
"https://www.lipcgatekeeper.org:2000";
901 $front =
"$ckurl?Acct=$micr&Cnum=$check&Amt=$amount&Img=$CKSIDE";
903 $miss =
"$server$front";
904 $fd = fopen($miss,
'rb');
906 $fx = fgets($fd, 4096);
907 if (preg_match(
"/NO MATCH FOUND/", $fx) || preg_match(
"/INVALID REQUEST/", $fx)) {
908 $front =
"Check Image Not Found";
910 $fx = str_replace(
"<IMG SRC=\"",
"", $fx);
911 $fx = str_replace(
"\">",
"", $fx);
912 $front = RawImage($img,
'', $fx, $Cu);
916 $front =
"Check Image Not Found";
923 # 3/9/10 Eascorp changing to unique requestor id and key for each cu 924 # requestor id is routing# dash DMS 925 # secret key will come from monitor Check Security Key 928 for ($i = 0; $i < strlen($ckhexkey); $i+=2) {
929 $key .= chr(hexdec(substr($ckhexkey, $i, 2)));
932 $session = substr(
'000000000' . strval(rand(1, 999999999)), -9);
933 if ($iCu !=
'STCU') {
934 $micr = substr(
'0000000000' . $micr, -10);
936 $timestamp = gmmktime();
938 $text =
"${rt}-DMS${session}${timestamp}${rt}${iCn}${micr}";
939 $mac = hash_hmac(
'MD5', $text, $key);
940 $src =
"https://www.member-data.com/hb/hb_ckcp.ashx";
942 $dxml =
"<?xml version=\"1.0\" encoding=\"utf-8\"?> 944 <requestor>${rt}-DMS</requestor> 945 <session>$session</session> 946 <timestamp>$timestamp</timestamp> 947 <routing>$rt</routing> 948 <member>$iCn</member> 949 <ck-account>$micr</ck-account> 950 <ck-date>$date</ck-date> 951 <ck-ck-number>$check</ck-ck-number> 952 <ck-amount>$amount</ck-amount> 957 #$cmd="/usr/bin/curl --show-error --dump-header '/tmp/xmlhead' --include --data-binary '$dxml' -H 'Content-Type: text/xml' $src"; 959 $cmd =
"/usr/bin/curl --silent --data-binary '$dxml' -H 'Content-Type: text/xml' $src";
961 $fd = popen(
"$cmd",
"r");
966 $data = @fread($fd, 8192);
967 if (strlen($data) == 0) {
977 if (!preg_match(
"#<URL>#s", $response)) {
981 $url = preg_replace(
"#</URL>.*$#s",
"", $response, -1);
982 $url = preg_replace(
"#.*<URL>#s",
"", $url, -1);
983 $src =
"https://$url";
985 if (HCU_array_key_value(
"logging", $parms) ==
"enabled") {
986 $logParms = $parms[
"environment"];
987 $logParms[
"token"] =
'';
988 $logParms[
"txnId"] = time();
989 $logParms[
"logPoint"] =
"Eascorp CK";
990 $logParms[
"request"] = $cmd;
991 $logParms[
"reply"] =
"URL $src \n$response";
992 LogSSOActivity($logParms);
996 header(
"Location: $src");
997 print $MC->msg(
"Loading Data");
999 print $MC->msg(
"Check Image Not Found");
1006 # Date is required and must match with corporate clearing date 1009 for ($i = 0; $i < strlen($ckhexkey); $i+=2) {
1010 $key .= chr(hexdec(substr($ckhexkey, $i, 2)));
1013 $text =
"${micr}${amount}${check}${date}${rt}";
1014 $mac = hash_hmac(
'MD5', $text, $key);
1016 $front =
"https://hb.csiimage.com/homebanking/hbimage.asp?RT=$rt&PDATE=$date&ACCT=$micr&AMT=$amount&CKNUM=$check&F_B=$CKSIDE&MAC=$mac";
1017 $front = RawImage($img,
'', $front, $Cu);
1024 $ymd = ( substr($date, 6, 4) . substr($date, 0, 2) . substr($date, 3, 2));
1025 if ($ymd <
'20101201') {
1026 NoImage(
"Images are not available for checks clearing prior to December 1, 2010<br>Please contact the credit union for assistance.");
1045 # $certfile, $pass, url used to come from FedSpecs.i. 1046 # Moving those things into monitor for easier support 1047 # but note that FedSpecs.i had FQ path for certfile, but monitor entry 1048 # is limited to 32 char & I don't want to mess with it now. 1049 # So assume the location is in cu sslforms directory. 1051 # Odyssey uses shared ssl certs directory 1052 # ckhexkey value should start with 'test/certs/cks/' or 'prod/certs/cks/' 1053 # note that ckhexkey value is varchar(50), and the required prefix uses 15 1054 # so... be brief with the cert file names! 1056 $certSecretId = trim($ckhexkey);
1061 $certfile = GetAwsCertFile($certSecretId, HOMECU_ENC_CERT_DIR, HOMECU_DOCK_CERT_DIR);
1063 if ($certfile ==
'' || !(is_readable($certfile))) {
1064 NoImage(
"Invalid Request (feature parameters not set)" , $adm);
1069 # FedImageGL gets the image links & call FedImageSI to get image stream 1070 # so what we get here is data:image/gif followed by encoded image bytes ready to display 1071 $imglist = FedImageGL($Cu, $date, $amount, $check, $rt, $micr, $sk, $bytrace, $certfile, $pass, $server);
1072 $front = $imglist[
'Front'];
1073 $back = $imglist[
'Back'];
1078 # by default, the date value passed to Fiserv is the date of the check 1079 # but ICCCU has some special processing because they get the file late 1080 # from Fiserv. See switch by $Cu in FiservImage script 1082 # ICCCU went away, now KONECU posts the file late and uses the date adjustment, 1083 # and FiservImage is now a function rather than a separate script. 1087 $server =
"https://www.fiservcws.com/ui/wsinterface.asmx";
1088 # $orgid="44444451"; # testing 1092 $ymd = ( substr($date, 6, 4) . substr($date, 0, 2) . substr($date, 3, 2));
1093 if ($ymd <
'20091001') {
1094 NoImage(
"Online images are not available for checks cleared prior to October 1, 2009.<br><br> Please contact the Credit Union for images of these checks.");
1100 $text =
"${Cu}${amount}${check}${micr}${rt}${date}${ckorgid}";
1101 $front = FiservImage($Cu, $CKSIDE, $amount, $check, $micr, $rt, $date, $ckorgid);
1106 <?xml version=
"1.0"?><!DOCTYPE html>
1107 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:lang=
"en" lang=
"en">
1109 <title>{$MC->msg(
'Cleared Check Detail')}</title>
1110 <meta name=
"robots" content=
"noindex,nofollow" />
1111 <meta http-equiv=
"X-UA-Compatible" content=
"IE=8" />
1114 setIncludeFiles( FALSE, TRUE,
"default", FALSE );
1118 <script language=\
"JavaScript\"><!-- 1130 top.window.resizeTo((screen.availWidth * .85),(screen.availHeight * .85)); 1132 else if (document.layers||document.getElementById) 1134 if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth) 1136 top.window.outerHeight = (screen.availHeight * .85); 1137 top.window.outerWidth = (screen.availWidth * .85); 1145 <div class="text-center
"> 1146 <div class="well well-sm col-sm-12
"> 1147 <div class="text-left
"> 1148 <label><?php echo $MC->msg('Date Cleared') ?>:</label> 1149 <label style="font-weight: normal;
"><?php echo $date; ?></label><br> 1150 <label><?php echo $MC->msg('Check Number') ?>:</label> 1151 <label style="font-weight: normal;
"><?php echo $check; ?></label><br> 1152 <label><?php echo $MC->msg('Amount') ?>:</label> 1153 <label style="font-weight: normal;
"><?php echo $amount; ?> 1157 // Display the front image 1158 if ($front == "Check Image Not Found
") { 1159 print $MC->msg('Check Image Not Found') . "<br>
"; 1161 print "<img src=
'$front' height=
'$iheight' width=
'$iwidth' alt=
'" . $MC->msg('Please Wait
') . "...' border=1>
"; 1169 if ($img == "FEDIMAGE
") { 1170 // Check if back image exists 1171 // Add extra break to get some space beteween images 1172 if ($back != "NO
") { 1174 print "<img src=
'$back' height=
'$iheight' width=
'$iwidth' alt=
'" . $MC->msg('Please Wait
') . "...' border=1>
"; 1178 // Show View Back / Front button here for other vendors 1179 $NextCKSIDE = ($CKSIDE == 'F' ? 'B' : 'F'); 1180 $view = ($NextCKSIDE == 'F' ? 'Front' : 'Back'); 1181 $viewCaption = $MC->msg("View $view
"); 1183 print "<br><a
id=
'ckViewBtn' class=
'k-button' href=\
"{$CHK_URL}cu=$Cu&CKITEM=${CKITEM}&CKARCHIVE={$CKARCHIVE}&CKHASH=${CKHASH}" . ($inc_adm ?
"&adm=1" :
"" ) .
"&CKSIDE=$NextCKSIDE\">$viewCaption</a>";
1202 function democheck($ckside) {
1203 $theader =
"data:image/jpg";
1204 # using hard-coded path instead of HB_ENV['cloudfrontDomainName'] 1205 # because this runs from both banking and admin (HB_ENV undefined in admin) 1206 $imagefile =
"https://d1kryjpwpzirc7.cloudfront.net/odyssey/images/demo_chk" . strtolower($ckside) .
".jpg";
1208 $nctypehead =
"data:image/gif";
1209 $nocheck =
"https://d1kryjpwpzirc7.cloudfront.net/odyssey/images/nochecksgl.gif";
1210 $headers = get_headers($imagefile,1);
1211 if ( stristr( $headers[0],
'200 OK') !==
false && stristr( $headers[
'Content-Type'],
'image') !==
false ) {
1212 $imagebytes = file_get_contents($imagefile);
1214 $imagebytes = file_get_contents($nocheck);
1215 $theader = $nctypehead;
1217 return $theader .
';base64,' . base64_encode($imagebytes);
1230 function RawImage($img, $server, $src, $Cu, $opts = array() ) {
1237 $opts[
'http'][
'ignore_errors'] =
true;
1240 # using hard-coded path instead of HB_ENV['cloudfrontDomainName'] 1241 # because this runs from both banking and admin (HB_ENV undefined in admin) 1242 $nocheck =
"https://d1kryjpwpzirc7.cloudfront.net/odyssey/images/nochecksgl.gif";
1243 $nctypehead =
"data:image/gif";
1246 CURLOPT_RETURNTRANSFER => 1,
1247 CURLOPT_SSL_VERIFYPEER => 0,
1248 CURLOPT_SSL_VERIFYHOST => 0,
1249 CURLOPT_HEADER => FALSE,
1250 CURLOPT_URL =>
"${server}${src}");
1257 curl_setopt_array($ch, $curlopts);
1260 $imagebytes = curl_exec($ch);
1261 $respHTTP = curl_getinfo($ch, CURLINFO_HTTP_CODE);
1262 $respTYPE = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); # gets NULL
if no valid Content-Type
1263 $respCURL = curl_errno($ch);
1267 $respERR =
"HCUERROR: Connection Failed cURL $respCURL";
1268 } elseif ($respHTTP > 400 && $respHTTP < 600) {
1269 # HTTP Response 4xx client error or 5xx server error 1270 $respERR =
"HCUERROR: Connection Failed HTTP $respHTTP ";
1271 } elseif (!isset($imagebytes) || $imagebytes ==
'') {
1273 $respERR =
"HCUERROR: Empty Response";
1274 } elseif (is_null($respTYPE) || strtolower(substr($respTYPE, 0, 5)) !=
'image') {
1275 # Content-Type header missing or not an image 1276 $respERR =
"HCUERROR: Response Not an Image";
1278 # should be good response 1279 $theader =
"data:" . trim($respTYPE);
1283 if (HCU_array_key_value(
"logging", $parms) ==
"enabled") {
1284 $logParms = $parms[
"environment"];
1285 $logParms[
"token"] =
'';
1286 $logParms[
"txnId"] = time();
1287 $logParms[
"logPoint"] =
"$img RawImage";
1288 $logParms[
"request"] =
"${server}${src}";
1289 $logParms[
"reply"] =
"$respERR\n";
1290 if (is_null($respTYPE) || strtolower(substr($respTYPE, 0, 5)) !=
'image') {
1291 $logParms[
"reply"] .= $imagebytes;
1293 $logParms[
"reply"] .=
"(IMAGE DATA)\n";
1295 LogSSOActivity($logParms);
1298 if ($respERR !=
'') {
1299 $theader = $nctypehead;
1300 $imagebytes = file_get_contents($nocheck);
1303 return $theader .
';base64,' . base64_encode($imagebytes);
1319 function FiservImage($Cu, $view, $amount, $check, $micr, $rt, $ckdate, $orgid) {
1320 # only one client (Konecu) on this interface, and none of their images work 1321 # turns out they are posting a day late - use BumpDate to adjust 1322 # 2/15/17 moving on to FedImage 1323 #$front="FiservImage?cu=$Cu&view=$CKSIDE&amount=$amount&check=$check&micr=$micr&rt=$rt&date=$date&orgid=$ckorgid{$inc_adm}&imgkey=$imgkey"; 1325 # $prpwd="i+PJQ7Fgn/+/xRqtZm0KBK34PJ0="; 1327 $prpwd =
"osSqERHPDtl5w5zsz3UDYl7X8ks=";
1328 $server =
"https://www.fiservcws.com/ui/wsinterface.asmx";
1330 $dstamp = strtotime(
"$ckdate");
1335 $ymd = BumpDate($ckdate);
1338 $ymd = date(
"Ymd", $dstamp);
1342 $datetime = (date(
"Y-m-d") .
"T" . date(
"H:i:sO"));
1344 $dxml =
'<fiAPI xmlns="http://integration.fiapi.com" ';
1345 $dxml .=
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ';
1346 $dxml .=
'xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" ';
1347 $dxml .=
'xsi:schemaLocation="http://integration.fiapi.com fiDocumentInquiry.xsd"> ';
1348 $dxml .=
'<fiHeader Version="2.0"> ';
1349 $dxml .=
'<Service Version="1.0" Name="FiservArchiveAccessAPI"> ';
1350 $dxml .=
'<DateTime>' . $datetime .
'</DateTime> ';
1351 $dxml .=
'<UUID>12345678-1234-1234-1234-123456789012</UUID> ';
1352 $dxml .=
'</Service> ';
1353 $dxml .=
'<Security> ';
1354 $dxml .=
'<AuthenticationMaterial> ';
1355 $dxml .=
'<PrincipalPWD>' . $prpwd .
'</PrincipalPWD> ';
1356 $dxml .=
'</AuthenticationMaterial> ';
1357 $dxml .=
'<PrincipalID>' . $prid .
'</PrincipalID> ';
1358 $dxml .=
'</Security> ';
1359 $dxml .=
'<Client Version="1.3"> ';
1360 $dxml .=
'<VendorID>Vendor Name</VendorID> ';
1361 $dxml .=
'<AppID>CWS</AppID> ';
1362 $dxml .=
'<OrgID>' . $orgid .
'</OrgID> ';
1363 $dxml .=
'<SessionID>88888888-4444-4444-4444-123456789012</SessionID> ';
1364 $dxml .=
'</Client> ';
1365 $dxml .=
'<DataSource> ';
1366 $dxml .=
'<URI /> ';
1367 $dxml .=
'</DataSource> ';
1368 $dxml .=
'</fiHeader> ';
1369 $dxml .=
'<Request TypeOfRequest="DocumentInquiryRq" RequestID="123" Echo="0"> ';
1370 $dxml .=
'<Date>' . $ymd .
'</Date> ';
1371 $dxml .=
'<Class>Check</Class> ';
1372 $dxml .=
'<Type>GetImage</Type> ';
1373 $dxml .=
'<Condition> ';
1374 $dxml .=
'<Detail>ItemSeqNum</Detail> ';
1375 $dxml .=
'<Operator>EQ</Operator> ';
1376 $dxml .=
'<Value>0</Value> ';
1377 $dxml .=
'</Condition> ';
1378 $dxml .=
'<Condition> ';
1379 $dxml .=
'<Detail>CheckAmt</Detail> ';
1380 $dxml .=
'<Operator>EQ</Operator> ';
1381 $dxml .=
'<Value>' . $amount .
'</Value> ';
1382 $dxml .=
'</Condition> ';
1383 $dxml .=
'<Condition> ';
1384 $dxml .=
'<Detail>TransCode</Detail> ';
1385 $dxml .=
'<Operator>EQ</Operator> ';
1386 $dxml .=
'<Value>' . $check .
'</Value> ';
1387 $dxml .=
'</Condition> ';
1388 $dxml .=
'<Condition> ';
1389 $dxml .=
'<Detail>AccountNum</Detail> ';
1390 $dxml .=
'<Operator>EQ</Operator> ';
1391 $dxml .=
'<Value>' . $micr .
'</Value> ';
1392 $dxml .=
'</Condition> ';
1393 $dxml .=
'<Condition> ';
1394 $dxml .=
'<Detail>TrRoutNum</Detail> ';
1395 $dxml .=
'<Operator>EQ</Operator> ';
1396 $dxml .=
'<Value>' . $rt .
'</Value> ';
1397 $dxml .=
'</Condition> ';
1398 $dxml .=
'<Condition> ';
1399 $dxml .=
'<Detail>SerialNum</Detail> ';
1400 $dxml .=
'<Operator>EQ</Operator> ';
1401 $dxml .=
'<Value>' . $check .
'</Value> ';
1402 $dxml .=
'</Condition> ';
1403 $dxml .=
'<RequestData ID="1" Name="1" Date="1" Class="1" Type="1"> ';
1404 $dxml .=
'<Page View="' . $view .
'" Format="gif">1</Page> ';
1405 $dxml .=
'</RequestData> ';
1406 $dxml .=
'<RequestMetaData /> ';
1407 $dxml .=
'</Request> ';
1408 $dxml .=
'</fiAPI>';
1410 $dxml = htmlspecialchars($dxml, ENT_NOQUOTES);
1412 $os =
'<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ';
1413 $os .=
'xmlns:xsd="http://www.w3.org/2001/XMLSchema" ';
1414 $os .=
'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> ';
1415 $os .=
'<soap:Body> ';
1416 $os .=
'<SubmitRequest xmlns="urn:Fiserv.CWS"> ';
1417 $os .=
'<FiAPIRequest>' . $dxml .
'</FiAPIRequest> ';
1418 $os .=
'</SubmitRequest> ';
1419 $os .=
'</soap:Body> ';
1420 $os .=
'</soap:Envelope> ';
1423 # using hard-coded path instead of HB_ENV['cloudfrontDomainName'] 1424 # because this runs from both banking and admin (HB_ENV undefined in admin) 1425 $nocheck =
"https://d1kryjpwpzirc7.cloudfront.net/odyssey/images/nochecksgl.gif";
1426 $nctypehead =
"data:image/gif";
1427 $front =
"Check Image Not Found";
1429 $cmd =
"/usr/bin/curl --silent --data-binary '$os' -H 'Content-Type: text/xml' -H 'SOAPAction: \"urn:Fiserv.CWS/SubmitRequest\"' '$server'";
1431 # use embedded curl to get results, check errors 1434 CURLOPT_RETURNTRANSFER => 1,
1435 CURLOPT_SSL_VERIFYPEER => 0,
1436 CURLOPT_SSL_VERIFYHOST => 0,
1437 CURLOPT_HEADER => FALSE,
1438 CURLOPT_POSTFIELDS => $os,
1439 CURLOPT_URL =>
"$server");
1440 $reqHeaders = array(
'Content-Type: text/xml',
'SOAPAction: "urn:Fiserv.CWS/SubmitRequest"');
1447 curl_setopt_array($ch, $curlopts);
1448 curl_setopt($ch, CURLOPT_HTTPHEADER, $reqHeaders);
1451 $response = curl_exec($ch);
1452 $respHTTP = curl_getinfo($ch, CURLINFO_HTTP_CODE);
1453 $respTYPE = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); # gets NULL
if no valid Content-Type
1454 $respCURL = curl_errno($ch);
1458 $respERR =
"HCUERROR: Connection Failed cURL $respCURL";
1459 } elseif ($respHTTP > 400 && $respHTTP < 600) {
1460 # HTTP Response 4xx client error or 5xx server error 1461 $respERR =
"HCUERROR: Connection Failed HTTP $respHTTP ";
1462 } elseif (!isset($response) || $response ==
'') {
1464 $respERR =
"HCUERROR: Empty Response";
1471 if ($respERR ==
'') {
1472 # set xml to catch errors, and remember the current setting 1473 $xmlerr_setting = libxml_use_internal_errors(
true);
1475 $xml = simplexml_load_string($response);
1477 # retrieve any errors encountered on the load 1478 $xmlerrors = libxml_get_errors();
1479 # clear the internal buffer 1480 libxml_clear_errors();
1481 # put the setting back to previous state 1482 libxml_use_internal_errors($xmlerr_setting);
1484 if (!is_object($xml)) {
1485 $respERR =
"HCUERROR INVALID XML: ";
1486 # if we need to print ea. error this would do it 1487 # but really just want to know the doc. didn't load 1493 # look for soap level error 1494 $xml->registerXPathNamespace(
's',
"http://schemas.xmlsoap.org/soap/envelope/");
1495 $errorresponse = $xml->xpath(
"//s:Fault");
1496 if (is_array($errorresponse) && count($errorresponse)) {
1497 $respERR =
"HCUERROR: " . $errorresponse[0]->faultcode .
" " . $errorresponse[0]->faultstring;
1499 # got this far, guess good document first - 1500 $xml->registerXPathNamespace(
'chk',
'http://integration.fiapi.com');
1501 # xml always returns an array. But there will only by 1, so use [0] 1502 $respType = $xml->xpath(
"//chk:Response")[0][
'TypeOfResponse'][0];
1503 if ($respType ==
'DocumentInquiryRs') {
1504 $image = $xml->xpath(
"//chk:Page")[0];
1505 $theader =
"data:image/" . $image[
'Format'];
1506 $imagebytes = base64_decode($image->Value);
1507 } elseif ($respType ==
'ERROR') {
1508 $respAPI = $xml->xpath(
"//chk:Status")[0];
1509 $respERR =
"HCUERROR: " . $respAPI->StatusCode .
" " . $respAPI->Desc;
1511 $respERR =
"HCUERROR: Unexpected XML content";
1515 if ($respERR !=
'') {
1516 $theader = $nctypehead;
1517 $imagebytes = file_get_contents($nocheck);
1520 if (HCU_array_key_value(
"logging", $parms) ==
"enabled") {
1521 $logParms = $parms[
"environment"];
1522 $logParms[
"token"] =
'';
1523 $logParms[
"txnId"] = time();
1524 $logParms[
"logPoint"] =
"FiServ Image";
1525 $logParms[
"request"] =
"$cmd";
1526 $logParms[
"reply"] =
"$respERR\n";
1541 if ($respType ==
"DocumentInquiryRs") {
1542 $xmlPage = $xml->xpath(
"//chk:Page")[0];
1543 $xmlPage->Value =
"(IMAGE DATA)";
1544 $logParms[
"reply"] .= $xml->asXML();
1547 $logParms[
"reply"] .= $response;
1549 LogSSOActivity($logParms);
1553 return $theader .
';base64,' . base64_encode($imagebytes);
1563 function BumpDate($ckdate) {
1564 $dstamp = strtotime(
"$ckdate");
1566 $wday = date(
"w", $dstamp); # day of week 0=Sunday
1568 case 1: # Monday, back up to Friday
1569 $ymd = date(
"Ymd", $dstamp - (86400 * 3));
1571 default: # back up one day
1572 $ymd = date(
"Ymd", $dstamp - 86400);
1575 # build list of holidays for year of ckdate 1576 # if we landed on a holiday, back up to the prior workday from the array 1577 $year = substr($ymd, 0, 4);
1578 $holidays = BumpHolidays($year, $year);
1579 if (array_key_exists($ymd, $holidays)) {
1580 $ymd = $holidays[$ymd];
1596 function FedImageSI($Cu, $src, $certfile, $pass, $server) {
1599 # using hard-coded path instead of HB_ENV['cloudfrontDomainName'] 1600 # because this runs from both banking and admin (HB_ENV undefined in admin) 1601 $nocheck =
"https://d1kryjpwpzirc7.cloudfront.net/odyssey/images/nochecksgl.gif";
1602 $nctypehead =
"data:image/gif";
1603 $front =
"Check Image Not Found";
1605 $cmd =
"/usr/bin/curl --silent -E $certfile:$pass $src";
1608 CURLOPT_RETURNTRANSFER => 1,
1609 CURLOPT_SSL_VERIFYPEER => 0,
1610 CURLOPT_SSL_VERIFYHOST => 0,
1611 CURLOPT_HEADER => FALSE,
1612 CURLOPT_SSLCERT => $certfile,
1613 CURLOPT_SSLCERTPASSWD => $pass,
1614 CURLOPT_URL =>
"$src");
1616 $reqHeaders = array();
1623 curl_setopt_array($ch, $curlopts);
1627 $imagebytes = curl_exec($ch);
1628 $respHTTP = curl_getinfo($ch, CURLINFO_HTTP_CODE);
1629 $respTYPE = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); # gets NULL
if no valid Content-Type
1630 $respCURL = curl_errno($ch);
1634 $respERR =
"HCUERROR: Connection Failed cURL $respCURL";
1635 } elseif ($respHTTP > 400 && $respHTTP < 600) {
1636 # HTTP Response 4xx client error or 5xx server error 1637 $respERR =
"HCUERROR: Connection Failed HTTP $respHTTP ";
1638 } elseif (!isset($imagebytes) || $imagebytes ==
'') {
1640 $respERR =
"HCUERROR: Empty Response";
1641 } elseif (is_null($respTYPE) || strtolower(substr($respTYPE, 0, 5)) !=
'image') {
1642 # Content-Type header missing or not an image 1643 $respERR =
"HCUERROR: Response Not an Image";
1645 # should be good response 1646 $theader =
"data:" . trim($respTYPE);
1650 if (HCU_array_key_value(
"logging", $parms) ==
"enabled") {
1651 $logParms = $parms[
"environment"];
1652 $logParms[
"token"] =
'';
1653 $logParms[
"txnId"] = time();
1654 $logParms[
"logPoint"] =
"FedImage SI";
1655 $logParms[
"request"] =
"$cmd";
1656 $logParms[
"reply"] =
"$respERR\n";
1657 if (is_null($respTYPE) || strtolower(substr($respTYPE, 0, 5)) !=
'image') {
1658 $logParms[
"reply"] .= $imagebytes;
1660 $logParms[
"reply"] .=
"(IMAGE DATA)\n";
1662 LogSSOActivity($logParms);
1665 if ($respERR !=
'') {
1666 $theader = $nctypehead;
1667 $imagebytes = file_get_contents($nocheck);
1670 return $theader .
';base64,' . base64_encode($imagebytes);
1692 function FedImageGL($Cu, $ckdate, $amount, $check, $rt, $micr, $sk, $bytrace, $certfile, $pass, $server) {
1693 # get links to images (front and back?) 1694 # "/FedImage?cu=$Cu&mode=gl&date=$date&amount=$amount&check=$check&rt=$rt&micr=$micr&sk=$sk&bytrace=$bytrace{$inc_adm}&imgkey=$imgkey"; 1707 $ymd = ( substr($ckdate, 6, 4) . substr($ckdate, 0, 2) . substr($ckdate, 3, 2));
1708 $amt = str_replace(
".",
"", $amount);
1710 $dxml =
"<?xml version=\"1.0\" encoding=\"utf-8\"?> 1713 <userRequestId>user</userRequestId> 1714 <description>Retrieve images</description> 1716 <itemType>both</itemType> 1717 <timeout>100</timeout> 1718 <maxItemsReturned>1</maxItemsReturned> 1720 <connector>AND</connector> 1722 <name>Routing and Transit Number</name> 1723 <operator>EQ</operator> 1727 <name>Process Date</name> 1728 <operator>EQ</operator> 1732 if ($bytrace == 1) {
1733 # query by Item Sequence Number 1735 <name>Item Sequence Number</name> 1736 <operator>EQ</operator> 1740 } elseif ($bytrace == 2) {
1741 # Tongass business accounts have check# in Aux On Us instead 1743 <name>Aux On Us</name> 1744 <operator>EQ</operator> 1745 <value>$check</value> 1751 if ($Cu ==
'SFEFCU' || $Cu ==
'IUCU') {
1752 $dxml .=
"<name>Check Number</name> 1755 $dxml .=
"<name>Process Control</name> 1758 $dxml .=
"<operator>EQ</operator> 1759 <value>$check</value> 1764 <name>Account Number</name> 1765 <operator>EQ</operator> 1766 <value>$micr</value> 1770 <operator>EQ</operator> 1775 <viewType>F$fvtype</viewType> 1776 <compression>PNG</compression> 1777 <density>0</density> 1778 <binarize>0</binarize> 1781 <viewType>B$fvtype</viewType> 1782 <compression>PNG</compression> 1783 <density>0</density> 1784 <binarize>0</binarize> 1791 # using hard-coded path instead of HB_ENV['cloudfrontDomainName'] 1792 # because this runs from both banking and admin (HB_ENV undefined in admin) 1793 $nocheck =
"https://d1kryjpwpzirc7.cloudfront.net/odyssey/images/nochecksgl.gif";
1794 $nctypehead =
"data:image/gif";
1795 $front =
"Check Image Not Found";
1798 $cmd =
"/usr/bin/curl --silent --data-binary '$dxml' -H 'Content-Type: text/xml' -E $certfile:$pass $server";
1800 # use embedded curl to get results, check errors 1803 CURLOPT_RETURNTRANSFER => 1,
1804 CURLOPT_SSL_VERIFYPEER => 0,
1805 CURLOPT_SSL_VERIFYHOST => 0,
1806 CURLOPT_HEADER => FALSE,
1807 CURLOPT_SSLCERT => $certfile,
1808 CURLOPT_SSLCERTPASSWD => $pass,
1809 CURLOPT_POSTFIELDS => $dxml,
1810 CURLOPT_URL =>
"$server");
1811 $reqHeaders = array(
'Content-Type: text/xml');
1818 curl_setopt_array($ch, $curlopts);
1819 curl_setopt($ch, CURLOPT_HTTPHEADER, $reqHeaders);
1821 $respERR =
'Success';
1822 $response = curl_exec($ch);
1823 $respHTTP = curl_getinfo($ch, CURLINFO_HTTP_CODE);
1824 $respTYPE = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); # gets NULL
if no valid Content-Type
1825 $respCURL = curl_errno($ch);
1829 $respERR =
"HCUERROR: Connection Failed cURL $respCURL";
1830 } elseif ($respHTTP > 400 && $respHTTP < 600) {
1831 # HTTP Response 4xx client error or 5xx server error 1832 $respERR =
"HCUERROR: Connection Failed HTTP $respHTTP ";
1833 } elseif (!isset($response) || $response ==
'') {
1835 $respERR =
"HCUERROR: Empty Response";
1838 if ($respERR ==
'Success') {
1839 # got this far, guess good document first - 1840 # but try to handle xml load errors 1841 # set xml to catch errors, and remember the current setting 1842 $xmlerr_setting = libxml_use_internal_errors(
true);
1844 $xml = simplexml_load_string($response);
1846 # retrieve any errors encountered on the load 1847 $xmlerrors = libxml_get_errors();
1848 # clear the internal buffer 1849 libxml_clear_errors();
1850 # put the setting back to previous state 1851 libxml_use_internal_errors($xmlerr_setting);
1853 if ($xml === FALSE ) {
1854 # if we need to print ea. error this would do it 1855 # but really just want to know the doc. didn't load 1859 $respERR =
"HCUERROR: Invalid XML";
1860 $imagebytes = file_get_contents($nocheck);
1861 $front = $nctypehead .
';base64,' . base64_encode($imagebytes);
1864 $respCode = $xml->xpath(
"//returnCode");
1866 foreach ($respCode as $code) {
1869 # check that $retcode == 0 ? 1870 $respLinks = $xml->xpath(
"//imageKey");
1871 if (HCU_array_key_value(0,$respLinks) && HCU_array_key_value(1,$respLinks)) {
1872 $front = FedImageSI($Cu, $respLinks[0], $certfile, $pass, $server);
1873 $back = FedImageSI($Cu, $respLinks[1], $certfile, $pass, $server);
1875 $respERR =
"HCUERROR: No Image Links ($retcode)";
1876 $imagebytes = file_get_contents($nocheck);
1877 $front = $nctypehead .
';base64,' . base64_encode($imagebytes);
1884 if (HCU_array_key_value(
"logging", $parms) ==
"enabled") {
1885 $logParms = $parms[
"environment"];
1886 $logParms[
"token"] =
'';
1887 $logParms[
"txnId"] = time();
1888 $logParms[
"logPoint"] =
"FedImage GL";
1889 $logParms[
"request"] =
"$cmd";
1890 $logParms[
"reply"] =
"$respERR\n$response";
1891 LogSSOActivity($logParms);
1893 # Status = 'Success' or error message 1894 return array(
'Status' => $respERR,
'Front' => $front,
'Back' => $back);
1903 function BumpHolidays($Start, $End) {
1914 $holidays = array();
1915 for ($i = $Start; $i <= $End; $i++) {
1916 for ($m = 1; $m <= 12; $m++) {
1927 $dtHoliday = mktime(12, 0, 0, 1, 1, $i);
1928 $dtHoliday = GetNearestWeekday($dtHoliday);
1929 $holidays[date(
'Ymd', $dtHoliday)] = date(
'Ymd', GetPreviousWeekday($dtHoliday));
1931 $dow = idate(
'w', $dtHoliday);
1935 $dtHoliday += 86400;
1937 case 1: #already Monday
1940 $dtHoliday += (86400 * 6);
1943 $dtHoliday += (86400 * 5);
1946 $dtHoliday += (86400 * 4);
1949 $dtHoliday += (86400 * 3);
1952 $dtHoliday += (86400 * 2);
1955 $dtHoliday += (86400 * 14); # add 2 weeks to
get 3rd Monday
1956 $holidays[date(
'Ymd', $dtHoliday)] = date(
'Ymd', GetPreviousWeekday($dtHoliday));
1961 $dtHoliday = mktime(12, 0, 0, 2, 1, $i);
1962 $dow = idate(
'w', $dtHoliday);
1966 $dtHoliday += 86400;
1968 case 1: #already Monday
1971 $dtHoliday += (86400 * 6);
1974 $dtHoliday += (86400 * 5);
1977 $dtHoliday += (86400 * 4);
1980 $dtHoliday += (86400 * 3);
1983 $dtHoliday += (86400 * 2);
1986 $dtHoliday += (86400 * 14); # add 2 weeks to
get 3rd Monday
1987 $holidays[date(
'Ymd', $dtHoliday)] = date(
'Ymd', GetPreviousWeekday($dtHoliday));
1992 $dtHoliday = mktime(12, 0, 0, 5, 31, $i);
1993 $dow = idate(
'w', $dtHoliday);
1994 # find last day & back up 1997 $dtHoliday -= (86400 * 6);
1999 case 1: #already Monday
2002 $dtHoliday -= 86400;
2005 $dtHoliday -= (86400 * 2);
2008 $dtHoliday -= (86400 * 3);
2011 $dtHoliday -= (86400 * 4);
2014 $dtHoliday -= (86400 * 5);
2017 $holidays[date(
'Ymd', $dtHoliday)] = date(
'Ymd', GetPreviousWeekday($dtHoliday));
2022 $dtHoliday = mktime(12, 0, 0, 7, 4, $i);
2023 $dtHoliday = GetNearestWeekday($dtHoliday);
2024 $holidays[date(
'Ymd', $dtHoliday)] = date(
'Ymd', GetPreviousWeekday($dtHoliday));
2030 $dtHoliday = mktime(12, 0, 0, 9, 1, $i);
2031 $dow = idate(
'w', $dtHoliday);
2035 $dtHoliday += 86400;
2037 case 1: #already Monday
2040 $dtHoliday += (86400 * 6);
2043 $dtHoliday += (86400 * 5);
2046 $dtHoliday += (86400 * 4);
2049 $dtHoliday += (86400 * 3);
2052 $dtHoliday += (86400 * 2);
2055 $holidays[date(
'Ymd', $dtHoliday)] = date(
'Ymd', GetPreviousWeekday($dtHoliday));
2060 $dtHoliday = mktime(12, 0, 0, 10, 1, $i);
2061 $dow = idate(
'w', $dtHoliday);
2065 $dtHoliday += 86400;
2067 case 1: #already Monday
2070 $dtHoliday += (86400 * 6);
2073 $dtHoliday += (86400 * 5);
2076 $dtHoliday += (86400 * 4);
2079 $dtHoliday += (86400 * 3);
2082 $dtHoliday += (86400 * 2);
2085 $dtHoliday += (86400 * 7); # add 1 week to
get 2nd Monday
2086 $holidays[date(
'Ymd', $dtHoliday)] = date(
'Ymd', GetPreviousWeekday($dtHoliday));
2091 $dtHoliday = mktime(12, 0, 0, 11, 11, $i);
2092 $dtHoliday = GetNearestWeekday($dtHoliday);
2093 $holidays[date(
'Ymd', $dtHoliday)] = date(
'Ymd', GetPreviousWeekday($dtHoliday));
2096 $dtHoliday = mktime(12, 0, 0, 11, 1, $i);
2097 $dow = idate(
'w', $dtHoliday);
2098 # find first Thursday 2101 $dtHoliday += (86400 * 4);
2104 $dtHoliday += (86400 * 3);
2107 $dtHoliday += (86400 * 2);
2110 $dtHoliday += 86400;
2115 $dtHoliday += (86400 * 6);
2118 $dtHoliday += (86400 * 5);
2121 $dtHoliday += (86400 * 21); # add 3 weeks to
get 4th Thursday
2122 $holidays[date(
'Ymd', $dtHoliday)] = date(
'Ymd', GetPreviousWeekday($dtHoliday));
2127 $dtHoliday = mktime(12, 0, 0, 12, 25, $i);
2128 $dtHoliday = GetNearestWeekday($dtHoliday);
2129 $holidays[date(
'Ymd', $dtHoliday)] = date(
'Ymd', GetPreviousWeekday($dtHoliday));
2146 Function GetPreviousWeekday($dtTimeStamp) {
2148 $intWeekday = idate(
'w', $dtTimeStamp);
2149 switch ($intWeekday) {
2150 case 0: #Sunday - move back to Friday
2151 $dtTimeStamp -= (2 * 86400);
2153 case 1: # Monday - move back to Friday
2154 $dtTimeStamp -= (3 * 86400);
2156 case 2:# Tuesday - Saturday - move back one day
2162 $dtTimeStamp -= 86400;
2165 return $dtTimeStamp;
2175 Function GetNearestWeekday($dtTimeStamp) {
2177 $intWeekday = idate(
'w', $dtTimeStamp);
2178 switch ($intWeekday) {
2179 case 0: #Sunday - move forward to Monday
2180 $dtTimeStamp += 86400;
2182 case 6: #Saturday - move back to Friday
2183 $dtTimeStamp -= 86400;
2185 case 1: # Monday - Friday -
do nothing
2193 return $dtTimeStamp;