@@ -64,9 +64,21 @@ public SortedMap<String, String> getPostParametersFromDLRequest(DirectoryLookupR
6464 // Set HTTP Post variables
6565 final SortedMap <String , String > postParameters = new TreeMap <>();
6666 postParameters .put (CURRENCY_CODE , request .getCurrencyCode ());
67- postParameters .put (MERCHANT_ACCOUNT , config .getMerchantAccount ());
67+
68+ if (request .getMerchantAccount () != null ) {
69+ postParameters .put (MERCHANT_ACCOUNT , request .getMerchantAccount ());
70+ } else {
71+ postParameters .put (MERCHANT_ACCOUNT , config .getMerchantAccount ());
72+ }
73+
6874 postParameters .put (PAYMENT_AMOUNT , request .getPaymentAmount ());
69- postParameters .put (SKIN_CODE , config .getSkinCode ());
75+
76+ if (request .getSkinCode () != null ) {
77+ postParameters .put (SKIN_CODE , request .getSkinCode ());
78+ } else {
79+ postParameters .put (SKIN_CODE , config .getSkinCode ());
80+ }
81+
7082 postParameters .put (MERCHANT_REFERENCE , request .getMerchantReference ());
7183 postParameters .put (SESSION_VALIDITY , request .getSessionValidity ());
7284 postParameters .put (COUNTRY_CODE , request .getCountryCode ());
@@ -75,7 +87,14 @@ public SortedMap<String, String> getPostParametersFromDLRequest(DirectoryLookupR
7587
7688 String dataToSign = hmacValidator .getDataToSign (postParameters );
7789
78- String merchantSig = hmacValidator .calculateHMAC (dataToSign , config .getHmacKey ());
90+ String hmacKey ;
91+ if (request .getHmacKey () != null ) {
92+ hmacKey = request .getHmacKey ();
93+ } else {
94+ hmacKey = config .getHmacKey ();
95+ }
96+
97+ String merchantSig = hmacValidator .calculateHMAC (dataToSign , hmacKey );
7998 postParameters .put (MERCHANT_SIG , merchantSig );
8099
81100 return postParameters ;
0 commit comments