Skip to content

Commit 5dca508

Browse files
JavaDoc -> added javadoc for methods in client files
1 parent 16d1175 commit 5dca508

2 files changed

Lines changed: 78 additions & 3 deletions

File tree

java/src/main/java/com/cybersource/ws/client/Client.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,13 @@ static String mapToString(Map src, boolean mask, int type) {
312312
return Utility.mapToString(src, mask, type);
313313
}
314314

315+
/**
316+
* Get Merchant Config object based on request and properties
317+
* @param request
318+
* @param props
319+
* @return MerchantConfig
320+
* @throws ConfigException
321+
*/
315322
static private MerchantConfig getMerchantConfigObject(Map<String, String> request, Properties props) throws ConfigException {
316323
MerchantConfig mc;
317324
String merchantID = request.get(MERCHANT_ID);
@@ -328,6 +335,12 @@ static private MerchantConfig getMerchantConfigObject(Map<String, String> reques
328335
return mc;
329336
}
330337

338+
/**
339+
* Get Merchant Id from request, If merchantId is null, get it from properties
340+
* @param request
341+
* @param props
342+
* @return String
343+
*/
331344
private static String getMerchantId(Map<String, String> request, Properties props) {
332345
String merchantID = request.get(MERCHANT_ID);
333346
if (merchantID == null) {
@@ -338,6 +351,12 @@ private static String getMerchantId(Map<String, String> request, Properties prop
338351
return merchantID;
339352
}
340353

354+
/**
355+
* get KeyAlias from property, If keyAlias is null, return merchant Id
356+
* @param request
357+
* @param props
358+
* @return String
359+
*/
341360
private static String getKeyForInstanceMap(Map<String, String> request, Properties props) {
342361
String keyAlias = props.getProperty(KEY_ALIAS);
343362
if(keyAlias != null) {
@@ -347,6 +366,14 @@ private static String getKeyForInstanceMap(Map<String, String> request, Properti
347366
return getMerchantId(request, props);
348367
}
349368

369+
/**
370+
* Get Merchant config instance from concurrent hash map in memory cache .
371+
* If it is empty, it will create new merchant config object and put it in map for reuse.
372+
* @param request
373+
* @param props
374+
* @return MerchantConfig
375+
* @throws ConfigException
376+
*/
350377
private static MerchantConfig getInstanceMap(Map<String, String> request, Properties props) throws ConfigException {
351378
String midOrKeyAlias = getKeyForInstanceMap(request, props);
352379

java/src/main/java/com/cybersource/ws/client/XMLClient.java

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,15 @@ private static Document soapWrapAndSign(
399399
return resultDocument ;
400400
}
401401

402+
/**
403+
* Wraps the given Map object in SOAP envelope
404+
* @param doc
405+
* @param mc
406+
* @param builder
407+
* @param logger
408+
* @return Document
409+
* @throws SignException
410+
*/
402411
private static Document soapWrap(Document doc, MerchantConfig mc, DocumentBuilder builder, LoggerWrapper logger) throws SignException{
403412
// look for the requestMessage element
404413
Element requestMessage
@@ -420,6 +429,14 @@ private static Document soapWrap(Document doc, MerchantConfig mc, DocumentBuilde
420429
return wrappedDoc;
421430
}
422431

432+
/**
433+
* Convert Document to String
434+
* @param doc
435+
* @return String
436+
* @throws TransformerConfigurationException
437+
* @throws TransformerException
438+
* @throws IOException
439+
*/
423440
private static String documentToString(Document doc)
424441
throws TransformerConfigurationException, TransformerException,
425442
IOException {
@@ -434,6 +451,13 @@ private static String documentToString(Document doc)
434451
}
435452
}
436453

454+
/**
455+
* Tranform document to byte array output stream
456+
* @param doc
457+
* @return ByteArrayOutputStream
458+
* @throws TransformerConfigurationException
459+
* @throws TransformerException
460+
*/
437461
private static ByteArrayOutputStream makeStream(Document doc)
438462
throws TransformerConfigurationException, TransformerException {
439463
TransformerFactory tf = TransformerFactory.newInstance();
@@ -489,7 +513,13 @@ private static Document soapUnwrap(
489513
return (unwrappedDoc);
490514
}
491515

492-
516+
/**
517+
* Get Merchant Config object based on request and properties
518+
* @param request
519+
* @param props
520+
* @return MerchantConfig
521+
* @throws ConfigException
522+
*/
493523
static private MerchantConfig getMerchantConfigObject(Document request, Properties props) throws ConfigException {
494524
MerchantConfig mc;
495525
String merchantID = Utility.getElementText(request, ELEM_MERCHANT_ID, "*");
@@ -506,7 +536,12 @@ static private MerchantConfig getMerchantConfigObject(Document request, Properti
506536
System.out.println("merchant config object got created");
507537
return mc;
508538
}
509-
539+
/**
540+
* Get Merchant Id from request, If merchantId is null, get it from properties
541+
* @param request
542+
* @param props
543+
* @return String
544+
*/
510545
private static String getMerchantId(Document request, Properties props) {
511546
String merchantID = Utility.getElementText(request, ELEM_MERCHANT_ID, "*");
512547
if (merchantID == null) {
@@ -517,6 +552,12 @@ private static String getMerchantId(Document request, Properties props) {
517552
return merchantID;
518553
}
519554

555+
/**
556+
* get KeyAlias from property, If keyAlias is null, return merchant Id
557+
* @param request
558+
* @param props
559+
* @return String
560+
*/
520561
private static String getKeyForInstanceMap(Document request, Properties props) {
521562
String keyAlias = props.getProperty(KEY_ALIAS);
522563
if(keyAlias != null) {
@@ -525,7 +566,14 @@ private static String getKeyForInstanceMap(Document request, Properties props) {
525566

526567
return getMerchantId(request, props);
527568
}
528-
569+
/**
570+
* Get Merchant config instance from concurrent hash map in memory cache .
571+
* If it is empty, it will create new merchant config object and put it in map for reuse.
572+
* @param request
573+
* @param props
574+
* @return MerchantConfig
575+
* @throws ConfigException
576+
*/
529577
private static MerchantConfig getInstanceMap(Document request, Properties props) throws ConfigException {
530578
String midOrKeyAlias = getKeyForInstanceMap(request, props);
531579

0 commit comments

Comments
 (0)