64 function RDCconfig($dbh, &$parms) {
65 $parms[
'pilot'] = (!isset($parms[
'pilot']) ? 0 : $parms[
'pilot']);
66 $parms[
'serviceurl'] = ($parms[
'pilot'] == 0 ? $parms[
'prodURL'] : $parms[
'pilotURL']);
67 $parms[
'acctttl'] = (!isset($parms[
'acctttl']) ?
'Select account' : $parms[
'acctttl']);
68 $parms[
'descttl'] = (!isset($parms[
'descttl']) ?
'Description' : $parms[
'descttl']);
77 function RDCauth($dbh, $HB_ENV, $MC, $parms) {
79 $return[
'status'][
'response'] =
'true';
80 $return[
'status'][
'code'] =
'000';
81 $return[
'status'][
'message'] =
'Success';
85 $parms[
'Fset2'] = $HB_ENV[
'Fset2'];
86 $hculist = RDCGetAccts($dbh, $parms);
88 if ($hculist[
'status'][
'response'] ==
'false') {
89 throw new Exception($hculist[
'status'][
'message'], $hculist[
'status'][
'code']);
92 if ($hculist[
'status'][
'response'] ==
'false') {
94 throw new Exception($hculist[
'status'][
'message'], $hculist[
'status'][
'code']);
102 $mbr_rdc = Get_RDCSetting($dbh, $HB_ENV, $parms[
'rdcvendor'], $parms[
'MBRACCT']);
105 if ($mbr_rdc[
'status'][
'code'] !=
'000') {
108 $dl = abs(intval(HCU_array_key_value(
'rdcsetting', $mbr_rdc)));
111 if ($parms[
'HomeCUAuth']) {
114 $HB_Notices_ary = Get_NoticeInfo($dbh, $HB_ENV, $MC,
'M',
"mblNoRDC",
true);
116 if ($HB_Notices_ary[
'status'][
'code'] ==
'000' && isset($HB_Notices_ary[
"notice"][0])) {
117 $noticeData = $HB_Notices_ary[
"notice"][0][
"notice_text"];
121 if (strlen($noticeData)) {
122 $message = $noticeData;
125 $message =
"Account not permitted for Remote Deposit. Please contact the Credit Union for more information";
128 throw new Exception($message, $code);
136 $pro = abs(intval(HCU_array_key_value(
'profileID', $parms)));
139 $dl = ($dl == 0 ? $pro : $dl);
143 $parms[
'depositlimit'] = abs(intval($dl));
148 $parms[
'rdcstatus'] =
'S';
150 if (HCU_array_key_value(
'HomeCUterms', $parms)) {
151 $rdcterms = hcuGetRDCterms($dbh, $HB_ENV, $MC);
152 if ($rdcterms[
'status'][
'response'] ==
'false') {
153 $e =
"HCU GetTerms call failed ({$rdcterms['status']['code']} {$rdcterms['status']['message']}";
154 throw new Exception($e, 301);
156 if ($rdcterms[
'data'][
'notice_popup'] == 1) {
157 $parms[
'rdcstatus'] =
'T';
160 $parms[
'rdcstatus'] =
'S';
162 $localTerms = HCU_array_key_value(
'terms', $rdcterms[
'data']);
167 $return = RDCPresentAccounts($parms, $hculist, $rdcterms);
168 if ($return[
'status'][
'response'] ==
'false') {
170 throw new Exception($return[
'status'][
'message'], $return[
'status'][
'code']);
173 $parms[
'vendorinfo'] = array(
174 "Vendortime" => mktime(),
175 "userAgent" => $_SERVER[
'HTTP_USER_AGENT'],
176 "userIP" => $_SERVER[
'REMOTE_ADDR'],
177 "accounts" => $return[
'data'][
'accounts'],
178 "depositlimit" => intval($dl)
183 $depostat = curdc_start($dbh, $parms);
184 if ($depostat[
'status'][
'response'] ==
'false') {
186 throw new Exception(
'HomeCU Start Deposit Failed', 200);
188 $parms[
'depositid'] = $depostat[
'data'][
'depositid'];
190 $return[
'data'][
'depositid'] = $parms[
'depositid'];
191 $return[
'data'][
'accounts'] = $parms[
'vendorinfo'][
'accounts'];
192 $return[
'data'][
'terms'] = $localTerms;
194 $depostat = curdc_setvinfo($dbh, array(
195 'Cu' => $parms[
'Cu'],
'depositid' => $parms[
'depositid'],
196 'vendorinfo' => json_encode($parms[
'vendorinfo'])
198 if ($depostat[
'status'][
'response'] ==
'false') {
200 throw new Exception($depostat[
'status'][
'message'], $depostat[
'status'][
'code']);
202 }
catch (Exception $e) {
203 $return[
'status'][
'response'] =
'false';
204 $return[
'status'][
'code'] = $e->getCode();
205 $return[
'status'][
'message'] =
"(" . $e->getLine() .
") " . htmlspecialchars($e->getMessage(), ENT_QUOTES,
'UTF-8', FALSE);
216 function RDCaccept($dbh, $HB_ENV, $MC, $parms) {
218 $return[
'status'][
'response'] =
'true';
219 $return[
'status'][
'code'] =
'000';
220 $return[
'status'][
'message'] =
'Success';
223 if (!isset($parms[
'Cu']) || !isset($parms[
'depositid'])) {
224 throw new Exception(
'Missing Parameters', 100);
228 $depo = curdc_read($dbh, $parms);
229 if ($depo[
'status'][
'response'] ==
'false') {
230 throw new Exception(
'HomeCU DepositID not found', 205);
235 $noticeInfo = Get_NoticeInfo($dbh, $HB_ENV, $MC,
"P",
"rdcTerms",
false);
236 if ($noticeInfo[
"status"][
"code"] ==
"000" &&
sizeof($noticeInfo[
'notice']) && intval($noticeInfo[
'notice'][0][
'notice_id']) > 0) {
238 $HB_ENV[
'HCUPOST'][
'notice_id'] = $noticeInfo[
'notice'][0][
'notice_id'];
239 $HB_ENV[
'HCUPOST'][
'notice_type'] = $noticeInfo[
'notice'][0][
'notice_type'];
240 $HB_ENV[
'HCUPOST'][
'notice_device'] =
'P';
241 $HB_ENV[
"HCUPOST"][
'notice_response'] = array(
"answer" => 1);
243 $HB_ENV[
"HCUPOST"][
'notice_cancel'] =
"0";
244 $HB_ENV[
'HCUPOST'][
'notice_msg_show'] = 1;
245 $noticeUpd = Update_NoticeInfo($dbh, $HB_ENV, $MC);
247 $return[
'status'][
'message'] =
'Accept Terms OK';
248 $vendorinfo = $depo[
'vendorinfo'];
249 $vendorinfo[
'terms'] =
'';
250 $vendorinfo[
'Vendortime'] = mktime();
251 $parms[
'vendorinfo'] = $vendorinfo;
255 $parms[
'rdcstatus'] =
'O';
257 $depostat = curdc_setvinfo($dbh, array(
258 'Cu' => $parms[
'Cu'],
'depositid' => $parms[
'depositid'],
259 'rdcstatus' => $parms[
'rdcstatus'],
'vendorinfo' => json_encode($parms[
'vendorinfo'])
261 if ($depostat[
'status'][
'response'] ==
'false') {
263 throw new Exception($depostat[
'status'][
'message'], $depostat[
'status'][
'code']);
265 }
catch (Exception $e) {
266 $return[
'status'][
'response'] =
'false';
267 $return[
'status'][
'code'] = $e->getCode();
268 $return[
'status'][
'message'] =
"(" . $e->getLine() .
") " . htmlspecialchars($e->getMessage(), ENT_QUOTES,
'UTF-8', FALSE);
280 function RDChistorylist($dbh, $parms) {
282 $return[
'status'][
'response'] =
'true';
283 $return[
'status'][
'code'] =
'000';
284 $return[
'status'][
'message'] =
'Success';
287 if (!isset($parms[
'Cu']) || !isset($parms[
'depositid'])) {
288 throw new Exception(
'Missing Parameters', 100);
292 $depo = curdc_read($dbh, $parms);
293 if ($depo[
'status'][
'response'] ==
'false') {
294 throw new Exception(
"HomeCU DepositID not found [{$parms['depositid']}]", 205);
297 $rdcresult = vsoftHistory($parms);
299 if ($rdcresult[
'status'][
'response'] ==
'false') {
300 throw new Exception(
'Vsoft History call failed ' . $rdcresult[
'status'][
'message'], 305);
305 $return[
'status'][
'message'] =
'Vsoft History List OK';
307 $vendorinfo[
'Vendortime'] = mktime();
308 $parms[
'vendorinfo'] = $vendorinfo;
312 $depostat = curdc_setvinfo($dbh, array(
313 'Cu' => $parms[
'Cu'],
'depositid' => $parms[
'depositid'],
314 'vendorinfo' => json_encode($parms[
'vendorinfo'])
316 if ($depostat[
'status'][
'response'] ==
'false') {
318 throw new Exception($depostat[
'status'][
'message'], $depostat[
'status'][
'code']);
320 $return[
'data'][
'TransactionList'] = $rdcresult[
'data'];
321 $return[
'data'][
'rdcvendor'] = $depo[
'data'][
'rdcvendor'];
322 }
catch (Exception $e) {
323 $return[
'status'][
'response'] =
'false';
324 $return[
'status'][
'code'] = $e->getCode();
325 $return[
'status'][
'message'] =
"(" . $e->getLine() .
") " . htmlspecialchars($e->getMessage(), ENT_QUOTES,
'UTF-8', FALSE);
337 function RDChistorydetl($dbh, $parms) {
339 $return[
'status'][
'response'] =
'true';
340 $return[
'status'][
'code'] =
'000';
341 $return[
'status'][
'message'] =
'Success';
344 if (!isset($parms[
'Cu']) || !isset($parms[
'transactionid']) || !isset($parms[
'depositid'])) {
345 throw new Exception(
'Missing Parameters', 100);
349 $depo = curdc_read($dbh, $parms);
350 if ($depo[
'status'][
'response'] ==
'false') {
351 throw new Exception(
'HomeCU DepositID not found', 205);
354 $depostat = curdc_setvinfo($dbh, array(
355 'Cu' => $parms[
'Cu'],
'depositid' => $parms[
'depositid'],
356 'vendorinfo' => json_encode($parms[
'vendorinfo'])
358 if ($depostat[
'status'][
'response'] ==
'false') {
360 throw new Exception($depostat[
'status'][
'message'], $depostat[
'status'][
'code']);
362 $return[
'data'] = $rdcresult[
'data'];
363 }
catch (Exception $e) {
364 $return[
'status'][
'response'] =
'false';
365 $return[
'status'][
'code'] = $e->getCode();
366 $return[
'status'][
'message'] =
"(" . $e->getLine() .
") " . htmlspecialchars($e->getMessage(), ENT_QUOTES,
'UTF-8', FALSE);
380 function RDCdeposit($dbh, $parms) {
382 $return[
'status'][
'response'] =
'true';
383 $return[
'status'][
'message'] =
'Success';
384 $return[
'status'][
'code'] =
'000';
387 $parms[
'SessionId'] = time();
390 !isset($parms[
'Cu']) || !isset($parms[
'depositid']) ||
391 !isset($parms[
'amount']) || !isset($parms[
'acctid'])
393 throw new Exception(
'Missing Parameters', 100);
402 $depo = curdc_read($dbh, $parms);
403 if ($depo[
'status'][
'response'] ==
'false') {
404 throw new Exception(
'HomeCU DepositID not found', 205);
407 switch ($depo[
'data'][
'status']) {
409 $fail =
'Must accept terms of use before depositing funds';
412 $fail =
'Deposit has been rejected';
415 $fail =
'Deposit already completed';
419 if (!isset($parms[
'POSTAWAY'])) {
420 $fail =
'Deposit requires override confirmation';
425 throw new Exception($fail, 229);
427 if (is_null($depo[
'data'][
'frontpath']) || is_null($depo[
'data'][
'backpath']) || !getimagesize($depo[
'data'][
'frontpath']) || !getimagesize($depo[
'data'][
'backpath'])) {
428 throw new Exception(
'Check Images not found', 220);
430 $vendorinfo = $depo[
'data'][
'vendorinfo'];
433 $depostat = curdc_update($dbh, array(
434 'Cu' => $parms[
'Cu'],
'depositid' => $parms[
'depositid'],
435 'amount' => $parms[
'amount'],
'acctid' => $parms[
'acctid']
437 if ($depostat[
'status'][
'response'] ==
'false') {
438 throw new Exception(
'HomeCU Update Deposit Amount Failed', 225);
441 $acctid = $parms[
'acctid'];
442 $hculist = RDCGetAccts($dbh, $parms, $acctid);
444 if ($hculist[
'status'][
'response'] !==
'true') {
445 throw new Exception(
'Invalid Deposit Account', 230);
447 $parms[
'depositlimit'] = $vendorinfo[
'depositlimit'];
448 $parms[
'depositAcct'] = $hculist[
'data'][$acctid][
'suffix'];
449 switch ($hculist[
'data'][$acctid][
'rdctype']) {
451 $parms[
'depositType'] = 3;
454 $parms[
'depositType'] = 1;
457 $parms[
'depositType'] = 2;
472 $vsofttran = vsoftStartTran($parms);
474 if ($vsofttran[
'status'][
'response'] !==
'true') {
475 throw new Exception(
'Start Session failed' . $vsofttran[
'status'][
'message'], 231);
488 $parms[
'SessionId'] = $vsofttran[
'data'][
'SessionId'];
489 $parms[
'FrontImage'] = base64_encode(file_get_contents($depo[
'data'][
'frontpath']));
490 $parms[
'RearImage'] = base64_encode(file_get_contents($depo[
'data'][
'backpath']));
491 $rdcresult = vsoftProcess($parms);
493 if ($rdcresult[
'status'][
'response'] ==
'false') {
494 throw new Exception(
'Deposit failed ' . $rdcresult[
'status'][
'message'], 243);
499 if ($rdcresult[
'data'][
'ReturnValue'] !==
'true') {
500 # process was rejected - figure out why 501 $rejectfor =
"{$rdcresult['data']['ErrorCode']} - {$rdcresult['data']['ErrorDesc']}";
502 $parms[
'rdcstatus'] =
'R';
503 $vendorinfo[
'Vendortime'] = mktime();
504 $vendorinfo[
'DepositStatus'] = $rejectfor;
505 $vendorinfo[
'DepositTime'] = date(
'YmdHis');
506 $depostat = curdc_setvinfo($dbh, array(
507 'Cu' => $parms[
'Cu'],
'depositid' => $parms[
'depositid'],
508 'rdcstatus' => $parms[
'rdcstatus'],
'vendorinfo' => json_encode($vendorinfo)
510 throw new Exception(
"Deposit Rejected: $rejectfor", 241);
513 $parms[
'ReturnValue'] = 1;
514 $rdcresult = vsoftAck($parms);
515 if ($rdcresult[
'status'][
'response'] !==
'true' || $rdcresult[
'data'][
'ReturnValue'] !==
'true') {
516 if ($rdcresult[
'status'][
'response'] !==
'true') {
517 $rejectfor = $rdcresult[
'status'][
'message'];
519 $rejectfor =
"{$rdcresult['data']['ErrorCode']} - {$rdcresult['data']['ErrorDesc']}";
522 $parms[
'rdcstatus'] =
'R';
523 $vendorinfo[
'Vendortime'] = mktime();
524 $vendorinfo[
'DepositStatus'] =
"VsoftACK failed: $rejectfor";
525 $vendorinfo[
'DepositTime'] = date(
'YmdHis');
526 $depostat = curdc_setvinfo($dbh, array(
527 'Cu' => $parms[
'Cu'],
'depositid' => $parms[
'depositid'],
528 'rdcstatus' => $parms[
'rdcstatus'],
'vendorinfo' => json_encode($vendorinfo)
531 throw new Exception(
"{$rdcresult['data']['ErrorCode']} - {$rdcresult['data']['ErrorDesc']}", 231);
533 $parms[
'rdcstatus'] =
'C';
534 $vendorinfo[
'Vendortime'] = mktime();
535 $vendorinfo[
'DepositStatus'] =
"Complete";
536 $vendorinfo[
'TransactionReceiptNumber'] = $rdcresult[
'data'][
'ConfirmationId'];
537 $vendorinfo[
'TransactionDateTime'] = date(
'c');
538 $depostat = curdc_setvinfo($dbh, array(
539 'Cu' => $parms[
'Cu'],
'depositid' => $parms[
'depositid'],
'frontaccept' =>
'Y',
540 'backaccept' =>
'Y',
'rdcstatus' => $parms[
'rdcstatus'],
'vendorinfo' => json_encode($vendorinfo)
542 if ($depostat[
'status'][
'response'] ==
'false') {
543 throw new Exception(
'HomeCU Update Vendorinfo Failed', 240);
545 $return[
'status'][
'response'] =
'true';
546 $return[
'status'][
'message'] =
'Vsoft Deposit Complete';
549 $return[
'data'] = $rdcresult[
'data'];
550 $return[
'data'][
'depositid'] = $parms[
'depositid'];
551 $return[
'data'][
'rdcstatus'] = $parms[
'rdcstatus'];
553 $return[
'data'][
'TransactionReceiptNumber'] = $rdcresult[
'data'][
'ConfirmationId'];
554 $return[
'data'][
'TransactionDateTime'] = date(
'c');
555 $return[
'data'][
'MaskedAccountholderNumber'] = $vendorinfo[
'accounts'][$acctid][
'suffix'];
557 $hcumessage =
"Your deposit request for account {$vendorinfo['accounts'][$acctid]['suffix']} has been received";
558 $hcumessage .=
". Your confirmation number is '{$rdcresult['data']['ConfirmationId']}'. ";
559 $hcumessage .=
"Please save this number and refer to it if you need to contact the credit union regarding this transaction. ";
561 $return[
'data'][
'HCUReceiptMessage'] = $hcumessage;
563 }
catch (Exception $e) {
564 $return[
'status'][
'response'] =
'false';
565 $return[
'status'][
'code'] = $e->getCode();
566 $return[
'status'][
'message'] =
"(" . $e->getLine() .
") " . htmlspecialchars($e->getMessage(), ENT_QUOTES,
'UTF-8', FALSE);
571 function RDCGetAccts($dbh, $parms, $Acctid =
"") {
574 if (!isset($parms[
'Cu']) || !isset($parms[
'Cn'])) {
575 $AcctList[
'status'][
'response'] =
'false';
576 $AcctList[
'status'][
'code'] =
'910';
577 $AcctList[
'status'][
'message'] =
'Missing RDC Account Parameters';
584 $Cn = $parms[
'MBRACCT'];
585 $Fset2 = $parms[
'Fset2'];
586 $balwhere = $parms[
'balwhere'];
587 $lnwhere = $parms[
'lnwhere'];
590 $rtxn = (
sizeof($parms[
'rtxn']) == 0 ?
591 array(
'AT' => 1,
'LP' => 1,
'CP' => 1) : json_decode($parms[
'rtxn'], TRUE));
592 $savingsql = (!isset($parms[
'savingsql']) ?
593 "trim(accounttype)" : $parms[
'savingsql']);
594 $draftsql = (!isset($parms[
'draftsql']) ?
595 "trim(accounttype)" : $parms[
'draftsql']);
596 $loansql = (!isset($parms[
'loansql']) ?
597 "trim(loannumber)" : $parms[
'loansql']);
598 $mbrsql = (!isset($parms[
'mbrsql']) ?
599 "trim(accountnumber)" : $parms[
'mbrsql']);
602 $sql =
"select ht.trancode, trim(t.trandesc), trim(ht.cudesc), t.specialproc 603 from cutrans t, cuhavetrans ht 605 and ht.trancode = t.trancode\n";
607 $sth = db_query($sql, $dbh);
612 for ($row = 0; list($code, $desc, $cudesc, $spec) = db_fetch_array($sth, $row); $row++) {
614 $code} = array($desc, $spec, $cudesc);
616 db_free_result($sth);
625 $sv_rdctype = (!isset($parms[
'Sv_rdctype']) ?
'0' : $parms[
'Sv_rdctype']);
626 $ck_rdctype = (!isset($parms[
'Ck_rdctype']) ?
'1' : $parms[
'Ck_rdctype']);
627 $ln_rdctype = (!isset($parms[
'Ln_rdctype']) ?
'128' : $parms[
'Ln_rdctype']);
632 $sv_rdctype = (str_word_count($sv_rdctype, 0,
'0123456789') > 1 ? $sv_rdctype :
"'$sv_rdctype'");
633 $ck_rdctype = (str_word_count($ck_rdctype, 0,
'0123456789') > 1 ? $ck_rdctype :
"'$ck_rdctype'");
634 $ln_rdctype = (str_word_count($ln_rdctype, 0,
'0123456789') > 1 ? $ln_rdctype :
"'$ln_rdctype'");
638 if (HCU_array_key_exists(
'AT', $txncodes) && HCU_array_key_exists(
'AT', $rtxn)) {
643 $sql =
"SELECT 'D' as tbl, 644 $mbrsql as rdcmember, trim(description) as desc, 645 trim(accounttype) as accounttype, $savingsql as suffix, certnumber as cert, 646 $sv_rdctype as rdctype, 'SAVINGS ACCOUNT' as rdcdesc 647 FROM ${Cu}accountbalance 648 WHERE accountnumber = '$Cn' $balwhere 649 AND upper(deposittype) in ('S','N') 651 SELECT 'D', $mbrsql as rdcmember, 652 trim(description), trim(accounttype), $draftsql, 653 certnumber, $ck_rdctype, 'CHECKING ACCOUNT' 654 FROM ${Cu}accountbalance 655 WHERE accountnumber = '$Cn' $balwhere 656 AND upper(deposittype) = 'Y' ";
661 if (HCU_array_key_exists(
'LP', $txncodes) && HCU_array_key_exists(
'LP', $rtxn)) {
664 SELECT 'L', $mbrsql as rdcmember, trim(description), 665 trim(loannumber), $loansql,'0', $ln_rdctype, 'LOAN' 666 FROM ${Cu}loanbalance 667 WHERE accountnumber = '$Cn' $lnwhere 668 AND currentbalance >0 ";
669 if (($Fset2 & $CU2_SPEC18) == $CU2_SPEC18) {
670 $sql .=
" and (type <> '18' or type is null) ";
673 SELECT 'C', $mbrsql as rdcmember, trim(description), 674 trim(loannumber), $loansql, '0', $ln_rdctype, 'CREDIT CARD' 675 FROM ${Cu}loanbalance 676 WHERE accountnumber = '$Cn' $lnwhere 678 if (($Fset2 & $CU2_CC18SHOWZERO) != $CU2_CC18SHOWZERO) {
679 $sql .=
" and currentbalance > 0 ";
684 $sql .=
" order by 5,2,3";
685 $acct_rs = db_query($sql, $dbh);
687 if (db_num_rows($acct_rs) == 0) {
688 $AcctList[
'status'][
'response'] =
'false';
689 $AcctList[
'status'][
'code'] =
'920';
690 $AcctList[
'status'][
'message'] = htmlspecialchars(
'No Eligible RDC <test>Accounts', ENT_QUOTES,
'UTF-8', FALSE);
691 $AcctList[
'status'][
'sql'] = $sql;
694 $AcctList[
'status'][
'response'] =
'true';
695 $AcctList[
'status'][
'code'] =
'000';
696 $AcctList[
'status'][
'message'] =
'Success';
697 for ($row = 0; $drow = db_fetch_array($acct_rs, $row); $row++) {
699 $desc = $drow[
'desc'];
700 $accounttype = $drow[
'accounttype'];
701 $suffix = $drow[
'suffix'];
702 $cert = $drow[
'cert'];
703 $rdctype = $drow[
'rdctype'];
706 $rdcdesc =
'Savings';
709 $rdcdesc =
'Checking';
712 $rdcdesc =
'CreditCard';
718 $rdcdesc =
'Savings';
721 $rdcmember = $drow[
'rdcmember'];
722 if (strpos($accounttype,
"@")) {
723 list($jtype, $jacct) = explode(
"@", $accounttype);
726 $jtype = $accounttype;
730 $tokn = sha1(
"${Cn}${accounttype}${Cu}${rdctype}obl1vi0u5");
734 $desc = ($desc ==
'' ?
'_' :
"$desc - $accounttype");
735 $desc = htmlspecialchars($desc, ENT_QUOTES,
'UTF-8', FALSE);
736 $displaydesc = ($cert == 0 ?
"{$drow['desc']} - $accounttype" :
"{$drow['desc']} # $cert - $accounttype");
737 $displaydesc = htmlspecialchars($displaydesc, ENT_QUOTES,
'UTF-8', FALSE);
739 $Accts[
"$tbl|$jacct|$jtype|$cert"][
'accounttype'] = $accounttype;
740 $Accts[
"$tbl|$jacct|$jtype|$cert"][
'suffix'] = $suffix;
741 $Accts[
"$tbl|$jacct|$jtype|$cert"][
'certnumber'] = $cert;
742 $Accts[
"$tbl|$jacct|$jtype|$cert"][
'acctclass'] = $tbl;
743 $Accts[
"$tbl|$jacct|$jtype|$cert"][
'description'] = $desc;
744 $Accts[
"$tbl|$jacct|$jtype|$cert"][
'tokn'] =
"$tokn";
745 $Accts[
"$tbl|$jacct|$jtype|$cert"][
'member'] =
"$Cn";
746 $Accts[
"$tbl|$jacct|$jtype|$cert"][
'tomember'] =
"$Cn";
747 $Accts[
"$tbl|$jacct|$jtype|$cert"][
'trust'] =
"$trust";
748 $Accts[
"$tbl|$jacct|$jtype|$cert"][
'displaydesc'] =
"$displaydesc";
749 $Accts[
"$tbl|$jacct|$jtype|$cert"][
'rdctype'] = $rdctype;
750 $Accts[
"$tbl|$jacct|$jtype|$cert"][
'rdcdesc'] = $rdcdesc;
751 $Accts[
"$tbl|$jacct|$jtype|$cert"][
'rdcmember'] = $rdcmember;
754 if (!empty($Acctid)) {
756 $AcctList[
'data'][$Acctid] = $Accts[$Acctid];
758 $AcctList[
'data'] = $Accts;
808 function RDCPresentAccounts($parms, $hculist, $rdcterms) {
814 $pass_along[
'data'][
'accounts'] = $hculist[
'data'];
817 if (
sizeof($rdcterms) > 0)
818 $pass_along[
'data'][
'terms'] = $rdcterms[
'data'][
'terms'];
819 $pass_along[
'status'][
'response'] =
'true';
820 $pass_along[
'status'][
'code'] =
'000';
821 $pass_along[
'status'][
'message'] =
'Success';
825 function vsoftStartTran($parms) {
842 $parms[
'SessionId'] = time();
843 if (!isset($parms[
'InstID']) || !isset($parms[
'serviceurl']) ||
844 !isset($parms[
'Cn']) ||
845 !isset($parms[
'depositAcct']) ||
846 !isset($parms[
'depositType']) ||
847 !isset($parms[
'depositlimit'])) {
848 throw new Exception(
"Missing Parameters " . print_r($parms,
true));
851 $soapString =
'<?xml version="1.0" encoding="utf-8"?>';
853 $soapString .=
'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:val="http://validationservice.vsoftcorp.com/">';
854 $soapString .=
"<soapenv:Header/> 858 <val:InstId>{$parms['InstID']}</val:InstId> 859 <val:ApplicationId>6</val:ApplicationId> 860 <val:UserId>{$parms['Cn']}</val:UserId> 861 <val:Email>" . urldecode($parms[
'Ml']) .
"</val:Email> 862 <val:AccountNumber>{$parms['depositAcct']}</val:AccountNumber> 863 <val:AccountType>{$parms['depositType']}</val:AccountType> 864 <val:ImageFormat>1</val:ImageFormat> 865 <val:ImageView>0</val:ImageView> 866 <val:ProfileId>{$parms['depositlimit']}</val:ProfileId> 867 <val:ReturnImage>0</val:ReturnImage> 871 </soapenv:Envelope>\n";
873 $cmd =
"/usr/bin/curl --silent --cacert /etc/ssl/certs/ValiCert.crt --data-binary '$soapString' -H 'Content-Type: text/xml; charset=utf-8'";
874 $cmd .=
" -H 'SOAPAction: \"http://validationservice.vsoftcorp.com/StartTran\"'";
875 $cmd .=
" {$parms['serviceurl']}";
877 $soapHeaders = array();
878 $soapHeaders[] =
"Content-Type: text/xml; charset=utf-8";
879 $soapHeaders[] =
'SOAPAction: "http://validationservice.vsoftcorp.com/StartTran"';
880 $response = embcurl($soapString, $soapHeaders, $parms[
'serviceurl']);
882 if ($parms[
"logging"] ==
"enabled") {
883 $logParms = $parms[
"environment"];
884 $logParms[
"SSOVendor"] = $parms[
'rdcvendor'];
885 $logParms[
"token"] = $parms[
'SessionId'];
886 $logParms[
"txnId"] = time();
887 $logParms[
"logPoint"] =
"StartTran";
888 $logParms[
"request"] = $cmd;
889 $logParms[
"reply"] = $response;
890 LogSSOActivity($logParms);
893 $pos = strpos($response,
'HCUERROR: ');
894 if ($pos !==
false) {
895 throw new Exception(substr($response, $pos));
897 if (empty($response)) {
898 throw new Exception(
"Empty Response");
901 $xmlreturn = vsoftGetXMLResponse($response,
'StartTranResult',
'http://validationservice.vsoftcorp.com/');
902 if (!is_array($xmlreturn)) {
903 throw new Exception(
"RDC Invalid XML Response");
906 if (!$xmlreturn[0][
'ReturnValue']) {
907 throw new Exception(
"{$xmlreturn[0]['ErrorDesc']} - {$xmlreturn[0]['ErrorCode']}");
909 $return[
'status'][
'response'] =
'true';
910 $return[
'status'][
'message'] =
'Success';
911 $return[
'data'] = $xmlreturn[0];
913 }
catch (Exception $e) {
914 $return[
'status'][
'response'] =
'false';
915 $return[
'status'][
'message'] = $e->getMessage();
916 $return[
'status'][
'raw'] =
"$response";
928 function vsoftProcess($parms) {
931 if (!isset($parms[
'SessionId']) || !isset($parms[
'serviceurl']) ||
932 !isset($parms[
'amount']) ||
933 !isset($parms[
'FrontImage']) ||
934 !isset($parms[
'RearImage'])) {
936 if (!isset($parms[
'SessionId']))
937 $str .=
"SessionId ";
938 if (!isset($parms[
'serviceurl']))
939 $str .=
"serviceurl ";
940 if (!isset($parms[
'amount']))
942 if (!isset($parms[
'FrontImage']))
943 $str .=
"FrontImage ";
944 if (!isset($parms[
'RearImage']))
945 $str .=
"RearImage ";
947 throw new Exception(
"Missing Parameters ($str)");
950 $soapString =
'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:val="http://validationservice.vsoftcorp.com/">';
951 $soapString .=
"<soapenv:Header/> 955 <val:SessionId>{$parms['SessionId']}</val:SessionId> 957 $soapString .= sprintf(
'%.2f', $parms[
'amount'] * .01);
958 $soapString .=
"</val:Amount> 959 <val:FrontImage>{$parms['FrontImage']}</val:FrontImage> 960 <val:RearImage>{$parms['RearImage']}</val:RearImage> 964 </soapenv:Envelope>\n";
966 $cmd =
"/usr/bin/curl --silent --cacert /etc/ssl/certs/ValiCert.crt --data-binary '$soapString' -H 'Content-Type: text/xml; charset=utf-8'";
967 $cmd .=
" -H 'SOAPAction: \"http://validationservice.vsoftcorp.com/Process\"'";
968 $cmd .=
" {$parms['serviceurl']}";
970 $soapHeaders = array();
971 $soapHeaders[] =
"Content-Type: text/xml; charset=utf-8";
972 $soapHeaders[] =
'SOAPAction: "http://validationservice.vsoftcorp.com/Process"';
973 $response = embcurl($soapString, $soapHeaders, $parms[
'serviceurl']);
976 $logRequest = $soapString;
977 $startpos = strpos($logRequest,
':FrontImage>') + 12;
978 $endpos = strrpos($logRequest,
'</val:FrontImage>');
979 $logRequest = substr_replace($logRequest,
" Base64-encode parms['CheckFront'] ", $startpos, $endpos - $startpos);
980 $startpos = strpos($logRequest,
'<val:RearImage>') + 15;
981 $endpos = strrpos($logRequest,
'</val:RearImage>');
982 $logRequest = substr_replace($logRequest,
" Base64-encode parms['CheckBack'] ", $startpos, $endpos - $startpos);
994 if ($parms[
"logging"] ==
"enabled") {
995 $logParms = $parms[
"environment"];
996 $logParms[
"SSOVendor"] = $parms[
'rdcvendor'];
997 $logParms[
"token"] = $parms[
'SessionId'];
998 $logParms[
"txnId"] = time();
999 $logParms[
"logPoint"] =
"Process";
1000 $logParms[
"request"] =
"Request HDRs: " . print_r($soapHeaders,
true);
1001 $logParms[
"request"] .=
"Request URL: {$parms['serviceurl']}\n";
1002 $logParms[
"request"] .=
"Request String: $logRequest\n";
1003 $logParms[
"reply"] = $response;
1004 LogSSOActivity($logParms);
1007 $pos = strpos($response,
'HCUERROR: ');
1008 if ($pos !==
false) {
1009 throw new Exception(substr($response, $pos));
1011 if (empty($response)) {
1012 throw new Exception(
"Empty Response");
1015 $xmlreturn = vsoftGetXMLResponse($response,
'ProcessResult',
'http://validationservice.vsoftcorp.com/');
1017 if (!is_array($xmlreturn)) {
1018 throw new Exception(
"RDC Invalid XML Response");
1021 if (!$xmlreturn[0][
'ReturnValue']) {
1022 throw new Exception(
"{$xmlreturn[0]['ErrorDesc']} - {$xmlreturn[0]['ErrorCode']}");
1024 $return[
'status'][
'response'] =
'true';
1025 $return[
'status'][
'message'] =
'Success';
1026 $return[
'data'] = $xmlreturn[0];
1028 }
catch (Exception $e) {
1029 $return[
'status'][
'response'] =
'false';
1030 $return[
'status'][
'message'] = $e->getMessage();
1032 $return[
'data'] = $xmlreturn[0];
1042 function vsoftAck($parms) {
1045 if (!isset($parms[
'SessionId']) || !isset($parms[
'serviceurl']) ||
1046 !isset($parms[
'ReturnValue'])) {
1047 throw new Exception(
"Missing Parameters");
1049 $soapString =
'<?xml version="1.0" encoding="utf-8"?>';
1051 $soapString .=
'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:val="http://validationservice.vsoftcorp.com/"> 1053 $soapString .=
"<soapenv:Body> 1054 <val:Acknowledgment> 1056 <val:SessionId>{$parms['SessionId']}</val:SessionId> 1057 <val:ReturnValue>{$parms['ReturnValue']}</val:ReturnValue> 1059 </val:Acknowledgment> 1061 </soapenv:Envelope>\n";
1063 $cmd =
"/usr/bin/curl --silent --cacert /etc/ssl/certs/ValiCert.crt --data-binary '$soapString' -H 'Content-Type: text/xml; charset=utf-8'";
1064 $cmd .=
" -H 'SOAPAction: \"http://validationservice.vsoftcorp.com/Acknowledgment\"'";
1065 $cmd .=
" {$parms['serviceurl']}";
1067 $soapHeaders = array();
1068 $soapHeaders[] =
"Content-Type: text/xml; charset=utf-8";
1069 $soapHeaders[] =
'SOAPAction: "http://validationservice.vsoftcorp.com/Acknowledgment"';
1070 $response = embcurl($soapString, $soapHeaders, $parms[
'serviceurl']);
1072 if ($parms[
"logging"] ==
"enabled") {
1073 $logParms = $parms[
"environment"];
1074 $logParms[
"SSOVendor"] = $parms[
'rdcvendor'];
1075 $logParms[
"token"] = $parms[
'SessionId'];
1076 $logParms[
"txnId"] = time();
1077 $logParms[
"logPoint"] =
"Ack";
1078 $logParms[
"request"] = $cmd;
1079 $logParms[
"reply"] = $response;
1080 LogSSOActivity($logParms);
1083 $pos = strpos($response,
'HCUERROR: ');
1084 if ($pos !==
false) {
1085 throw new Exception(substr($response, $pos));
1087 if (empty($response)) {
1088 throw new Exception(
"Empty Response");
1091 $xmlreturn = vsoftGetXMLResponse($response,
'AcknowledgmentResult',
'http://validationservice.vsoftcorp.com/');
1092 if (!is_array($xmlreturn)) {
1093 throw new Exception(
"RDC Invalid XML Response");
1096 if (!$xmlreturn[0][
'ReturnValue']) {
1097 throw new Exception(
"{$xmlreturn[0]['ErrorDesc']} - {$xmlreturn[0]['ErrorCode']}");
1099 $return[
'status'][
'response'] =
'true';
1100 $return[
'status'][
'message'] =
'Success';
1101 $return[
'data'] = $xmlreturn[0];
1103 }
catch (Exception $e) {
1104 $return[
'status'][
'response'] =
'false';
1105 $return[
'status'][
'message'] = $e->getMessage();
1122 function vsoftHistory($parms) {
1128 $return[
'status'][
'response'] =
'true';
1129 $return[
'status'][
'message'] =
'Success';
1130 $return[
'callparms'] = $parms;
1131 $return[
'data'] = array();
1135 $parms[
'SessionId'] = time();
1136 if (!isset($parms[
'InstID']) || !isset($parms[
'serviceurl']) ||
1137 !isset($parms[
'Cn']) || !isset($parms[
'depositAcct']) ||
1138 !isset($parms[
'depositType'])) {
1139 throw new Exception(
"Missing Parameters " . print_r($parms,
true));
1142 $soapString =
'<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 1143 xmlns:xsd="http://www.w3.org/2001/XMLSchema" 1144 xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 1146 <AccountTransactionHistory xmlns="http://validationservice.vsoftcorp.com/">';
1148 $soapString .=
"<AcctTransHistoryRequest> 1149 <InstId>{$parms['InstID']}</InstId> 1150 <AccountNumber>{$parms['depositAcct']}</AccountNumber> 1151 <UserId>{$parms['Cn']}</UserId> 1152 <AccountType>{$parms['depositType']}</AccountType> 1153 </AcctTransHistoryRequest> 1154 </AccountTransactionHistory> 1156 </soapenv:Envelope>\n";
1158 $cmd =
"/usr/bin/curl --silent --cacert /etc/ssl/certs/ValiCert.crt --data-binary '$soapString' -H 'Content-Type: text/xml; charset=utf-8'";
1159 $cmd .=
" -H 'SOAPAction: \"http://validationservice.vsoftcorp.com/AccountTransactionHistory\"'";
1160 $cmd .=
" {$parms['serviceurl']}";
1162 $soapHeaders = array();
1163 $soapHeaders[] =
"Content-Type: text/xml; charset=utf-8";
1164 $soapHeaders[] =
'SOAPAction: "http://validationservice.vsoftcorp.com/AccountTransactionHistory"';
1165 $response = embcurl($soapString, $soapHeaders, $parms[
'serviceurl']);
1167 if ($parms[
"logging"] ==
"enabled") {
1168 $logParms = $parms[
"environment"];
1169 $logParms[
"SSOVendor"] = $parms[
'rdcvendor'];
1170 $logParms[
"token"] = $parms[
'SessionId'];
1171 $logParms[
"txnId"] = time();
1172 $logParms[
"logPoint"] =
"TransactionHistory";
1173 $logParms[
"request"] = $cmd;
1174 $logParms[
"reply"] = $response;
1175 LogSSOActivity($logParms);
1178 $pos = strpos($response,
'HCUERROR: ');
1179 if ($pos !==
false) {
1180 throw new Exception(substr($response, $pos));
1182 if (empty($response)) {
1183 throw new Exception(
"Empty Response");
1186 $xmlreturn = vsoftGetXMLResponse($response,
'AccountTransactionHistoryResult',
'http://validationservice.vsoftcorp.com/');
1187 if (!is_array($xmlreturn)) {
1188 throw new Exception(
"RDC Invalid XML Response");
1191 if (!$xmlreturn[0][
'ReturnValue']) {
1192 throw new Exception(
"{$xmlreturn[0]['ErrorDesc']} - {$xmlreturn[0]['ErrorCode']}");
1194 $return[
'status'][
'response'] =
'true';
1195 $return[
'status'][
'message'] =
'Success';
1196 $return[
'data'] = $xmlreturn[0];
1198 }
catch (Exception $e) {
1199 $return[
'status'][
'response'] =
'false';
1200 $return[
'status'][
'message'] = $e->getMessage();
1201 $return[
'data'] = $response;
1206 function vsoftGetXMLResponse($rdcXML, $rdcCONT, $rdcNS) {
1208 $xml = simplexml_load_string($rdcXML,
"SimpleXMLElement", LIBXML_NOWARNING);
1209 if (!is_object($xml)) {
1210 throw new Exception(
"Invalid XML not object");
1212 $xml->registerXPathNamespace(
's',
"http://schemas.xmlsoap.org/soap/envelope/");
1213 $errorresponse = $xml->xpath(
"//s:Fault");
1214 if (is_array($errorresponse) && count($errorresponse)) {
1216 'faultcode' => $errorresponse[0]->faultcode,
1217 'faultstring' => $errorresponse[0]->faultstring
1220 $xml->registerXPathNamespace(
'rdc', $rdcNS);
1221 $dataresponse = $xml->xpath(
"//rdc:$rdcCONT");
1222 $resp_arr = objectToArray($dataresponse);
1224 }
catch (Exception $e) {