Subversion Repositories SmartDukaan

Rev

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

Rev 6390 Rev 6419
Line 138... Line 138...
138
    		return "proceed-to-pay-redirect";
138
    		return "proceed-to-pay-redirect";
139
		}
139
		}
140
    	
140
    	
141
    	int gatewayId = (int)findGatewayId(paymentOption);
141
    	int gatewayId = (int)findGatewayId(paymentOption);
142
    	switch (gatewayId) {
142
    	switch (gatewayId) {
-
 
143
    	case 4:
-
 
144
    		IPaymentService codPaymentService = new CodPaymentService();
-
 
145
    	    paymentId = codPaymentService.createPayment(userinfo.getUserId(), txnId, paymentOption, 4);
-
 
146
            if (paymentId == IPaymentService.PAYMENT_NOT_CREATED) {
-
 
147
                //Very unlikely. The only possible reason can be that the payment service is down.
-
 
148
                log.error("Unable to process the COD payment.");
-
 
149
                addActionError("We are experiencing some problems. Please try later.");
-
 
150
                return "proceed-to-pay-redirect";
-
 
151
            } else {
-
 
152
                CommonPaymentService.processCodTxn(txnId);
-
 
153
                return "cod-redirect";
-
 
154
            }
-
 
155
 
-
 
156
    	case 5:
143
    	case 10:
157
    	case 10:
144
			IPaymentService innovitiPaymentService = new InnovitiPaymentService();
-
 
145
			paymentId = innovitiPaymentService.createPayment(userinfo.getUserId(), txnId, paymentOption, gatewayId);
-
 
146
			if (paymentId == IPaymentService.PAYMENT_NOT_CREATED) {
-
 
147
				//Very unlikely. The only possible reason can be that the payment service is down.
-
 
148
				log.error("Unable to process the COD payment.");
-
 
149
				addActionError("We are experiencing some problems. Please try later.");
-
 
150
				return "proceed-to-pay-redirect";
-
 
151
			} else {
-
 
152
	            log.info("Successfully created payment for Innoviti to process. Redirecting to /innoviti-pay/" + paymentId);
-
 
153
				return "innoviti-pay-redirect";
-
 
154
			}
-
 
155
		
-
 
156
    	case 9:
-
 
157
    	case 11:
158
    	case 11:
158
    	case 12:
159
    	case 12:
159
    	case 13:
-
 
160
			IPaymentService hdfcEmiPaymentService = new HdfcEmiPaymentService();
160
			IPaymentService hdfcEmiPaymentService = new HdfcEmiPaymentService();
161
            paymentId = hdfcEmiPaymentService.createPayment(userinfo.getUserId(), txnId, paymentOption, gatewayId);
161
            paymentId = hdfcEmiPaymentService.createPayment(userinfo.getUserId(), txnId, paymentOption, gatewayId);
162
            if(paymentId == IPaymentService.PAYMENT_NOT_CREATED){
162
            if(paymentId == IPaymentService.PAYMENT_NOT_CREATED){
163
                addActionError("We are experiencing some problems. Please try later.");
163
                addActionError("We are experiencing some problems. Please try later.");
164
                log.error("Unable to process payment through HDFC EMI.");
164
                log.error("Unable to process payment through HDFC EMI.");
Line 166... Line 166...
166
            } else {
166
            } else {
167
                this.redirectURL = ((HdfcEmiPaymentService)hdfcEmiPaymentService).getRedirectUrl();
167
                this.redirectURL = ((HdfcEmiPaymentService)hdfcEmiPaymentService).getRedirectUrl();
168
                log.info(this.redirectURL);
168
                log.info(this.redirectURL);
169
                return "success";
169
                return "success";
170
            }
170
            }
171
 
171
        
172
    	case 3:
172
    	case 13:
173
    		IPaymentService codPaymentService = new CodPaymentService();
173
			IPaymentService innovitiPaymentService = new InnovitiPaymentService();
174
    	    paymentId = codPaymentService.createPayment(userinfo.getUserId(), txnId, paymentOption, 4);
174
			paymentId = innovitiPaymentService.createPayment(userinfo.getUserId(), txnId, paymentOption, gatewayId);
175
            if (paymentId == IPaymentService.PAYMENT_NOT_CREATED) {
175
			if (paymentId == IPaymentService.PAYMENT_NOT_CREATED) {
176
                //Very unlikely. The only possible reason can be that the payment service is down.
176
				//Very unlikely. The only possible reason can be that the payment service is down.
177
                log.error("Unable to process the COD payment.");
177
				log.error("Unable to process the COD payment.");
178
                addActionError("We are experiencing some problems. Please try later.");
178
				addActionError("We are experiencing some problems. Please try later.");
179
                return "proceed-to-pay-redirect";
179
				return "proceed-to-pay-redirect";
180
            } else {
180
			} else {
181
                CommonPaymentService.processCodTxn(txnId);
181
	            log.info("Successfully created payment for Innoviti to process. Redirecting to /innoviti-pay/" + paymentId);
182
                return "cod-redirect";
182
				return "innoviti-pay-redirect";
183
            }
183
			}
-
 
184
		
184
            
185
    	
185
		default:
186
		default:
186
			break;
187
			break;
187
		}
188
		}
188
    	
189
    	
189
 
190
 
Line 230... Line 231...
230
    private long findGatewayId(String paymentOption){
231
    private long findGatewayId(String paymentOption){
231
    	long gatewayId = 0;
232
    	long gatewayId = 0;
232
    	gatewayId = ProceedToPayController.getGatewayId(Long.parseLong(paymentOption));
233
    	gatewayId = ProceedToPayController.getGatewayId(Long.parseLong(paymentOption));
233
    	if(gatewayId==0){
234
    	if(gatewayId==0){
234
    		if(paymentOption.equals(IPaymentService.COD)){
235
    		if(paymentOption.equals(IPaymentService.COD)){
235
    			gatewayId = 5;
236
    			gatewayId = 4;
236
    		}
237
    		}
237
    	}
238
    	}
238
    	return gatewayId;
239
    	return gatewayId;
239
    }
240
    }
240
    
241