| Line 137... |
Line 137... |
| 137 |
return "proceed-to-pay-redirect";
|
137 |
return "proceed-to-pay-redirect";
|
| 138 |
}
|
138 |
}
|
| 139 |
|
139 |
|
| 140 |
if(paymentOption.equals(IPaymentService.COD)){
|
140 |
if(paymentOption.equals(IPaymentService.COD)){
|
| 141 |
IPaymentService codPaymentService = new CodPaymentService();
|
141 |
IPaymentService codPaymentService = new CodPaymentService();
|
| 142 |
paymentId = codPaymentService.createPayment(userinfo.getCartId(), userinfo.getUserId(), txnId, paymentOption);
|
142 |
paymentId = codPaymentService.createPayment(userinfo.getCartId(), userinfo.getUserId(), txnId, paymentOption, sourceId);
|
| 143 |
if (paymentId == IPaymentService.PAYMENT_NOT_CREATED) {
|
143 |
if (paymentId == IPaymentService.PAYMENT_NOT_CREATED) {
|
| 144 |
//Very unlikely. The only possible reason can be that the payment service is down.
|
144 |
//Very unlikely. The only possible reason can be that the payment service is down.
|
| 145 |
log.error("Unable to process the COD payment.");
|
145 |
log.error("Unable to process the COD payment.");
|
| 146 |
addActionError("We are experiencing some problems. Please try later.");
|
146 |
addActionError("We are experiencing some problems. Please try later.");
|
| 147 |
return "proceed-to-pay-redirect";
|
147 |
return "proceed-to-pay-redirect";
|
| Line 151... |
Line 151... |
| 151 |
}
|
151 |
}
|
| 152 |
} else {
|
152 |
} else {
|
| 153 |
if(paymentOption.equals(IPaymentService.HDFC_MASTERCARD) || paymentOption.equals(IPaymentService.HDFC_VISA) || paymentOption.equals(IPaymentService.HDFC_VISA_ELECTRON)) {
|
153 |
if(paymentOption.equals(IPaymentService.HDFC_MASTERCARD) || paymentOption.equals(IPaymentService.HDFC_VISA) || paymentOption.equals(IPaymentService.HDFC_VISA_ELECTRON)) {
|
| 154 |
// User has selected Visa or MasterCard CC
|
154 |
// User has selected Visa or MasterCard CC
|
| 155 |
IPaymentService hdfcPaymentService = new HdfcPaymentService();
|
155 |
IPaymentService hdfcPaymentService = new HdfcPaymentService();
|
| 156 |
paymentId = hdfcPaymentService.createPayment(userinfo.getCartId(), userinfo.getUserId(), txnId, paymentOption);
|
156 |
paymentId = hdfcPaymentService.createPayment(userinfo.getCartId(), userinfo.getUserId(), txnId, paymentOption, sourceId);
|
| 157 |
if (paymentId == IPaymentService.PAYMENT_NOT_CREATED) {
|
157 |
if (paymentId == IPaymentService.PAYMENT_NOT_CREATED) {
|
| 158 |
log.error("Unable to process payment through HDFC. Falling through to EBS.");
|
158 |
log.error("Unable to process payment through HDFC. Falling through to EBS.");
|
| 159 |
} else {
|
159 |
} else {
|
| 160 |
this.redirectURL = ((HdfcPaymentService)hdfcPaymentService).getRedirectUrl();
|
160 |
this.redirectURL = ((HdfcPaymentService)hdfcPaymentService).getRedirectUrl();
|
| 161 |
log.info(this.redirectURL);
|
161 |
log.info(this.redirectURL);
|
| Line 169... |
Line 169... |
| 169 |
paymentOption = IPaymentService.EBS_MASTERCARD;
|
169 |
paymentOption = IPaymentService.EBS_MASTERCARD;
|
| 170 |
else if(paymentOption.equals(IPaymentService.HDFC_VISA_ELECTRON))
|
170 |
else if(paymentOption.equals(IPaymentService.HDFC_VISA_ELECTRON))
|
| 171 |
paymentOption = null; //Since we don't know the bank's name in this case, we'll let the user select the bank on the EBS page.
|
171 |
paymentOption = null; //Since we don't know the bank's name in this case, we'll let the user select the bank on the EBS page.
|
| 172 |
|
172 |
|
| 173 |
IPaymentService ebsPaymentService = new EbsPaymentService();
|
173 |
IPaymentService ebsPaymentService = new EbsPaymentService();
|
| 174 |
paymentId = ebsPaymentService.createPayment(userinfo.getCartId(), userinfo.getUserId(), txnId, paymentOption);
|
174 |
paymentId = ebsPaymentService.createPayment(userinfo.getCartId(), userinfo.getUserId(), txnId, paymentOption, sourceId);
|
| 175 |
if(paymentId == IPaymentService.PAYMENT_NOT_CREATED){
|
175 |
if(paymentId == IPaymentService.PAYMENT_NOT_CREATED){
|
| 176 |
addActionError("We are experiencing some problems. Please try later.");
|
176 |
addActionError("We are experiencing some problems. Please try later.");
|
| 177 |
return "proceed-to-pay-redirect";
|
177 |
return "proceed-to-pay-redirect";
|
| 178 |
} else {
|
178 |
} else {
|
| 179 |
log.info("Successfully created payment for EBS to process. Redirecting to /ebs-pay/" + paymentId);
|
179 |
log.info("Successfully created payment for EBS to process. Redirecting to /ebs-pay/" + paymentId);
|
| Line 247... |
Line 247... |
| 247 |
return false;
|
247 |
return false;
|
| 248 |
}
|
248 |
}
|
| 249 |
|
249 |
|
| 250 |
|
250 |
|
| 251 |
try {
|
251 |
try {
|
| 252 |
String errorMsg = userClient.validateCart(currentCartId);
|
252 |
String errorMsg = userClient.validateCart(currentCartId, sourceId);
|
| 253 |
if(!errorMsg.isEmpty()){
|
253 |
if(!errorMsg.isEmpty()){
|
| 254 |
addActionError(errorMsg);
|
254 |
addActionError(errorMsg);
|
| 255 |
return false;
|
255 |
return false;
|
| 256 |
}
|
256 |
}
|
| 257 |
} catch (ShoppingCartException e1) {
|
257 |
} catch (ShoppingCartException e1) {
|