@@ -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