19 function GetAccts($dbh, $HB_ENV, $parms) {
22 if (!isset($parms[
'Cu']) || !isset($parms[
'Uid']) || !isset($parms[
'MBRACCT'])) {
23 $AcctList[
'status'][
'response'] =
'false';
24 $AcctList[
'status'][
'code'] =
'910';
25 $AcctList[
'status'][
'message'] =
'Missing Account Parameters'; # missing Cu/Uid/MBRACCT
29 $AcctList = TX_list($dbh, $HB_ENV);
30 if (!HCU_array_key_exists(
'acctlist', $AcctList)) {
31 throw new Exception (
"Unable to load accounts.");
37 $accountspecs = explode(
"|", $parms[
'accountspecs']);
39 $accountspecs = array_map(
'trim', $accountspecs);
40 if (in_array(
'micraccount', $accountspecs)){
45 foreach($AcctList[
'acctlist'] as $key=>$value){
46 $outputElem = array();
53 if ( $value[
'acctclass'] ==
'D' && $value[
'available'] > 0
54 && $value[
'to_ext'] ==
'Y' && ( !$micrFlg || ($micrFlg &&
55 $value[
'micraccount'] !=
'' && $value[
'micraccount'] !=
'0' ))) {
56 $outputElem[
'micraccount'] = $value[
'micraccount'];
57 $outputElem[
'suffix'] = $value[
'suffix'];
58 $outputElem[
'name'] = $value[
'description'];
59 $outputElem[
'class'] = $value[
'acctclass'];
61 $outputElem[
'type'] = ($value[
'deposittype'] ==
'Y' ?
'Checking' :
'Savings');
62 $outputElem[
'balance'] = $value[
'available'];
63 $outputElem[
'toext'] = $value[
'to_ext'];
64 $outputElem[
'member'] = $value[
'member'];
68 foreach($accountspecs as $k=>$v){
73 $fieldspec = explode(
"(", $cleanv);
74 $fieldname = trim($fieldspec[0]);
77 if(isset($fieldspec[1])){
78 $positions = explode(
",", rtrim($fieldspec[1],
")"));
80 if(!empty($positions)){
81 if (!empty($positions[0])){
82 $start = $positions[0];
84 if (!empty($positions[1])){
85 $length = $positions[1];
89 foreach ($value as $k1=>$v1){
91 if ($fieldname == $k1 && !empty($start) && !empty($length)){
92 $account .= substr($value[$k1], $start-1, $length);
94 } elseif ($fieldname == $k1) {
95 $account .= $value[$k1];
100 if($outputElem[
'type'] ==
'Checking'){
103 else if ($outputElem[
'type'] ==
'Savings'){
108 $acctIdEncrypted = hcu_encrypturl( $account, $HB_ENV[
'historyHash'] );
110 $outputElem[
'accountid'] = $acctIdEncrypted;
112 $output[] = $outputElem;
118 $AcctList[
'status'][
'response'] =
'false';
119 $AcctList[
'status'][
'code'] =
'910';
120 $AcctList[
'status'][
'message'] =
'No elibigle pay from accounts found.';
123 #normalize the name for scalability 124 $cleanlist = $output;
125 $return[
"status"][
"response"] =
'true';
126 $return[
"status"][
"message"] =
'Success';
127 $return[
"data"] = $cleanlist;
129 }
catch (Exception $e) {
130 $return[
'status'][
'response'] =
'false';
131 $return[
'status'][
'message'] = $e->getMessage();
132 $return[
'status'][
'code'] = $e->getCode();
133 $return[
'data'] = array();
148 function embcurl($soapString, $soapHeaders, $soapServer, $soapCertfile=
'', $soapKeyfile=
'', $soapCACert=
'') {
153 CURLOPT_SSL_VERIFYPEER => 0,
154 CURLOPT_RETURNTRANSFER => 1,
157 CURLOPT_POSTFIELDS =>
"$soapString",
158 CURLOPT_URL =>
"$soapServer");
159 if (!empty($soapCertfile)) {
160 $curlopts[CURLOPT_SSLCERT] =
"$soapCertfile";
162 if (!empty($soapKeyfile)) {
163 $curlopts[CURLOPT_SSLKEY] =
"$soapKeyfile";
165 if (!empty($soapCACert)) {
166 $curlopts[CURLOPT_CAINFO] =
"$soapCACert";
170 @curl_setopt_array($ch, $curlopts);
171 @curl_setopt($ch, CURLOPT_HTTPHEADER, $soapHeaders);
173 $response = @curl_exec($ch);
176 if (curl_errno($ch)) {
185 $clData =
"--data-binary '$soapString' ";
188 if (is_array($soapHeaders)) {
189 foreach ($soapHeaders as $hdrLine) {
190 $clHeaders .=
"-H '$hdrLine' ";
194 if (!empty($soapCertfile)) {
195 $clCert =
"--cert '$soapCertfile' ";
198 if (!empty($soapKeyfile)) {
199 $clKey=
"--key '$soapKeyfile' ";
202 if (!empty($soapCACert)) {
203 $clCA =
"--cacert $soapCACert";
207 $clAction =
"'$soapServer'";
209 $curlExec =
"/usr/bin/curl $clData $clHeaders $clCert $clKey $clCA $clAction";
211 $clCurl = popen($curlExec,
"r");
217 while ($buff = fread ($clCurl, 1500)) {
220 $pipe_err = pclose($clCurl);
234 function objectToArray( $object ) {
235 if( !is_object( $object ) && !is_array( $object ) ) {
238 if( is_object( $object ) ) {
239 $object = get_object_vars( $object );
241 return array_map(
'objectToArray', $object );
252 function UniqueMultidimArray($array, $key){
253 $temp_array = array();
255 $key_array = array();
257 foreach($array as $val) {
258 if (!in_array($val[$key], $key_array)) {
259 $key_array[$i] = $val[$key];
260 $temp_array[$i] = $val;
278 function ReadCache($dbh, $user, $subscriber, $cu, $cacheType, $session) {
280 $sql =
"SELECT session, entry, data 283 AND username = '$user' 284 AND subscriber = '$subscriber' 285 AND type = '$cacheType'";
287 $rs = db_query( $sql, $dbh );
292 while ($cacheRow = db_fetch_array($rs, $row++)) {
294 if ( strlen( $returnData ) > 0 ) {
295 DeleteCache($dbh, $user, $subscriber, $cu, $cacheType, $cacheRow[
"session"], $cacheRow[
"entry"]);
296 }
else if ( $cacheRow[
"session"] == $session ) {
298 $returnData = $cacheRow[
"data"];
301 DeleteCache($dbh, $user, $subscriber, $cu, $cacheType, $cacheRow[
"session"],
"");
305 $returnStructure = json_decode( $returnData,
true );
307 return $returnStructure;
323 function DeleteCache($dbh, $user, $subscriber, $cu, $cacheType, $session, $timestamp) {
324 $sql =
"DELETE FROM cu_vendorcache 326 AND username = '$user' 327 AND subscriber = '$subscriber'";
329 if ( strlen( $cacheType ) ) {
330 $sql .=
" AND type = '$cacheType'";
333 if ( strlen( $session ) ) {
334 $sql .=
" AND session = '$session'";
337 if ( strlen( $timestamp ) ) {
338 $sql .=
" AND entry = '$timestamp'";
340 db_query( $sql, $dbh );
355 function WriteCache($dbh, $user, $subscriber, $cu, $cacheType, $session, $data) {
357 if ( !$dbh || !$user || !$subscriber || !$cu || !$cacheType || !$session || !$data ) {
363 $jsonData = json_encode( $data );
364 }
catch ( Exception $e ) {
368 if ( strlen( $jsonData ) ) {
369 $jsonData = pg_escape_string($jsonData);
371 $sql =
"INSERT INTO cu_vendorcache (cu, username, subscriber, session, type, data) 372 VALUES ('$cu', '$user', '$subscriber', '$session', '$cacheType', '$jsonData' )";
374 $result = db_query( $sql, $dbh );
385 function LogActivity( $logData ) {
387 $logPoint = substr( $logData[
"logPoint"], 0, 35 );
388 $sessionId = substr( $logData[
"token"], -20 );
389 $txnId = substr( $logData[
"txnId"], -20 );
390 $request = pg_escape_string(trim($logData[
"request"]));
391 $reply = pg_escape_string(trim($logData[
"reply"]));
395 $sql =
"INSERT INTO cu_vendorlog (cu, user_id, service, sub_service, 396 session_id, txn_id, user_ip, request, response) 397 VALUES ('{$logData["Cu
"]}', '{$logData["memberId
"]}', '{$logData["SSOVendor
"]}', 398 '$logPoint', '$sessionId', '$txnId', 399 '{$logData["userIP
"]}', '$request', '$reply')";
401 db_query($sql, $logData[
"dbConn"] );
410 mt_srand((
double)microtime()*10000);
411 $charid = strtoupper(md5(uniqid(rand(),
true)));
414 .substr($charid, 0, 8).$hyphen
415 .substr($charid, 8, 4).$hyphen
416 .substr($charid,12, 4).$hyphen
417 .substr($charid,16, 4).$hyphen
418 .substr($charid,20,12)
428 function GetBPStateList() {
430 [
"name"=>
'Alabama',
"value"=>
'AL'],
431 [
"name"=>
'Alaska',
"value"=>
'AK'],
432 [
"name"=>
'Arizona',
"value"=>
'AZ'],
433 [
"name"=>
'Arkansas',
"value"=>
'AR'],
434 [
"name"=>
'California',
"value"=>
'CA'],
435 [
"name"=>
'Colorado',
"value"=>
'CO'],
436 [
"name"=>
'Connecticut',
"value"=>
'CT'],
437 [
"name"=>
'Delaware',
"value"=>
'DE'],
438 [
"name"=>
'Florida',
"value"=>
'FL'],
439 [
"name"=>
'Georgia',
"value"=>
'GA'],
440 [
"name"=>
'Hawaii',
"value"=>
'HI'],
441 [
"name"=>
'Idaho',
"value"=>
'ID'],
442 [
"name"=>
'Illinois',
"value"=>
'IL'],
443 [
"name"=>
'Indiana',
"value"=>
'IN'],
444 [
"name"=>
'Iowa',
"value"=>
'IA'],
445 [
"name"=>
'Kansas',
"value"=>
'KS'],
446 [
"name"=>
'Kentucky',
"value"=>
'KY'],
447 [
"name"=>
'Louisiana',
"value"=>
'LA'],
448 [
"name"=>
'Maine',
"value"=>
'ME'],
449 [
"name"=>
'Maryland',
"value"=>
'MD'],
450 [
"name"=>
'Massachusetts',
"value"=>
'MA'],
451 [
"name"=>
'Michigan',
"value"=>
'MI'],
452 [
"name"=>
'Minnesota',
"value"=>
'MN'],
453 [
"name"=>
'Mississippi',
"value"=>
'MS'],
454 [
"name"=>
'Missouri',
"value"=>
'MO'],
455 [
"name"=>
'Montana',
"value"=>
'MT'],
456 [
"name"=>
'Nebraska',
"value"=>
'NE'],
457 [
"name"=>
'Nevada',
"value"=>
'NV'],
458 [
"name"=>
'New Hampshire',
"value"=>
'NH'],
459 [
"name"=>
'New Jersey',
"value"=>
'NJ'],
460 [
"name"=>
'New Mexico',
"value"=>
'NM'],
461 [
"name"=>
'New York',
"value"=>
'NY'],
462 [
"name"=>
'North Carolina',
"value"=>
'NC'],
463 [
"name"=>
'North Dakota',
"value"=>
'ND'],
464 [
"name"=>
'Ohio',
"value"=>
'OH'],
465 [
"name"=>
'Oklahoma',
"value"=>
'OK'],
466 [
"name"=>
'Oregon',
"value"=>
'OR'],
467 [
"name"=>
'Pennsylvania',
"value"=>
'PA'],
468 [
"name"=>
'Rhode Island',
"value"=>
'RI'],
469 [
"name"=>
'South Carolina',
"value"=>
'SC'],
470 [
"name"=>
'South Dakota',
"value"=>
'SD'],
471 [
"name"=>
'Tennessee',
"value"=>
'TN'],
472 [
"name"=>
'Texas',
"value"=>
'TX'],
473 [
"name"=>
'Utah',
"value"=>
'UT'],
474 [
"name"=>
'Vermont',
"value"=>
'VT'],
475 [
"name"=>
'Virginia',
"value"=>
'VA'],
476 [
"name"=>
'Washington',
"value"=>
'WA'],
477 [
"name"=>
'West Virginia',
"value"=>
'WV'],
478 [
"name"=>
'Wisconsin',
"value"=>
'WI'],
479 [
"name"=>
'Wyoming',
"value"=>
'WY']
501 $returnData = $states;
510 function GetPhoneTypes(){
512 [
"name"=>
'Home',
"code"=>
'Home'],
513 [
"name"=>
'Cell',
"code"=>
'Cell'],
514 [
"name"=>
'Work',
"code"=>
'Work'],
516 $returnData = $types;
525 function GetBPAccountTypes($MC){
527 [
"name"=>$MC->msg(
'Checking'),
"value"=>
'D'],
528 [
"name"=>$MC->msg(
'Savings'),
"value"=>
'S'],
530 $returnData = $types;
539 function GetBPP2PTypes($MC){
541 [
"name"=>$MC->msg(
'Text'),
"value"=>
'SMS'],
542 [
"name"=>$MC->msg(
'Email'),
"value"=>
'Email'],
544 $returnData = $types;
554 function GetBillingFreq($MC){
556 [
"name"=>$MC->msg(
'Once'),
"value"=>
'Once',
"isDeleted"=>
false],
557 [
"name"=>$MC->msg(
'Weekly'),
"value"=>
'Weekly',
"isDeleted"=>
false],
558 [
"name"=>$MC->msg(
'Monthly'),
"value"=>
'Monthly',
"isDeleted"=>
false],
559 [
"name"=>$MC->msg(
'Annually'),
"value"=>
'Annual',
"isDeleted"=>
false],
561 $returnData = $types;