Subversion Repositories SmartDukaan

Rev

Rev 3126 | Rev 6050 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3126 Rev 4566
Line 1... Line 1...
1
package in.shop2020.serving.controllers;
1
package in.shop2020.serving.controllers;
2
 
2
 
-
 
3
import java.math.BigInteger;
-
 
4
import java.security.MessageDigest;
-
 
5
import java.security.NoSuchAlgorithmException;
3
import java.util.List;
6
import java.util.List;
4
 
7
 
5
import org.apache.log4j.Logger;
8
import org.apache.log4j.Logger;
6
import org.apache.struts2.convention.annotation.InterceptorRef;
9
import org.apache.struts2.convention.annotation.InterceptorRef;
7
import org.apache.struts2.convention.annotation.InterceptorRefs;
10
import org.apache.struts2.convention.annotation.InterceptorRefs;
Line 38... Line 41...
38
	
41
	
39
	private static String returnUrl;
42
	private static String returnUrl;
40
	
43
	
41
	private static String mode;
44
	private static String mode;
42
	
45
	
-
 
46
	private static String ebsSecretKey;
-
 
47
	
43
	static{
48
	static{
44
		try {
49
		try {
45
			accountId = ConfigClient.getClient().get("ebs_account_id");
50
			accountId = ConfigClient.getClient().get("ebs_account_id");
46
			returnUrl = ConfigClient.getClient().get("ebs_return_url");
51
			returnUrl = ConfigClient.getClient().get("ebs_return_url");
47
			mode = ConfigClient.getClient().get("ebs_pay_mode");
52
			mode = ConfigClient.getClient().get("ebs_pay_mode");
-
 
53
			ebsSecretKey = ConfigClient.getClient().get("ebs_secret_key");
48
		} catch (ConfigException e) {
54
		} catch (ConfigException e) {
49
			mode = "LIVE";
55
			mode = "LIVE";
50
			log.error("Unable to get EBS payment configuration.");
56
			log.error("Unable to get EBS payment configuration.");
51
		}
57
		}
52
	}
58
	}
Line 166... Line 172...
166
	}
172
	}
167
	
173
	
168
	public String getPaymentOption(){
174
	public String getPaymentOption(){
169
		return paymentOption;
175
		return paymentOption;
170
	}
176
	}
-
 
177
 
-
 
178
	public String getSecureHash() throws NoSuchAlgorithmException{
-
 
179
		String pass = ebsSecretKey + "|" + accountId + "|" + amount + "|" + id + "|" + returnUrl + "|" + mode;
-
 
180
		MessageDigest m = MessageDigest.getInstance("MD5");
-
 
181
		byte[] data = pass.getBytes();
-
 
182
		m.update(data,0,data.length);
-
 
183
		BigInteger i = new BigInteger(1,m.digest());
-
 
184
		String secureHash = String.format("%1$032X", i);
-
 
185
		return secureHash;
-
 
186
	}
171
	
187
	
172
	public ContactDetails getBillingDetails() {
188
	public ContactDetails getBillingDetails() {
173
		return billingDetails;
189
		return billingDetails;
174
	}
190
	}
175
 
191