34 define(
"MP_PSCU_ERROR_CODE",
"5010" );
36 function bpAuth($parms) {
38 $return=array(
'status'=>array(
'response'=>
'true',
'code'=>
'000',
'message'=>
'success'));
40 if (HCU_array_key_value(
'pilot', $parms) == 1) {
41 $parms[
'serviceurl'] = HCU_array_key_value(
'piloturl', $parms);
43 $parms[
'serviceurl'] = HCU_array_key_value(
'produrl', $parms);
45 if (empty($parms[
'serviceurl']) ) {
46 throw new Exception(
'Missing URL configuration');
52 $parms[
'Token']=time();
54 $reqdata = pscuBankAccounts($parms);
56 if ($reqdata[
'status'][
'response'] !=
'true') {
57 throw new Exception($reqdata[
'status'][
'message']);
60 $return[
'data'][
'Token']=time();
61 $return[
'data'][
'BillpayId']=HCU_array_key_value(
'BillpayId', $parms);
62 $return[
"data"][
'MoblPayName']= (trim(HCU_array_key_value(
'MoblPayName', $parms)) ==
'' ? htmlentities(
'Pay Bills') : htmlentities($parms[
'MoblPayName']));
63 $return[
'data'][
'DateModel']=HCU_array_key_value(
'datemodel', $parms);
64 $return[
'data'][
'Extras']=htmlentities(HCU_array_key_value(
'ExtraOptions', $parms));
66 }
catch (Exception $e) {
67 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage(),
'code'=>
'999'),
'data'=>array(
'Token'=>
'0'));
72 function bpHist($parms) {
74 $return=array(
'status'=>array(
'response'=>
'true',
'message'=>
'success'));
75 if (HCU_array_key_value(
'pilot', $parms) == 1) {
76 $parms[
'serviceurl'] = HCU_array_key_value(
'piloturl', $parms);
78 $parms[
'serviceurl'] = HCU_array_key_value(
'produrl', $parms);
80 if (empty($parms[
'serviceurl']) ) {
81 throw new Exception(
'Missing URL configuration');
83 $parms[
'Token']=$parms[
'passwith'][
'Token'];
84 $reqdata = pscuGetRecentPayments($parms);
86 if ($reqdata[
'status'][
'response'] !=
'true') {
87 throw new Exception($reqdata[
'status'][
'message']);
89 foreach ($reqdata[
'data'] as $pkey => $payment) {
91 foreach ($payment as $key => $value) {
94 $item[
'TxnId'] = $value;
97 $item[
'ToName'] = $value[
'payeeName'];
100 $item[
'Amount'] = sprintf(
'%0.2f',$value);
103 $item[
'Date'] = substr($value, 0, 10);
105 case 'confirmationNumber':
106 $item[
'AdditionalInfo'][
'Confirmation'] = $value;
108 case "paymentAccount":
109 $item[
'AdditionalInfo'][
'Paid_From'] = implode(
"|", $value);
111 case "automaticPayment":
112 $item[
'AdditionalInfo'][
'Automatic'] = ($value ?
'True' :
'False');
114 case "recurringPayment":
115 $item[
'AdditionalInfo'][
'Recurring'] = ($value ?
'True' :
'False');
118 $item[
'AdditionalInfo'][
'Status'] = $value;
122 $item[
'Type']=
'Payment';
123 $return[
'data'][]=$item;
126 if (is_array($return[
'data'])) {
127 usort($return[
'data'],
"histSort");
131 }
catch (Exception $e) {
132 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage()),
'code'=>MP_PSCU_ERROR_CODE,
'data'=>array());
137 function bpSched($parms) {
139 $return=array(
'status'=>array(
'response'=>
'true',
'message'=>
'success'));
140 if (HCU_array_key_value(
'pilot', $parms) == 1) {
141 $parms[
'serviceurl'] = HCU_array_key_value(
'piloturl', $parms);
143 $parms[
'serviceurl'] = HCU_array_key_value(
'produrl', $parms);
145 if (empty($parms[
'serviceurl']) ) {
146 throw new Exception(
'Missing URL configuration');
149 $parms[
'Token']=$parms[
'passwith'][
'Token'];
150 $reqdata = pscuGetScheduledPayments($parms);
151 if ($reqdata[
'status'][
'response'] !=
'true') {
152 throw new Exception($reqdata[
'status'][
'message']);
154 foreach ($reqdata[
'data'] as $pkey => $payment) {
156 foreach ($payment as $key => $value) {
158 case 'transactionID':
159 $item[
'TxnId'] = $value;
162 $item[
'ToName'] = $value[
'payeeName'];
163 $item[
'ToId'] = $value[
'id'];
166 $item[
'Amount'] = sprintf(
'%0.2f',$value);
169 $item[
'Date'] = substr($value, 0, 10);
171 case "paymentAccount":
172 # PSCU doesn't use a separate fromID, set both id & name 173 $item[
'FromId'] = implode(
"|", $value);
174 $item[
'AdditionalInfo'][
'Pay_From'] = implode(
"|", $value);
176 case 'confirmationNumber':
177 $item[
'AdditionalInfo'][
'Confirmation'] = $value;
179 case "automaticPayment":
180 $item[
'AdditionalInfo'][
'Automatic'] = ($value ?
'True' :
'False');
182 case "recurringPayment":
183 $item[
'AdditionalInfo'][
'Recurring'] = ($value ?
'True' :
'False');
186 $item[
'AdditionalInfo'][
'Status'] = $value;
190 $item[
'Type']=
'Payment';
192 $item[
'Frequency']=
'Once';
193 $return[
'data'][]=$item;
195 if (is_array($return[
'data'])) {
196 usort($return[
'data'],
"schedSort");
199 }
catch (Exception $e) {
200 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage()),
'code'=>MP_PSCU_ERROR_CODE,
'data'=>array());
205 function bpSourceAccts($parms) {
207 $return=array(
'status'=>array(
'response'=>
'true',
'message'=>
'success'));
208 if (HCU_array_key_value(
'pilot', $parms) == 1) {
209 $parms[
'serviceurl'] = HCU_array_key_value(
'piloturl', $parms);
211 $parms[
'serviceurl'] = HCU_array_key_value(
'produrl', $parms);
213 if (empty($parms[
'serviceurl']) ) {
214 throw new Exception(
'Missing URL configuration');
217 $parms[
'Token']=$parms[
'passwith'][
'Token'];
218 $reqdata = pscuBankAccounts($parms);
219 if ($reqdata[
'status'][
'response'] !=
'true') {
220 throw new Exception($reqdata[
'status'][
'message']);
222 $hasAtLeastOneAccount =
false;
223 foreach ($reqdata[
'data'] as $akey => $account) {
225 foreach ($account as $key => $value) {
229 if (trim($value) >
'') {
231 $item[
'Name'] = $value;
234 case "paymentAccount":
235 $item[
'FromId'] = implode(
"|", $value);
236 $hasAtLeastOneAccount =
true;
238 case 'preferredAccount':
239 $item[
'AdditionalInfo'][
'Preferred_Account'] = (is_null($value) ? 0 : 1);
241 case 'primaryAccountOwner':
242 if (trim($value) >
'') {
243 $item[
'AdditionalInfo'][
'Primary_Owner'] = $value;
249 if ( strlen( HCU_array_key_value(
'Name', $item) ) == 0 &&
250 strlen( HCU_array_key_value(
'FromId', $item) ) > 0 ) {
251 $parts = explode(
"|", $item[
"FromId"] );
252 $item[
"Name"] = $parts[0];
256 $return[
'data'][]=$item;
259 if ( !$hasAtLeastOneAccount ) {
260 throw new Exception(
"No source accounts received from vendor.");
262 }
catch (Exception $e) {
263 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage()),
'code'=>MP_PSCU_ERROR_CODE,
'data'=>array());
268 function bpDestAccts($parms) {
269 # PSCU doesn't do transfers, so this is always Payees 271 $return=array(
'status'=>array(
'response'=>
'true',
'message'=>
'success'));
272 if (HCU_array_key_value(
'pilot', $parms) == 1) {
273 $parms[
'serviceurl'] = HCU_array_key_value(
'piloturl', $parms);
275 $parms[
'serviceurl'] = HCU_array_key_value(
'produrl', $parms);
277 if (empty($parms[
'serviceurl']) ) {
278 throw new Exception(
'Missing URL configuration');
281 $parms[
'Token']=$parms[
'passwith'][
'Token'];
282 $reqdata = pscuGetPayees($parms);
283 if ($reqdata[
'status'][
'response'] !=
'true') {
284 throw new Exception($reqdata[
'status'][
'message']);
286 $hasAtLeastOneAccount =
false;
287 foreach ($reqdata[
'data'] as $akey => $account) {
289 foreach ($account as $key => $value) {
292 $item[
'ToId'] = $value;
293 $hasAtLeastOneAccount =
true;
296 $item[
'Name'] = $value;
298 case 'preferredAccount':
299 $item[
'AdditionalInfo'][
'Preferred_Account'] = (is_null($value) ? 0 : 1);
301 case 'primaryAccountOwner':
302 if (trim($value) >
'') {
303 $item[
'AdditionalInfo'][
'Primary_Owner'] = $value;
306 case 'accountNumber':
307 if (trim($value) >
'') {
308 $item[
'AdditionalInfo'][
'Account_Number'] = $value;
311 if (trim($value) >
'') {
312 $item[
'AdditionalInfo'][
'Category'] = $value;
314 case 'earliestPaymentDt':
315 if (strtotime($value)) {
316 $item[
'FirstPayDate'] = gmdate(
"Y-m-d", strtotime( $value ) );
318 case 'nextPaymentDt':
319 if (strtotime($value)) {
320 $item[
'NextPayDate'] = gmdate(
"Y-m-d", strtotime( $value ) );
326 $return[
'data'][]=$item;
329 if ( !$hasAtLeastOneAccount ) {
330 throw new Exception(
"No destination accounts received from vendor.");
332 }
catch (Exception $e) {
333 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage()),
'code'=>MP_PSCU_ERROR_CODE,
'data'=>array());
338 function bpPmtAdd($parms) {
340 $return=array(
'status'=>array(
'response'=>
'true',
'message'=>
'success'));
341 if (HCU_array_key_value(
'pilot', $parms) == 1) {
342 $parms[
'serviceurl'] = HCU_array_key_value(
'piloturl', $parms);
344 $parms[
'serviceurl'] = HCU_array_key_value(
'produrl', $parms);
346 if (empty($parms[
'serviceurl']) ) {
347 throw new Exception(
'Missing URL configuration');
349 list($acctno,$accttype,$rt) = explode(
"|",$parms[
'passwith'][
'FromId']);
350 $parms[
'Token']=$parms[
'passwith'][
'Token'];
351 $parms[
'PayeeId'] = $parms[
'passwith'][
'ToId'];
352 $parms[
'AcctNo'] = $acctno;
353 $parms[
'AcctType'] = $accttype;
355 $parms[
'PayDate'] = $parms[
'passwith'][
'Date'];
356 $parms[
'Amount'] = $parms[
'passwith'][
'Amount'];
357 # PSCU mobile doesn't support rush payments 358 $parms[
'DelMethod'] =
'REGULAR_PAYMENT';
360 $reqdata = pscuAddPayment($parms);
361 if ($reqdata[
'status'][
'response'] !=
'true') {
362 throw new Exception($reqdata[
'status'][
'message']);
365 $return[
'data'][
'Confirmation']=$reqdata[
'data'][
'confirmationNumber'];
366 $return[
'data'][
'TransactionId']=$reqdata[
'data'][
'transactionID'];
367 $return[
'data'][
'EstimatedArrival']=
'';
369 }
catch (Exception $e) {
370 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage()),
'code'=>MP_PSCU_ERROR_CODE,
'data'=>array());
375 function bpTrnAdd($parms) {
377 $return=array(
'status'=>array(
'response'=>
'true',
'message'=>
'success'),
'data'=>array());
378 # PSCU has no Transfer functionality - just return error 379 throw new Exception(
'Feature Unavailable');
380 }
catch (Exception $e) {
381 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage()),
'code'=>MP_PSCU_ERROR_CODE,
'data'=>array());
386 function bpPmtEdit($parms) {
388 $return=array(
'status'=>array(
'response'=>
'true',
'message'=>
'success'));
389 if (HCU_array_key_value(
'pilot', $parms) == 1) {
390 $parms[
'serviceurl'] = HCU_array_key_value(
'piloturl', $parms);
392 $parms[
'serviceurl'] = HCU_array_key_value(
'produrl', $parms);
394 if (empty($parms[
'serviceurl']) ) {
395 throw new Exception(
'Missing URL configuration');
398 list($acctno,$accttype,$rt) = explode(
"|",$parms[
'passwith'][
'payFrom']);
399 $parms[
'Token']=$parms[
'passwith'][
'Token'];
400 $parms[
'txnID'] = $parms[
'passwith'][
'TxnId'];
401 $parms[
'PayeeId'] = $parms[
'passwith'][
'ToId'];
402 $parms[
'AcctNo'] = $acctno;
403 $parms[
'AcctType'] = $accttype;
405 $parms[
'PayDate'] = $parms[
'passwith'][
'Date'];
406 $parms[
'Amount'] = $parms[
'passwith'][
'Amount'];
407 # PSCU mobile doesn't support rush payments 408 $parms[
'DelMethod'] =
'REGULAR_PAYMENT';
410 $reqdata = pscuEditPayment($parms);
411 if ($reqdata[
'status'][
'response'] !=
'true') {
412 throw new Exception($reqdata[
'status'][
'message']);
415 $return[
'data'][
'Confirmation']=$reqdata[
'data'][
'confirmationNumber'];
416 $return[
'data'][
'TransactionId']=$reqdata[
'data'][
'transactionID'];
417 $return[
'data'][
'EstimatedArrival']=
'';
419 }
catch (Exception $e) {
420 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage()),
'code'=>MP_PSCU_ERROR_CODE,
'data'=>array());
425 function bpPmtStop($parms) {
427 $return=array(
'status'=>array(
'response'=>
'true',
'message'=>
'success'));
428 if (HCU_array_key_value(
'pilot', $parms) == 1) {
429 $parms[
'serviceurl'] = HCU_array_key_value(
'piloturl', $parms);
431 $parms[
'serviceurl'] = HCU_array_key_value(
'produrl', $parms);
433 if (empty($parms[
'serviceurl']) ) {
434 throw new Exception(
'Missing URL configuration');
437 $parms[
'Token']=$parms[
'passwith'][
'Token'];
438 $parms[
'txnID'] = $parms[
'passwith'][
'TxnId'];
440 $reqdata = pscuCancelPayment($parms);
441 if ($reqdata[
'status'][
'response'] !=
'true') {
442 throw new Exception($reqdata[
'status'][
'message']);
444 $return[
'data'][
'StopResult']=1;
446 }
catch (Exception $e) {
447 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage()),
'code'=>MP_PSCU_ERROR_CODE,
'data'=>array());
452 function bpGetPaymentDates($parms) {
454 $return=array(
'status'=>array(
'response'=>
'true',
'message'=>
'success'));
456 if (HCU_array_key_value(
'pilot', $parms) == 1) {
457 $parms[
'serviceurl'] = HCU_array_key_value(
'piloturl', $parms);
459 $parms[
'serviceurl'] = HCU_array_key_value(
'produrl', $parms);
461 if (empty($parms[
'serviceurl']) ) {
462 throw new Exception(
'Missing URL configuration');
465 $parms[
'Token']=$parms[
'passwith'][
'Token'];
466 # PSCU always gets dates relative to Payee 467 $parms[
'PayeeId']=$parms[
'passwith'][
'PayeeId'];
469 $reqdata = pscuGetPayees($parms);
470 if ($reqdata[
'status'][
'response'] !=
'true') {
471 throw new Exception($reqdata[
'status'][
'message']);
473 foreach ($reqdata[
'data'] as $payee) {
474 if ($payee[
'id'] == $parms[
'PayeeId']) {
475 # this is the $account we want, break out of foreach(reqdata['data']); 479 $lead = $payee[
'leadDays'];
480 $firstpay = $payee[
'earliestPaymentDt'];
481 $nextpay = $payee[
'nextPaymentDt'];
482 $cutoff = $payee[
'cutoffTime'];
485 # test $firstpay to make sure it is a date? 486 $defaultTZ=date_default_timezone_get(); # so we can put it back
487 date_default_timezone_set(
'UTC');
489 if($now > strtotime( $cutoff )) {
490 $Start = strtotime( $nextpay );
492 $Start = strtotime( $firstpay );
494 # if Start is false (strtotime failed) use current time 495 $Start = ($Start ? $Start : $now);
496 $End = $Start + (90 * 24 * 60 * 60);
497 $holidays = ListHolidays(date(
'Y',$Start),date(
'Y',$End));
498 for ($i=$Start; $i<=$End; $i+=86400) {
499 $i=GetNextBusiness($i);
501 $idate = gmdate(
'Y-m-d',$i);
502 if (!in_array($idate,$holidays)) {
503 $item[
'Proc'] = gmdate(
'Y-m-d',$i);
504 if (strtoupper($parms[
'datemodel']) ==
'DUE') {
505 $item[
'Due'] = gmdate(
'Y-m-d',GetNextBusiness($i+($lead*86400)));
512 date_default_timezone_set($defaultTZ);
514 $return[
'data'][
'EarliestPay'] = $firstpay;
515 $return[
'data'][
'NextPay'] = $nextpay;
516 $return[
'data'][
'Cutoff'] = $cutoff;
517 $return[
'data'][
'LeadDays'] = $lead;
518 # build RushOptions list like this: 520 $return[
'data'][
'RushOptions']=array();
521 $return[
'data'][
'PaymentDates']=$datelist;
522 }
catch (Exception $e) {
523 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage()),
'code'=>MP_PSCU_ERROR_CODE,
'data'=>array());
528 function bpGetTerms($parms) {
530 # PSCU has no Get Terms functionality - just return empty success 531 $return=array(
'status'=>array(
'response'=>
'true',
'message'=>
'success'),
'data'=>array(
'Terms'=>
''));
532 }
catch (Exception $e) {
533 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage()),
'code'=>MP_PSCU_ERROR_CODE,
'data'=>array());
538 function bpGetRushOptions($parms) {
540 # PSCU has no Rush Options functionality - just return empty success 541 $return=array(
'status'=>array(
'response'=>
'true',
'message'=>
'success'),
'data'=>array());
542 }
catch (Exception $e) {
543 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage()),
'code'=>MP_PSCU_ERROR_CODE,
'data'=>array());
548 function bpAcceptTerms($parms) {
550 # PSCU has no Accept Terms functionality - just return empty success 551 $return=array(
'status'=>array(
'response'=>
'true',
'message'=>
'success'),
'data'=>array());
552 }
catch (Exception $e) {
553 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage()),
'code'=>MP_PSCU_ERROR_CODE,
'data'=>array());
558 function bpGetFeatureList($parms) {
560 # Need to decide what the data looks like here -- string list of available features 561 # maybe something out of trusteddetail (which comes to this function in $parms) 562 # to allow customizing by cu 563 $extraOptions = htmlentities($parms[
'ExtraOptions']);
565 $return=array(
'status'=>array(
'response'=>
'true',
'message'=>
'success'),
566 'data'=>array(
"extras" => $extraOptions,
'featurelist'=>
""));
567 }
catch (Exception $e) {
568 $return=array(
'status'=>array(
'response'=>
'false',
'message'=>$e->getMessage()),
'code'=>MP_PSCU_ERROR_CODE,
'data'=>array());
573 function schedSort($a, $b)
575 $atime = strtotime($a[
'Date']);
576 $btime = strtotime($b[
'Date']);
577 if ($atime == $btime) {
578 if ($a[
'ToName'] == $b[
'ToName']) {
581 return ($a[
'ToName'] < $b[
'ToName']) ? -1 : 1;
583 return ($atime < $btime) ? -1 : 1;
586 function histSort($a, $b) {
587 $atime = strtotime($a[
'Date']);
588 $btime = strtotime($b[
'Date']);
589 if ($atime == $btime) {
590 if ($a[
'ToName'] == $b[
'ToName']) {
593 return ($a[
'ToName'] < $b[
'ToName']) ? -1 : 1;
595 return ($atime > $btime) ? -1 : 1;
598 function pscuGetPayees($parms) {
600 # uses: $parms['APIKey'] 601 # $parms['APISecret'] 602 # $parms['serviceurl'] 604 # $parms['BillpayId'] 608 if (!isset($parms[
'APIKey']) || !isset($parms[
'APISecret']) ||
609 !isset($parms[
'serviceurl']) || !isset($parms[
'clientid']) ||
610 !isset($parms[
'BillpayId']) || !isset($parms[
'Token'])) {
611 throw new Exception(
"Missing Parameters");
614 $parms[
'BillpayId'] = substr(
"000000000{$parms['BillpayId']}",-9,9);
615 $cmd =
"/usr/bin/curl -X GET \ 616 -H \"Content-Type:application/json\" \ 617 -H \"X-application-id:13333\" \ 618 -H \"X-account-type:subcriberID\" \ 619 -H \"X-pscu-user-id:dmsSystem\" \ 620 -H \"X-client-id:{$parms['clientid']}\" \ 621 -H \"X-interaction-id:{$parms['Token']}\" \ 622 -H \"X-account-number:{$parms['BillpayId']}\" \ 623 -u \"{$parms['APIKey']}:{$parms['APISecret']}\" \ 624 {$parms['serviceurl']}/payees";
629 $reqHeaders = array(
"Content-Type:application/json",
630 "X-application-id:13333",
631 "X-account-type:subcriberID",
632 "X-pscu-user-id:dmsSystem",
633 "X-client-id:{$parms['clientid']}",
634 "X-interaction-id:{$parms['Token']}",
635 "X-account-number:{$parms['BillpayId']}");
638 $parms[
"environment"][
"request"] = $cmd;
639 $parms[
"environment"][
"logPoint"] =
"payees";
640 $response = pscu_embcurl($parms,
"{$parms['serviceurl']}/payees",
"{$parms['APIKey']}:{$parms['APISecret']}", $reqHeaders, $reqOpts);
643 if (!empty($response)) {
644 $response = json_decode($response,
true);
647 if (empty($response) || !($response[
'success'])) {
648 throw new Exception((empty($response[
'errorMessage']) ?
"No Response" : $response[
'errorMessage']));
650 # call parse function to format response array 652 $return[
'status'][
'response'] =
'true';
653 $return[
'status'][
'message'] =
'success';
654 $return[
'data'] = $response[
'data'];
656 }
catch (Exception $e) {
657 $return[
'status'][
'response'] =
'false';
658 $return[
'status'][
'message'] = $e->getMessage();
659 $return[
'status'][
'code'] = MP_PSCU_ERROR_CODE;
660 $return[
'data'] = array();
663 $return[
'response'] = $response;
668 function pscuGetRecentPayments($parms) {
669 # uses: $parms['APIKey'] 670 # $parms['APISecret'] 671 # $parms['serviceurl'] 673 # $parms['BillpayId'] 675 # startingPaymentDate:2013-12-30 (current date ) 676 # as of 01/20/2016 - startingPaymentDate means the day to start looking at history 677 # numberOfDays:90 (days backward from starting date) 678 # as of 01/20/2016 - based on an email exchange with PSCUPAY developers, days backward from starting date 681 if (!isset($parms[
'APIKey']) || !isset($parms[
'APISecret']) ||
682 !isset($parms[
'serviceurl']) || !isset($parms[
'clientid']) ||
683 !isset($parms[
'BillpayId']) || !isset($parms[
'Token'])) {
684 throw new Exception(
"Missing Parameters");
687 $start = (isset($parms[
'startingPaymentDate']) ? $parms[
'startingPaymentDate'] : date(
'Y-m-d',time()));
688 $days = (isset($parms[
'numberOfDays']) ? $parms[
'numberOfDays'] : 90);
690 $parms[
'BillpayId'] = substr(
"000000000{$parms['BillpayId']}",-9,9);
691 $cmd =
"/usr/bin/curl -X GET \ 692 -H \"Content-Type:application/json\" \ 693 -H \"X-application-id:13333\" \ 694 -H \"X-account-type:subcriberID\" \ 695 -H \"X-pscu-user-id:dmsSystem\" \ 696 -H \"X-client-id:{$parms['clientid']}\" \ 697 -H \"X-interaction-id:{$parms['Token']}\" \ 698 -H \"X-account-number:{$parms['BillpayId']}\" \ 699 -u \"{$parms['APIKey']}:{$parms['APISecret']}\" \ 700 {$parms['serviceurl']}/recent?startingPaymentDate=$start&numberOfDays=$days";
704 $reqHeaders = array(
"Content-Type:application/json",
705 "X-application-id:13333",
706 "X-account-type:subcriberID",
707 "X-pscu-user-id:dmsSystem",
708 "X-client-id:{$parms['clientid']}",
709 "X-interaction-id:{$parms['Token']}",
710 "X-account-number:{$parms['BillpayId']}");
714 $parms[
"environment"][
"request"] = $cmd;
715 $parms[
"environment"][
"logPoint"] =
"recent";
716 $response = pscu_embcurl($parms,
"{$parms['serviceurl']}/recent?startingPaymentDate=$start&numberOfDays=$days",
"{$parms['APIKey']}:{$parms['APISecret']}", $reqHeaders, $reqOpts);
718 if (!empty($response)) {
719 $response = json_decode($response,
true);
722 if (empty($response) || !($response[
'success'])) {
723 throw new Exception((empty($response[
'errorMessage']) ?
"No Response" : $response[
'errorMessage']));
725 # call parse function to format response array 727 $return[
'status'][
'response'] =
'true';
728 $return[
'status'][
'message'] =
'success';
729 $return[
'data'] = $response[
'data'];
731 }
catch (Exception $e) {
732 $return[
'status'][
'response'] =
'false';
733 $return[
'status'][
'message'] = $e->getMessage();
734 $return[
'status'][
'code'] = MP_PSCU_ERROR_CODE;
735 $return[
'data'] = array();
740 function pscuGetScheduledPayments($parms) {
741 # uses: $parms['APIKey'] 742 # $parms['APISecret'] 743 # $parms['serviceurl'] 745 # $parms['BillpayId'] 747 # startingPaymentDate:2013-12-30 (current date ) 748 # as of 01/20/2016 - startingPaymentDate means the day to start looking at history 749 # numberOfDays:90 (days forward from starting date) 750 # as of 01/20/2016 - based on an email exchange with PSCUPAY developers, days forward from starting date 753 if (!isset($parms[
'APIKey']) || !isset($parms[
'APISecret']) ||
754 !isset($parms[
'serviceurl']) || !isset($parms[
'clientid']) ||
755 !isset($parms[
'BillpayId']) || !isset($parms[
'Token'])) {
756 throw new Exception(
"Missing Parameters");
758 $start = (isset($parms[
'startingPaymentDate']) ? $parms[
'startingPaymentDate'] : date(
'Y-m-d'));
759 $days = (isset($parms[
'numberOfDays']) ? $parms[
'numberOfDays'] : 90);
761 $parms[
'BillpayId'] = substr(
"000000000{$parms['BillpayId']}",-9,9);
762 $cmd =
"/usr/bin/curl -X GET \ 763 -H \"Content-Type:application/json\" \ 764 -H \"X-application-id:13333\" \ 765 -H \"X-account-type:subcriberID\" \ 766 -H \"X-pscu-user-id:dmsSystem\" \ 767 -H \"X-client-id:{$parms['clientid']}\" \ 768 -H \"X-interaction-id:{$parms['Token']}\" \ 769 -H \"X-account-number:{$parms['BillpayId']}\" \ 770 -u \"{$parms['APIKey']}:{$parms['APISecret']}\" \ 771 {$parms['serviceurl']}/scheduled?startingPaymentDate=$start&numberOfDays=$days";
776 $reqHeaders = array(
"Content-Type:application/json",
777 "X-application-id:13333",
778 "X-account-type:subcriberID",
779 "X-pscu-user-id:dmsSystem",
780 "X-client-id:{$parms['clientid']}",
781 "X-interaction-id:{$parms['Token']}",
782 "X-account-number:{$parms['BillpayId']}");
785 $parms[
"environment"][
"request"] = $cmd;
786 $parms[
"environment"][
"logPoint"] =
"scheduled";
787 $response = pscu_embcurl($parms,
"{$parms['serviceurl']}/scheduled?startingPaymentDate=$start&numberOfDays=$days",
"{$parms['APIKey']}:{$parms['APISecret']}", $reqHeaders, $reqOpts);
789 if (!empty($response)) {
790 $response = json_decode($response,
true);
793 if (empty($response) || !($response[
'success'])) {
794 throw new Exception((empty($response[
'errorMessage']) ?
"No Response" : $response[
'errorMessage']));
796 # call parse function to format response array 798 $return[
'status'][
'response'] =
'true';
799 $return[
'status'][
'message'] =
'success';
800 $return[
'data'] = $response[
'data'];
802 }
catch (Exception $e) {
803 $return[
'status'][
'response'] =
'false';
804 $return[
'status'][
'message'] = $e->getMessage();
805 $return[
'status'][
'code'] = MP_PSCU_ERROR_CODE;
806 $return[
'data'] = array();
811 function pscuBankAccounts($parms) {
812 # uses: $parms['APIKey'] 813 # $parms['APISecret'] 814 # $parms['serviceurl'] 816 # $parms['BillpayId'] 819 if (!isset($parms[
'APIKey']) || !isset($parms[
'APISecret']) ||
820 !isset($parms[
'serviceurl']) || !isset($parms[
'clientid']) ||
821 !isset($parms[
'BillpayId']) || !isset($parms[
'Token'])) {
822 throw new Exception(
"Missing Parameters");
825 $parms[
'BillpayId'] = substr(
"000000000{$parms['BillpayId']}",-9,9);
826 $cmd =
"/usr/bin/curl -X GET \ 827 -H \"Content-Type:application/json\" \ 828 -H \"X-application-id:13333\" \ 829 -H \"X-account-type:subcriberID\" \ 830 -H \"X-pscu-user-id:dmsSystem\" \ 831 -H \"X-client-id:{$parms['clientid']}\" \ 832 -H \"X-interaction-id:{$parms['Token']}\" \ 833 -H \"X-account-number:{$parms['BillpayId']}\" \ 834 -u \"{$parms['APIKey']}:{$parms['APISecret']}\" \ 835 {$parms['serviceurl']}/bankAccounts";
841 $reqHeaders = array(
"Content-Type:application/json",
842 "X-application-id:13333",
843 "X-account-type:subcriberID",
844 "X-pscu-user-id:dmsSystem",
845 "X-client-id:{$parms['clientid']}",
846 "X-interaction-id:{$parms['Token']}",
847 "X-account-number:{$parms['BillpayId']}");
850 $parms[
"environment"][
"request"] = $cmd;
851 $parms[
"environment"][
"logPoint"] =
"bankAccounts";
852 $response = pscu_embcurl($parms,
"{$parms['serviceurl']}/bankAccounts",
"{$parms['APIKey']}:{$parms['APISecret']}", $reqHeaders, $reqOpts);
854 if (!empty($response)) {
855 $response = json_decode($response,
true);
858 if (empty($response) || !($response[
'success'])) {
859 throw new Exception((empty($response[
'errorMessage']) ?
"No Response" : $response[
'errorMessage'] ));
861 # call parse function to format response array 863 $return[
'status'][
'response'] =
'true';
864 $return[
'status'][
'message'] =
'success';
865 $return[
'data'] = $response[
'data'];
866 $return[
'cmd'] = $cmd;
869 }
catch (Exception $e) {
870 $return[
'status'][
'response'] =
'false';
871 $return[
'status'][
'message'] = $e->getMessage();
872 $return[
'status'][
'code'] = MP_PSCU_ERROR_CODE;
873 $return[
'status'][
'line'] = $e->getLine();
874 $return[
'data'] = array();
875 $return[
'cmd'] = $cmd;
884 function pscuAddPayment($parms) {
885 # uses: $parms['APIKey'] 886 # $parms['APISecret'] 887 # $parms['serviceurl'] 889 # $parms['BillpayId'] 894 # $parms['DelMethod'] 901 if (!isset($parms[
'APIKey']) || !isset($parms[
'APISecret']) ||
902 !isset($parms[
'serviceurl']) || !isset($parms[
'clientid']) ||
903 !isset($parms[
'PayeeId']) ||
904 !isset($parms[
'Amount']) || !isset($parms[
'PayDate']) ||
905 !isset($parms[
'DelMethod']) || !isset($parms[
'AcctNo']) ||
906 !isset($parms[
'AcctType']) || !isset($parms[
'rt']) ||
907 !isset($parms[
'BillpayId'])|| !isset($parms[
'Token'])) {
908 throw new Exception(
"Missing Parameters");
911 $reqString = json_encode(array(
"payeeID" =>
"{$parms['PayeeId']}",
912 "paymentAmount" => $parms[
'Amount'],
913 "paymentDate" =>
"{$parms['PayDate']}",
914 "paymentDeliveryMethod" =>
"{$parms['DelMethod']}",
915 "paymentNote" =>
"{$parms['PayNote']}",
916 "paymentAccount" => array(
917 "accountNumber" =>
"{$parms['AcctNo']}",
"accountType" =>
"{$parms['AcctType']}",
"routingNumber" =>
"{$parms['rt']}")), JSON_FORCE_OBJECT);
918 $parms[
'BillpayId'] = substr(
"000000000{$parms['BillpayId']}",-9,9);
919 $cmd =
"/usr/bin/curl -X POST \ 920 -H \"Content-Type:application/json\" \ 921 -H \"X-application-id:13333\" \ 922 -H \"X-account-type:subcriberID\" \ 923 -H \"X-pscu-user-id:dmsSystem\" \ 924 -H \"X-client-id:{$parms['clientid']}\" \ 925 -H \"X-interaction-id:{$parms['Token']}\" \ 926 -H \"X-account-number:{$parms['BillpayId']}\" \ 927 -u \"{$parms['APIKey']}:{$parms['APISecret']}\" \ 929 {$parms['serviceurl']}";
932 $reqHeaders = array(
"Content-Type:application/json",
933 "X-application-id:13333",
934 "X-account-type:subcriberID",
935 "X-pscu-user-id:dmsSystem",
936 "X-client-id:{$parms['clientid']}",
937 "X-interaction-id:{$parms['Token']}",
938 "X-account-number:{$parms['BillpayId']}");
940 $reqOpts = array(CURLOPT_POST => 1, CURLOPT_POSTFIELDS => $reqString);
941 $parms[
"environment"][
"request"] = $cmd;
942 $parms[
"environment"][
"logPoint"] =
"AddPayment";
943 $response = pscu_embcurl($parms, $parms[
'serviceurl'],
"{$parms['APIKey']}:{$parms['APISecret']}", $reqHeaders, $reqOpts);
945 if (!empty($response)) {
946 $response = json_decode($response,
true);
949 if (empty($response) || !($response[
'success'])) {
950 throw new Exception((empty($response[
'errorMessage']) ?
"No Response" : $response[
'errorMessage']));
952 # call parse function to format response array 954 $return[
'status'][
'response'] =
'true';
955 $return[
'status'][
'message'] =
'success';
956 $return[
'data'] = $response[
'data'];
958 }
catch (Exception $e) {
959 $return[
'status'][
'response'] =
'false';
960 $return[
'status'][
'message'] = $e->getMessage();
961 $return[
'status'][
'code'] = MP_PSCU_ERROR_CODE;
962 $return[
'data'] = array();
967 function pscuCancelPayment($parms) {
968 # uses: $parms['APIKey'] 969 # $parms['APISecret'] 970 # $parms['serviceurl'] 972 # $parms['BillpayId'] 976 if (!isset($parms[
'APIKey']) || !isset($parms[
'APISecret']) ||
977 !isset($parms[
'serviceurl']) || !isset($parms[
'clientid']) ||
978 !isset($parms[
'txnID']) || !isset($parms[
'BillpayId']) ||
979 !isset($parms[
'Token'])) {
980 throw new Exception(
"Missing Parameters");
983 $parms[
'BillpayId'] = substr(
"000000000{$parms['BillpayId']}",-9,9);
984 $cmd =
"/usr/bin/curl -X DELETE \ 985 -H \"Content-Type:application/json\" \ 986 -H \"X-application-id:13333\" \ 987 -H \"X-account-type:subcriberID\" \ 988 -H \"X-pscu-user-id:dmsSystem\" \ 989 -H \"X-client-id:{$parms['clientid']}\" \ 990 -H \"X-interaction-id:{$parms['Token']}\" \ 991 -H \"X-account-number:{$parms['BillpayId']}\" \ 992 -u \"{$parms['APIKey']}:{$parms['APISecret']}\" \ 993 {$parms['serviceurl']}/{$parms['txnID']}";
996 $reqHeaders = array(
"Content-Type:application/json",
997 "X-application-id:13333",
998 "X-account-type:subcriberID",
999 "X-pscu-user-id:dmsSystem",
1000 "X-client-id:{$parms['clientid']}",
1001 "X-interaction-id:{$parms['Token']}",
1002 "X-account-number:{$parms['BillpayId']}");
1004 $reqOpts = array(CURLOPT_CUSTOMREQUEST =>
'DELETE');
1005 $parms[
"environment"][
"request"] = $cmd;
1006 $parms[
"environment"][
"logPoint"] =
"CancelPayment";
1007 $response = pscu_embcurl($parms,
"{$parms['serviceurl']}/{$parms['txnID']}",
"{$parms['APIKey']}:{$parms['APISecret']}", $reqHeaders, $reqOpts);
1009 if (!empty($response)) {
1010 $response = json_decode($response,
true);
1013 if (empty($response) || !($response[
'success'])) {
1014 throw new Exception((empty($response[
'errorMessage']) ?
"No Response" : $response[
'errorMessage']));
1016 # call parse function to format response array 1018 $return[
'status'][
'response'] =
'true';
1019 $return[
'status'][
'message'] =
'success';
1020 $return[
'data'] = $response[
'data'];
1022 }
catch (Exception $e) {
1023 $return[
'status'][
'response'] =
'false';
1024 $return[
'status'][
'message'] = $e->getMessage();
1025 $return[
'status'][
'code'] = MP_PSCU_ERROR_CODE;
1026 $return[
'data'] = array();
1031 function pscuEditPayment($parms) {
1032 # uses: $parms['APIKey'] 1033 # $parms['APISecret'] 1034 # $parms['serviceurl'] 1035 # $parms['clientid'] 1036 # $parms['BillpayId'] 1041 # $parms['DelMethod'] 1044 # $parms['AcctType'] 1048 if (!isset($parms[
'APIKey']) || !isset($parms[
'APISecret']) ||
1049 !isset($parms[
'serviceurl']) || !isset($parms[
'clientid']) ||
1050 !isset($parms[
'PayeeId']) ||
1051 !isset($parms[
'txnID']) || !isset($parms[
'Amount']) ||
1052 !isset($parms[
'PayDate']) || !isset($parms[
'DelMethod']) ||
1053 !isset($parms[
'AcctNo']) || !isset($parms[
'AcctType']) ||
1054 !isset($parms[
'rt']) || !isset($parms[
'BillpayId'])||
1055 !isset($parms[
'Token'])) {
1056 throw new Exception(
"Missing Parameters");
1058 $reqString = json_encode(array(
"payeeID" =>
"{$parms['PayeeId']}",
1059 "transactionID" =>
"{$parms['txnID']}",
1060 "paymentAmount" => $parms[
'Amount'],
1061 "paymentDate" =>
"{$parms['PayDate']}",
1062 "paymentDeliveryMethod" =>
"{$parms['DelMethod']}",
1063 "paymentNote" =>
"{$parms['PayNote']}",
1064 "paymentAccount" => array(
"accountNumber" =>
"{$parms['AcctNo']}",
"accountType" =>
"{$parms['AcctType']}",
"routingNumber" =>
"{$parms['rt']}")), JSON_FORCE_OBJECT);
1066 $parms[
'BillpayId'] = substr(
"000000000{$parms['BillpayId']}",-9,9);
1067 $cmd =
"/usr/bin/curl -X PUT \ 1068 -H \"Content-Type:application/json\" \ 1069 -H \"X-application-id:13333\" \ 1070 -H \"X-account-type:subcriberID\" \ 1071 -H \"X-pscu-user-id:dmsSystem\" \ 1072 -H \"X-client-id:{$parms['clientid']}\" \ 1073 -H \"X-interaction-id:{$parms['Token']}\" \ 1074 -H \"X-account-number:{$parms['BillpayId']}\" \ 1075 -u \"{$parms['APIKey']}:{$parms['APISecret']}\" \ 1077 {$parms['serviceurl']}/{$parms['txnID']}";
1080 $reqHeaders = array(
"Content-Type:application/json",
1081 "X-application-id:13333",
1082 "X-account-type:subcriberID",
1083 "X-pscu-user-id:dmsSystem",
1084 "X-client-id:{$parms['clientid']}",
1085 "X-interaction-id:{$parms['Token']}",
1086 "X-account-number:{$parms['BillpayId']}");
1088 $reqOpts = array(CURLOPT_CUSTOMREQUEST =>
'PUT', CURLOPT_POSTFIELDS => $reqString);
1089 $parms[
"environment"][
"request"] = $cmd;
1090 $parms[
"environment"][
"logPoint"] =
"EditPayment";
1091 $response = pscu_embcurl($parms,
"{$parms['serviceurl']}/{$parms['txnID']}",
"{$parms['APIKey']}:{$parms['APISecret']}", $reqHeaders, $reqOpts);
1093 if (!empty($response)) {
1094 $response = json_decode($response,
true);
1097 if (empty($response) || !($response[
'success'])) {
1098 throw new Exception((empty($response[
'errormessage']) ?
"No Response" : $response[
'errorMessage']));
1100 # call parse function to format response array 1102 $return[
'status'][
'response'] =
'true';
1103 $return[
'status'][
'message'] =
'success';
1104 $return[
'data'] = $response[
'data'];
1106 }
catch (Exception $e) {
1107 $return[
'status'][
'response'] =
'false';
1108 $return[
'status'][
'message'] = $e->getMessage();
1109 $return[
'status'][
'code'] = MP_PSCU_ERROR_CODE;
1110 $return[
'data'] = array();
1115 function pscu_embcurl($parms, $reqURL, $reqUser, $reqHeaders, $reqOpts = array()) {
1116 # reqURL is the service url 1117 # reqUser is "{$parms['APIKey']}:{$parms['APISecret']}" 1118 # reqHeaders is an array of headers to be sent 1119 # reqOpts is an array of curlopts 1121 # this is a really bad idea -- pass what you need don't rely on global 1133 CURLOPT_RETURNTRANSFER => 1,
1134 CURLOPT_SSL_VERIFYPEER => 0,
1135 CURLOPT_SSL_VERIFYHOST => 0,
1136 CURLOPT_HEADER => 0,
1137 CURLOPT_USERPWD =>
"$reqUser",
1138 CURLOPT_URL =>
"$reqURL");
1141 @curl_setopt_array($ch, $curlopts);
1142 if (count($reqOpts)) {
1143 @curl_setopt_array($ch, $reqOpts);
1145 @curl_setopt($ch, CURLOPT_HTTPHEADER, $reqHeaders);
1147 $response = @curl_exec($ch);
1148 $responseIP = curl_getinfo($ch,CURLINFO_PRIMARY_IP);
1149 if ( $parms[
"logging"] ==
"enabled" ) {
1150 $logParms = $parms[
"environment"];
1151 $logParms[
"token"] = $parms[
'Token'];
1152 $logParms[
"SSOVendor"] =
'PSCUPAY_API';
1153 $logParms[
"txnId"] = time();
1154 $logParms[
"reply"] =
"$responseIP responded \n$response";
1155 LogSSOActivity( $logParms );
1158 if (curl_errno($ch)) {
1164 function ListHolidays($Start, $End) {
1173 $holidays = array();
1174 for ($i = $Start; $i <= $End; $i++) {
1175 for ($m = 1; $m <= 12; $m++) {
1186 $dtHoliday = mktime(12, 0, 0, 1, 1, $i);
1188 $holidays[] = date(
'Y-m-d',$dtHoliday);
1190 $dow = idate(
'w', $dtHoliday);
1194 $dtHoliday += 86400;
1196 case 1: #already Monday
1199 $dtHoliday += (86400 * 6);
1202 $dtHoliday += (86400 * 5);
1205 $dtHoliday += (86400 * 4);
1208 $dtHoliday += (86400 * 3);
1211 $dtHoliday += (86400 * 2);
1214 $dtHoliday += (86400 * 14); # add 2 weeks to
get 3rd Monday
1215 $holidays[] = date(
'Y-m-d',$dtHoliday);
1220 $dtHoliday = mktime(12, 0, 0, 2, 1, $i);
1221 $dow = idate(
'w', $dtHoliday);
1225 $dtHoliday += 86400;
1227 case 1: #already Monday
1230 $dtHoliday += (86400 * 6);
1233 $dtHoliday += (86400 * 5);
1236 $dtHoliday += (86400 * 4);
1239 $dtHoliday += (86400 * 3);
1242 $dtHoliday += (86400 * 2);
1245 $dtHoliday += (86400 * 14); # add 2 weeks to
get 3rd Monday
1246 $holidays[] = date(
'Y-m-d',$dtHoliday);
1251 $dtHoliday = mktime(12, 0, 0, 5, 31, $i);
1252 $dow = idate(
'w', $dtHoliday);
1253 # find last day & back up 1256 $dtHoliday -= (86400 * 6);
1258 case 1: #already Monday
1261 $dtHoliday -= 86400;
1264 $dtHoliday -= (86400 * 2);
1267 $dtHoliday -= (86400 * 3);
1270 $dtHoliday -= (86400 * 4);
1273 $dtHoliday -= (86400 * 5);
1276 $holidays[] = date(
'Y-m-d',$dtHoliday);
1281 $dtHoliday = mktime(12, 0, 0, 7, 4, $i);
1283 $holidays[] = date(
'Y-m-d',$dtHoliday);
1289 $dtHoliday = mktime(12, 0, 0, 9, 1, $i);
1290 $dow = idate(
'w', $dtHoliday);
1294 $dtHoliday += 86400;
1296 case 1: #already Monday
1299 $dtHoliday += (86400 * 6);
1302 $dtHoliday += (86400 * 5);
1305 $dtHoliday += (86400 * 4);
1308 $dtHoliday += (86400 * 3);
1311 $dtHoliday += (86400 * 2);
1314 $holidays[] = date(
'Y-m-d',$dtHoliday);
1319 $dtHoliday = mktime(12, 0, 0, 10, 1, $i);
1320 $dow = idate(
'w', $dtHoliday);
1324 $dtHoliday += 86400;
1326 case 1: #already Monday
1329 $dtHoliday += (86400 * 6);
1332 $dtHoliday += (86400 * 5);
1335 $dtHoliday += (86400 * 4);
1338 $dtHoliday += (86400 * 3);
1341 $dtHoliday += (86400 * 2);
1344 $dtHoliday += (86400 * 7); # add 1 week to
get 2nd Monday
1345 $holidays[] = date(
'Y-m-d',$dtHoliday);
1350 $dtHoliday = mktime(12, 0, 0, 11, 11, $i);
1352 $holidays[] = date(
'Y-m-d',$dtHoliday);
1355 $dtHoliday = mktime(12, 0, 0, 11, 1, $i);
1356 $dow = idate(
'w', $dtHoliday);
1357 # find first Thursday 1360 $dtHoliday += (86400 * 4);
1363 $dtHoliday += (86400 * 3);
1366 $dtHoliday += (86400 * 2);
1369 $dtHoliday += 86400;
1374 $dtHoliday += (86400 * 6);
1377 $dtHoliday += (86400 * 5);
1380 $dtHoliday += (86400 * 21); # add 3 weeks to
get 4th Thursday
1381 $holidays[] = date(
'Y-m-d',$dtHoliday);
1386 $dtHoliday = mktime(12, 0, 0, 12, 25, $i);
1388 $holidays[] = date(
'Y-m-d',$dtHoliday);
1399 Function GetNearestWeekday($dtTimeStamp) {
1402 $intWeekday = idate(
'w', $dtTimeStamp);
1403 switch ($intWeekday) {
1404 case 0: #Sunday - move forward to Monday
1405 $dtTimeStamp += 86400;
1407 case 6: #Saturday - move back to Friday
1408 $dtTimeStamp -= 86400;
1410 case 1: # Monday - Friday -
do nothing
1418 return $dtTimeStamp;
1421 Function GetNextBusiness($dtTimeStamp) {
1424 $intWeekday = idate(
'w', $dtTimeStamp);
1425 switch ($intWeekday) {
1426 case 0: #Sunday - move forward to Monday
1427 $dtTimeStamp += 86400;
1429 case 6: #Saturday - move forward to Monday
1430 $dtTimeStamp += (86400*2);
1432 case 1: # Monday - Friday -
do nothing
1440 return $dtTimeStamp;