View Javadoc
1   package org.kuali.ole.sip2.response;
2   
3   import org.kuali.ole.sip2.sip2Server.MessageUtil;
4   import org.kuali.ole.sip2.sip2Server.StringUtil;
5   
6   /**
7    * Created by gayathria on 15/12/14.
8    */
9   public class OLESIP2FeePaidTurnedOffResponse extends OLESIP2TurnedOffResponse {
10  
11      public OLESIP2FeePaidTurnedOffResponse() {
12          code = "38";
13      }
14  
15      public String getOLESIP2FeePaidTurnedOffResponse(String requestData) {
16  
17          String[] requestDataArray = requestData.split("\\|");
18          StringBuilder sip2FeePaidResponseBuilder = new StringBuilder();
19          sip2FeePaidResponseBuilder.append(code);
20          sip2FeePaidResponseBuilder.append(StringUtil.bool2Char(false));
21          sip2FeePaidResponseBuilder.append(MessageUtil.getSipDateTime());
22          sip2FeePaidResponseBuilder.append("AO");
23          sip2FeePaidResponseBuilder.append("|AA");
24          for (String data : requestDataArray) {
25              if (data.startsWith("AA")) {
26                  sip2FeePaidResponseBuilder.append((data.replaceFirst("AA", "")).trim());
27              }
28          }
29  
30          sip2FeePaidResponseBuilder.append("|AF");
31          sip2FeePaidResponseBuilder.append("Fee Service Currently turned Off");
32  
33  
34          for (String data : requestDataArray) {
35              if (data.startsWith("AY")) {
36                  sip2FeePaidResponseBuilder.append("|AY");
37                  sip2FeePaidResponseBuilder.append(data.substring(2, 5));
38                  sip2FeePaidResponseBuilder.append(MessageUtil.computeChecksum(sip2FeePaidResponseBuilder.toString()));
39              }
40          }
41  
42          return sip2FeePaidResponseBuilder.toString() + '\r';
43  
44      }
45  
46  }