Odyssey
IPAYMBL.i
1 <?php
2 /* Plugin module for iPay bill pay.
3  * NOTE: all "status" return elements need to be lower case.
4  * NOTE: The case of the passed in elements need to match across plugins.
5  * NOTE: The trusted detail values are read and passed in "as is" because the terminology is
6  * specific to the vendor.
7  * NOTE: The values sent from the client app are in a "passwith" structure in $parms. Need to move
8  * the values to where the code expects it.
9  * NOTE: Any data returned should be in a ["data"] structure. Not just raw data, either.
10  *
11  * For all plugin entry points the following parameters are expected:
12  * $parms['moc'] == 1 - if the test or "moc" values should be used
13  */
14 define( "MP_IPAY_ERROR_CODE", "5011" );
15 
16 function bpAuth( $parms) {
17  if ($parms['moc'] == 1) {
18  $parms['tokenurl'] = $parms['moctoken'];
19  $parms['password'] = $parms['mocpass'];
20  $parms['serviceurl'] = $parms['mocservice'];
21  }
22 
23  $reply = ipayGetToken( $parms );
24 
25  if ( $reply["status"]["response"] == "false" ) {
26  if ( empty($reply["status"]["message"]) ) {
27  $reply["status"]["message"] = 'Get Token Failed'; // . print_r( $reply, true );
28  }
29  $return = $reply;
30  } else {
31  $testToken = $reply["ipaydata"]["token"];
32  // make sure returned token is valid (needs to start with 0)
33  if (!preg_match('/[^0-]/', $testToken)) {
34  // set up the error response
35  $reply["status"]["response"] = "false";
36  $reply["status"]["code"] = "2075";
37  $reply["status"]["message"] = "Bill Pay Service not available";
38  $return = $reply;
39  } else {
40  $parms['Token'] = $testToken;
41 
42  $response = ipaySubscriberValidation( $parms );
43  # normalize the name for scalability
44  if ( $response["status"]["response"] == "false" ) {
45  if ( empty($response["status"]["message"]) ) {
46  $response["status"]["response"] = "false";
47  $response["status"]["code"] = "999";
48  $response["status"]["message"] = "Subscriber Validation Failed. {$response['ipaydata'][0]['Response']}"; // . print_r( $response, true );
49  }
50  } else {
51  // return good status
52  $response["status"]["code"] = "000";
53 
54  $output["Token"] = $response['ipaydata'][0]["Token"];
55  $output["DateModel"] = $parms["datemodel"]; // echo back but with the correct case sensitivity
56  $output["BillpayId"] = $parms["BillpayId"];
57  $output['MoblPayName']= (trim($parms['MoblPayName']) == '' ? htmlentities('Pay Bills') : htmlentities($parms['MoblPayName']));
58  $output['Extras'] = htmlentities($parms['ExtraOptions']);
59  $response['data']= $output;
60  }
61 
62  $return = $response;
63  }
64  }
65 
66  return $return;
67 }
68 
69 // Function to have the history sorted descending in time.
70 function histSort( $a, $b ) {
71  $atime = strtotime($a['Date']);
72  $btime = strtotime($b['Date']);
73  if ($atime == $btime) {
74  return strcmp( $a["TxnId"], $b["TxnId"] );
75  }
76  return ($atime > $btime) ? -1 : 1;
77 }
78 
79 function bpHist( $parms ) {
80  if ($parms['moc'] == 1) {
81  $parms['serviceurl'] = $parms['mocservice'];
82  }
83 
84  $parms['Token'] = $parms["passwith"]["Token"];
85  $response = ipayGetHistory( $parms );
86 
87  if ( $response["status"]["response"] == "false" ) {
88  if ( empty($response["status"]["message"]) )
89  $response["status"]["message"] = 'Get History Failed';
90  $return = $response;
91  } else {
92  // put into a consistent structure
93  $output = array();
94 // $test = $response["ipaydata"];
95 // print_r( $test );
96  foreach( $response["ipaydata"] as $value ) {
97  $outputElem = array();
98  $outputElem["TxnId"] = $value["Id"];
99  $outputElem["Type"] = $value["Type"]; // needed to help figure out display issues
100  $outputElem["ToName"] = $value["ToName"];
101  $outputElem["Amount"] = number_format( $value["Amount"], 2 );
102  $outputElem["Date"] = date( "m/d/Y", strtotime( $value["Date"] ) );
103 
104  // need to have any dates go back correctly formatted
105  $estimatedArrival = strtotime( $value["EstimatedArrival"] );
106 
107  $Additional = array( "From" => $value["FromName"],
108  "Estimated_Arrival" => date( "m/d/Y", $estimatedArrival ),
109  "Confirmation" => $value["Confirmation"],
110  "Rush" => $value["Rush"],
111  "Method" => $value["Method"] );
112 
113  $outputElem["AdditionalInfo"] = $Additional;
114 
115  $output[] = $outputElem;
116  }
117 
118  usort( $output, "histSort" );
119 
120  // return good status
121  $return["status"]["code"] = "000";
122 
123  # normalize the name for scalability
124  $return['data'] = $output;
125  }
126 
127  return $return;
128 }
129 
130 // Function to have the scheduled payments sorted ascending in time.
131 function schedSort( $a, $b ) {
132  $atime = strtotime($a['Date']);
133  $btime = strtotime($b['Date']);
134  if ($atime == $btime) {
135  return strcmp( $a["TxnId"], $b["TxnId"] );
136  }
137  return ($atime < $btime) ? -1 : 1;
138 }
139 
140 function bpSched( $parms ) {
141  if ($parms['moc'] == 1) {
142  $parms['serviceurl'] = $parms['mocservice'];
143  }
144 
145  $parms['Token'] = $parms["passwith"]["Token"];
146  $response = ipayGetScheduled( $parms );
147 
148  if ( $response["status"]["response"] == "false" ) {
149  if ( empty($response["status"]["message"]) ) {
150  $response["status"]["message"] = 'Get Scheduled Failed';
151  }
152  $return = $response;
153  } else {
154  // put into a consistent structure
155  $output = array();
156  foreach( $response["ipaydata"] as $key => $value ) {
157  $outputElem = array();
158 
159  $outputElem["TxnId"] = $value["Id"];
160  $outputElem["Type"] = $value["Type"];
161  $outputElem["ToId"] = $value["To"];
162  $outputElem["ToName"] = $value["ToName"];
163  $outputElem["FromId"] = $value["From"];
164  $outputElem["Amount"] = number_format( $value["Amount"], 2 );
165  $outputElem["Date"] = date( "m/d/Y", strtotime( $value["Date"] ) );
166  $outputElem["Confirmation"] = $value["Confirmation"];
167 
168  $estimatedArrival = strtotime( $value["EstimatedArrival"] );
169  $Additional = array( "From" => $value["FromName"],
170  "Estimated_Arrival" => date( "m/d/Y", $estimatedArrival ),
171  "Rush" => $value["Rush"],
172  "Method" => $value["Method"] );
173 // "Dump" => print_r( $value, true ) );
174 
175  $outputElem["AdditionalInfo"] = $Additional;
176  $output[] = $outputElem;
177  }
178 
179  usort( $output, "schedSort" );
180 
181  // return good status
182  $return["status"]["code"] = "000";
183 
184  # normalize the name for scalability
185  $return['data'] = $output;
186  }
187 
188  return $return;
189 }
190 
191 function bpSourceAccts( $parms ) {
192  try {
193  if ($parms['moc'] == 1) {
194  $parms['serviceurl'] = $parms['mocservice'];
195  }
196 
197  $parms['Account']['types'] = "PayFrom";
198  $parms['Token'] = $parms["passwith"]["Token"];
199  $response=ipayGetAccountList( $parms );
200 
201  if ($response["status"]["response"]=='false'){
202  if (empty($response["status"]["message"]))
203  $response["status"]["message"]='Get Accounts Failed';
204  } else {
205  // put into a consistent structure
206  $output = array();
207  foreach( $response["ipaydata"] as $key => $value ) {
208  $outputElem = array();
209  $outputElem["Name"] = $value["Name"];
210  $outputElem["FromId"] = $value["Id"];
211  $outputElem["CanRush"] = $value["CanRush"] == "true" ? "1" : "0"; // this is just for AccountList results
212 
213  // make sure we have a name for the account
214  if ( strlen( trim( $outputElem["Name"] ) ) == 0 ) {
215  $outputElem["Name"] = $value["Id"];
216  }
217 
218  $output[] = $outputElem;
219  }
220 
221  if ( !count( $output ) ) {
222  throw new Exception("No source accounts received from vendor.");
223  }
224 
225  // return good status
226  $response["status"]["code"] = "000";
227 
228  # normalize the name for scalability
229  $response['data']= $output;
230  }
231  } catch (Exception $e) {
232  $response["status"]["response"] = "false";
233  $response["status"]["message"] = $e->getMessage();
234  $response["code"] = MP_IPAY_ERROR_CODE;
235  $response["data"] = array();
236  }
237 
238  return $response;
239 }
240 
241 /* The dest account can be a payee list for payments, or a list of accounts for transfers.
242  *
243  */
244 function bpDestAccts( $parms ) {
245  try {
246  if ($parms['moc'] == 1) {
247  $parms['serviceurl'] = $parms['mocservice'];
248  }
249 
250  $parms['Account']['types'] = "Outbound";
251  $parms['Token'] = $parms["passwith"]["Token"];
252  if ( $parms["passwith"]["AcctType"] == "Payment" )
253  $response=ipayGetPayeeList( $parms );
254  else
255  $response=ipayGetAccountList( $parms );
256 
257  if ($response["status"]["response"]=='false'){
258  if (empty($response["status"]["message"]))
259  $response["status"]["message"]='Get Payee List Failed';
260  } else {
261  // put into a consistent structure
262  $output = array();
263  foreach( $response["ipaydata"] as $key => $value ) {
264  $outputElem = array();
265  $outputElem["Name"] = $value["Name"];
266  $outputElem["Type"] = $value["Type"];
267  $outputElem["ToId"] = $value["Id"];
268  $outputElem["CanRush"] = $value["CanRush"] == "true" ? "1" : "0"; // this is just for AccountList results
269 
270  $output[] = $outputElem;
271  }
272 
273  if ( !count( $output ) ) {
274  throw new Exception("No Payees Configured.");
275  }
276 
277  // return good status
278  $response["status"]["code"] = "000";
279 
280  # normalize the name for scalability
281  $response['data']= $output;
282  // $response["data"]["mike"] = "Hello: " . print_r( $response, true ) . " Goodbye";
283  }
284  } catch (Exception $e) {
285  $response["status"]["response"] = "false";
286  $response["status"]["message"] = $e->getMessage();
287  $response["code"] = MP_IPAY_ERROR_CODE;
288  $response["data"] = array();
289  }
290 
291  return $response;
292 }
293 
294 function bpPmtAdd( $parms ) {
295  if ($parms['moc'] == 1) {
296  $parms['serviceurl'] = $parms['mocservice'];
297  }
298 
299  $parms['Account']['types'] = "PayFrom";
300  $parms['Token'] = $parms["passwith"]["Token"];
301 
302  $parms['Payment']['From'] = $parms["passwith"]["FromId"];
303  $parms['Payment']['To'] = $parms["passwith"]["ToId"];
304  $parms['Payment']['Amount'] = $parms["passwith"]["Amount"];
305  $parms['Payment']['Rush'] = $parms["passwith"]["Rush"];
306  $parms['Payment']['Date'] = $parms["passwith"]["Date"];
307  $response=ipaySubmitPayment( $parms );
308 
309  if ($response["status"]["response"]=='false'){
310  if (empty($response["status"]["message"]))
311  $response["status"]["message"]='Submit Payment Failed';
312 
313 // $response["status"]["message"] .= print_r( $parms, true );
314  } else {
315  // put into a consistent structure
316  $outputElem = array();
317  $outputElem["Confirmation"] = $response["ipaydata"][0]["Confirmation"];
318  $outputElem["EstimatedArrival"] = $response["ipaydata"][0]["EstimatedArrival"];
319 
320  // return good status
321  $response["status"]["code"] = "000";
322 
323  # normalize the name for scalability
324  $response['data'] = $outputElem;
325  }
326 
327  return $response;
328 }
329 
330 function bpTrnAdd( $parms ) {
331  if ($parms['moc'] == 1) {
332  $parms['serviceurl'] = $parms['mocservice'];
333  }
334 
335  $parms['Account']['types'] = "PayFrom";
336  $parms['Token'] = $parms["passwith"]["Token"];
337 
338  $parms['Payment']['From'] = $parms["passwith"]["FromId"];
339  $parms['Payment']['To'] = $parms["passwith"]["ToId"];
340  $parms['Payment']['Amount'] = $parms["passwith"]["Amount"];
341  $parms['Payment']['Date'] = $parms["passwith"]["Date"];
342 
343  $response=ipaySubmitTransfer( $parms );
344 
345  if ($response["status"]["response"]=='false'){
346  if (empty($response["status"]["message"]))
347  $response["status"]["message"]='Submit Transfer Failed';
348  } else {
349  // put into a consistent structure
350  $outputElem = array();
351  $outputElem["Confirmation"] = $response["ipaydata"][0]["Confirmation"];
352  $outputElem["EstimatedArrival"] = $response["ipaydata"][0]["EstimatedArrival"];
353 
354  // return good status
355  $response["status"]["code"] = "000";
356 
357  # normalize the name for scalability
358  $response['data']= $outputElem;
359  }
360 
361  return $response;
362 }
363 
364 function bpPmtEdit( $parms ) {
365  if ($parms['moc'] == 1) {
366  $parms['serviceurl'] = $parms['mocservice'];
367  }
368 
369  $parms['Account']['types'] = "PayFrom";
370  $parms['Token'] = $parms["passwith"]["Token"];
371 
372  $parms['Payment']['Id'] = $parms["passwith"]["TxnId"];
373  $parms['Payment']['From'] = $parms["passwith"]["FromId"];
374  $parms['Payment']['Amount'] = $parms["passwith"]["Amount"];
375  $parms['Payment']['Rush'] = $parms["passwith"]["Rush"];
376  $parms['Payment']['Date'] = $parms["passwith"]["Date"];
377  $response = ipayEditPayment( $parms );
378 
379  if ($response["status"]["response"]=='false'){
380  if (empty($response["status"]["message"]))
381  $response["status"]["message"]='Edit Payment Failed';
382  } else {
383  // put into a consistent structure
384  $outputElem = array();
385  $outputElem["Confirmation"] = $response["ipaydata"][0]["Confirmation"];
386  $outputElem["EstimatedArrival"] = $response["ipaydata"][0]["EstimatedArrival"];
387 
388  // return good status
389  $response["status"]["code"] = "000";
390 
391  # normalize the name for scalability
392  $response['data']= $outputElem;
393  }
394 
395  return $response;
396 }
397 
398 function bpPmtStop($parms) {
399  if ($parms['moc'] == 1) {
400  $parms['serviceurl'] = $parms['mocservice'];
401  }
402 
403  $parms['Token'] = $parms["passwith"]["Token"];
404  $parms['Payment']['Id'] = $parms["passwith"]["TxnId"];
405 
406  $response = ipayStopPayment($parms);
407 
408  if ($response["status"]["response"] == 'false') {
409  if (empty($response["status"]["message"]))
410  $response["status"]["message"] = 'Stop Payment Failed';
411  } else {
412  // return good status
413  $response["status"]["code"] = "000";
414 
415  # normalize the name for scalability
416  $response['data']["StopResult"] = $response['ipaydata'][0]["Response"] == "S01" ? "1" : "0";
417  }
418 
419  return $response;
420 }
421 
422 function bpGetPaymentDates( $parms ) {
423  if ($parms['moc'] == 1) {
424  $parms['serviceurl'] = $parms['mocservice'];
425  }
426 
427  $payeeId = $parms["passwith"]["PayeeId"];
428 
429  $canRush = $parms["passwith"]["CanRush"] == "1";
430 
431  if ( $canRush ) {
432  // first, request rush options
433  $parms['Token'] = $parms["passwith"]["Token"];
434  $parms['Payee']['Id'] = $payeeId;
435  $parms['Payee']['Type'] = "Transfer";
436  $parms['Payee']['RushOptions'] = "Overnight SecondDay SecondDayEconomy";
437  $responseRush = ipayGetDeliveryOptions( $parms );
438 
439  if ( $responseRush["status"]["response"] == "false" ) {
440  if ( empty($responseRush["status"]["message"]) ) {
441  $responseRush["status"]["message"] = 'Get Delivery Options Failed';
442  }
443 
444  // early exit
445  return $responseRush;
446  }
447  } else {
448  $responseRush = array();
449  }
450 
451  // now get the payment dates (uses same parms)
452  $parms['Token'] = $parms["passwith"]["Token"];
453  $parms['Payee']['Id'] = $payeeId;
454  $parms['Payee']['Type'] = "Payment";
455 
456  // use the trusted detail info to figure out date model
457  if ( strtoupper( $parms["datemodel"] ) == "DUE" ) {
458  $responseDates = ipayGetDeliverByDates( $parms );
459  } else {
460  $responseDates = ipayGetProcessDates( $parms );
461  }
462 
463  $response = array();
464 
465  if ( $responseDates["status"]["response"] == 'false' ) {
466  if (empty( $responseDates["status"]["message"] ) )
467  $responseDates["status"]["message"] = "Get " . (strtoupper( $parms["datemodel"] ) == "DUE" ? "Deliver By" : "Process") . " Dates Failed";
468 
469  $response = $responseDates;
470  } else {
471  // put into a consistent structure
472  $output = array();
473  // return the "options"
474  $response["data"]["RushOptions"] = $responseRush["ipaydata"][0];
475 
476  foreach( $responseDates["ipaydata"] as $key => $value ) {
477  $outputElem = array();
478  $outputElem["Proc"] = date( "Y-m-d", strtotime( $value["ProcessDate"] ) );
479  if ( strtoupper( $parms["datemodel"] ) == "DUE" ) {
480  $outputElem["Due"] = date( "Y-m-d", strtotime( $value["DeliverByDate"] ) );
481  }
482 
483  $output[] = $outputElem;
484  }
485  // return good status
486  $response["status"]["code"] = "000";
487 
488  # normalize the name for scalability
489  $response['data']["PaymentDates"] = $output;
490  }
491 
492 //$response["data"]["debug"] = print_r( $responseDates, true );
493  return $response;
494 }
495 
496 
497 function bpGetTerms( $parms ) {
498  if ($parms['moc'] == 1) {
499  $parms['serviceurl'] = $parms['mocservice'];
500  }
501 
502  $parms['Token'] = $parms["passwith"]["Token"];
503  $response = ipayGetDisclosures( $parms );
504 
505  if ( $response["status"]["response"] == "false" ) {
506  if ( empty($response["status"]["message"]) ) {
507  $response["status"]["message"] = 'Get Disclosures Failed';
508  }
509  $return = $response;
510  } else {
511  // return good status
512  $return["status"]["code"] = "000";
513 
514  // return the "terms"
515  $return["data"]["Terms"] = $response["ipaydata"][0]["string"];
516  }
517 
518  return $return;
519 }
520 
521 function bpGetRushOptions( $parms ) {
522  if ($parms['moc'] == 1) {
523  $parms['serviceurl'] = $parms['mocservice'];
524  }
525 
526  $parms['Token'] = $parms["passwith"]["Token"];
527  $parms['Payee']['Id'] = $parms["passwith"]["PayeeId"];
528  $parms['Payee']['Type'] = "Payment";
529  $parms['Payee']['RushOptions'] = "Overnight,SecondDay,SecondDayEconomy";
530  $response = ipayGetDeliveryOptions( $parms );
531 
532  if ( $response["status"]["response"] == "false" ) {
533  if ( empty($response["status"]["message"]) ) {
534  $response["status"]["message"] = 'Get Delivery Options Failed';
535  }
536  $return = $response;
537  } else {
538  // return good status
539  $return["status"]["code"] = "000";
540 
541  // return the "terms"
542  $return["data"]["Rush"] = $response["ipaydata"][0];
543  }
544 
545  return $return;
546 }
547 
548 function bpAcceptTerms( $parms ) {
549  if ($parms['moc'] == 1) {
550  $parms['serviceurl'] = $parms['mocservice'];
551  }
552 
553  $parms['Token'] = $parms["passwith"]["Token"];
554  $parms["User"]["Accepted"] = "1";
555  $response = ipayActivateUser( $parms );
556  if ( $response["status"]["response"] == "false" ) {
557  if ( empty($response["status"]["message"]) ) {
558  $response["status"]["message"] = 'Activate User Failed';
559  }
560  $return = $response;
561  } else {
562  $output = array();
563  $output["Status"] = isset( $response["ipaydata"][0]["Accepted"] ) ? "true" : "false";
564 // $output["debug"] = print_r( $response["ipaydata"], true );
565 
566  // return good status
567  $return["status"]["code"] = "000";
568 
569  $return["data"] = $output;
570  }
571 
572  return $return;
573 }
574 
575 function bpGetFeatureList($parms) {
576  try {
577  # Need to decide what the data looks like here -- string list of available features
578  # maybe something out of trusteddetail (which comes to this function in $parms)
579  # to allow customizing by cu
580  $extraOptions = htmlentities($parms['ExtraOptions']);
581 
582  $return=array('status'=>array('response'=>'true','message'=>'success',"code"=>"000"),
583  'data'=>array("extras" => $extraOptions, 'featurelist'=>""));
584  } catch (Exception $e) {
585  $return=array('status'=>array('response'=>'false','message'=>$e->getMessage()),'code'=>MP_PSCU_ERROR_CODE,'data'=>array());
586  }
587  return $return;
588 }
589 
590 function OpenIpay( $parms ) {
591 # tested OK 10/22/12
592 # uses: $parms['InstitutionId']
593 # $parms['password']
594 # $parms['tokenurl']
595 # (retrieved and decoded from cuthird)
596 #
597 # GetToken
598 # SubscriberValidation
599 # return SubscriberValidation result as status, <User> data as ipaydata
600 
601  $token = array();
602  if ( !isset($parms['InstitutionId']) || !isset($parms['password']) ||
603  !isset($parms['tokenurl']) ){
604  $token["status"]["response"]='false';
605  $token["status"]["code"] = MP_IPAY_ERROR_CODE;
606  $token["status"]["message"]='Missing Parameters (' . __LINE__ . ')';
607  $return=$token;
608  }
609 
610  $response = array();
611  $token = ipayGetToken( $parms );
612 
613 
614  if ($token["status"]["response"] == 'false') {
615  if (empty($token["status"]["message"]))
616  $token["status"]["message"] = 'Get Token Failed';
617  $return = $token;
618  } else {
619  $parms['Token'] = $token["ipaydata"]["token"];
620  $subscriber = ipaySubscriberValidation($parms);
621  $return = $subscriber;
622  }
623  return $return;
624 }
625 
626 function ipayGetToken( $parms ) {
627 # tested OK 10/22/12
628 
629 if ( !isset($parms['InstitutionId']) || !isset($parms['password']) ||
630  !isset($parms['tokenurl']) ){
631  $token = array();
632  $token["status"]["response"]='false';
633  $token["status"]["code"] = MP_IPAY_ERROR_CODE;
634  $token["status"]["message"]='Missing Parameters (' . __LINE__ . ')';
635  $return=$token;
636 }
637 
638 $cuid = $parms['InstitutionId'];
639 $pwd = $parms['password'];
640 $ipayhost = $parms['tokenurl'];
641 
642 $soapString = '<?xml version="1.0"?>';
643 $soapString .= "\n<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:AuthService=\"http://www.billpaysite.com/Mobile/\" xmlns:s1=\"http://microsoft.com/wsdl/types/\" xsl:version=\"1.0\">\n";
644 $soapString .= "<soap:Body>
645  <AuthService:GetToken>
646  <AuthService:id>$cuid</AuthService:id>
647  <AuthService:password>$pwd</AuthService:password>
648  </AuthService:GetToken>
649  </soap:Body>
650 </soap:Envelope>\n";
651 
652 $cmd="/usr/bin/curl --silent --data-binary '$soapString' -H 'Content-Type: text/xml; charset=utf-8' -H 'SOAPAction: \"http://www.billpaysite.com/Mobile/GetToken\"' $ipayhost";
653 
654 $response=getcurl($cmd);
655 if ($parms["logging"] == "enabled") {
656  $logParms = $parms["environment"]; // get the environment info passed in
657  $logParms["token"] = ''; // the id used across all communications in session
658  $logParms["txnId"] = time(); // the id for this transaction
659  $logParms["logPoint"] = "GetToken"; // this action in a readable form
660  $logParms["request"] = $cmd; // the request
661  $logParms["reply"] = $response; // the response
662  LogSSOActivity($logParms);
663 }
664 
665 preg_match('/<GetTokenResult>(.*)<\/GetTokenResult>/i',$response,$stat);
666 $token = $stat[1];
667 
668 if (!preg_match('/[^0-]/',$token)) {
669  $return["status"]["response"]="false";
670  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
671  $return["status"]["message"]="Get Token Failed";
672 // $return["status"]["message"]="Get Token Failed: " . $cmd . " Response: " . $response;
673 } else {
674  $return["status"]["response"]='true';
675  $return["ipaydata"]["token"]=$token;
676 }
677 
678  return $return;
679 }
680 
681 function ipayActivateUser( $parms ) {
682 
683 if ( !isset($parms['InstitutionId']) || !isset($parms['Token']) ||
684  !isset($parms['serviceurl']) || !isset($parms['BillpayId']) ||
685  !isset($parms['User']['Accepted']) ){
686  $return["status"]["response"]='false';
687  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
688  $return["status"]["message"]='Missing Parameters (' . __LINE__ . ')';
689  $return["ipaydata"] = array();
690  return $return;
691 }
692 
693 $ipayhost = $parms['serviceurl'];
694 
695 #POST /Mobile/MobileService.asmx HTTP/1.1
696 #Host: services.billpaysite.com
697 #Content-Type: text/xml; charset=utf-8
698 #Content-Length: length
699 #SOAPAction: "http://mobile.billpaysite.com/ActivateUser"
700 
701 // use the date as acceptance
702 $acceptDate = date( "Y-m-d\TH:i:s" );
703 $soapString='<?xml version="1.0" encoding="utf-8"?>';
704 $soapString .= "\n<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:MobileService=\"http://mobile.billpaysite.com/\" xmlns:s1=\"http://microsoft.com/wsdl/types/\" xsl:version=\"1.0\">";
705 $soapString .= "\n<soap:Body>
706  <MobileService:ActivateUser>
707  <MobileService:user xsi:type=\"MobileService:User\">
708  <MobileService:Product>Consumer</MobileService:Product>
709  <MobileService:Token>{$parms['Token']}</MobileService:Token>
710  <MobileService:InstitutionId>{$parms['InstitutionId']}</MobileService:InstitutionId>
711  <MobileService:Login>{$parms['BillpayId']}</MobileService:Login>
712  <MobileService:Accepted>{$acceptDate}</MobileService:Accepted>
713  </MobileService:user>
714  </MobileService:ActivateUser>
715  </soap:Body>
716 </soap:Envelope>\n";
717 
718 $cmd="/usr/bin/curl --silent --data-binary '$soapString' -H 'Content-Type: text/xml; charset=utf-8' -H 'SOAPAction: \"http://mobile.billpaysite.com/ActivateUser\"' $ipayhost";
719 
720 $response=getcurl($cmd);
721 if ($parms["logging"] == "enabled") {
722  $logParms = $parms["environment"]; // get the environment info passed in
723  $logParms["token"] = $parms['Token']; // the id used across all communications in session
724  $logParms["txnId"] = time(); // the id for this transaction
725  $logParms["logPoint"] = "ActivateUser"; // this action in a readable form
726  $logParms["request"] = $cmd; // the request
727  $logParms["reply"] = $response; // the response
728  LogSSOActivity($logParms);
729 }
730 
731  if (empty($response)) {
732  $return["status"]["response"]='false';
733  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
734  $return["status"]["message"]="No Response (" . __LINE__ . ")";
735  $return["ipaydata"]=array();
736  } else {
737  # call parse function to format response array
738  $return=ipayGetXMLResponse($response,'ActivateUserResult','user');
739  }
740  return $return;
741 }
742 
743 function ipaySubmitPayment( $parms ) {
744 # uses: $parms['InstitutionId']
745 # $parms['Token']) ||
746 # $parms['serviceurl']
747 # $parms['BillpayId']
748 # $parms['Payment']['From']
749 # $parms['Payment']['To']
750 # $parms['Payment']['Amount']
751 # $parms['Payment']['Rush']
752 # $parms['Payment']['Date']
753 
754 if ( !isset($parms['InstitutionId']) || !isset($parms['Token']) ||
755  !isset($parms['serviceurl']) || !isset($parms['BillpayId']) ||
756  !isset($parms['Payment']['From']) ||
757  !isset($parms['Payment']['To']) ||
758  !isset($parms['Payment']['Amount']) ||
759  !isset($parms['Payment']['Rush']) ||
760  !isset($parms['Payment']['Date']) ){
761  $return["status"]["response"]='false';
762  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
763  $return["status"]["message"]='Missing Parameters (' . __LINE__ . ')';
764  $return["ipaydata"]=array();
765  return $return;
766 }
767 
768 $ipayhost = $parms['serviceurl'];
769 #POST /Mobile/MobileService.asmx HTTP/1.1
770 #Host: services.billpaysite.com
771 #Content-Type: text/xml; charset=utf-8
772 #Content-Length: length
773 #SOAPAction: "http://mobile.billpaysite.com/SubmitPayment"
774 
775 $soapString='<?xml version="1.0" encoding="utf-8"?>';
776 $soapString .= "\n<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:MobileService=\"http://mobile.billpaysite.com/\" xmlns:s1=\"http://microsoft.com/wsdl/types/\" xsl:version=\"1.0\">";
777 $soapString .= "<soap:Body>
778  <MobileService:SubmitPayment>
779  <MobileService:payment>
780  <MobileService:Product>Consumer</MobileService:Product>
781  <MobileService:Token>{$parms['Token']}</MobileService:Token>
782  <MobileService:InstitutionId>{$parms['InstitutionId']}</MobileService:InstitutionId>
783  <MobileService:Login>{$parms['BillpayId']}</MobileService:Login>\n";
784 
785  foreach($parms['Payment'] as $key =>$value) {
786  if($key != 'Token') {
787  $soapString .= "<MobileService:{$key}>$value</MobileService:{$key}>\n";
788  }
789  }
790 
791  $soapString .= "</MobileService:payment>
792  </MobileService:SubmitPayment>
793  </soap:Body>
794 </soap:Envelope>\n";
795 
796 $cmd="/usr/bin/curl --silent --data-binary '$soapString' -H 'Content-Type: text/xml; charset=utf-8' -H 'SOAPAction: \"http://mobile.billpaysite.com/SubmitPayment\"' $ipayhost";
797 
798 $response=getcurl($cmd);
799 if ($parms["logging"] == "enabled") {
800  $logParms = $parms["environment"]; // get the environment info passed in
801  $logParms["token"] = $parms['Token']; // the id used across all communications in session
802  $logParms["txnId"] = time(); // the id for this transaction
803  $logParms["logPoint"] = "SubmitPayment"; // this action in a readable form
804  $logParms["request"] = $cmd; // the request
805  $logParms["reply"] = $response; // the response
806  LogSSOActivity($logParms);
807 }
808 
809  if (empty($response)) {
810  $return["status"]["response"]='false';
811  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
812  $return["status"]["message"]="No Response (" . __LINE__ . ")";
813  $return["ipaydata"]=array();
814  } else {
815  # call parse function to format response array
816  $return=ipayGetXMLResponse($response,'SubmitPaymentResult','payment');
817  }
818  return $return;
819 }
820 
821 function ipayEditPayment( $parms ) {
822 # uses: $parms['InstitutionId']
823 # $parms['Token']
824 # $parms['serviceurl']
825 # $parms['BillpayId']
826 # $parms['Payment']['Id']
827 # $parms['Payment']['From']
828 # $parms['Payment']['Amount']
829 # $parms['Payment']['Rush']
830 # $parms['Payment']['Date']
831 if ( !isset($parms['InstitutionId']) || !isset($parms['Token']) ||
832  !isset($parms['serviceurl']) || !isset($parms['BillpayId']) ||
833  !isset($parms['Payment']['Id']) ||
834  !isset($parms['Payment']['From']) ||
835  !isset($parms['Payment']['Amount']) ||
836  !isset($parms['Payment']['Rush']) ||
837  !isset($parms['Payment']['Date']) ){
838  $return["status"]["response"]='false';
839  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
840  $return["status"]["message"]='Missing Parameters (' . __LINE__ . ')';
841  $return["ipaydata"]=array();
842  $return=$return;
843 }
844 
845 $ipayhost = $parms['serviceurl'];
846 #POST /Mobile/MobileService.asmx HTTP/1.1
847 #Host: services.billpaysite.com
848 #Content-Type: text/xml; charset=utf-8
849 #Content-Length: length
850 #SOAPAction: "http://mobile.billpaysite.com/EditPayment"
851 
852 $soapString='<?xml version="1.0" encoding="utf-8"?>';
853 $soapString .= "\n<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:MobileService=\"http://mobile.billpaysite.com/\" xmlns:s1=\"http://microsoft.com/wsdl/types/\" xsl:version=\"1.0\">\n";
854 $soapString .= "<soap:Body>
855  <MobileService:EditPayment>
856  <MobileService:payment>
857  <MobileService:Product>Consumer</MobileService:Product>
858  <MobileService:Token>{$parms['Token']}</MobileService:Token>
859  <MobileService:InstitutionId>{$parms['InstitutionId']}</MobileService:InstitutionId>
860  <MobileService:Login>{$parms['BillpayId']}</MobileService:Login>";
861 
862  foreach($parms['Payment'] as $key =>$value) {
863  if($key != 'Token') {
864  $soapString .= "<MobileService:{$key}>$value</MobileService:{$key}>\n";
865  }
866  }
867 
868  $soapString .= "</MobileService:payment>
869  </MobileService:EditPayment>
870  </soap:Body>
871 </soap:Envelope>\n";
872 
873 $cmd="/usr/bin/curl --silent --data-binary '$soapString' -H 'Content-Type: text/xml; charset=utf-8' -H 'SOAPAction: \"http://mobile.billpaysite.com/EditPayment\"' $ipayhost";
874 
875 $response=getcurl($cmd);
876 if ($parms["logging"] == "enabled") {
877  $logParms = $parms["environment"]; // get the environment info passed in
878  $logParms["token"] = $parms['Token']; // the id used across all communications in session
879  $logParms["txnId"] = time(); // the id for this transaction
880  $logParms["logPoint"] = "EditPayment"; // this action in a readable form
881  $logParms["request"] = $cmd; // the request
882  $logParms["reply"] = $response; // the response
883  LogSSOActivity($logParms);
884 }
885 
886  if (empty($response)) {
887  $return["status"]["response"]='false';
888  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
889  $return["status"]["message"]="No Response (" . __LINE__ . ")";
890  $return["ipaydata"]=array();
891  } else {
892  # call parse function to format response array
893  $return=ipayGetXMLResponse($response,'EditPaymentResult','payment');
894  }
895  return $return;
896  }
897 
898 function ipayGetAccountList( $parms ) {
899 # tested OK 10/22/12
900 # uses: $parms['InstitutionId']
901 # $parms['Token']
902 # $parms['serviceurl']
903 # $parms['BillpayId'])
904 # $parms['Account']['types']
905 
906 if ( !isset($parms['InstitutionId']) || !isset($parms['Token']) ||
907  !isset($parms['serviceurl']) || !isset($parms['BillpayId']) ||
908  !isset($parms['Account']['types']) ){
909  $return["status"]["response"]='false';
910  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
911  $return["status"]["message"]='Missing Parameters (' . __LINE__ . ')';
912  $return["ipaydata"]=array();
913  $return=$return;
914 }
915 
916 $ipayhost = $parms['serviceurl'];
917 #POST /Mobile/MobileService.asmx HTTP/1.1
918 #Host: services.billpaysite.com
919 #Content-Type: text/xml; charset=utf-8
920 #Content-Length: length
921 #SOAPAction: "http://mobile.billpaysite.com/GetAccountList"
922 
923 $soapString='<?xml version="1.0" encoding="utf-8"?>';
924 $soapString .= "\n<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:MobileService=\"http://mobile.billpaysite.com/\" xmlns:s1=\"http://microsoft.com/wsdl/types/\" xsl:version=\"1.0\">";
925 $soapString .= "<soap:Body>
926  <MobileService:GetAccountList>
927  <MobileService:user xsi:type=\"MobileService:User\">
928  <MobileService:Product>Consumer</MobileService:Product>
929  <MobileService:Token>{$parms['Token']}</MobileService:Token>
930  <MobileService:InstitutionId>{$parms['InstitutionId']}</MobileService:InstitutionId>
931  <MobileService:Login>{$parms['BillpayId']}</MobileService:Login>
932  </MobileService:user>
933  <MobileService:types>{$parms['Account']['types']}</MobileService:types>
934  </MobileService:GetAccountList>
935  </soap:Body>
936 </soap:Envelope>\n";
937 
938 $cmd="/usr/bin/curl --silent --data-binary '$soapString' -H 'Content-Type: text/xml; charset=utf-8' -H 'SOAPAction: \"http://mobile.billpaysite.com/GetAccountList\"' $ipayhost";
939 
940 $response=getcurl($cmd);
941 if ($parms["logging"] == "enabled") {
942  $logParms = $parms["environment"]; // get the environment info passed in
943  $logParms["token"] = $parms['Token']; // the id used across all communications in session
944  $logParms["txnId"] = time(); // the id for this transaction
945  $logParms["logPoint"] = "GetAccountList"; // this action in a readable form
946  $logParms["request"] = $cmd; // the request
947  $logParms["reply"] = $response; // the response
948  LogSSOActivity($logParms);
949 }
950 
951  if (empty($response)) {
952  $return["status"]["response"]='false';
953  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
954  $return["status"]["message"]="No Response (" . __LINE__ . ")";
955  $return["ipaydata"]=array();
956  } else {
957  # call parse function to format response array
958  $return=ipayGetXMLResponse($response,'user/ipay:Response','Account');
959  }
960 
961  return $return;
962  }
963 
964 function ValidDatesIpay( $parms ) {
965 # tested OK 11/05/12
966 # uses: $parms['InstitutionId']
967 # $parms['Token']
968 # $parms['serviceurl']
969 # $parms['BillpayId']
970 # $parms['datemodel'] {due, process (Default)}
971 # returns: array of ProcessDate and possibly DeliverByDates
972 
973 # default datemodel is process
974 if ( !isset($parms['datemodel'])) {$parms['datemodel']='process';}
975 
976 if ( !isset($parms['InstitutionId']) || !isset($parms['Token']) ||
977  !isset($parms['serviceurl']) || !isset($parms['BillpayId']) ||
978  (strtolower($parms['datemodel'])=='due' && (
979  !isset($parms['Payee']['Id']) || !isset($parms['Payee']['Type'])))
980  ){
981  $return["status"]["response"]='false';
982  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
983  $return["status"]["message"]='Missing Parameters (' . __LINE__ . ')';
984  $return["ipaydata"]=array();
985  $return=$return;
986 } else {
987  if (strtolower($parms['datemodel']) == 'due') {
988  $return=ipayGetDeliverByDates( $parms );
989  } else {
990  $return=ipayGetProcessDates( $parms );
991  }
992 
993 }
994  return $return;
995 }
996 
997 function ipayGetProcessDates( $parms ) {
998 # tested OK 11/05/12
999 # uses: $parms['InstitutionId']
1000 # $parms['Token']
1001 # $parms['serviceurl']
1002 # $parms['BillpayId']
1003 
1004 if ( !isset($parms['InstitutionId']) || !isset($parms['Token']) ||
1005  !isset($parms['serviceurl']) || !isset($parms['BillpayId']) ) {
1006  $return["status"]["response"]='false';
1007  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
1008  $return["status"]["message"]='Missing Parameters (' . __LINE__ . ')';
1009  $return["ipaydata"]=array();
1010  $return=$return;
1011 }
1012 
1013 $ipayhost = $parms['serviceurl'];
1014 #POST /Mobile/MobileService.asmx HTTP/1.1
1015 #Host: services.billpaysite.com
1016 #Content-Type: text/xml; charset=utf-8
1017 #Content-Length: length
1018 #SOAPAction: "http://mobile.billpaysite.com/GetProcessDates"
1019 
1020 $soapString='<?xml version="1.0" encoding="utf-8"?>';
1021 $soapString .= "\n<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:MobileService=\"http://mobile.billpaysite.com/\" xmlns:s1=\"http://microsoft.com/wsdl/types/\" xsl:version=\"1.0\">";
1022 $soapString .= "<soap:Body>
1023  <MobileService:GetProcessDates>
1024  <MobileService:user xsi:type=\"MobileService:User\">
1025  <MobileService:Product>Consumer</MobileService:Product>
1026  <MobileService:Token>{$parms['Token']}</MobileService:Token>
1027  <MobileService:InstitutionId>{$parms['InstitutionId']}</MobileService:InstitutionId>
1028  <MobileService:Login>{$parms['BillpayId']}</MobileService:Login>
1029  </MobileService:user>
1030  </MobileService:GetProcessDates>
1031  </soap:Body>
1032 </soap:Envelope>\n";
1033 
1034 $cmd="/usr/bin/curl --silent --data-binary '$soapString' -H 'Content-Type: text/xml; charset=utf-8' -H 'SOAPAction: \"http://mobile.billpaysite.com/GetProcessDates\"' $ipayhost";
1035 
1036 $response=getcurl($cmd);
1037 if ($parms["logging"] == "enabled") {
1038  $logParms = $parms["environment"]; // get the environment info passed in
1039  $logParms["token"] = $parms['Token']; // the id used across all communications in session
1040  $logParms["txnId"] = time(); // the id for this transaction
1041  $logParms["logPoint"] = "GetProcessDates"; // this action in a readable form
1042  $logParms["request"] = $cmd; // the request
1043  $logParms["reply"] = $response; // the response
1044  LogSSOActivity($logParms);
1045 }
1046 
1047  if (empty($response)) {
1048  $return["status"]["response"]='false';
1049  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
1050  $return["status"]["message"]="No Response (" . __LINE__ . ")";
1051  $return["ipaydata"]=array();
1052  } else {
1053  # call parse function to format response array
1054  $return=ipayGetXMLProcDates($response,'user/ipay:Response','GetProcessDatesResult');
1055  }
1056  return $return;
1057 }
1058 
1059 function ipayGetDeliverByDates( $parms ) {
1060 # tested OK 11/05/12
1061 # uses: $parms['InstitutionId']
1062 # $parms['Token']
1063 # $parms['serviceurl']
1064 # $parms['BillpayId']
1065 # $parms['Payee']['Id']
1066 # $parms['Payee']['Type']
1067 
1068 if ( !isset($parms['InstitutionId']) || !isset($parms['Token']) ||
1069  !isset($parms['serviceurl']) || !isset($parms['BillpayId']) ||
1070  !isset($parms['Payee']['Id']) || !isset($parms['Payee']['Type']) ){
1071  $return["status"]["response"]='false';
1072  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
1073  $return["status"]["message"]='Missing Parameters (' . __LINE__ . ')';
1074  $return["ipaydata"]=array();
1075  $return=$return;
1076 }
1077 
1078 $ipayhost = $parms['serviceurl'];
1079 #POST /Mobile/MobileService.asmx HTTP/1.1
1080 #Host: services.billpaysite.com
1081 #Content-Type: text/xml; charset=utf-8
1082 #Content-Length: length
1083 #SOAPAction: "http://mobile.billpaysite.com/GetDeliverByDates"
1084 
1085 $soapString='<?xml version="1.0" encoding="utf-8"?>';
1086 $soapString .= "\n<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:MobileService=\"http://mobile.billpaysite.com/\" xmlns:s1=\"http://microsoft.com/wsdl/types/\" xsl:version=\"1.0\">";
1087 $soapString .= "<soap:Body>
1088 <MobileService:GetDeliverByDates>
1089  <MobileService:user xsi:type=\"MobileService:User\">
1090  <MobileService:Product>Consumer</MobileService:Product>
1091  <MobileService:Token>{$parms['Token']}</MobileService:Token>
1092  <MobileService:InstitutionId>{$parms['InstitutionId']}</MobileService:InstitutionId>
1093  <MobileService:Login>{$parms['BillpayId']}</MobileService:Login>
1094  </MobileService:user>
1095  <MobileService:payee>\n";
1096 
1097  foreach($parms['Payee'] as $key =>$value) {
1098  if($key != 'Token') {
1099  $soapString .= "<MobileService:{$key}>$value</MobileService:{$key}>\n";
1100  }
1101  }
1102 
1103 $soapString .= "</MobileService:payee>
1104  </MobileService:GetDeliverByDates>
1105  </soap:Body>
1106 </soap:Envelope>\n";
1107 
1108 $cmd="/usr/bin/curl --silent --data-binary '$soapString' -H 'Content-Type: text/xml; charset=utf-8' -H 'SOAPAction: \"http://mobile.billpaysite.com/GetDeliverByDates\"' $ipayhost";
1109 
1110 $response=getcurl($cmd);
1111 if ($parms["logging"] == "enabled") {
1112  $logParms = $parms["environment"]; // get the environment info passed in
1113  $logParms["token"] = $parms['Token']; // the id used across all communications in session
1114  $logParms["txnId"] = time(); // the id for this transaction
1115  $logParms["logPoint"] = "GetDeliverByDates"; // this action in a readable form
1116  $logParms["request"] = $cmd; // the request
1117  $logParms["reply"] = $response; // the response
1118  LogSSOActivity($logParms);
1119 }
1120 
1121  if (empty($response)) {
1122  $return["status"]["response"]='false';
1123  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
1124  $return["status"]["message"]="No Response (" . __LINE__ . ")";
1125  $return["ipaydata"]=array();
1126  } else {
1127  # call parse function to format response array
1128  $return=ipayGetXMLDueDates($response,'user/ipay:Response','Date_x0020_Pairs');
1129  }
1130  return $return;
1131 }
1132 
1133 function ipayGetDeliveryOptions( $parms ) {
1134 # tested OK 11/06/12
1135 # weird though - returns Payee object but w/PaymentMethod
1136 # and RushOptions filled in (PaymentMethod is 'unknown' in PayeeList)
1137 # function documentation references 'DeliveryMethods', but
1138 # schema shows PaymentMethod, which is what function returns
1139 #
1140 # uses: $parms['InstitutionId']
1141 # $parms['Token']
1142 # $parms['serviceurl']
1143 # $parms['BillpayId']) ||
1144 # $parms['Payee']['Id']
1145 
1146 if ( !isset($parms['InstitutionId']) || !isset($parms['Token']) ||
1147  !isset($parms['serviceurl']) || !isset($parms['BillpayId']) ||
1148  !isset($parms['Payee']['Id']) ){
1149  $return["status"]["response"]='false';
1150  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
1151  $return["status"]["message"]='Missing Parameters (' . __LINE__ . ')';
1152  $return["ipaydata"]=array();
1153  $return=$return;
1154 }
1155 
1156 $ipayhost = $parms['serviceurl'];
1157 #POST /Mobile/MobileService.asmx HTTP/1.1
1158 #Host: services.billpaysite.com
1159 #Content-Type: text/xml; charset=utf-8
1160 #Content-Length: length
1161 #SOAPAction: "http://mobile.billpaysite.com/GetDeliveryOptions"
1162 
1163 $soapString='<?xml version="1.0" encoding="utf-8"?>';
1164 $soapString .= "\n<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:MobileService=\"http://mobile.billpaysite.com/\" xmlns:s1=\"http://microsoft.com/wsdl/types/\" xsl:version=\"1.0\">";
1165 $soapString .= "<soap:Body>
1166  <MobileService:GetDeliveryOptions>
1167  <MobileService:payee>
1168  <MobileService:Product>Consumer</MobileService:Product>
1169  <MobileService:Token>{$parms['Token']}</MobileService:Token>
1170  <MobileService:InstitutionId>{$parms['InstitutionId']}</MobileService:InstitutionId>
1171  <MobileService:Login>{$parms['BillpayId']}</MobileService:Login>\n";
1172  foreach($parms['Payee'] as $key =>$value) {
1173  if($key != 'Token') {
1174  $soapString .= "<MobileService:{$key}>$value</MobileService:{$key}>\n";
1175  }
1176  }
1177  $soapString .= "</MobileService:payee>
1178  </MobileService:GetDeliveryOptions>
1179  </soap:Body>
1180 </soap:Envelope>\n";
1181 
1182 $cmd="/usr/bin/curl --silent --data-binary '$soapString' -H 'Content-Type: text/xml; charset=utf-8' -H 'SOAPAction: \"http://mobile.billpaysite.com/GetDeliveryOptions\"' $ipayhost";
1183 
1184 $response=getcurl($cmd);
1185 if ($parms["logging"] == "enabled") {
1186  $logParms = $parms["environment"]; // get the environment info passed in
1187  $logParms["token"] = $parms['Token']; // the id used across all communications in session
1188  $logParms["txnId"] = time(); // the id for this transaction
1189  $logParms["logPoint"] = "GetDeliveryOptions"; // this action in a readable form
1190  $logParms["request"] = $cmd; // the request
1191  $logParms["reply"] = $response; // the response
1192  LogSSOActivity($logParms);
1193 }
1194 
1195  if (empty($response)) {
1196  $return["status"]["response"]='false';
1197  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
1198  $return["status"]["message"]="No Response (" . __LINE__ . ")";
1199  $return["ipaydata"]=array();
1200  } else {
1201  # call parse function to format response array
1202  $return=ipayGetXMLResponse($response,'GetDeliveryOptionsResult','payee');
1203  }
1204  return $return;
1205 }
1206 
1207 function ipayGetDisclosures( $parms ) {
1208 # tested OK 10/22/12
1209 # uses: $parms['InstitutionId']
1210 # $parms['Token']
1211 # $parms['serviceurl']
1212 # $parms['BillpayId']
1213 
1214 if ( !isset($parms['InstitutionId']) || !isset($parms['Token']) ||
1215  !isset($parms['serviceurl']) || !isset($parms['BillpayId']) ){
1216  $return["status"]["response"]='false';
1217  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
1218  $return["status"]["message"]='Missing Parameters (' . __LINE__ . ')';
1219  $return["ipaydata"]=array();
1220  $return=$return;
1221 }
1222 
1223 $ipayhost = $parms['serviceurl'];
1224 #POST /Mobile/MobileService.asmx HTTP/1.1
1225 #Host: services.billpaysite.com
1226 #Content-Type: text/xml; charset=utf-8
1227 #Content-Length: length
1228 #SOAPAction: "http://mobile.billpaysite.com/GetDisclosures"
1229 
1230 $soapString='<?xml version="1.0" encoding="utf-8"?>';
1231 $soapString .= "\n<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:MobileService=\"http://mobile.billpaysite.com/\" xmlns:s1=\"http://microsoft.com/wsdl/types/\" xsl:version=\"1.0\">";
1232 $soapString .= "<soap:Body>
1233  <MobileService:GetDisclosures>
1234  <MobileService:user xsi:type=\"MobileService:User\">
1235  <MobileService:Product>Consumer</MobileService:Product>
1236  <MobileService:Token>{$parms['Token']}</MobileService:Token>
1237  <MobileService:InstitutionId>{$parms['InstitutionId']}</MobileService:InstitutionId>
1238  <MobileService:Login>{$parms['BillpayId']}</MobileService:Login>
1239  </MobileService:user>
1240  </MobileService:GetDisclosures>
1241  </soap:Body>
1242 </soap:Envelope>\n";
1243 
1244 $cmd="/usr/bin/curl --silent --data-binary '$soapString' -H 'Content-Type: text/xml; charset=utf-8' -H 'SOAPAction: \"http://mobile.billpaysite.com/GetDisclosures\"' $ipayhost";
1245 
1246 $response=getcurl($cmd);
1247 if ($parms["logging"] == "enabled") {
1248  $logParms = $parms["environment"]; // get the environment info passed in
1249  $logParms["token"] = $parms['Token']; // the id used across all communications in session
1250  $logParms["txnId"] = time(); // the id for this transaction
1251  $logParms["logPoint"] = "GetDisclosures"; // this action in a readable form
1252  $logParms["request"] = $cmd; // the request
1253  $logParms["reply"] = $response; // the response
1254  LogSSOActivity($logParms);
1255 }
1256 
1257  if (empty($response)) {
1258  $return["status"]["response"]='false';
1259  $return["status"]["message"]="No Response (" . __LINE__ . ")";
1260  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
1261  $return["ipaydata"]=array();
1262  } else {
1263  # call parse function to format response array
1264  $return=ipayGetXMLResponse($response,'user/ipay:Response','GetDisclosuresResult');
1265  }
1266  return $return;
1267 }
1268 
1269 
1270 function ipayGetHistory( $parms ) {
1271 # tested OK 11/06/12
1272 # uses: $parms['InstitutionId']
1273 # $parms['Token']
1274 # $parms['serviceurl']
1275 # $parms['BillpayId']
1276 
1277 if ( !isset($parms['InstitutionId']) || !isset($parms['Token']) ||
1278  !isset($parms['serviceurl']) || !isset($parms['BillpayId']) ) {
1279  $return["status"]["response"]='false';
1280  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
1281  $return["status"]["message"]='Missing Parameters (' . __LINE__ . ')';
1282  $return["ipaydata"]=array();
1283  $return=$return;
1284 }
1285 
1286 $ipayhost = $parms['serviceurl'];
1287 #POST /Mobile/MobileService.asmx HTTP/1.1
1288 #Host: services.billpaysite.com
1289 #Content-Type: text/xml; charset=utf-8
1290 #Content-Length: length
1291 #SOAPAction: "http://mobile.billpaysite.com/GetHistory"
1292 
1293 $soapString='<?xml version="1.0" encoding="utf-8"?>';
1294 $soapString .= "\n<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:MobileService=\"http://mobile.billpaysite.com/\" xmlns:s1=\"http://microsoft.com/wsdl/types/\" xsl:version=\"1.0\">";
1295 $soapString .= "<soap:Body>
1296  <MobileService:GetHistory>
1297  <MobileService:user xsi:type=\"MobileService:User\">
1298  <MobileService:Product>Consumer</MobileService:Product>
1299  <MobileService:Token>{$parms['Token']}</MobileService:Token>
1300  <MobileService:InstitutionId>{$parms['InstitutionId']}</MobileService:InstitutionId>
1301  <MobileService:Login>{$parms['BillpayId']}</MobileService:Login>
1302  </MobileService:user>
1303  </MobileService:GetHistory>
1304  </soap:Body>
1305 </soap:Envelope>\n";
1306 
1307 $cmd="/usr/bin/curl --silent --data-binary '$soapString' -H 'Content-Type: text/xml; charset=utf-8' -H 'SOAPAction: \"http://mobile.billpaysite.com/GetHistory\"' $ipayhost";
1308 
1309 $response=getcurl($cmd);
1310 if ($parms["logging"] == "enabled") {
1311  $logParms = $parms["environment"]; // get the environment info passed in
1312  $logParms["token"] = $parms['Token']; // the id used across all communications in session
1313  $logParms["txnId"] = time(); // the id for this transaction
1314  $logParms["logPoint"] = "GetHistory"; // this action in a readable form
1315  $logParms["request"] = $cmd; // the request
1316  $logParms["reply"] = $response; // the response
1317  LogSSOActivity($logParms);
1318 }
1319 
1320  if (empty($response)) {
1321  $return["status"]["response"]='false';
1322  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
1323  $return["status"]["message"]="No Response (" . __LINE__ . ")";
1324  $return["ipaydata"]=array();
1325  } else {
1326  # call parse function to format response array
1327  $return=ipayGetXMLResponse($response,'user/ipay:Response','Payment');
1328  }
1329 
1330  return $return;
1331 }
1332 
1333 function ipaySubscriberValidation( $parms ) {
1334 #tested OK 10/22/12
1335 # uses: $parms['InstitutionId']
1336 # $parms['Token']
1337 # $parms['serviceurl']
1338 # $parms['BillpayId'])
1339 
1340 if ( !isset($parms['InstitutionId']) || !isset($parms['Token']) ||
1341  !isset($parms['serviceurl']) || !isset($parms['BillpayId']) ){
1342  $return["status"]["response"]='false';
1343  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
1344  $return["status"]["message"]='Missing Parameters (' . __LINE__ . ')';
1345  $return["ipaydata"]=array();
1346  $return=$return;
1347 }
1348 $ipayhost = $parms['serviceurl'];
1349 #POST /Mobile/MobileService.asmx HTTP/1.1
1350 #Host: services.billpaysite.com
1351 #Content-Type: text/xml; charset=utf-8
1352 #Content-Length: length
1353 #SOAPAction: "http://mobile.billpaysite.com/SubscriberValidation"
1354 
1355 $soapString='<?xml version="1.0"?>';
1356 $soapString .= "\n<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:MobileService=\"http://mobile.billpaysite.com/\" xmlns:s1=\"http://microsoft.com/wsdl/types/\" xsl:version=\"1.0\">";
1357 $soapString .= "<soap:Body>
1358 <MobileService:SubscriberValidation>
1359  <MobileService:user xsi:type=\"MobileService:User\">
1360  <MobileService:Product>Consumer</MobileService:Product>
1361  <MobileService:Token>{$parms['Token']}</MobileService:Token>
1362  <MobileService:InstitutionId>{$parms['InstitutionId']}</MobileService:InstitutionId>
1363  <MobileService:Login>{$parms['BillpayId']}</MobileService:Login>
1364  </MobileService:user>
1365  </MobileService:SubscriberValidation>
1366  </soap:Body>
1367 </soap:Envelope>\n";
1368 
1369  $cmd="/usr/bin/curl --silent --data-binary '$soapString' -H 'Content-Type: text/xml; charset=utf-8' -H 'SOAPAction: \"http://mobile.billpaysite.com/SubscriberValidation\"' $ipayhost";
1370 
1371  $response=getcurl($cmd);
1372 if ($parms["logging"] == "enabled") {
1373  $logParms = $parms["environment"]; // get the environment info passed in
1374  $logParms["token"] = $parms['Token']; // the id used across all communications in session
1375  $logParms["txnId"] = time(); // the id for this transaction
1376  $logParms["logPoint"] = "SubscriberValidation"; // this action in a readable form
1377  $logParms["request"] = $cmd; // the request
1378  $logParms["reply"] = $response; // the response
1379  LogSSOActivity($logParms);
1380 }
1381 
1382  if (empty($response)) {
1383  $return["status"]["response"]='false';
1384  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
1385  $return["status"]["message"]="No Response (" . __LINE__ . ")";
1386  $return["ipaydata"]=array();
1387  } else {
1388  # call parse function to format response array
1389  $return=ipayGetXMLResponse($response,'SubscriberValidationResult','user');
1390  }
1391 // $return[soap]=$soapString;
1392 // $return[raw]=print_r($response,true);
1393  return $return;
1394 }
1395 
1396 function ipayGetLastPaid( $parms ) {
1397 # tested OK 11/06/12
1398 if ( !isset($parms['InstitutionId']) || !isset($parms['Token']) ||
1399  !isset($parms['serviceurl']) || !isset($parms['BillpayId']) ||
1400  !isset($parms['Payment']['To']) ) {
1401  $return["status"]["response"]='false';
1402  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
1403  $return["status"]["message"]='Missing Parameters (' . __LINE__ . ')';
1404  $return["ipaydata"]=array();
1405  $return=$return;
1406 }
1407 
1408 $ipayhost = $parms['serviceurl'];
1409 #POST /Mobile/MobileService.asmx HTTP/1.1
1410 #Host: services.billpaysite.com
1411 #Content-Type: text/xml; charset=utf-8
1412 #Content-Length: length
1413 #SOAPAction: "http://mobile.billpaysite.com/GetLastPaid"
1414 
1415 $soapString='<?xml version="1.0" encoding="utf-8"?>';
1416 $soapString .= "\n<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:MobileService=\"http://mobile.billpaysite.com/\" xmlns:s1=\"http://microsoft.com/wsdl/types/\" xsl:version=\"1.0\">";
1417 $soapString .= "<soap:Body>
1418  <MobileService:GetLastPaid>
1419  <MobileService:payment>
1420  <MobileService:Product>Consumer</MobileService:Product>
1421  <MobileService:Login>{$parms['BillpayId']}</MobileService:Login>
1422  <MobileService:Token>{$parms['Token']}</MobileService:Token>\n";
1423 
1424  foreach($parms['Payment'] as $key =>$value) {
1425  if($key != 'Token') {
1426  $soapString .= "<MobileService:{$key}>$value</MobileService:{$key}>\n";
1427  }
1428  }
1429 
1430  $soapString .= "</MobileService:payment>
1431  </MobileService:GetLastPaid>
1432  </soap:Body>
1433 </soap:Envelope>\n";
1434 
1435 $cmd="/usr/bin/curl --silent --data-binary '$soapString' -H 'Content-Type: text/xml; charset=utf-8' -H 'SOAPAction: \"http://mobile.billpaysite.com/GetLastPaid\"' $ipayhost";
1436 
1437 $response=getcurl($cmd);
1438 if ($parms["logging"] == "enabled") {
1439  $logParms = $parms["environment"]; // get the environment info passed in
1440  $logParms["token"] = $parms['Token']; // the id used across all communications in session
1441  $logParms["txnId"] = time(); // the id for this transaction
1442  $logParms["logPoint"] = "GetLastPaid"; // this action in a readable form
1443  $logParms["request"] = $cmd; // the request
1444  $logParms["reply"] = $response; // the response
1445  LogSSOActivity($logParms);
1446 }
1447 
1448  if (empty($response)) {
1449  $return["status"]["response"]='false';
1450  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
1451  $return["status"]["message"]="No Response (" . __LINE__ . ")";
1452  $return["ipaydata"]=array();
1453  } else {
1454  # call parse function to format response array
1455  $return=ipayGetXMLResponse($response,'GetLastPaidResult','payment');
1456  }
1457  return $return;
1458 }
1459 
1460 function ipaySubmitTransfer( $parms ) {
1461 # uses: $parms['InstitutionId']
1462 # $parms['Token']
1463 # $parms['serviceurl']
1464 # $parms['BillpayId']
1465 # $parms['Payment']['From']
1466 # $parms['Payment']['To']
1467 # $parms['Payment']['Amount']
1468 # $parms['Payment']['Date']
1469 
1470 if ( !isset($parms['InstitutionId']) || !isset($parms['Token']) ||
1471  !isset($parms['serviceurl']) || !isset($parms['BillpayId']) ||
1472  !isset($parms['Payment']['From']) ||
1473  !isset($parms['Payment']['To']) ||
1474  !isset($parms['Payment']['Amount']) ||
1475  !isset($parms['Payment']['Date']) ){
1476  $return["status"]["response"]='false';
1477  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
1478  $return["status"]["message"]='Missing Parameters (' . __LINE__ . ')';
1479  $return["ipaydata"]=array();
1480  $return=$return;
1481 }
1482 
1483 $ipayhost = $parms['serviceurl'];
1484 #POST /Mobile/MobileService.asmx HTTP/1.1
1485 #Host: services.billpaysite.com
1486 #Content-Type: text/xml; charset=utf-8
1487 #Content-Length: length
1488 #SOAPAction: "http://mobile.billpaysite.com/SubmitTransfer"
1489 
1490 $soapString='<?xml version="1.0" encoding="utf-8"?>';
1491 $soapString .= "\n<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:MobileService=\"http://mobile.billpaysite.com/\" xmlns:s1=\"http://microsoft.com/wsdl/types/\" xsl:version=\"1.0\">";
1492 $soapString .= "<soap:Body>
1493  <MobileService:SubmitTransfer>
1494  <MobileService:payment>
1495  <MobileService:Product>Consumer</MobileService:Product>
1496  <MobileService:Token>{$parms['Token']}</MobileService:Token>
1497  <MobileService:InstitutionId>{$parms['InstitutionId']}</MobileService:InstitutionId>
1498  <MobileService:Login>{$parms['BillpayId']}</MobileService:Login>\n";
1499 
1500  foreach($parms['Payment'] as $key =>$value) {
1501  if($key != 'Token') {
1502  $soapString .= "<MobileService:{$key}>$value</MobileService:{$key}>\n";
1503  }
1504  }
1505 
1506  $soapString .= "</MobileService:payment>
1507  </MobileService:SubmitTransfer>
1508  </soap:Body>
1509 </soap:Envelope>\n";
1510 
1511 $cmd="/usr/bin/curl --silent --data-binary '$soapString' -H 'Content-Type: text/xml; charset=utf-8' -H 'SOAPAction: \"http://mobile.billpaysite.com/SubmitTransfer\"' $ipayhost";
1512 
1513 $response=getcurl($cmd);
1514 if ($parms["logging"] == "enabled") {
1515  $logParms = $parms["environment"]; // get the environment info passed in
1516  $logParms["token"] = $parms['Token']; // the id used across all communications in session
1517  $logParms["txnId"] = time(); // the id for this transaction
1518  $logParms["logPoint"] = "SubmitTransfer"; // this action in a readable form
1519  $logParms["request"] = $cmd; // the request
1520  $logParms["reply"] = $response; // the response
1521  LogSSOActivity($logParms);
1522 }
1523 
1524  if (empty($response)) {
1525  $return["status"]["response"]='false';
1526  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
1527  $return["status"]["message"]="No Response (" . __LINE__ . ")";
1528  $return["ipaydata"]=array();
1529  } else {
1530  # call parse function to format response array
1531  $return=ipayGetXMLResponse($response,'SubmitTransferResult','payment');
1532  }
1533  return $return;
1534 }
1535 
1536 function ipayGetPayeeList( $parms ) {
1537 # tested OK 10/22/12
1538 # uses: $parms['InstitutionId']
1539 # $parms['Token']
1540 # $parms['serviceurl']
1541 # $parms['BillpayId'])
1542 
1543 if ( !isset($parms['InstitutionId']) || !isset($parms['Token']) ||
1544  !isset($parms['serviceurl']) || !isset($parms['BillpayId']) ){
1545  $return["status"]["response"]='false';
1546  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
1547  $return["status"]["message"]='Missing Parameters (' . __LINE__ . ')';
1548  $return["ipaydata"]=array();
1549  $return=$return;
1550 }
1551 
1552 $ipayhost = $parms['serviceurl'];
1553 #POST /Mobile/MobileService.asmx HTTP/1.1
1554 #Host: services.billpaysite.com
1555 #Content-Type: text/xml; charset=utf-8
1556 #Content-Length: length
1557 #SOAPAction: "http://mobile.billpaysite.com/GetPayeeList"
1558 
1559 $soapString='<?xml version="1.0" encoding="utf-8"?>';
1560 $soapString .= "\n<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:MobileService=\"http://mobile.billpaysite.com/\" xmlns:s1=\"http://microsoft.com/wsdl/types/\" xsl:version=\"1.0\">";
1561 $soapString .= "<soap:Body>
1562  <MobileService:GetPayeeList>
1563  <MobileService:user xsi:type=\"MobileService:User\">
1564  <MobileService:Product>Consumer</MobileService:Product>
1565  <MobileService:Token>{$parms['Token']}</MobileService:Token>
1566  <MobileService:InstitutionId>{$parms['InstitutionId']}</MobileService:InstitutionId>
1567  <MobileService:Login>{$parms['BillpayId']}</MobileService:Login>
1568  </MobileService:user>
1569  </MobileService:GetPayeeList>
1570  </soap:Body>
1571 </soap:Envelope>\n";
1572 
1573 $cmd="/usr/bin/curl --silent --data-binary '$soapString' -H 'Content-Type: text/xml; charset=utf-8' -H 'SOAPAction: \"http://mobile.billpaysite.com/GetPayeeList\"' $ipayhost";
1574 
1575 $response=getcurl($cmd);
1576 if ($parms["logging"] == "enabled") {
1577  $logParms = $parms["environment"]; // get the environment info passed in
1578  $logParms["token"] = $parms['Token']; // the id used across all communications in session
1579  $logParms["txnId"] = time(); // the id for this transaction
1580  $logParms["logPoint"] = "GetPayeeList"; // this action in a readable form
1581  $logParms["request"] = $cmd; // the request
1582  $logParms["reply"] = $response; // the response
1583  LogSSOActivity($logParms);
1584 }
1585 
1586  if (empty($response)) {
1587  $return["status"]["response"]='false';
1588  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
1589  $return["status"]["message"]="No Response (" . __LINE__ . ")";
1590  $return["ipaydata"]=array();
1591  } else {
1592  # call parse function to format response array
1593  $return=ipayGetXMLResponse($response,'user/ipay:Response','Payee');
1594  }
1595  return $return;
1596 }
1597 
1598 function ipayGetShortcuts( $parms ) {
1599 $ipayhost = $parms['serviceurl'];
1600 #POST /Mobile/MobileService.asmx HTTP/1.1
1601 #Host: services.billpaysite.com
1602 #Content-Type: text/xml; charset=utf-8
1603 #Content-Length: length
1604 #SOAPAction: "http://mobile.billpaysite.com/GetShortcuts"
1605 
1606 $soapString='<?xml version="1.0" encoding="utf-8"?>';
1607 $soapString .= "\n<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:MobileService=\"http://mobile.billpaysite.com/\" xmlns:s1=\"http://microsoft.com/wsdl/types/\" xsl:version=\"1.0\">";
1608 $soapString .= "<soap:Body>
1609  <MobileService:GetShortcuts>
1610  <MobileService:user xsi:type=\"MobileService:User\">
1611  <MobileService:Product>Consumer</MobileService:Product>
1612  <MobileService:Token>{$parms['Token']}</MobileService:Token>
1613  <MobileService:InstitutionId>{$parms['InstitutionId']}</MobileService:InstitutionId>
1614  <MobileService:Login>{$parms['BillpayId']}</MobileService:Login>
1615  </MobileService:user>
1616  </MobileService:GetShortcuts>
1617  </soap:Body>
1618 </soap:Envelope>\n";
1619 
1620 $cmd="/usr/bin/curl --silent --data-binary '$soapString' -H 'Content-Type: text/xml; charset=utf-8' -H 'SOAPAction: \"http://mobile.billpaysite.com/GetShortcuts\"' $ipayhost";
1621 
1622 $response=getcurl($cmd);
1623 if ($parms["logging"] == "enabled") {
1624  $logParms = $parms["environment"]; // get the environment info passed in
1625  $logParms["token"] = $parms['Token']; // the id used across all communications in session
1626  $logParms["txnId"] = time(); // the id for this transaction
1627  $logParms["logPoint"] = "GetShortcuts"; // this action in a readable form
1628  $logParms["request"] = $cmd; // the request
1629  $logParms["reply"] = $response; // the response
1630  LogSSOActivity($logParms);
1631 }
1632 
1633  if (empty($response)) {
1634  $return["status"]["response"]='false';
1635  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
1636  $return["status"]["message"]="No Response (" . __LINE__ . ")";
1637  $return["ipaydata"]=array();
1638  } else {
1639  # call parse function to format response array
1640  $return=ipayGetXMLResponse($response,'user/ipay:Response','Payment');
1641  }
1642  return $return;
1643 }
1644 
1645 function ipayGetScheduled( $parms ) {
1646 # tested OK 11/06/12
1647 # uses: $parms['InstitutionId']
1648 # $parms['Token']
1649 # $parms['serviceurl']
1650 # $parms['BillpayId'])
1651 
1652 if ( !isset($parms['InstitutionId']) || !isset($parms['Token']) ||
1653  !isset($parms['serviceurl']) || !isset($parms['BillpayId']) ){
1654  $return["status"]["response"]='false';
1655  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
1656  $return["status"]["message"]='Missing Parameters (' . __LINE__ . ')';
1657  $return["ipaydata"]=array();
1658  $return=$return;
1659 }
1660 $ipayhost = $parms['serviceurl'];
1661 #POST /Mobile/MobileService.asmx HTTP/1.1
1662 #Host: services.billpaysite.com
1663 #Content-Type: text/xml; charset=utf-8
1664 #Content-Length: length
1665 #SOAPAction: "http://mobile.billpaysite.com/GetScheduled"
1666 
1667 $soapString='<?xml version="1.0" encoding="utf-8"?>';
1668 $soapString .= "\n<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:MobileService=\"http://mobile.billpaysite.com/\" xmlns:s1=\"http://microsoft.com/wsdl/types/\" xsl:version=\"1.0\">";
1669 $soapString .= "<soap:Body>
1670  <MobileService:GetScheduled>
1671  <MobileService:user xsi:type=\"MobileService:User\">
1672  <MobileService:Product>Consumer</MobileService:Product>
1673  <MobileService:Token>{$parms['Token']}</MobileService:Token>
1674  <MobileService:InstitutionId>{$parms['InstitutionId']}</MobileService:InstitutionId>
1675  <MobileService:Login>{$parms['BillpayId']}</MobileService:Login>
1676  </MobileService:user>
1677  </MobileService:GetScheduled>
1678  </soap:Body>
1679 </soap:Envelope>\n";
1680 
1681 $cmd="/usr/bin/curl --silent --data-binary '$soapString' -H 'Content-Type: text/xml; charset=utf-8' -H 'SOAPAction: \"http://mobile.billpaysite.com/GetScheduled\"' $ipayhost";
1682 
1683 $response=getcurl($cmd);
1684 if ($parms["logging"] == "enabled") {
1685  $logParms = $parms["environment"]; // get the environment info passed in
1686  $logParms["token"] = $parms['Token']; // the id used across all communications in session
1687  $logParms["txnId"] = time(); // the id for this transaction
1688  $logParms["logPoint"] = "GetScheduled"; // this action in a readable form
1689  $logParms["request"] = $cmd; // the request
1690  $logParms["reply"] = $response; // the response
1691  LogSSOActivity($logParms);
1692 }
1693 
1694  if (empty($response)) {
1695  $return["status"]["response"]='false';
1696  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
1697  $return["status"]["message"]="No Response (" . __LINE__ . ")";
1698  $return["ipaydata"]=array();
1699  } else {
1700  # call parse function to format response array
1701  $return=ipayGetXMLResponse($response,'user/ipay:Response','Payment');
1702  }
1703 //$return["mike"] = $response;
1704  return $return;
1705 }
1706 
1707 function ipayStopPayment( $parms ) {
1708 # uses: $parms['InstitutionId']
1709 # $parms['Token']
1710 # $parms['serviceurl']
1711 # $parms['BillpayId']
1712 # $parms['Payment']['Id']
1713 
1714 if ( !isset($parms['InstitutionId']) || !isset($parms['Token']) ||
1715  !isset($parms['serviceurl']) || !isset($parms['BillpayId']) ||
1716  !isset($parms['Payment']['Id']) ){
1717  $return["status"]["response"]='false';
1718  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
1719  $return["status"]["message"]='Missing Parameters (' . __LINE__ . ')';
1720  $return["ipaydata"]=array();
1721  $return=$return;
1722 }
1723 
1724 $ipayhost = $parms['serviceurl'];
1725 #POST /Mobile/MobileService.asmx HTTP/1.1
1726 #Host: services.billpaysite.com
1727 #Content-Type: text/xml; charset=utf-8
1728 #Content-Length: length
1729 #SOAPAction: "http://mobile.billpaysite.com/StopPayment"
1730 
1731 $soapString='<?xml version="1.0" encoding="utf-8"?>';
1732 $soapString .= "\n<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:MobileService=\"http://mobile.billpaysite.com/\" xmlns:s1=\"http://microsoft.com/wsdl/types/\" xsl:version=\"1.0\">\n";
1733 $soapString .= "<soap:Body>
1734  <MobileService:StopPayment>
1735  <MobileService:payment>
1736  <MobileService:Product>Consumer</MobileService:Product>
1737  <MobileService:Token>{$parms['Token']}</MobileService:Token>
1738  <MobileService:InstitutionId>{$parms['InstitutionId']}</MobileService:InstitutionId>
1739  <MobileService:Login>{$parms['BillpayId']}</MobileService:Login>\n";
1740 
1741  foreach($parms['Payment'] as $key =>$value) {
1742  if($key != 'Token') {
1743  $soapString .= "<MobileService:{$key}>$value</MobileService:{$key}>\n";
1744  }
1745  }
1746 
1747  $soapString .= "</MobileService:payment>
1748  </MobileService:StopPayment>
1749  </soap:Body>
1750 </soap:Envelope>\n";
1751 
1752 $cmd="/usr/bin/curl --silent --data-binary '$soapString' -H 'Content-Type: text/xml; charset=utf-8' -H 'SOAPAction: \"http://mobile.billpaysite.com/StopPayment\"' $ipayhost";
1753 
1754 $response=getcurl($cmd);
1755 if ($parms["logging"] == "enabled") {
1756  $logParms = $parms["environment"]; // get the environment info passed in
1757  $logParms["token"] = $parms['Token']; // the id used across all communications in session
1758  $logParms["txnId"] = time(); // the id for this transaction
1759  $logParms["logPoint"] = "StopPayment"; // this action in a readable form
1760  $logParms["request"] = $cmd; // the request
1761  $logParms["reply"] = $response; // the response
1762  LogSSOActivity($logParms);
1763 }
1764 
1765  if (empty($response)) {
1766  $return["status"]["response"]='false';
1767  $return["status"]["code"] = MP_IPAY_ERROR_CODE;
1768  $return["status"]["message"]="No Response (" . __LINE__ . ")";
1769  $return["ipaydata"]=array();
1770  } else {
1771  # call parse function to format response array
1772  $return=ipayGetXMLResponse($response,'StopPaymentResult','payment');
1773  }
1774  return $return;
1775  }
1776 
1777 
1778 function ipayGetXMLResponse ($ipayXML,$XMLresp,$XMLdata) {
1779 
1780  $xml = simplexml_load_string($ipayXML);
1781  $xml->registerXPathNamespace('ipay', 'http://mobile.billpaysite.com/');
1782 
1783  $userresponse = $xml->xpath("//ipay:$XMLresp");
1784  $dataresponse = $xml->xpath("//ipay:$XMLdata");
1785 // print "<br>dataresponse: ";
1786 // print_r( $dataresponse );
1787  $resp_arr=array();
1788  $resp_arr["status"]["response"]=(string)$userresponse[0][0];
1789 
1790  $resp_arr["ipaydata"]=array();
1791  foreach($dataresponse as $key=>$details) {
1792  foreach($details as $dkey=>$dd) {
1793  $resp_arr["ipaydata"][$key][$dkey]=(string)($dd);
1794  }
1795  }
1796 
1797  return $resp_arr;
1798 }
1799 
1800 function ipayGetXMLProcDates ($ipayXML,$XMLresp,$XMLdata) {
1801 
1802  $xml = simplexml_load_string($ipayXML);
1803  $xml->registerXPathNamespace('ipay', 'http://mobile.billpaysite.com/');
1804 
1805  $userresponse = $xml->xpath("//ipay:$XMLresp");
1806  $dataresponse = $xml->xpath("//ipay:$XMLdata");
1807  $resp_arr=array();
1808  $resp_arr["status"]["response"]=(string)$userresponse[0][0];
1809 
1810  $resp_arr["ipaydata"]=array();
1811  foreach($dataresponse as $key=>$details) {
1812  $dkey=0;
1813  foreach($details as $dd) {
1814  $resp_arr["ipaydata"][$dkey]=array('ProcessDate' => (string)($dd));
1815  $dkey++;
1816  }
1817  }
1818 
1819  return $resp_arr;
1820 }
1821 
1822 function ipayGetXMLDueDates ($ipayXML,$XMLresp,$XMLdata) {
1823 
1824  $xml = simplexml_load_string($ipayXML);
1825  $xml->registerXPathNamespace('ipay', 'http://mobile.billpaysite.com/');
1826 
1827  $userresponse = $xml->xpath("//ipay:$XMLresp");
1828 # note! dates are returned as a dataset and NOT under the ipay namespace
1829  $dataresponse = $xml->xpath("//$XMLdata");
1830 
1831  $resp_arr=array();
1832  $resp_arr["status"]["response"]=(string)$userresponse[0][0];
1833 
1834  $resp_arr["ipaydata"]=array();
1835 
1836  foreach($dataresponse as $key=>$details) {
1837  foreach($details as $dkey=>$dd) {
1838  $resp_arr["ipaydata"][$key][$dkey]=(string)($dd);
1839  }
1840  }
1841 
1842  return $resp_arr;
1843 }
1844 
1845 ?>