2 function RDCsession($dbh, &$parms) {
3 if (isset($parms[
'passwith'][
'DEPOSITID'])) {
4 # look up depositid & decode vendorinfo 5 $parms[
'depositid'] = $parms[
'passwith'][
'DEPOSITID'];
6 $depo = curdc_read($dbh, $parms);
7 if ($depo[
'status'][
'response'] ==
'false') {
8 throw new Exception(
"HomeCU DepositID {$parms['passwith']['DEPOSITID']} not found", 205);
10 if (isset($depo[
'data'][
'vendorinfo'][
'SessionStateId'])) {
12 $parms[
'SessionStateId'] = $depo[
'data'][
'vendorinfo'][
'SessionStateId'];
14 if (isset($depo[
'data'][
'vendorinfo'][
'tzToken'])) {
15 # Catalyst TranzCapture uses this 16 $parms[
'tzToken'] = $depo[
'data'][
'vendorinfo'][
'tzToken'];
17 $parms[
'tzToken_expires'] = $depo[
'data'][
'vendorinfo'][
'tzToken_expires'];
19 $parms[
'rdcvendor'] = $depo[
'data'][
'rdcvendor'];
21 if (isset($depo[
'data'][
'vendorinfo'][
'SessionStateId'])) {
23 $parms[
'SessionStateId'] = $depo[
'data'][
'vendorinfo'][
'SessionStateId'];
25 if (isset($depo[
'data'][
'vendorinfo'][
'tzToken'])) {
26 # Catalyst TranzCapture uses this 27 $parms[
'tzToken'] = $depo[
'data'][
'vendorinfo'][
'tzToken'];
28 $parms[
'tzToken_expires'] = $depo[
'data'][
'vendorinfo'][
'tzToken_expires'];
31 $parray = array(
'Cu' => $parms[
'Cu'],
'trustedid' => $parms[
'rdcvendor']);
32 $trusted = cutd_read($dbh, $parray);
33 if ($trusted[
'status'][
'Response'] ==
'false') {
34 throw new Exception(
"RDC Service {$parms['rdcvendor']} not configured", 105);
37 # check if cu is testing a transition to a new RDC Vendor and 38 # if so, check if this member is forwarding and if so, override vendor 39 $fwdToVendor = trim(HCU_array_key_value(
'hcuFwdToVen', $trusted[
'data'][
"{$parms['Cu']}|{$parms['rdcvendor']}"]));
40 if (!empty($fwdToVendor)) {
41 $fwdList = trim(HCU_array_key_value(
'hcuFwdList', $trusted[
'data'][
"{$parms['Cu']}|{$parms['rdcvendor']}"]));
42 if (strlen($fwdList) > 0) {
44 $enableFwd = $fwdList == -1;
47 $fwdList = str_replace(
" ",
"", $fwdList);
48 $testArray = explode(
",", $fwdList);
49 $enableFwd = in_array($parms[
'passwith'][
'MBRACCT'], $testArray);
53 $parray = array(
'Cu' => $parms[
'Cu'],
'trustedid' => $fwdToVendor);
54 $trusted = cutd_read($dbh, $parray);
55 if ($trusted[
'status'][
'Response'] ==
'false') {
56 throw new Exception(
"RDC Service Forwarding {$fwdToVendor} not configured", 106);
58 $parms[
'rdcvendor'] = $fwdToVendor;
62 $parms = array_merge($parms, $trusted[
'data'][
"{$parms['Cu']}|{$parms['rdcvendor']}"]);
64 $loggingFlag = trim($parms[
"hcuLogging"]);
65 if (strlen($loggingFlag) > 0) {
67 $enable = $loggingFlag == -1;
70 $loggingFlag = str_replace(
" ",
"", $loggingFlag);
71 $testArray = explode(
",", $loggingFlag);
72 $enable = in_array($parms[
'MBRACCT'], $testArray);
77 $parms[
"logging"] =
"enabled";
78 $parms[
"environment"] = array(
80 "SSOVendor" => $parms[
'rdcvendor'],
81 "memberId" => $parms[
'MBRACCT'],
82 "userIP" => $_SERVER[
'REMOTE_ADDR'],
86 $parms[
"logging"] =
"";
91 function RDCGetDepositInfo($dbh, $parms) {
92 $return[
'status'][
'response'] =
'true';
93 $return[
'status'][
'message'] =
'Success';
94 $return[
'status'][
'code'] =
'000';
96 if (!isset($parms[
'Cu']) || !isset($parms[
'Uid']) || !isset($parms[
'MBRACCT'])) {
97 throw new Exception(
'Missing Parameters', 100);
99 $sql =
"select * from curdcstatus 100 where cu='{$parms['Cu']}' and user_id={$parms['Uid']} and accountnumber='{$parms['MBRACCT']}' ";
101 if (isset($parms[
'depositid'])) {
102 $sql .=
"and depositid='{$parms['depositid']}' ";
104 $sql .=
"order by lastupdate desc";
105 $sth = db_query($sql, $dbh);
107 if (db_num_rows($sth) == 0) {
108 throw new Exception(
'HomeCU Deposit not found', 205);
111 $passalong = array();
112 for ($row = 0; $drow = db_fetch_assoc($sth, $row); $row++) {
114 $drow[
'cu'] = trim($drow[
'cu']);
115 $drow[
'accountnumber'] = trim($drow[
'accountnumber']);
116 $drow[
'vendorinfo'] = json_decode($drow[
'vendorinfo'], TRUE);
117 $drow[
'frontpath'] = htmlspecialchars($drow[
'frontpath'], ENT_QUOTES,
'UTF-8', FALSE);
118 $drow[
'backpath'] = htmlspecialchars($drow[
'backpath'], ENT_QUOTES,
'UTF-8', FALSE);
120 $passalong[
"{$drow['depositid']}"] = $drow;
123 $return[
'data'] = $passalong;
124 }
catch (Exception $e) {
125 $return[
'status'][
'response'] =
'false';
126 $return[
'status'][
'code'] = $e->getCode();
127 $return[
'status'][
'message'] =
"(" . $e->getLine() .
") " . htmlspecialchars($e->getMessage(), ENT_QUOTES,
'UTF-8', FALSE);
157 function curdc_start($dbh, $parms) {
158 $return[
'status'][
'response'] =
'true';
159 $return[
'status'][
'message'] =
'OK';
160 $return[
'status'][
'code'] =
'000';
163 if (!isset($parms[
'Cu']) || !isset($parms[
'rdcvendor']) || !isset($parms[
'Uid']) || !isset($parms[
'MBRACCT'])) {
164 throw new Exception(
'Missing Parameters', 100);
168 $status = (
sizeof($parms[
'rdcstatus']) == 0 ?
'O' : $parms[
'rdcstatus']);
170 $inssql =
"insert into curdcstatus (cu, user_id, accountnumber, rdcvendor, starttime, lastupdate,status,vendorinfo) 171 values ('{$parms['Cu']}',{$parms['Uid']},'{$parms['MBRACCT']}','{$parms['rdcvendor']}',DEFAULT,DEFAULT,'$status', 172 E'" . prep_save($parms[
'vendorinfo']) .
"' ) ";
173 $inssql .=
"returning depositid";
176 $sth = db_query($inssql, $dbh);
177 if (!db_affected_rows($sth)) {
178 throw new Exception(
'Failed', 215);
181 $return[
'status'][
'message'] =
'Inserted';
182 $drow = db_fetch_array($sth, 0);
183 $return[
'data'][
'depositid'] = $drow[
'depositid'];
184 }
catch (Exception $e) {
185 $return[
'status'][
'response'] =
'false';
186 $return[
'status'][
'code'] = $e->getCode();
187 $return[
'status'][
'message'] =
"(" . $e->getLine() .
") " . htmlspecialchars($e->getMessage(), ENT_QUOTES,
'UTF-8', FALSE);
188 $return[
'data'] = array();
203 function curdc_setvinfo($dbh, $parms) {
204 $return[
'status'][
'response'] =
'true';
205 $return[
'status'][
'message'] =
'OK';
206 $return[
'status'][
'code'] =
'000';
208 if (!isset($parms[
'Cu']) || !isset($parms[
'depositid']) || !isset($parms[
'vendorinfo'])) {
209 throw new Exception(
'Missing Parameters', 100);
212 $sql =
"select vendorinfo from curdcstatus 213 where cu='{$parms['Cu']}' and depositid='{$parms['depositid']}'";
214 $sth = db_query($sql, $dbh);
216 if (db_num_rows($sth) != 1) {
217 throw new Exception(
'HomeCU DepositID not found', 205);
219 $drow = db_fetch_assoc($sth, 0);
220 $savedvinfo = json_decode($drow[
'vendorinfo'], TRUE);
221 $newvinfo = json_decode($parms[
'vendorinfo'], TRUE);
222 $drow[
'vendorinfo'] = array_merge((array) $savedvinfo, (array) $newvinfo);
224 $updparms = array(
'Cu' => $parms[
'Cu'],
'depositid' => $parms[
'depositid'],
'vendorinfo' => json_encode($drow[
'vendorinfo']));
225 if (HCU_array_key_exists(
'rdcstatus', $parms)) {
226 $updparms[
'rdcstatus'] = $parms[
'rdcstatus'];
229 if (HCU_array_key_exists(
'frontaccept', $parms)) {
230 $updparms[
'frontaccept'] = $parms[
'frontaccept'];
233 if (HCU_array_key_exists(
'backaccept', $parms)) {
234 $updparms[
'backaccept'] = $parms[
'backaccept'];
237 $depostat = curdc_update($dbh, $updparms);
238 if ($depostat[
'status'][
'response'] ==
'false') {
239 throw new Exception($depostat[
'status'][
'message'], $depostat[
'status'][
'code']);
242 $return[
'data'] = $drow;
243 }
catch (Exception $e) {
244 $return[
'status'][
'response'] =
'false';
245 $return[
'status'][
'code'] = $e->getCode();
246 $return[
'status'][
'message'] =
"(" . $e->getLine() .
") " . htmlspecialchars($e->getMessage(), ENT_QUOTES,
'UTF-8', FALSE);
247 $return[
'data'] = array();
260 function curdc_read($dbh, $parms) {
261 $return[
'status'][
'response'] =
'true';
262 $return[
'status'][
'message'] =
'OK';
263 $return[
'status'][
'code'] =
'000';
266 if (!(isset($parms[
'Cu']) && (isset($parms[
'depositid']) || (isset($parms[
'Uid']) && isset($parms[
'MBRACCT']))))) {
267 throw new Exception(
'Missing Parameters', 100);
270 $sql =
"select * from curdcstatus 271 where cu='{$parms['Cu']}' ";
272 if (isset($parms[
'depositid'])) {
273 $sql .=
"and depositid={$parms['depositid']} ";
276 if (isset($parms[
'Uid']) && isset($parms[
'MBRACCT'])) {
277 $sql .=
"and user_id = {$parms['Uid']} and accountnumber='{$parms['MBRACCT']}' ";
280 $sql .=
"order by lastupdate desc limit 1 ";
281 $sth = db_query($sql, $dbh);
283 if (db_num_rows($sth) != 1) {
284 throw new Exception(
'HomeCU Deposit not found', 205);
286 $drow = db_fetch_assoc($sth, 0);
288 $drow[
'cu'] = trim($drow[
'cu']);
289 $drow[
'accountnumber'] = trim($drow[
'accountnumber']);
290 $drow[
'vendorinfo'] = json_decode($drow[
'vendorinfo'], TRUE);
291 $return[
'data'] = $drow;
292 }
catch (Exception $e) {
293 $return[
'status'][
'response'] =
'false';
294 $return[
'status'][
'code'] = $e->getCode();
295 $return[
'status'][
'message'] =
"(" . $e->getLine() .
") " . htmlspecialchars($e->getMessage(), ENT_QUOTES,
'UTF-8', FALSE);
296 $return[
'data'] = array();
301 function curdc_list($dbh, $parms) {
302 $return[
'status'][
'response'] =
'true';
303 $return[
'status'][
'message'] =
'OK';
304 $return[
'status'][
'code'] =
'000';
307 if (!(isset($parms[
'Cu']) && (isset($parms[
'depositid']) || (isset($parms[
'Uid']) && isset($parms[
'MBRACCT']))))) {
308 throw new Exception(
'Missing Parameters', 100);
311 $sql =
"select * from curdcstatus 312 where cu='{$parms['Cu']}' ";
313 if (isset($parms[
'Uid']) && isset($parms[
'MBRACCT'])) {
314 $sql .=
"and user_id = {$parms['Uid']} and accountnumber='{$parms['MBRACCT']}' ";
316 if (isset($parms[
'depositid'])) {
317 $sql .=
"and depositid={$parms['depositid']} ";
319 $sql .=
"and status <> 'S' and (current_timestamp - lastupdate) < interval '30 days' ";
321 $sql .=
"order by lastupdate desc ";
323 if (intval(HCU_array_key_value(
'Limit', $parms)) > 0) {
324 $sql .=
"limit " . intval($parms[
'Limit']);
327 $sth = db_query($sql, $dbh);
329 if (db_num_rows($sth) == 0) {
330 throw new Exception(
"No Deposits Found", 205);
332 for ($row = 0; $drow = db_fetch_assoc($sth, $row); $row++) {
333 $depoid =
"DEP{$drow['depositid']}";
334 $drow[
'cu'] = trim($drow[
'cu']);
335 $drow[
'accountnumber'] = trim($drow[
'accountnumber']);
336 $drow[
'vendorinfo'] = json_decode($drow[
'vendorinfo'], TRUE);
337 $return[
'data'][$depoid] = $drow;
339 }
catch (Exception $e) {
340 $return[
'status'][
'response'] =
'false';
341 $return[
'status'][
'code'] = $e->getCode();
342 $return[
'status'][
'message'] =
"(" . $e->getLine() .
") " . htmlspecialchars($e->getMessage(), ENT_QUOTES,
'UTF-8', FALSE);
343 $return[
'data'] = array();
356 function curdc_update($dbh, $parms) {
357 $return[
'status'][
'response'] =
'true';
358 $return[
'status'][
'message'] =
'OK';
359 $return[
'status'][
'code'] =
'000';
362 if (!isset($parms[
'Cu']) || !isset($parms[
'depositid'])) {
363 throw new Exception(
'Missing Parameters', 100);
366 $sql =
"update curdcstatus set lastupdate = DEFAULT";
367 $sql .= (!HCU_array_key_exists(
'rdcstatus', $parms) ?
"" :
", status = E'" . prep_save($parms[
'rdcstatus']) .
"' ");
368 $sql .= (!HCU_array_key_exists(
'vendorinfo', $parms) ?
"" :
", vendorinfo = E'" . prep_save($parms[
'vendorinfo']) .
"' ");
369 $sql .= (!HCU_array_key_exists(
'frontpath', $parms) ?
"" :
", frontpath = E'" . prep_save($parms[
'frontpath']) .
"' ");
370 $sql .= (!HCU_array_key_exists(
'frontaccept', $parms) ?
"" :
", frontaccept = E'" . prep_save($parms[
'frontaccept']) .
"' ");
371 $sql .= (!HCU_array_key_exists(
'backpath', $parms) ?
"" :
", backpath = E'" . prep_save($parms[
'backpath']) .
"' ");
372 $sql .= (!HCU_array_key_exists(
'backaccept', $parms) ?
"" :
", backaccept = E'" . prep_save($parms[
'backaccept']) .
"' ");
373 $sql .= (!HCU_array_key_exists(
'amount', $parms) ?
"" :
", amount = " . $parms[
'amount'] * .01 .
" ");
374 $sql .= (!HCU_array_key_exists(
'amountaccept', $parms) ?
"" :
", amountaccept = E'" . prep_save($parms[
'amountaccept']) .
"' ");
375 $sql .= (!HCU_array_key_exists(
'acctid', $parms) ?
"" :
", acctid = E'" . prep_save($parms[
'acctid']) .
"' ");
376 $sql .=
" where cu='{$parms['Cu']}' and depositid=" . prep_save($parms[
'depositid']);
377 $sth = db_query($sql, $dbh);
379 if (db_affected_rows($sth) != 1) {
380 throw new Exception(
'HomeCU Update Deposit Failed', 205);
383 $return[
'data'] = array();
384 }
catch (Exception $e) {
385 $return[
'status'][
'response'] =
'false';
386 $return[
'status'][
'code'] = $e->getCode();
387 $return[
'status'][
'message'] =
"(" . $e->getLine() .
") " . htmlspecialchars($e->getMessage(), ENT_QUOTES,
'UTF-8', FALSE);
388 $return[
'data'] = array();
393 function RDCUploadImage($dbh, $parms) {
394 if (!isset($parms[
'Cu']) || !isset($parms[
'depositid'])
395 || !isset($parms[
'FB'])) {
396 $response[
'response'] =
'false';
397 $response[
'message'] =
'Missing Parameters';
398 } elseif ($parms[
'FB'] !==
"F" && $parms[
'FB'] !==
"B") {
399 $response[
'response'] =
'false';
400 $response[
'message'] =
'Invalid Parameters';
401 } elseif (!is_uploaded_file($_FILES[
'upload_file'][
'tmp_name']) || ($_FILES[
'upload_file'][
'size'] < 1) || ($_FILES[
'upload_file'][
'error'] != 0)) {
405 switch ($_FILES[
'upload_file'][
'error']) {
407 $up_err =
"0: No error, file uploaded successfully.";
410 $up_err =
"1: Upload is larger than the upload_max_filesize directive in php.ini";
413 $up_err =
"2: Upload is larger than the MAX_FILE_SIZE directive.";
416 $up_err =
"3: File was only partially uploaded";
419 $up_err =
"4: No file was uploaded";
422 $up_err =
"6: Missing temporary folder";
425 $up_err =
"7: Failed to write file to disk";
428 $up_err =
"8: PHP extension blocked upload";
432 $up_err =
"Unknown upload error";
435 $response[
'response'] =
'false';
436 $response[
'message'] = $up_err;
439 } elseif (!getimagesize($_FILES[
'upload_file'][
'tmp_name'])) {
440 $response[
'response'] =
'false';
441 $response[
'message'] =
"File is not an image";
447 $response[
'response'] =
'true';
448 $response[
'message'] =
"Upload OK";
450 $uploads_dir = (isset($parms[
'uploads_dir']) ? $parms[
'uploads_dir'] :
"/tmp");
451 $tmp_name = $_FILES[
'upload_file'][
'tmp_name'];
452 $name = $_FILES[
'upload_file'][
'name'];
453 $savename =
"$uploads_dir/{$parms['depositid']}_$name";
454 if (!move_uploaded_file($tmp_name,
"$savename")) {
455 $response[
'response'] =
'false';
456 $response[
'message'] =
"Move Failed";
464 if ($response[
'response'] ==
'true') {
465 if ($parms[
'FB'] ==
'F') {
466 $updparms[
'frontpath'] =
"$savename";
467 $updparms[
'frontaccept'] =
"N";
469 $updparms[
'backpath'] =
"$savename";
470 $updparms[
'backaccept'] =
"N";
472 $updparms[
'rdcstatus'] =
'O';
473 $updparms[
'Cu'] = $parms[
'Cu'];
474 $updparms[
'depositid'] = $parms[
'depositid'];
475 $depostat = curdc_update($dbh, $updparms);
476 if ($depostat[
'status'][
'response'] ==
'false') {
478 $result[
'response'] =
'false';
479 $result[
'message'] =
'Update Deposit Status Failed';
483 $result[
'status'] = $response;
484 $result[
'data'] = array();
485 if ($response[
'response'] ==
'true') {
486 $result[
'data'][
'filename'] =
"$savename";
492 function embcurl($soapString, $soapHeaders, $soapServer, $soapCertfile =
'') {
494 CURLOPT_RETURNTRANSFER => 1,
495 CURLOPT_SSL_VERIFYPEER => 0,
496 CURLOPT_SSL_VERIFYHOST => 0,
499 CURLOPT_POSTFIELDS =>
"$soapString",
500 CURLOPT_URL =>
"$soapServer" 502 if (!empty($soapCertfile)) {
503 $curlopts[CURLOPT_SSLCERT] =
"$soapCertfile";
507 @curl_setopt_array($ch, $curlopts);
508 @curl_setopt($ch, CURLOPT_HTTPHEADER, $soapHeaders);
510 $response = @curl_exec($ch);
511 $respHTTP = curl_getinfo($ch, CURLINFO_HTTP_CODE);
512 if ($respHTTP >= 400 && $respHTTP < 600) {
513 # HTTP Response 4xx client error or 5xx server error 514 $response =
"HCUERROR: Connection Failed HTTP Error $respHTTP";
515 } elseif (curl_errno($ch)) {
516 # Bad! Don't hide the error, return the curl error if it occurred. 517 $response =
"HCUERROR: Connection Failed " . curl_error($ch);
532 function RDCvaliduser($dbh, $parms, $MC) {
537 $return[
'status'][
'response'] =
'true';
538 $return[
'status'][
'message'] =
'Success';
540 if (!isset($parms[
'Cu']) || !isset($parms[
'Uid']) || !isset($parms[
'MBRACCT']) || !isset($parms[
'rdcvendor'])) {
541 $return[
'status'][
'response'] =
'false';
542 $return[
'status'][
'message'] =
'Missing Parameters';
545 $parray[
'Cu'] = $parms[
'Cu'];
546 $parray[
'trustedid'] = $parms[
'rdcvendor'];
547 $trusted = cutd_read($dbh, $parray);
548 if ($trusted[
'status'][
'Response'] ==
'false') {
549 $return[
'status'][
'response'] =
'false';
550 $return[
'status'][
'message'] =
'RDC Service not configured';
555 $rdcparms = $trusted[
'data'][
"{$parms['Cu']}|{$parms['rdcvendor']}"];
557 $rdcparms[
'Cu'] = $parms[
'Cu'];
558 $rdcparms[
'Uid'] = $parms[
'Uid'];
559 $rdcparms[
'MBRACCT'] = $parms[
'MBRACCT'];
560 $rdcparms[
'Fset2'] = $parms[
'Fset2'];
561 $rdcparms[
'Fset3'] = $parms[
'Fset3'];
563 $hculist = RDCGetAccts($dbh, $rdcparms);
565 if ($hculist[
'status'][
'response'] ==
'false') {
567 $return[
'status'][
'response'] =
'false';
568 $return[
'status'][
'message'] = $hculist[
'status'][
'message'];
575 if ($rdcparms[
'HomeCUAuth']) {
576 $mbr_rdc = Get_RDCSetting($dbh, $HB_ENV, $parms[
'rdcvendor'], $parms[
'MBRACCT']);
577 if ($mbr_rdc[
'status'][
'code'] !=
'000') {
578 throw new Exception($mbr_rdc[
'status'][
'message'], $mbr_rdc[
'status'][
'code']);
580 $dl = $mbr_rdc[
'rdcsetting'];
581 if (abs(intval($dl)) == 0) {
583 $return[
'status'][
'response'] =
'false';
584 $return[
'data'][
'depositlimit'] = 0;
589 $HB_Notices_ary = Get_NoticeInfo($dbh, $HB_ENV, $MC,
'M',
"mblNoRDC",
true);
590 if ($HB_Notices_ary[
'status'][
'code'] ==
'000') {
591 $noticeData = $HB_Notices_ary[
"notice"][0][
"notice_text"];
595 if (strlen($noticeData)) {
596 $message = htmlspecialchars($noticeData);
598 $message =
"Account not permitted for Remote Deposit. Please contact the Credit Union for more information";
612 $return[
'status'][
'message'] = $message;
614 $return[
'data'][
'depositlimit'] = $dl;
619 function objectToArray($object) {
621 if (!is_object($object) && !is_array($object)) {
624 if (is_object($object)) {
625 $object = get_object_vars($object);
627 return array_map(
'objectToArray', $object);
630 function XMLIntoArray($arrObjData, $arrSkipIndices = array()) {
632 $xia[
'calledwith'] = print_r($arrObjData,
true);
635 if (is_object($arrObjData)) {
636 $arrObjData = get_object_vars($arrObjData);
637 $xia[
'afterobject'] = print_r($arrObjData,
true);
639 if (is_array($arrObjData)) {
640 foreach ($arrObjData as $index => $value) {
641 if (is_object($value) || is_array($value)) {
642 $value = XMLIntoArray($value, $arrSkipIndices);
644 if (in_array($index, $arrSkipIndices)) {
647 $arrData[$index] = $value;
661 function stampuser($dbh, $parms) {
662 $tstamp = mktime() - (2 * $parms[
'Clw']);
663 $onlyif = mktime() - (3 * $parms[
'Clw']);
665 $sql =
"update cuusers set pktstamp = $tstamp, 666 pktdate = '" . date(
"D M j Y H:i:s T") .
"', 668 where cu = '{$parms['Cu']}' 669 and user_name = '{$parms['MBRACCT']}' and pktstamp > $onlyif";
670 $sth = db_query($sql, $dbh);
676 return (db_affected_rows($sth));
681 function hcuGetRDCterms($dbh, $HB_ENV, $MC) {
684 $noticeInfo = Get_NoticeInfo($dbh, $HB_ENV, $MC,
"P",
"rdcTerms",
true);
685 if (HCU_array_item_count(
'notice', $noticeInfo) && HCU_array_key_value(
'notice_popup', $noticeInfo[
'notice'][0]) == 1 && strlen($noticeInfo[
'notice'][0][
'notice_text']) > 0) {
687 $noticeText = $noticeInfo[
'notice'][0][
'notice_text'];
688 $noticePopup = $noticeInfo[
'notice'][0][
'notice_popup'];
693 $return[
'status'][
'response'] =
'true';
694 $return[
'status'][
'code'] =
'000';
695 $return[
'status'][
'message'] =
'Success';
696 $return[
'data'][
'terms'] = $noticeText;
697 $return[
'data'][
'notice_popup'] = $noticePopup;
713 function Get_RDCSetting($dbh, $HB_ENV, $TrustID =
'mobilerdc', $pAcct) {
716 $mobilerdc = array();
718 $sql =
"select coalesce(rdcsetting,0) from {$Cu}memberacct 719 where accountnumber = '{$pAcct}'";
721 $sth = db_query($sql, $dbh);
722 if (db_num_rows($sth) == 0) {
724 $mobilerdc[
'status'][
'code'] =
'999';
725 $mobilerdc[
'status'][
'severity'] =
'ERROR';
726 $mobilerdc[
'status'][
'errors'][] =
"Account not found";
727 $mobilerdc[
'rdcsetting'] =
"0";
729 switch ($mobilerdc) {
732 list($rdcsetting) = db_fetch_array($sth, 0);
736 $mobilerdc[
'status'][
'code'] =
'000';
737 $mobilerdc[
'status'][
'severity'] =
'SUCCESS';
738 $mobilerdc[
'rdcsetting'] = $rdcsetting;
774 function HandleRDCRequest($HB_ENV, $pass) {
775 $reply_arr = array(
'STATUS' => array(
'CODE' => 0,
"MESSAGE" =>
""));
778 $dbh = $HB_ENV[
"dbh"];
782 $accessRights = Perm_AccessRights($dbh, $HB_ENV, array(
"feature" => FEATURE_MOBILE_RDC));
783 if (!HCU_array_key_value(
'access', $accessRights)) {
784 throw new Exception($HB_ENV[
'MC']->msg(
'Rights not set', HCU_DISPLAY_AS_HTML), 915);
788 $rdcparms[
'chome'] = $HB_ENV[
'chome'];
789 $rdcparms[
'Flang'] = $HB_ENV[
'Flang'];
790 $rdcparms[
'Cu'] = $HB_ENV[
'Cu'];
791 $rdcparms[
'Cn'] = $HB_ENV[
'Cn'];
792 $rdcparms[
'Uid'] = $HB_ENV[
'Uid'];
793 $rdcparms[
'Ml'] = $HB_ENV[
'Ml'];
794 $rdcparms[
'MBRACCT'] = $pass[
'MBRACCT'];
795 $rdcparms[
'passwith'] = $pass;
797 if (!isset($pass[
'DEPOSITID'])) {
798 $rdcparms[
'rdcvendor'] = $pass[
'RDCVENDOR'];
801 RDCsession($dbh, $rdcparms);
803 switch (
"{$rdcparms['rdcvendor']}") {
806 include_once (dirname(__FILE__) .
'/../library/rdcEnsenta.i');
809 $verVen =
"Bluepoint";
810 include_once (dirname(__FILE__) .
'/../library/rdcBluepoint.i');
813 $verVen =
"Catalyst";
814 include_once (dirname(__FILE__) .
'/../library/rdcTranzCap.i');
818 include_once (dirname(__FILE__) .
'/../library/rdcVSoft.i');
822 include_once (dirname(__FILE__) .
'/../library/rdcDigiliti.i');
826 include_once (dirname(__FILE__) .
'/../library/rdcRDCTest.i');
831 throw new Exception(
"Missing RDC vendor", 4001);
834 if ($verVen !=
"" && !hcu_checkService($dbh, $verVen)) {
835 $omsg = hcu_checkServiceMsg($dbh, $verVen);
836 throw new Exception($omsg, 2077);
838 RDCconfig($dbh, $rdcparms);
840 switch ($pass[
'RDC_ACTION']) {
842 $rdcsays = RDCauth($dbh, $HB_ENV, $MC, $rdcparms);
845 if ($rdcsays[
'status'][
'response'] ==
'false') {
846 if ($rdcsays[
'status'][
'code'] ==
'110' || $rdcsays[
'status'][
'code'] ==
'111') {
851 throw new Exception($rdcsays[
'status'][
'message'], $rcode);
854 'STATUS' => array(
'CODE' => 0),
855 'DEPOSITID' => $rdcsays[
'data'][
'depositid'],
856 'RDC_RESPONSE' => array(
'ACCOUNTS' => array()),
858 if (is_array($rdcsays[
'data'][
'accounts'])) {
859 foreach ($rdcsays[
'data'][
'accounts'] as $acct => $detl) {
860 $acct_arr = array(
'ACCTID' => $acct);
861 foreach ($detl as $key => $value) {
862 $key = strtoupper($key);
863 $acct_arr[$key] = htmlentities($value, ENT_NOQUOTES | ENT_XML1,
'UTF-8', FALSE);
865 $reply_arr[
'RDC_RESPONSE'][
'ACCOUNTS'][][
'ACCT'] = $acct_arr;
868 $reply_arr[
'RDC_RESPONSE'][
'TERMS'] = htmlentities(convertMicrosoftCharacters(HCU_array_key_value(
'terms', $rdcsays[
'data'])), ENT_NOQUOTES | ENT_XML1,
'UTF-8', FALSE);
869 $reply_arr[
'RDC_RESPONSE'][
'DEPMESSAGES'] = array();
870 if (isset($rdcsays[
'data'][
'depmessages'])) {
871 foreach ($rdcsays[
'data'][
'depmessages'] as $msg => $detl) {
872 $acct_arr = array(
'MSGID' => $msg);
873 foreach ($detl as $key => $value) {
874 $key = strtoupper($key);
875 $acct_arr[$key] = htmlentities($value, ENT_NOQUOTES | ENT_XML1,
'UTF-8', FALSE);
877 $reply_arr[
'RDC_RESPONSE'][
'DEPMESSAGES'][][
'MSG'] = $acct_arr;
884 if (!isset($pass[
'DEPOSITID'])) {
885 throw new Exception(
"Missing RDC parameters", 4001);
887 $rdcparms[
'depositid'] = $pass[
'DEPOSITID'];
888 $rdcsays = RDCaccept($dbh, $HB_ENV, $MC, $rdcparms);
890 if ($rdcsays[
'status'][
'response'] ==
'false') {
891 throw new Exception($rdcsays[
'status'][
'message'], 4020);
895 'STATUS' => array(
'CODE' => 0),
896 'RDC_RESPONSE' => array(
'DEPMESSAGES' => array()),
898 if (HCU_array_key_exists(
'data', $rdcsays)) {
899 if (is_array($rdcsays[
'data'][
'depmessages'])) {
900 foreach ($rdcsays[
'data'][
'depmessages'] as $msg => $detl) {
901 $item_arr = array(
'MSGID' => $msg);
902 foreach ($detl as $key => $value) {
903 if (is_array($detl)) {
904 $key = strtoupper($key);
905 $item_arr[$key] = htmlentities($value, ENT_NOQUOTES | ENT_XML1,
'UTF-8', FALSE);
908 $reply_arr[
'RDC_RESPONSE'][
'DEPMESSAGES'][][
'MSG'] = $item_arr;
916 if (!isset($pass[
'DEPOSITID']) || !isset($pass[
'FB']) ||
sizeof($_FILES) == 0) {
917 throw new Exception(
"Missing RDC parameters", 4001);
919 $rdcparms[
'uploads_dir'] =
"/home/{$HB_ENV['chome']}/sslforms/RDCImages";
920 $rdcparms[
'depositid'] = $pass[
'DEPOSITID'];
921 $rdcparms[
'FB'] = $pass[
'FB'];
922 $rdcsays = RDCUploadImage($dbh, $rdcparms);
924 if ($rdcsays[
'status'][
'response'] ==
'false') {
925 throw new Exception($rdcsays[
'status'][
'message'], 4030);
928 'STATUS' => array(
'CODE' => 0),
929 'RDC_RESPONSE' => array(
'MESSAGE' =>
'Image Upload Successful'),
935 if (!isset($pass[
'DEPOSITID']) || !isset($pass[
'AMOUNT']) || !isset($pass[
'ACCTID'])) {
936 throw new Exception(
"Missing RDC parameters", 4001);
938 $rdcparms[
'depositid'] = $pass[
'DEPOSITID'];
939 $rdcparms[
'acctid'] = $pass[
'ACCTID'];
940 $rdcparms[
'amount'] = $pass[
'AMOUNT'];
941 $rdcparms[
'rdcacctid'] = HCU_array_key_value(
'RDCACCTID', $pass);
942 $rdcparms[
'live'] = $HB_ENV[
'live'];
943 $rdcparms[
'Ml'] = $HB_ENV[
'Ml'];
944 $rdcparms[
'Clw'] = $HB_ENV[
'livewait'];
945 $rdcparms[
"Fset3"] = $HB_ENV[
"Fset3"];
946 $rdcparms[
'Fset2'] = $HB_ENV[
'Fset2'];
947 $rdcparms[
'Uid'] = $HB_ENV[
'Uid'];
949 if (HCU_array_key_value(
'POSTAWAY', $pass) == 1) {
950 $rdcparms[
'POSTAWAY'] = HCU_array_key_value(
'POSTAWAY', $pass);
957 $rdcsays = RDCdeposit($dbh, $rdcparms);
959 if ($rdcsays[
'status'][
'response'] ==
'false') {
960 throw new Exception($rdcsays[
'status'][
'message'], 4040);
963 if ($HB_ENV[
'live'] && HCU_array_key_value(
'refreshimmediate', $rdcparms)) {
965 $userData[
'accountnumbers'][] = HCU_array_key_value(
"MBRACCT", $pass);
966 $updResp = SetbackMemberStamps($HB_ENV, $HB_ENV[
'Uid'], $userData);
971 'STATUS' => array(
'CODE' => 0),
972 'RDC_RESPONSE' => array(),
975 foreach ($rdcsays[
'data'] as $key => $value) {
978 if (is_array($value)) {
979 foreach ($value as $msg => $detl) {
980 $reply_arr[
'RDC_RESPONSE'][
'RISKS'][][
'MSGTEXT'] = htmlentities(convertMicrosoftCharacters($detl[
'RiskDesc']), ENT_NOQUOTES | ENT_XML1,
'UTF-8', FALSE);
986 if (is_array($value)) {
987 foreach ($value as $msg => $detl) {
988 $reply_arr[
'RDC_RESPONSE'][
'RISKS'][][
'MSGTEXT'] = htmlentities(convertMicrosoftCharacters($detl), ENT_NOQUOTES | ENT_XML1,
'UTF-8', FALSE);
992 case 'LocalizedMessageText':
993 if (is_array($value)) {
994 foreach ($value as $msg => $detl) {
995 $reply_arr[
'RDC_RESPONSE'][
'RISKS'][][
'MSGTEXT'] = htmlentities(convertMicrosoftCharacters($detl), ENT_NOQUOTES | ENT_XML1,
'UTF-8', FALSE);
998 $reply_arr[
'RDC_RESPONSE'][
'RISKS'][][
'MSGTEXT'] = htmlentities(convertMicrosoftCharacters($value), ENT_NOQUOTES | ENT_XML1,
'UTF-8', FALSE);
1001 case 'SentToReview':
1002 if ($value ==
'true') {
1003 $reply_arr[
'RDC_RESPONSE'][
'RISKS'][][
'MSGTEXT'] = $key;
1006 case 'ReviewReasons':
1007 if (is_array($value[
'InReviewReason'])) {
1008 foreach ($value[
'InReviewReason'] as $msg => $detl) {
1009 $reply_arr[
'RDC_RESPONSE'][
'RISKS'][][
'MSGTEXT'] = $detl;
1012 $reply_arr[
'RDC_RESPONSE'][
'RISKS'][][
'MSGTEXT'] = HCU_array_key_value(
'InReviewReason', $value);
1016 $key = strtoupper($key);
1017 $reply_arr[
'RDC_RESPONSE'][$key] = $value;
1024 if (!isset($HB_ENV[
'Cn']) || !isset($pass[
'DEPOSITID'])) {
1026 throw new Exception(
"Missing RDC parameters", 4001);
1028 $rdcparms[
'Cn'] = $HB_ENV[
'Cn'];
1029 if (isset($pass[
'DAYS'])) {
1030 $rdcparms[
'numberofdays'] = $pass[
'DAYS'];
1033 if (isset($pass[
'LIMIT'])) {
1034 $rdcparms[
'translimit'] = $pass[
'LIMIT'];
1046 unset($rdcparms[
'depositid']);
1047 $depostat = curdc_list($dbh, $rdcparms);
1049 $rdcparms[
'depositid'] = $pass[
'DEPOSITID'];
1053 $depohist = RDChistorylist($dbh, $rdcparms);
1054 if ($depostat[
'status'][
'response'] ==
'false') {
1055 throw new Exception($depostat[
'status'][
'message'], 4040);
1056 } elseif ($depohist[
'status'][
'response'] ==
'false') {
1057 throw new Exception($depohist[
'status'][
'message'], 4040);
1060 $histlist = array();
1061 if (is_array($depohist[
'data'][
'TransactionList'])) {
1062 foreach ($depohist[
'data'][
'TransactionList'] as $key => $value) {
1063 if (!empty($value[
'ReceiptReferenceNo'])) {
1064 $receiptno = $value[
'ReceiptReferenceNo'];
1065 foreach ($value as $tag => $tval) {
1066 switch (strtolower($tag)) {
1067 case "transactionid":
1068 case "transactiondttm":
1069 case "receiptreferenceno":
1070 case "submittedamount":
1071 case "currentamount":
1072 case "amountdisplay":
1074 case "accountnumber":
1075 case "accountholdernumber":
1076 case "transactiontype":
1077 case "acceptedbydescr":
1078 case "statuschgdttm":
1080 case "statusdisplay":
1082 $histlist[$receiptno][strtolower($tag)] = $tval;
1086 $histlist[$receiptno][
'amountdisplay'] = HCU_array_key_value(
'submittedamount', $histlist[$receiptno]);
1087 if (HCU_array_key_value(
'currentamount', $histlist[$receiptno]) > 0) {
1088 $histlist[$receiptno][
'amountdisplay'] = HCU_array_key_value(
'currentamount', $histlist[$receiptno]);
1095 'STATUS' => array(
'CODE' => 0),
1096 'RDC_RESPONSE' => array(
'DEPOSITS' => array()),
1098 foreach ($depostat[
'data'] as $key => $value) {
1099 $item_arr = array();
1100 foreach ($value as $tag => $tval) {
1107 $tag = strtoupper($tag);
1108 $item_arr[$tag] = $tval;
1111 $item_arr[
'RDCSTATUS'] = $tval;
1115 $hcustat =
"Wait for Terms";
1120 $hcustat =
"Incomplete";
1123 $hcustat =
"Rejected";
1126 $hcustat =
"Submitted";
1132 $item_arr[
'HCUSTATUS'] = $hcustat;
1135 if (HCU_array_key_value(
'DEBUG', $pass) == 1) {
1136 $item_arr[
'VENDORINFO'] = print_r($tval,
true);
1142 if (HCU_array_key_value(
'TransactionReceiptNumber', $value[
'vendorinfo'])) {
1143 $item_arr[
'TRANSACTIONRECEIPTNUMBER'] = $value[
'vendorinfo'][
'TransactionReceiptNumber'];
1144 $receiptno = $value[
'vendorinfo'][
'TransactionReceiptNumber'];
1145 if (HCU_array_key_exists($receiptno, $histlist)) {
1146 if (!HCU_array_key_value(
'amountdisplay', $histlist[$receiptno])) {
1147 $histlist[$receiptno][
'amountdisplay'] = $value[
'amount'];
1149 foreach ($histlist[$receiptno] as $rtag => $rval) {
1150 $rtag = strtoupper($rtag);
1151 $item_arr[$rtag] = $rval;
1156 $item_arr[
'AMOUNTDISPLAY'] = $value[
'amount'];
1157 $item_arr[
'STATUS'] = $hcustat;
1158 if (HCU_array_key_value(
'Message', $value[
'vendorinfo'])) {
1159 $item_arr[
'STATUSDESCR'] = $value[
'vendorinfo'][
'Message'];
1160 $item_arr[
'STATUSDISPLAY'] =
"$hcustat {$value['vendorinfo']['Message']}";
1163 $reply_arr[
'RDC_RESPONSE'][
'DEPOSITS'][][
'DEPOSIT'] = $item_arr;
1171 throw new Exception(
"Unknown RDC Mode", 15550);
1174 }
catch (Exception $e) {
1175 $code = $e->getCode();
1178 if ($code == 0 || $code ==
"000") {
1181 $message = $e->getMessage();
1184 $reply_arr[
"STATUS"][
"CODE"] = $code;
1185 $reply_arr[
"STATUS"][
"MESSAGE"] = $message;
1224 function hcu_FwdRDC($p_dbh, $pFwdVendor, $pClient, $pMember) {
1228 $fwdItems = cutm_readdflt($p_dbh, Array(
'trustedid' => $pFwdVendor));
1229 if (HCU_array_key_value(
'Response', $fwdItems[
'status']) ==
'true') {
1230 if (HCU_array_key_exists(
"$pClient", $fwdItems[
'master'][
'trustedfields'])) {
1231 $fwdFlag = HCU_array_key_value(
'Default', $fwdItems[
'master'][
'trustedfields'][
"$pClient"]);
1232 # set up logging here 1233 $fwdFlag = trim($fwdFlag);
1234 if (strlen($fwdFlag) > 0) {
1235 $enable = $fwdFlag == -1;
1237 $fwdFlag = str_replace(
" ",
"", $fwdFlag);
1238 $testArray = explode(
",", $fwdFlag);
1239 $enable = in_array($pMember, $testArray);
1243 $bolRet = ($enable ? true :
false);
1246 }
catch (Exception $e) {