28
28
*
29
29
*/
30
30
public class HttpClient {
31
- private static Log logger = LogFactory . getLog ( HttpClient . class );
31
+
32
32
33
33
public static final String ENCODING = "UTF-8" ;
34
34
@@ -90,7 +90,7 @@ private static Map<ResponseField, String> createResponseMap(Transaction transact
90
90
transaction instanceof net .authorize .sim .Transaction ) {
91
91
92
92
String decodedResponseData = URLDecoder .decode (responseString , HTTP .UTF_8 );
93
- logger . debug ( "Url-decoded response data: " + decodedResponseData );
93
+
94
94
95
95
responseMap = ResponseParser .parseResponseString (decodedResponseData );
96
96
}
@@ -115,13 +115,7 @@ public static Map<ResponseField, String> execute(Environment environment, Transa
115
115
// create the HTTP POST object
116
116
HttpPost httpPost = createHttpPost (environment , transaction );
117
117
118
- // get the raw data being sent for logging while in sandbox type modes
119
- if (Environment .SANDBOX .equals (environment ) ||
120
- Environment .SANDBOX_TESTMODE .equals (environment )) {
121
- InputStream outstream = (InputStream )httpPost .getEntity ().getContent ();
122
- String requestData = convertStreamToString (outstream );
123
- logger .debug ("SANDBOX MODES ONLY>> Url-encoded request data: " + requestData );
124
- }
118
+
125
119
126
120
// execute the request
127
121
HttpResponse httpResponse = httpClient .execute (httpPost );
@@ -147,7 +141,7 @@ public static Map<ResponseField, String> execute(Environment environment, Transa
147
141
148
142
responseMap = HttpClient .createResponseMap (transaction , rawResponseString );
149
143
} catch (Exception e ) {
150
- logger . error ( "HttpClient execution failed" , e );
144
+
151
145
}
152
146
}
153
147
@@ -199,13 +193,6 @@ public static BasicXmlDocument executeXML(Environment environment, Transaction t
199
193
// create the HTTP POST object
200
194
HttpPost httpPost = createHttpPost (environment , transaction );
201
195
202
- // get the raw data being sent for logging while in sandbox type modes
203
- if (Environment .SANDBOX .equals (environment ) ||
204
- Environment .SANDBOX_TESTMODE .equals (environment )) {
205
- InputStream outstream = (InputStream )httpPost .getEntity ().getContent ();
206
- String requestData = convertStreamToString (outstream );
207
- logger .debug ("SANDBOX MODES ONLY>> Url-encoded request data: " + requestData );
208
- }
209
196
210
197
// execute the request
211
198
HttpResponse httpResponse = httpClient .execute (httpPost );
@@ -248,24 +235,20 @@ public static BasicXmlDocument executeXML(Environment environment, Transaction t
248
235
249
236
if (Environment .SANDBOX .equals (environment ) ||
250
237
Environment .SANDBOX_TESTMODE .equals (environment )) {
251
- logger . debug ( "SANDBOX MODES ONLY>> Response data: " + rawResponseString );
238
+
252
239
}
253
240
254
241
int mark = rawResponseString .indexOf ("<?xml" );
255
242
if (mark == -1 ){
256
- logger .error ("Invalid response" );
257
- logger .error (rawResponseString );
258
243
return null ;
259
244
}
260
245
261
246
response .parseString (rawResponseString .substring (mark ,rawResponseString .length ()));
262
247
if (response .IsAccessible () == false ){
263
- logger .error ("Invalid response" );
264
- logger .error (rawResponseString );
265
248
return null ;
266
249
}
267
250
} catch (Exception e ) {
268
- logger . error ( "HttpClient execution failed" , e );
251
+
269
252
}
270
253
}
271
254
0 commit comments