Subversion Repositories SmartDukaan

Rev

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

Rev 8650 Rev 8907
Line 38... Line 38...
38
     * Enum of all statuses that can be returned by the HDFC gateway
38
     * Enum of all statuses that can be returned by the HDFC gateway
39
     * 
39
     * 
40
     * @author Chandranshu
40
     * @author Chandranshu
41
     * 
41
     * 
42
     */
42
     */
43
    private enum HdfcPaymentReturnStatus{
43
    public enum HdfcPaymentReturnStatus{
44
        APPROVED("APPROVED"),
44
        APPROVED("APPROVED"),
45
        NOT_APPROVED("NOT APPROVED"),
45
        NOT_APPROVED("NOT APPROVED"),
46
        CAPTURED("CAPTURED"),
46
        CAPTURED("CAPTURED"),
47
        NOT_CAPTURED ("NOT CAPTURED"),
47
        NOT_CAPTURED ("NOT CAPTURED"),
48
        CANCELLED ("CANCELLED"),
48
        CANCELLED ("CANCELLED"),
49
        DENIED_BY_RISK("DENIED BY RISK"),
49
        DENIED_BY_RISK("DENIED BY RISK"),
50
        HOST_TIMEOUT("HOST TIMEOUT");
50
        HOST_TIMEOUT("HOST TIMEOUT"),
-
 
51
        SUCCESS("SUCCESS"),
-
 
52
        FAILURE("FAILURE");
51
        private String value;
53
        private String value;
52
        HdfcPaymentReturnStatus(String value) {
54
        HdfcPaymentReturnStatus(String value) {
53
            this.value = value;
55
            this.value = value;
54
        }
56
        }
55
        public String value(){
57
        public String value(){
Line 924... Line 926...
924
    public void markPaymentAsProcessed(long paymentId,
926
    public void markPaymentAsProcessed(long paymentId,
925
            ExtraPaymentProcessingType category) throws TException {
927
            ExtraPaymentProcessingType category) throws TException {
926
        paymentRequiringExtraProcessingHandler.delete(paymentId, category);
928
        paymentRequiringExtraProcessingHandler.delete(paymentId, category);
927
    }
929
    }
928
 
930
 
-
 
931
	@Override
-
 
932
	public boolean validatePaymentAtGateway(long merchantTxnId, double amount, boolean isDigital) throws PaymentException, TException {
-
 
933
	        logger.info("Attempting to get status of payment of amount " + amount + " corresponding to our transaction " + merchantTxnId);
-
 
934
	        List<in.shop2020.payment.domain.Payment> payments;
-
 
935
	        if(isDigital){
-
 
936
	        	payments = paymentHandler.getPaymentForRechargeTxn(merchantTxnId);
-
 
937
	        }else{
-
 
938
	        	payments = paymentHandler.getPaymentForTxn(merchantTxnId);
-
 
939
	        }
-
 
940
	        if(payments ==null || payments.isEmpty())
-
 
941
	            throw new PaymentException(104, "No payments found corresponding to the merchant txn " + merchantTxnId);
-
 
942
	        
-
 
943
	        if(payments ==null || payments.isEmpty())
-
 
944
	            throw new PaymentException(104, "No payments found corresponding to the merchant txn " + merchantTxnId);
-
 
945
 
-
 
946
	        in.shop2020.payment.domain.Payment payment = payments.get(0);
-
 
947
	        long gatewayId = payment.getGatewayId();
-
 
948
	        
-
 
949
	        if(gatewayId == HDFC_GATEWAY_ID){
-
 
950
	            return HdfcPaymentHandler.validateHdfcPayment(payment, amount);
-
 
951
	        }else if (gatewayId == EBS_GATEWAY_ID){
-
 
952
	            //return validateEbsPayment(payment, amount);
-
 
953
	        } 
-
 
954
	        else if (HDFC_EMI_GATEWAY_IDS.contains(gatewayId)){
-
 
955
	            //return validateHdfcEmiPayment(payment, amount);
-
 
956
	        }
-
 
957
	        
-
 
958
	        logger.error("We have an payment from unknown gateway: " + gatewayId);
-
 
959
	        return false;
-
 
960
	    }
-
 
961
 
-
 
962
	
929
}
963
}