Skip to content

Commit 20d9a58

Browse files
committed
Merge branch 'future' of https://github.com/Mayuri-Kumar93/cybersource-sdk-java into future
sync
2 parents d111af1 + dd87b0d commit 20d9a58

6 files changed

Lines changed: 326 additions & 41 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

0 commit comments

Comments
 (0)