Subversion Repositories SmartDukaan

Rev

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

Rev 8907 Rev 8914
Line 235... Line 235...
235
		}
235
		}
236
		        		
236
		        		
237
		return resultMap;
237
		return resultMap;
238
	}
238
	}
239
 
239
 
240
	public static boolean validateHdfcPayment(Payment payment, double amount){
240
	public static PaymentStatus validateHdfcPayment(Payment payment, double amount){
241
		String ramount = "" + amount;
241
		String ramount = "" + amount;
242
		//String gatewayPaymentId = payment.getGatewayPaymentId();
242
		//String gatewayPaymentId = payment.getGatewayPaymentId();
243
		
243
		
244
		e24TranPipe pipe = new e24TranPipe();
244
		e24TranPipe pipe = new e24TranPipe();
245
		pipe.setResourcePath(resourceDirPath);
245
		pipe.setResourcePath(resourceDirPath);
Line 272... Line 272...
272
			log.info("Amount: " + pipe.getAmt());
272
			log.info("Amount: " + pipe.getAmt());
273
			
273
			
274
			String result = pipe.getResult();
274
			String result = pipe.getResult();
275
			log.info("Result: " + pipe.getResult());
275
			log.info("Result: " + pipe.getResult());
276
			gatewayStatus = result.substring(0, Math.min(result.length(), 20)).trim();		//This will return the result of the transaction. (Successful or Failed)
276
			gatewayStatus = result.substring(0, Math.min(result.length(), 20)).trim();		//This will return the result of the transaction. (Successful or Failed)
-
 
277
			
-
 
278
			if ((""+refundStatus).trim().equals("0")) {
277
			if ((""+refundStatus).trim().equals("0") && HdfcPaymentReturnStatus.SUCCESS.value().equals(gatewayStatus)) {
279
				if(HdfcPaymentReturnStatus.CAPTURED.value().equals(gatewayStatus)){
278
				return true;
280
					return PaymentStatus.SUCCESS;
279
			}
281
				}
-
 
282
				if(HdfcPaymentReturnStatus.APPROVED.value().equals(gatewayStatus)){
-
 
283
					return PaymentStatus.AUTHORIZED;
280
			else {
284
				}
-
 
285
				if(HdfcPaymentReturnStatus.NOT_CAPTURED.value().equals(gatewayStatus)){
-
 
286
					return PaymentStatus.FAILED;
-
 
287
				}
-
 
288
				if(HdfcPaymentReturnStatus.NOT_APPROVED.value().equals(gatewayStatus)){
281
				return false;
289
					return PaymentStatus.FAILED;
-
 
290
				}
282
			}
291
			}
283
		} catch (NotEnoughDataException e) {
292
		} catch (NotEnoughDataException e) {
284
            log.error(Errors.CAPTURE_FAILURE.message, e);
293
            log.error(Errors.CAPTURE_FAILURE.message, e);
285
		}	
294
		}	
286
		return false;
295
		return PaymentStatus.INIT;
287
	}
296
	}
288
	
297
	
289
	public static String initializeHdfcPayment(Payment payment, PaymentServiceHandler handler) throws Exception{
298
	public static String initializeHdfcPayment(Payment payment, PaymentServiceHandler handler) throws Exception{
290
		long merchantPaymentId = payment.getId();
299
		long merchantPaymentId = payment.getId();
291
		double amount = payment.getAmount();
300
		double amount = payment.getAmount();