4 define(
"MP_PV_ERROR_CODE",
"5010" );
7 function bpAuth($parms) {
9 $return=array(
'status'=>array(
'response'=>
'true',
'code'=>
'000',
'message'=>
'success'));
11 if ($parms[
'pilot'] == 1) {
12 $parms[
'serviceurl'] = $parms[
'piloturl'];
14 $parms[
'serviceurl'] = $parms[
'produrl'];
17 $parms[
'Token']=time();
19 $reqdata = PV_getUserProfile($parms); # how to know
if member is authorized
20 if ($reqdata[
'status'][
'response'] !=
'true') {
21 throw new Exception($reqdata[
'status'][
'message']);
23 # format valid response array 24 $return[
'data'][
'Token']=time();
25 $return[
'data'][
'BillpayId']=$parms[
'BillpayId'];
26 $output[
'MoblPayName']= (trim($parms[
'MoblPayName']) ==
'' ? htmlentities(
'Pay Bills') : htmlentities($parms[
'MoblPayName']));
27 $return[
'data'][
'DateModel']=$parms[
'datemodel'];
28 $return[
'data'][
'Extras']=htmlentities($parms[
'ExtraOptions']);
30 }
catch (Exception $e) {
31 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage(),
'code'=>
'999'),
'data'=>array(
'Token'=>
'0'));
36 function bpHist($parms) {
38 $return=array(
'status'=>array(
'response'=>
'true',
'message'=>
'success'));
39 if ($parms[
'pilot'] == 1) {
40 $parms[
'serviceurl'] = $parms[
'piloturl'];
42 $parms[
'serviceurl'] = $parms[
'produrl'];
44 $parms[
'Token']=$parms[
'passwith'][
'Token'];
45 $reqdata = pscuGetRecentPayments($parms); #
get payment history
47 if ($reqdata[
'status'][
'response'] !=
'true') {
48 throw new Exception($reqdata[
'status'][
'message']);
50 # format valid response array 51 $return[
'data'][]=$item;
54 if (is_array($return[
'data'])) {
55 usort($return[
'data'],
"histSort");
58 }
catch (Exception $e) {
59 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage()),
'code'=>MP_PV_ERROR_CODE,
'data'=>array());
64 function bpSched($parms) {
66 $return=array(
'status'=>array(
'response'=>
'true',
'message'=>
'success'));
67 if ($parms[
'pilot'] == 1) {
68 $parms[
'serviceurl'] = $parms[
'piloturl'];
70 $parms[
'serviceurl'] = $parms[
'produrl'];
73 $parms[
'Token']=$parms[
'passwith'][
'Token'];
74 $reqdata = pscuGetScheduledPayments($parms); # show scheduled payments
75 if ($reqdata[
'status'][
'response'] !=
'true') {
76 throw new Exception($reqdata[
'status'][
'message']);
79 # format valid response array 81 $return[
'data'][]=$item;
84 if (is_array($return[
'data'])) {
85 usort($return[
'data'],
"schedSort");
88 }
catch (Exception $e) {
89 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage()),
'code'=>MP_PV_ERROR_CODE,
'data'=>array());
94 function bpSourceAccts($parms) {
96 $return=array(
'status'=>array(
'response'=>
'true',
'message'=>
'success'));
97 if ($parms[
'pilot'] == 1) {
98 $parms[
'serviceurl'] = $parms[
'piloturl'];
100 $parms[
'serviceurl'] = $parms[
'produrl'];
103 $parms[
'Token']=$parms[
'passwith'][
'Token'];
104 $reqdata = pscuBankAccounts($parms); #
get source accounts
105 if ($reqdata[
'status'][
'response'] !=
'true') {
106 throw new Exception($reqdata[
'status'][
'message']);
108 $hasAtLeastOneAccount =
false;
110 if ( strlen( $item[
"Name"] ) == 0 &&
111 strlen( $item[
"FromId"] ) > 0 ) {
112 $parts = explode(
"|", $item[
"FromId"] );
113 $item[
"Name"] = $parts[0];
116 $return[
'data'][]=$item;
118 if ( !$hasAtLeastOneAccount ) {
119 throw new Exception(
"No source accounts received from vendor.");
121 }
catch (Exception $e) {
122 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage()),
'code'=>MP_PV_ERROR_CODE,
'data'=>array());
127 function bpDestAccts($parms) {
129 $return=array(
'status'=>array(
'response'=>
'true',
'message'=>
'success'));
130 if ($parms[
'pilot'] == 1) {
131 $parms[
'serviceurl'] = $parms[
'piloturl'];
133 $parms[
'serviceurl'] = $parms[
'produrl'];
136 $parms[
'Token']=$parms[
'passwith'][
'Token'];
137 $reqdata = pscuGetPayees($parms); #
get destination accounts
138 if ($reqdata[
'status'][
'response'] !=
'true') {
139 throw new Exception($reqdata[
'status'][
'message']);
141 $hasAtLeastOneAccount =
false;
142 $return[
'data'][]=$item;
144 if ( !$hasAtLeastOneAccount ) {
145 throw new Exception(
"No destination accounts received from vendor.");
147 }
catch (Exception $e) {
148 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage()),
'code'=>MP_PV_ERROR_CODE,
'data'=>array());
153 function bpPmtAdd($parms) {
155 $return=array(
'status'=>array(
'response'=>
'true',
'message'=>
'success'));
156 if ($parms[
'pilot'] == 1) {
157 $parms[
'serviceurl'] = $parms[
'piloturl'];
159 $parms[
'serviceurl'] = $parms[
'produrl'];
161 list($acctno,$accttype,$rt) = explode(
"|",$parms[
'passwith'][
'FromId']);
162 $parms[
'Token']=$parms[
'passwith'][
'Token'];
163 $parms[
'PayeeId'] = $parms[
'passwith'][
'ToId'];
164 $parms[
'AcctNo'] = $acctno;
165 $parms[
'AcctType'] = $accttype;
167 $parms[
'PayDate'] = $parms[
'passwith'][
'Date'];
168 $parms[
'Amount'] = $parms[
'passwith'][
'Amount'];
169 $parms[
'DelMethod'] =
'REGULAR_PAYMENT'; # allow rush
if available?
171 $reqdata = pscuAddPayment($parms); # submit payment
172 if ($reqdata[
'status'][
'response'] !=
'true') {
173 throw new Exception($reqdata[
'status'][
'message']);
176 $return[
'data'][
'Confirmation']=$reqdata[
'data'][
'confirmationNumber'];
177 $return[
'data'][
'TransactionId']=$reqdata[
'data'][
'transactionID'];
178 $return[
'data'][
'EstimatedArrival']=
'';
180 }
catch (Exception $e) {
181 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage()),
'code'=>MP_PV_ERROR_CODE,
'data'=>array());
186 function bpTrnAdd($parms) {
188 $return=array(
'status'=>array(
'response'=>
'true',
'message'=>
'success'),
'data'=>array());
189 # if no Transfer functionality - just return error 190 throw new Exception(
'Feature Unavailable');
191 }
catch (Exception $e) {
192 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage()),
'code'=>MP_PV_ERROR_CODE,
'data'=>array());
197 function bpPmtEdit($parms) {
199 $return=array(
'status'=>array(
'response'=>
'true',
'message'=>
'success'));
200 if ($parms[
'pilot'] == 1) {
201 $parms[
'serviceurl'] = $parms[
'piloturl'];
203 $parms[
'serviceurl'] = $parms[
'produrl'];
206 list($acctno,$accttype,$rt) = explode(
"|",$parms[
'passwith'][
'FromId']);
207 $parms[
'Token']=$parms[
'passwith'][
'Token'];
208 $parms[
'txnID'] = $parms[
'passwith'][
'TxnId'];
209 $parms[
'PayeeId'] = $parms[
'passwith'][
'ToId'];
210 $parms[
'AcctNo'] = $acctno;
211 $parms[
'AcctType'] = $accttype;
213 $parms[
'PayDate'] = $parms[
'passwith'][
'Date'];
214 $parms[
'Amount'] = $parms[
'passwith'][
'Amount'];
215 # PSCU mobile doesn't support rush payments 216 $parms[
'DelMethod'] =
'REGULAR_PAYMENT';
218 $reqdata = pscuEditPayment($parms); # update payment
219 if ($reqdata[
'status'][
'response'] !=
'true') {
220 throw new Exception($reqdata[
'status'][
'message']);
223 $return[
'data'][
'Confirmation']=$reqdata[
'data'][
'confirmationNumber'];
224 $return[
'data'][
'TransactionId']=$reqdata[
'data'][
'transactionID'];
225 $return[
'data'][
'EstimatedArrival']=
'';
228 }
catch (Exception $e) {
229 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage()),
'code'=>MP_PV_ERROR_CODE,
'data'=>array());
234 function bpPmtStop($parms) {
236 $return=array(
'status'=>array(
'response'=>
'true',
'message'=>
'success'));
237 if ($parms[
'pilot'] == 1) {
238 $parms[
'serviceurl'] = $parms[
'piloturl'];
240 $parms[
'serviceurl'] = $parms[
'produrl'];
243 $parms[
'Token']=$parms[
'passwith'][
'Token'];
244 $parms[
'txnID'] = $parms[
'passwith'][
'TxnId'];
247 $reqdata = pscuCancelPayment($parms); # cancel payment
248 if ($reqdata[
'status'][
'response'] !=
'true') {
249 throw new Exception($reqdata[
'status'][
'message']);
251 $return[
'data'][
'StopResult']=1;
253 }
catch (Exception $e) {
254 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage()),
'code'=>MP_PV_ERROR_CODE,
'data'=>array());
259 function bpGetPaymentDates($parms) {
261 $return=array(
'status'=>array(
'response'=>
'true',
'message'=>
'success'));
263 if ($parms[
'pilot'] == 1) {
264 $parms[
'serviceurl'] = $parms[
'piloturl'];
266 $parms[
'serviceurl'] = $parms[
'produrl'];
269 $parms[
'Token']=$parms[
'passwith'][
'Token'];
271 $reqdata = pscuGetPayees($parms); #
get business dates
272 if ($reqdata[
'status'][
'response'] !=
'true') {
273 throw new Exception($reqdata[
'status'][
'message']);
278 # test $firstpay to make sure it is a date? 279 $defaultTZ=date_default_timezone_get(); # so we can put it back
280 date_default_timezone_set(
'UTC');
282 if($now > strtotime( $cutoff )) {
283 $Start = strtotime( $nextpay );
285 $Start = strtotime( $firstpay );
287 # if Start is false (strtotime failed) use current time 288 $Start = ($Start ? $Start : $now);
289 $End = $Start + (90 * 24 * 60 * 60);
290 $holidays = ListHolidays(date(
'Y',$Start),date(
'Y',$End));
291 for ($i=$Start; $i<=$End; $i+=86400) {
292 $i=GetNextBusiness($i);
294 $idate = gmdate(
'Y-m-d',$i);
295 if (!in_array($idate,$holidays)) {
296 $item[
'Proc'] = gmdate(
'Y-m-d',$i);
297 if (strtoupper($parms[
'datemodel']) ==
'DUE') {
298 $item[
'Due'] = gmdate(
'Y-m-d',GetNextBusiness($i+($lead*86400)));
305 date_default_timezone_set($defaultTZ);
307 $return[
'data'][
'EarliestPay'] = $firstpay;
308 $return[
'data'][
'NextPay'] = $nextpay;
309 $return[
'data'][
'Cutoff'] = $cutoff;
310 $return[
'data'][
'LeadDays'] = $lead;
311 # build RushOptions list like this: 313 $return[
'data'][
'RushOptions']=array();
314 $return[
'data'][
'PaymentDates']=$datelist;
315 }
catch (Exception $e) {
316 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage()),
'code'=>MP_PV_ERROR_CODE,
'data'=>array());
321 function bpGetTerms($parms) {
323 # PayVeris has no Get Terms functionality - just return empty success 324 $return=array(
'status'=>array(
'response'=>
'true',
'message'=>
'success'),
'data'=>array(
'Terms'=>
''));
325 }
catch (Exception $e) {
326 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage()),
'code'=>MP_PV_ERROR_CODE,
'data'=>array());
331 function bpGetRushOptions($parms) {
333 # PayVeris has no Rush Options functionality - just return empty success 334 $return=array(
'status'=>array(
'response'=>
'true',
'message'=>
'success'),
'data'=>array());
335 }
catch (Exception $e) {
336 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage()),
'code'=>MP_PV_ERROR_CODE,
'data'=>array());
341 function bpAcceptTerms($parms) {
343 # PayVeris has no Accept Terms functionality - just return empty success 344 $return=array(
'status'=>array(
'response'=>
'true',
'message'=>
'success'),
'data'=>array());
345 }
catch (Exception $e) {
346 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage()),
'code'=>MP_PV_ERROR_CODE,
'data'=>array());
351 function bpGetFeatureList($parms) {
353 # Need to decide what the data looks like here -- string list of available features 354 # maybe something out of trusteddetail (which comes to this function in $parms) 355 # to allow customizing by cu 356 $return=array(
'status'=>array(
'response'=>
'true',
'message'=>
'success'),
'data'=>array(
'featurelist'=>
"Payment|History|Scheduled"));
357 }
catch (Exception $e) {
358 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage()),
'code'=>MP_PV_ERROR_CODE,
'data'=>array());
362 function schedSort($a, $b)
364 $atime = strtotime($a[
'Date']);
365 $btime = strtotime($b[
'Date']);
366 if ($atime == $btime) {
367 if ($a[
'ToName'] == $b[
'ToName']) {
370 return ($a[
'ToName'] < $b[
'ToName']) ? -1 : 1;
372 return ($atime < $btime) ? -1 : 1;
375 function histSort($a, $b) {
376 $atime = strtotime($a[
'Date']);
377 $btime = strtotime($b[
'Date']);
378 if ($atime == $btime) {
379 if ($a[
'ToName'] == $b[
'ToName']) {
382 return ($a[
'ToName'] < $b[
'ToName']) ? -1 : 1;
384 return ($atime > $btime) ? -1 : 1;
387 function PV_createUserSession($parms) {
388 # uses: $parms['APIKey'] 389 # $parms['APIVersion'] 390 # $parms['ClientCode'] 392 # $parms['BillpayId'] 397 if (!isset($parms[
'passwith'][
'Cu']) ||
398 !isset($parms[
'APIKey']) ||
399 !isset($parms[
'serviceurl']) ||
400 !isset($parms[
'APIVersion']) ||
401 !isset($parms[
'ClientCode']) ||
402 !isset($parms[
'passwith'][
'BillpayId']) ||
403 !count($parms[
'passwith'][
'Accounts'])) {
404 throw new Exception(
"Missing Parameters");
406 list($msec, $sec) = explode(
" ", microtime());
407 $floatsec = sprintf(
"%03d", (
float) $msec * 1000);
408 $RequestID = (gmdate(
"YmdHis")) . $floatsec;
411 $pvCustomerType = ( in_array($parms[
'MIR'][
"class"], array(
'B',
'T') ) ?
'Business' :
'Personal');
413 $soapString =
'<?xml version="1.0" encoding="utf-8"?>';
414 $soapString =
"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:cus=\"http://www.payveris.com/api/schema/CustomerServices\" xmlns:com=\"http://www.payveris.com/api/schema/CommonTypes\">";
415 $soapString .=
"\n<soapenv:Header/>";
416 $soapString .=
"\n<soapenv:Body>";
417 $soapString .=
"<cus:CreateUserSessionRequest> 418 <com:Version>{$parms['APIVersion']}</com:Version> 419 <com:APIKey>{$parms['APIKey']}</com:APIKey> 420 <com:ClientCode>{$parms['ClientCode']}</com:ClientCode> 421 <com:RequestId>$RequestID</com:RequestId> 422 <cus:CustomerProfile CustomerCode=\"{$parms['passwith']['BillpayId']}\" UserCode=\"{$parms['passwith']['BillpayId']}\"> 423 <com:CustomerType>{$pvCustomerType}</com:CustomerType> 424 <com:Prefix></com:Prefix> 425 <com:FirstName>{$parms['MIR']["firstname
"]}</com:FirstName> 426 <com:MiddleInitial></com:MiddleInitial> 427 <com:LastName>{$parms['MIR']["lastname
"]}</com:LastName> 428 <com:Suffix></com:Suffix> 429 <com:EmailAddress>{$parms['MIR']['email']}</com:EmailAddress> 430 <com:UserRole>{$pvCustomerType}</com:UserRole>\n";
431 if (isset($parms[
'MIR'][
"homephone"])) {
432 $soapString .=
"<com:Phone> 433 <com:NumberType>Personal</com:NumberType> 434 <com:AreaCode>{$parms['MIR']["homephone
"]['Area']}</com:AreaCode> 435 <com:Prefix>{$parms['MIR']["homephone
"]['Pre']}</com:Prefix> 436 <com:Number>{$parms['MIR']["homephone
"]['Num']}</com:Number> 439 if (isset($parms[
'MIR'][
"cellphone"])) {
440 $soapString .=
"<com:Phone> 441 <com:NumberType>Cellular</com:NumberType> 442 <com:AreaCode>{$parms['MIR']["cellphone
"]['Area']}</com:AreaCode> 443 <com:Prefix>{$parms['MIR']["cellphone
"]['Pre']}</com:Prefix> 444 <com:Number>{$parms['MIR']["cellphone
"]['Num']}</com:Number> 447 if (isset($parms[
'MIR'][
"workphone"])) {
448 $soapString .=
"<com:Phone> 449 <com:NumberType>Business</com:NumberType> 450 <com:AreaCode>{$parms['MIR']["workphone
"]['Area']}</com:AreaCode> 451 <com:Prefix>{$parms['MIR']["workphone
"]['Pre']}</com:Prefix> 452 <com:Number>{$parms['MIR']["workphone
"]['Num']}</com:Number> 455 $soapString .=
"<com:Address> 456 <com:AddressLine1>{$parms['MIR']['address1']}</com:AddressLine1>\n";
457 if (isset($parms[
'MIR'][
'Address2'])) {
458 $soapString .=
"<com:AddressLine2>{$parms['MIR']['address2']}</com:AddressLine2>\n";
460 $soapString .=
"<com:City>{$parms['MIR']['city']}</com:City> 461 <com:StateCode>{$parms['MIR']['state']}</com:StateCode> 462 <com:ZipCode>{$parms['MIR']['zip']}</com:ZipCode> 463 <com:Country>{$parms['MIR']['cc']}</com:Country> 465 if ($pvCustomerType ==
'Business') {
466 # documentation does not show Address as part of Business profile, 467 # but connection fails without it 468 $soapString .=
"<com:Business> 469 <com:BusinessName>{$parms['MIR']["lastname
"]}</com:BusinessName> 470 <com:EmailAddress>{$parms['MIR']['email']}</com:EmailAddress> 472 <com:AddressLine1>{$parms['MIR']['address1']}</com:AddressLine1>\n";
473 if (isset($parms[
'MIR'][
'Address2'])) {
474 $soapString .=
"<com:AddressLine2>{$parms['MIR']['address2']}</com:AddressLine2>\n";
476 $soapString .=
"<com:City>{$parms['MIR']['city']}</com:City> 477 <com:StateCode>{$parms['MIR']['state']}</com:StateCode> 478 <com:ZipCode>{$parms['MIR']['zip']}</com:ZipCode> 479 <com:Country>{$parms['MIR']['cc']}</com:Country> 483 $soapString .=
"<com:Accounts>\n";
484 if (is_array($parms[
'passwith'][
'Accounts'])) {
485 foreach ($parms[
'passwith'][
'Accounts'] as $acctkey => $acct) {
486 if (is_array($acct)) {
488 if( isset( $parms[
'SendCoreSpecific'] ) && $parms[
'SendCoreSpecific'] ) {
489 $csatTag =
"<com:CoreSpecificAccountType>{$acct['corespecific']}</com:CoreSpecificAccountType>";
494 $soapString .=
"<com:Account AccountCode=\"$acctkey\" PayBillsFrom=\"{$acct['paybillsfrom']}\" PrimaryBillPaymentAccount=\"false\" TransferFrom=\"{$acct['transferfrom']}\" TransferTo=\"{$acct['transferto']}\"> 495 <com:RoutingNumber>{$parms['passwith']['rt']}</com:RoutingNumber> 496 <com:AccountNumber>{$acct['micraccount']}</com:AccountNumber> 497 <com:Description>" . htmlspecialchars($acct[
'description'], ENT_QUOTES,
'UTF-8', FALSE) .
"</com:Description> 498 <com:Type>{$acct['depositdesc']}</com:Type> 499 <com:Balance>{$acct['acctbalance']}</com:Balance> 500 <com:BalanceAsOfDate>{$acct['acctbalasof']}</com:BalanceAsOfDate> 502 <com:AccountStatus>Active</com:AccountStatus> 503 <com:AccessRole>Full</com:AccessRole> 508 $soapString .=
"</com:Accounts> 509 <com:Status>Active</com:Status> 510 </cus:CustomerProfile> 511 <cus:SessionValidForMinutes>30</cus:SessionValidForMinutes> 512 <cus:UnreadMessageCount>0</cus:UnreadMessageCount> 513 </cus:CreateUserSessionRequest> 515 </soapenv:Envelope>\n";
517 $reqHeaders = array();
518 $reqHeaders[] =
"Content-Type: text/xml; charset=utf-8";
519 $reqHeaders[] =
'SOAPAction: ""';
521 $response = PV_embcurl(
"{$parms['serviceurl']}/CustomerServices", $soapString, $reqHeaders);
523 if (empty($response)) {
524 throw new Exception(
"Empty Response");
526 if (is_array($response) && isset($response[
'curl_errno'])) {
527 throw new Exception(
"Curl Error {$response['curl_errno']} {$response['curl_error']}");
529 # call parse function to format response array 530 $xmlreturn = PV_GetXMLItem($response,
'ArtifactId',
'http://www.payveris.com/api/schema/CustomerServices');
531 if (!is_array($xmlreturn)) {
532 throw new Exception(
"Invalid XML Response" );
534 if ( isset( $xmlreturn[
'faultcode'] ) && $xmlreturn[
'faultcode'] ) {
535 throw new Exception(
"PV Fault {$xmlreturn['faultcode']} {$xmlreturn['faultstring']}");
537 $return[
"status"][
"response"] =
'true';
538 $return[
"status"][
"code"] =
'000';
539 $return[
"status"][
"message"] =
'Success';
540 $return[
"data"][
'ArtifactId'] = $xmlreturn[0];
542 $return[
"request"] = $soapString;
543 $return[
"raw"] = $response;
544 }
catch (Exception $e) {
545 $return[
"status"][
"response"] =
'false';
546 $return[
"status"][
"message"] = $e->getMessage();
548 if ( $parms[
"logging"] ==
"enabled" ) {
549 $logParms = $parms[
"environment"];
550 $logParms[
"token"] = $return[
"data"][
'ArtifactId'];
551 $logParms[
"txnId"] = time();
552 $logParms[
"logPoint"] =
"CreateUserSessionRequest";
553 $logParms[
"request"] =
"{$logParms['platform']} : userIP {$logParms['userIP']} userAgent {$logParms['userAgent']} \n$soapString";
554 $logParms[
"reply"] = $response;
555 LogSSOActivity( $logParms );
560 function PV_getUserProfile($parms) {
561 # uses: $parms['APIKey'] 562 # $parms['APIVersion'] 563 # $parms['ClientCode'] 565 # $parms['BillpayId'] 570 if (!isset($parms[
'APIKey']) ||
571 !isset($parms[
'serviceurl']) ||
572 !isset($parms[
'APIVersion']) ||
573 !isset($parms[
'ClientCode']) ||
574 !isset($parms[
'passwith'][
'BillpayId'])) {
575 throw new Exception(
"Missing Parameters");
577 list($msec, $sec) = explode(
" ", microtime());
578 $floatsec = sprintf(
"%03d", (
float) $msec * 1000);
579 $RequestID = (gmdate(
"YmdHis")) . $floatsec;
581 $soapString =
'<?xml version="1.0" encoding="utf-8"?>';
582 $soapString =
"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:cus=\"http://www.payveris.com/api/schema/CustomerServices\" xmlns:com=\"http://www.payveris.com/api/schema/CommonTypes\">";
583 $soapString .=
"\n<soapenv:Header/>";
584 $soapString .=
"\n<soapenv:Body>";
585 $soapString .=
"<cus:GetUserProfileRequest> 586 <com:Version>{$parms['APIVersion']}</com:Version> 587 <com:APIKey>{$parms['APIKey']}</com:APIKey> 588 <com:ClientCode>{$parms['ClientCode']}</com:ClientCode> 589 <com:RequestId>$RequestID</com:RequestId> 590 <com:UserCode>{$parms['passwith']['BillpayId']}</com:UserCode> 591 </cus:GetUserProfileRequest> 593 </soapenv:Envelope>\n";
595 $reqHeaders = array();
596 $reqHeaders[] =
"Content-Type: text/xml; charset=utf-8";
597 $reqHeaders[] =
'SOAPAction: ""';
599 $response = PV_embcurl(
"{$parms['serviceurl']}/CustomerServices", $soapString, $reqHeaders);
601 if (empty($response)) {
602 throw new Exception(
"Empty Response");
604 if (is_array($response) && isset($response[
'curl_errno'])) {
605 throw new Exception(
"Curl Error {$response['curl_errno']} {$response['curl_error']}");
607 # call parse function to format response array 608 $xmlreturn = PV_GetXMLResponse($response,
'CustomerProfile',
'http://www.payveris.com/api/schema/CustomerServices');
609 if (!is_array($xmlreturn)) {
610 throw new Exception(
"Invalid XML Response");
612 if ($xmlreturn[
'faultcode']) {
613 throw new Exception(
"PV Fault {$xmlreturn['faultcode']} {$xmlreturn['faultstring']}");
615 $return[
"status"][
"response"] =
'true';
616 $return[
"status"][
"code"] =
'000';
617 $return[
"status"][
"message"] =
'Success';
618 $return[
"data"][
'ArtifactId'] = $xmlreturn[0];
622 }
catch (Exception $e) {
623 $return[
"status"][
"response"] =
'false';
624 $return[
"status"][
"message"] = $e->getMessage();
628 function PV_getPaymentAccounts($parms) {
629 # uses: $parms['APIKey'] 630 # $parms['APIVersion'] 631 # $parms['ClientCode'] 633 # $parms['BillpayId'] 638 if (!isset($parms[
'APIKey']) ||
639 !isset($parms[
'serviceurl']) ||
640 !isset($parms[
'APIVersion']) ||
641 !isset($parms[
'ClientCode']) ||
642 !isset($parms[
'passwith'][
'BillpayId'])) {
643 throw new Exception(
"Missing Parameters");
645 list($msec, $sec) = explode(
" ", microtime());
646 $floatsec = sprintf(
"%03d", (
float) $msec * 1000);
647 $RequestID = (gmdate(
"YmdHis")) . $floatsec;
648 $parms[
'passwith'][
'BillpayId'] =
'0000000223';
649 $soapString =
'<?xml version="1.0" encoding="utf-8"?>';
650 $soapString =
"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:cus=\"http://www.payveris.com/api/schema/CustomerServices\" xmlns:com=\"http://www.payveris.com/api/schema/CommonTypes\">";
651 $soapString .=
"\n<soapenv:Header/>";
652 $soapString .=
"\n<soapenv:Body>";
653 $soapString .=
"<pay:GetUserPaymentAccountsRequest> 654 <com:Version>{$parms['APIVersion']}</com:Version> 655 <com:APIKey>{$parms['APIKey']}</com:APIKey> 656 <com:ClientCode>{$parms['ClientCode']}</com:ClientCode> 657 <com:RequestId>$RequestID</com:RequestId> 658 <com:UserCode>{$parms['passwith']['BillpayId']}</com:UserCode> 659 </pay:GetUserPaymentAccountsRequest> 661 </soapenv:Envelope>\n";
663 $reqHeaders = array();
664 $reqHeaders[] =
"Content-Type: text/xml; charset=utf-8";
665 $reqHeaders[] =
'SOAPAction: ""';
667 $response = PV_embcurl(
"{$parms['serviceurl']}/PaymentServices", $soapString, $reqHeaders);
669 if (empty($response)) {
670 throw new Exception(
"Empty Response");
672 if (is_array($response) && isset($response[
'curl_errno'])) {
673 throw new Exception(
"Curl Error {$response['curl_errno']} {$response['curl_error']}");
675 # call parse function to format response array 676 $xmlreturn = PV_GetXMLResponse($response,
'Accounts',
'http://www.payveris.com/api/schema/PaymentServices');
677 if (!is_array($xmlreturn)) {
678 throw new Exception(
"Invalid XML Response");
680 if ($xmlreturn[
'faultcode']) {
681 throw new Exception(
"PV Fault {$xmlreturn['faultcode']} {$xmlreturn['faultstring']}");
683 $return[
"status"][
"response"] =
'true';
684 $return[
"status"][
"code"] =
'000';
685 $return[
"status"][
"message"] =
'Success';
686 $return[
"data"] = $xmlreturn[0];
690 }
catch (Exception $e) {
691 $return[
"status"][
"response"] =
'false';
692 $return[
"status"][
"message"] = $e->getMessage();
697 function PV_GetXMLItem($pvXML, $pvCONT, $pvNS) {
699 $xml = simplexml_load_string($pvXML,
"SimpleXMLElement",LIBXML_NOWARNING);
700 if (!is_object($xml)) {
701 throw new Exception(
"Invalid XML");
704 $xml->registerXPathNamespace(
's',
"http://schemas.xmlsoap.org/soap/envelope/");
705 $errorresponse = $xml->xpath(
"//s:Fault");
706 if(is_array($errorresponse) && count($errorresponse)) {
707 $resp_arr = array(
'faultcode' => $errorresponse[0]->faultcode,
708 'faultstring' => $errorresponse[0]->faultstring);
718 $xml->registerXPathNamespace(
'bill', $pvNS);
719 $dataresponse = $xml->xpath(
"//bill:$pvCONT");
722 if (!is_object($dataresponse[0])) {
723 throw new Exception(
"Invalid Response Object");
725 $resp_arr = array($dataresponse[0]->__toString());
728 }
catch (Exception $e) {
733 function PV_GetXMLResponse($pvXML, $pvCONT, $pvNS) {
735 $xml = simplexml_load_string($pvXML,
"SimpleXMLElement",LIBXML_NOWARNING);
736 if (!is_object($xml)) {
737 throw new Exception(
"Invalid XML");
740 $xml->registerXPathNamespace(
's',
"http://schemas.xmlsoap.org/soap/envelope/");
741 $errorresponse = $xml->xpath(
"//s:Fault");
742 if(is_array($errorresponse) && count($errorresponse)) {
743 $resp_arr = array(
'faultcode' => $errorresponse[0]->faultcode,
744 'faultstring' => $errorresponse[0]->faultstring);
746 $xml->registerXPathNamespace(
'bill', $pvNS);
747 $dataresponse = $xml->xpath(
"//bill:$pvCONT");
748 $resp_arr = objectToArray($dataresponse[0]);
764 }
catch (Exception $e) {
770 function objectToArray( $object )
772 if( !is_object( $object ) && !is_array( $object ) )
776 if( is_object( $object ) )
778 $object = get_object_vars( $object );
780 return array_map(
'objectToArray', $object );
784 function PV_embcurl($reqURL, $reqSoap, $reqHeaders, $reqOpts = array()) {
785 # reqURL is the service url 786 # reqSoap is the soap string to pass 787 # reqHeaders is an array of headers to be sent 788 # reqOpts is an array of curlopts 792 CURLOPT_RETURNTRANSFER => 1,
793 CURLOPT_SSL_VERIFYPEER => 0,
794 CURLOPT_SSL_VERIFYHOST => 0,
797 CURLOPT_POSTFIELDS =>
"$reqSoap",
798 CURLOPT_URL =>
"$reqURL");
801 @curl_setopt_array($ch, $curlopts);
802 if (count($reqOpts)) {
803 @curl_setopt_array($ch, $reqOpts);
805 @curl_setopt($ch, CURLOPT_HTTPHEADER, $reqHeaders);
806 $response = @curl_exec($ch);
808 if (curl_errno($ch)) {
809 $response = array(
'Curl_errno' => curl_errno($ch),
'Curl_error' => curl_error($ch));
815 function ListHolidays($Start, $End) {
825 for ($i = $Start; $i <= $End; $i++) {
826 for ($m = 1; $m <= 12; $m++) {
837 $dtHoliday = mktime(12, 0, 0, 1, 1, $i);
839 $holidays[] = date(
'Y-m-d',$dtHoliday);
841 $dow = idate(
'w', $dtHoliday);
847 case 1: #already Monday
850 $dtHoliday += (86400 * 6);
853 $dtHoliday += (86400 * 5);
856 $dtHoliday += (86400 * 4);
859 $dtHoliday += (86400 * 3);
862 $dtHoliday += (86400 * 2);
865 $dtHoliday += (86400 * 14); # add 2 weeks to
get 3rd Monday
866 $holidays[] = date(
'Y-m-d',$dtHoliday);
871 $dtHoliday = mktime(12, 0, 0, 2, 1, $i);
872 $dow = idate(
'w', $dtHoliday);
878 case 1: #already Monday
881 $dtHoliday += (86400 * 6);
884 $dtHoliday += (86400 * 5);
887 $dtHoliday += (86400 * 4);
890 $dtHoliday += (86400 * 3);
893 $dtHoliday += (86400 * 2);
896 $dtHoliday += (86400 * 14); # add 2 weeks to
get 3rd Monday
897 $holidays[] = date(
'Y-m-d',$dtHoliday);
902 $dtHoliday = mktime(12, 0, 0, 5, 31, $i);
903 $dow = idate(
'w', $dtHoliday);
904 # find last day & back up 907 $dtHoliday -= (86400 * 6);
909 case 1: #already Monday
915 $dtHoliday -= (86400 * 2);
918 $dtHoliday -= (86400 * 3);
921 $dtHoliday -= (86400 * 4);
924 $dtHoliday -= (86400 * 5);
927 $holidays[] = date(
'Y-m-d',$dtHoliday);
932 $dtHoliday = mktime(12, 0, 0, 7, 4, $i);
934 $holidays[] = date(
'Y-m-d',$dtHoliday);
940 $dtHoliday = mktime(12, 0, 0, 9, 1, $i);
941 $dow = idate(
'w', $dtHoliday);
947 case 1: #already Monday
950 $dtHoliday += (86400 * 6);
953 $dtHoliday += (86400 * 5);
956 $dtHoliday += (86400 * 4);
959 $dtHoliday += (86400 * 3);
962 $dtHoliday += (86400 * 2);
965 $holidays[] = date(
'Y-m-d',$dtHoliday);
970 $dtHoliday = mktime(12, 0, 0, 10, 1, $i);
971 $dow = idate(
'w', $dtHoliday);
977 case 1: #already Monday
980 $dtHoliday += (86400 * 6);
983 $dtHoliday += (86400 * 5);
986 $dtHoliday += (86400 * 4);
989 $dtHoliday += (86400 * 3);
992 $dtHoliday += (86400 * 2);
995 $dtHoliday += (86400 * 7); # add 1 week to
get 2nd Monday
996 $holidays[] = date(
'Y-m-d',$dtHoliday);
1001 $dtHoliday = mktime(12, 0, 0, 11, 11, $i);
1003 $holidays[] = date(
'Y-m-d',$dtHoliday);
1006 $dtHoliday = mktime(12, 0, 0, 11, 1, $i);
1007 $dow = idate(
'w', $dtHoliday);
1008 # find first Thursday 1011 $dtHoliday += (86400 * 4);
1014 $dtHoliday += (86400 * 3);
1017 $dtHoliday += (86400 * 2);
1020 $dtHoliday += 86400;
1025 $dtHoliday += (86400 * 6);
1028 $dtHoliday += (86400 * 5);
1031 $dtHoliday += (86400 * 21); # add 3 weeks to
get 4th Thursday
1032 $holidays[] = date(
'Y-m-d',$dtHoliday);
1037 $dtHoliday = mktime(12, 0, 0, 12, 25, $i);
1039 $holidays[] = date(
'Y-m-d',$dtHoliday);
1050 Function GetNearestWeekday($dtTimeStamp) {
1053 $intWeekday = idate(
'w', $dtTimeStamp);
1054 switch ($intWeekday) {
1055 case 0: #Sunday - move forward to Monday
1056 $dtTimeStamp += 86400;
1058 case 6: #Saturday - move back to Friday
1059 $dtTimeStamp -= 86400;
1061 case 1: # Monday - Friday -
do nothing
1069 return $dtTimeStamp;
1072 Function GetNextBusiness($dtTimeStamp) {
1075 $intWeekday = idate(
'w', $dtTimeStamp);
1076 switch ($intWeekday) {
1077 case 0: #Sunday - move forward to Monday
1078 $dtTimeStamp += 86400;
1080 case 6: #Saturday - move forward to Monday
1081 $dtTimeStamp += (86400*2);
1083 case 1: # Monday - Friday -
do nothing
1091 return $dtTimeStamp;
1093 function PV_getHCUAccts($dbh, $parms) {
1096 if (!isset($parms[
'passwith'][
'Cu']) || !isset($parms[
'passwith'][
'Cn'])) {
1097 $AcctList[
"status"][
"response"] =
'false';
1098 $AcctList[
"status"][
"code"] =
'910';
1099 $AcctList[
"status"][
"message"] =
'Missing PV Account Parameters' . print_r($parms,
true); # PV_getHCUAccts missing Cu/Cn
1105 $Cu = $parms[
'passwith'][
'Cu'];
1106 $Cn = $parms[
'passwith'][
'Cn'];
1107 $showavailable = $parms[
'passwith'][
'showavailable'];
1108 $showbal = ($showavailable ?
'available' :
'amount ');
1109 $dataasof = ((bool)strtotime($parms[
'passwith'][
'lastupdate']) ? date(
'Y-m-d', strtotime($parms[
'passwith'][
'lastupdate'])) : date(
'Y-m-d'));
1110 $PV_AcctsWhere = $parms[
'getAcctsWhere'];
1111 $PV_AcctsAs = (isset($parms[
'AccountNumberAs']) ? $parms[
'AccountNumberAs'] :
"trim(micraccount)");
1112 $PV_csatAs = (isset($parms[
'CoreSpecificAs']) ? $parms[
'CoreSpecificAs'] :
"trim(accounttype)");
1113 $PV_PayBillsFrom = (isset($parms[
'PayBillsFrom']) ? $parms[
'PayBillsFrom'] :
"'true'");
1114 $PV_TransferFrom = (isset($parms[
'TransferFrom']) ? $parms[
'TransferFrom'] :
"'true'");
1115 $PV_TransferTo = (isset($parms[
'TransferTo']) ? $parms[
'TransferTo'] :
"'true'");
1116 $PV_SendJoint = (HCU_array_key_value(
'sendjoint', $parms) ?
'' :
" and accounttype not like '%@%' ");
1123 $sql =
"select trim(accountnumber) as accountnumber, 1124 trim(accounttype) as accounttype, 1127 case when deposittype = 'Y' then 'Checking' else 'Savings' end as depositdesc, 1128 $showbal as acctbalance, 1129 $PV_PayBillsFrom as paybillsfrom, 1130 $PV_TransferFrom as transferfrom, 1131 $PV_TransferTo as transferto, 1132 trim(description) as description, 1133 $PV_AcctsAs as micraccount, 1134 $PV_csatAs as corespecific 1135 from ${Cu}accountbalance 1136 where accountnumber='$Cn' and deposittype in ('Y','S','N') $PV_SendJoint ";
1137 if (isset($PV_AcctsWhere)) $sql .=
" and $PV_AcctsWhere ";
1139 # Run the sql and see if we got anything 1141 $sthdp = db_query($sql, $dbh);
1143 if (db_num_rows($sthdp)) {
1145 for ($row = 0; $drow = db_fetch_array($sthdp, $row); $row++) {
1146 if ($drow[
'deposittype'] ==
'Y') {
1151 $drow[
'description'] = utf8_encode($drow[
'description']);
1153 $accounttype = $drow[
'accounttype'];
1154 $cert = $drow[
'certnumber'];
1155 $micraccount = $drow[
'micraccount'];
1156 if (strpos($accounttype,
"@")) {
1161 if (trim($micraccount) ==
'') {
1162 $sqlmicr =
"select trim(o.micraccount) as omicr 1163 from cuovermicr o join cuadmin a on o.cu = a.cu 1164 where o.cu='$Cu' and o.accountnumber='$Cn' 1165 and o.accounttype='$accounttype' and o.rt=a.rt 1166 order by o.startcheck desc limit 1";
1167 $sthmicr = db_query($sqlmicr, $dbh);
1168 if (db_num_rows($sthmicr) == 1) {
1169 list ($micraccount) = db_fetch_row($sthmicr, 0);
1170 $drow[
'micraccount'] = $micraccount;
1175 $accts[
"dp"][
"D|$Cn|$accounttype|$cert"][
"accounttype"] = $drow[
'accounttype'];
1176 $accts[
"dp"][
"D|$Cn|$accounttype|$cert"][
"certnumber"] = $drow[
'certnumber'];
1177 $accts[
"dp"][
"D|$Cn|$accounttype|$cert"][
"depositdesc"] = $drow[
'depositdesc'];
1178 $accts[
"dp"][
"D|$Cn|$accounttype|$cert"][
"description"] = $drow[
'description'];
1179 $accts[
"dp"][
"D|$Cn|$accounttype|$cert"][
"acctbalance"] = sprintf(
"%.2f",$drow[
'acctbalance']);
1180 $accts[
"dp"][
"D|$Cn|$accounttype|$cert"][
"acctbalasof"] = $dataasof;
1181 $accts[
"dp"][
"D|$Cn|$accounttype|$cert"][
"micraccount"] = $drow[
'micraccount'];
1182 $accts[
"dp"][
"D|$Cn|$accounttype|$cert"][
"corespecific"] = $drow[
'corespecific'];
1183 $accts[
"dp"][
"D|$Cn|$accounttype|$cert"][
"trust"] =
"$trust";
1184 $accts[
"dp"][
"D|$Cn|$accounttype|$cert"][
"paybillsfrom"] = $drow[
'paybillsfrom'];
1185 $accts[
"dp"][
"D|$Cn|$accounttype|$cert"][
"transferfrom"] = $drow[
'transferfrom'];
1186 $accts[
"dp"][
"D|$Cn|$accounttype|$cert"][
"transferto"] = $drow[
'transferto'];
1187 $accts[
"dp"][
"D|$Cn|$accounttype|$cert"][
"displaydesc"] =
1188 ($cert == 0 ?
"{$drow['description']} - $accounttype" :
"{$drow['description']} # $cert - $accounttype");
1191 if (isset($accts[
'dp']) &&
sizeof($accts[
'dp'])) {
1192 $accts[
"status"][
"code"] =
'000';
1193 $accts[
"status"][
"severity"] =
'SUCCESS';
1194 $accts[
"status"][
"CheckingAccounts"] = $checkingCount;
1197 $accts[
"status"][
"code"] =
'999';
1198 $accts[
"status"][
"severity"] =
'ERROR';
1199 $accts[
"status"][
"errors"][] =
'No Accounts Available';
1203 if ( $parms[
"logging"] ==
"enabled" ) {
1204 $logParms = $parms[
"environment"];
1205 $logParms[
"token"] =
'';
1206 $logParms[
"txnId"] = time();
1207 $logParms[
"logPoint"] =
"PV_getHCUAccts";
1208 $logParms[
"request"] =
"{$logParms['platform']} : userIP {$logParms['userIP']} userAgent {$logParms['userAgent']} \n$sql";
1209 $logParms[
"reply"] = print_r($accts,
true);
1210 LogSSOActivity( $logParms );
1214 function PV_populateMIR($MIR, $Ml, $reqMIR, $datefmt =
'Y-m-d', $phones =
'flat', $noEmpty =
false) {
1244 if ($phones ==
'flat') {
1245 $MIR[
'phone'] = preg_replace(
'/\D/',
'', $MIR[
'homephone']);
1246 if (trim($MIR[
'phone']) ==
'') {
1247 $MIR[
'phone'] = preg_replace(
'/\D/',
'', $MIR[
'cellphone']);
1249 if (trim($MIR[
'phone']) ==
'') {
1250 $MIR[
'phone'] = preg_replace(
'/\D/',
'', $MIR[
'workphone']);
1252 } elseif ($phones ==
'split') {
1253 $MIR[
'homephone'] = preg_replace(
'/\D/',
'', $MIR[
'homephone']);
1254 switch (strlen($MIR[
'homephone'])) {
1256 $MIR[
'homephone'] = array(
'Area' => substr($MIR[
'homephone'], 0, 3),
1257 'Pre' => substr($MIR[
'homephone'], 3, 3),
1258 'Num' => substr($MIR[
'homephone'], 6, 4));
1260 # PV requires 10 digits -- don't allow 7 1266 unset($MIR[
'homephone']);
1269 $MIR[
'cellphone'] = preg_replace(
'/\D/',
'', $MIR[
'cellphone']);
1270 switch (strlen($MIR[
'cellphone'])) {
1272 $MIR[
'cellphone'] = array(
'Area' => substr($MIR[
'cellphone'], 0, 3),
1273 'Pre' => substr($MIR[
'cellphone'], 3, 3),
1274 'Num' => substr($MIR[
'cellphone'], 6, 4));
1276 # PV requires 10 digits -- don't allow 7 1282 unset($MIR[
'cellphone']);
1285 $MIR[
'workphone'] = preg_replace(
'/\D/',
'', $MIR[
'workphone']);
1286 switch (strlen($MIR[
'workphone'])) {
1288 $MIR[
'workphone'] = array(
'Area' => substr($MIR[
'workphone'], 0, 3),
1289 'Pre' => substr($MIR[
'workphone'], 3, 3),
1290 'Num' => substr($MIR[
'workphone'], 6, 4));
1292 # PV requires 10 digits -- don't allow 7 1298 unset($MIR[
'workphone']);
1304 if (strtotime($MIR[
'dob'])) {
1305 $MIR[
'dob'] = date($datefmt, strtotime($MIR[
'dob']));
1310 $rmlist = array(
' ',
'-');
1311 $MIR[
'ssn'] = str_replace($rmlist,
'', $MIR[
'ssn']);
1313 $MIR[
'zip'] = str_replace($rmlist,
'', $MIR[
'zip']);
1314 if (strlen($MIR[
'zip']) < 5) {
1318 $rmlist = array(
"#",
"&",
"/",
"%",
",",
":",
"=",
"?",
"'");
1320 $EMAIL = (empty($MIR[
'email']) ? $Ml : $MIR[
'email']);
1321 $MIR[
'email'] = str_replace($rmlist,
"", $EMAIL);
1322 $MIR[
'firstname'] = str_replace($rmlist,
"", $MIR[
'firstname']);
1323 $MIR[
'middlename'] = str_replace($rmlist,
"", $MIR[
'middlename']);
1324 $MIR[
'lastname'] = str_replace($rmlist,
"", $MIR[
'lastname']);
1325 $MIR[
'address1'] = str_replace($rmlist,
"", $MIR[
'address1']);
1326 $MIR[
'address2'] = str_replace($rmlist,
"", $MIR[
'address2']);
1327 $MIR[
'city'] = str_replace($rmlist,
"", $MIR[
'city']);
1328 $MIR[
'state'] = str_replace($rmlist,
"", $MIR[
'state']);
1329 $MIR[
'accountnumber'] = str_replace($rmlist,
"", $MIR[
'accountnumber']);
1330 # default country code to US. Assume CU will specify for other countries 1331 if (trim($MIR[
'cc']) ==
'') {
1335 $MIR[
'class'] = str_replace($rmlist,
"", $MIR[
'class']);
1336 if (trim($MIR[
'class']) ==
'') {
1337 $MIR[
'class'] =
'P'; #
default to personal account
1339 # Jan 2018 Payveris requires firstname / lastname even for business. So if this is a business 1340 # account and the first name is empty, fill it with a dot so we can connect 1341 if (empty($MIR[
'firstname']) && in_array ( $MIR[
'class'] , array (
'B',
'T') ) ) {
1342 $MIR[
'firstname'] =
'.';
1347 if (trim($MIR[
'email']) ==
false) {
1348 unset($MIR[
'email']);
1350 if (trim($MIR[
'firstname']) ==
false) {
1351 unset($MIR[
'firstname']);
1353 if (trim($MIR[
'middlename']) ==
false) {
1354 unset($MIR[
'middlename']);
1356 if (trim($MIR[
'lastname']) ==
false) {
1357 unset($MIR[
'lastname']);
1359 if (trim($MIR[
'address1']) ==
false) {
1360 unset($MIR[
'address1']);
1362 if (trim($MIR[
'address2']) ==
false) {
1363 unset($MIR[
'address2']);
1365 if (trim($MIR[
'city']) ==
false) {
1366 unset($MIR[
'city']);
1368 if (trim($MIR[
'state']) ==
false) {
1369 unset($MIR[
'state']);
1371 if (trim($MIR[
'accountnumber']) ==
false) {
1372 unset($MIR[
'accountnumber']);
1374 if (trim($MIR[
'dob']) ==
false) {
1377 if (trim($MIR[
'zip']) ==
false) {
1382 $missing = array_diff_key($reqMIR, $MIR);
1383 if (
sizeof($missing)) {
1385 throw new Exception(
"Incomplete Member Info (" . join(
", ", array_keys($missing)) .
")");
1387 $return[
'status'][
'response'] =
true;
1388 $return[
'status'][
'message'] =
'Success';
1389 $return[
'data'] = $MIR;
1390 }
catch (Exception $e) {
1391 $return[
'status'][
'response'] =
false;
1392 $return[
'status'][
'message'] = $e->getMessage();
1394 $return[
'data'] = array();