Subversion Repositories SmartDukaan

Rev

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

Rev 2199 Rev 2334
Line 33... Line 33...
33
 
33
 
34
public class EbsPaymentService implements IPaymentService{
34
public class EbsPaymentService implements IPaymentService{
35
	
35
	
36
	private static Logger log = Logger.getLogger(Class.class);
36
	private static Logger log = Logger.getLogger(Class.class);
37
	
37
	
38
	public static final String STATUS = "status";
-
 
39
	public static final String ERR_CODE = "errorCode";
-
 
40
	public static final String ERROR = "error";
-
 
41
	public static final String TXN_ID = "transactionId";
38
	public static final String TXN_ID = "transactionId";
42
	public static final String PAYMENT_ID = "paymentId";
39
	public static final String PAYMENT_ID = "paymentId";
43
	public static final String AMOUNT = "amount";
40
	public static final String AMOUNT = "amount";
44
	public static final String DATE_TIME = "dateTime";
41
	public static final String DATE_TIME = "dateTime";
45
	public static final String MODE = "mode";
42
	public static final String MODE = "mode";
46
	public static final String REF_NO = "referenceNo";
43
	public static final String REF_NO = "referenceNo";
47
	public static final String TXN_TYPE = "transactionType";
44
	public static final String TXN_TYPE = "transactionType";
48
	
45
	
49
	private enum Errors{
-
 
50
		CONN_FAILURE("-1", "Unable to initialize connection to EBS API server"),
-
 
51
		CAPTURE_FAILURE("-2", "Error while capturing EBS payment");
-
 
52
		
-
 
53
		private String code;
-
 
54
		private String message;
-
 
55
		
-
 
56
		Errors(String code, String message){
-
 
57
			this.code = code;
-
 
58
			this.message = message;
-
 
59
		}
-
 
60
	}
-
 
61
	
-
 
62
    private static String accountId;
46
    private static String accountId;
63
    private static String secretKey;
47
    private static String secretKey;
64
    
48
    
65
	static{
49
	static{
66
		try {
50
		try {
Line 241... Line 225...
241
		if("".equals(status) || !"Processing".equals(status)){
225
		if("".equals(status) || !"Processing".equals(status)){
242
			//We've received an error. Retrieve the error values
226
			//We've received an error. Retrieve the error values
243
			resultMap.put(ERR_CODE, elem.getAttribute(ERR_CODE));
227
			resultMap.put(ERR_CODE, elem.getAttribute(ERR_CODE));
244
			resultMap.put(ERROR, elem.getAttribute(ERROR));
228
			resultMap.put(ERROR, elem.getAttribute(ERROR));
245
		}else{
229
		}else{
246
			resultMap.put(TXN_ID, elem.getAttribute(TXN_ID));
230
			resultMap.put(CAPTURE_TXN_ID, elem.getAttribute(TXN_ID));
247
			resultMap.put(PAYMENT_ID, elem.getAttribute(PAYMENT_ID));
231
			resultMap.put(PAYMENT_ID, elem.getAttribute(PAYMENT_ID));
248
			resultMap.put(AMOUNT, elem.getAttribute(AMOUNT));
232
			resultMap.put(AMOUNT, elem.getAttribute(AMOUNT));
249
			resultMap.put(DATE_TIME, elem.getAttribute(DATE_TIME));
233
			resultMap.put(CAPTURE_TIME, elem.getAttribute(DATE_TIME));
250
			resultMap.put(MODE, elem.getAttribute(MODE));
234
			resultMap.put(MODE, elem.getAttribute(MODE));
251
			resultMap.put(REF_NO, elem.getAttribute(REF_NO));
235
			resultMap.put(REF_NO, elem.getAttribute(REF_NO));
252
			resultMap.put(TXN_TYPE, elem.getAttribute(TXN_TYPE));
236
			resultMap.put(TXN_TYPE, elem.getAttribute(TXN_TYPE));
253
		}
237
		}
254
 
238