| Line 70... |
Line 70... |
| 70 |
}
|
70 |
}
|
| 71 |
}
|
71 |
}
|
| 72 |
|
72 |
|
| 73 |
|
73 |
|
| 74 |
public long createPayment(long currentCartId, long userId, long txnId, String paymentOption){
|
74 |
public long createPayment(long currentCartId, long userId, long txnId, String paymentOption){
|
| 75 |
|
- |
|
| - |
|
75 |
log.info("Creating payment for the txn#: " + txnId + " for the user: " + userId + " for processing through HDFC");
|
| 76 |
CommonPaymentService cps = new CommonPaymentService();
|
76 |
CommonPaymentService cps = new CommonPaymentService();
|
| 77 |
if(!cps.createPayment(currentCartId, userId, txnId, gatewayId)){
|
77 |
if(!cps.createPayment(currentCartId, userId, txnId, gatewayId)){
|
| 78 |
log.error("Error while creating the basic payment");
|
78 |
log.error("Error while creating the basic payment");
|
| 79 |
return PAYMENT_NOT_CREATED;
|
79 |
return PAYMENT_NOT_CREATED;
|
| 80 |
}
|
80 |
}
|
| Line 116... |
Line 116... |
| 116 |
e.printStackTrace();
|
116 |
e.printStackTrace();
|
| 117 |
return PAYMENT_NOT_CREATED;
|
117 |
return PAYMENT_NOT_CREATED;
|
| 118 |
}
|
118 |
}
|
| 119 |
|
119 |
|
| 120 |
try {
|
120 |
try {
|
| - |
|
121 |
//TODO: Put this in a timed block.
|
| - |
|
122 |
short status = pipe.performPaymentInitialization();
|
| 121 |
if(pipe.performPaymentInitialization() != e24PaymentPipe.SUCCESS) {
|
123 |
if(status != e24PaymentPipe.SUCCESS) {
|
| 122 |
log.error("Error sending Payment Initialization Request: ");
|
124 |
log.error("Error sending Payment Initialization Request: ");
|
| 123 |
paymentServiceClient.getClient().updatePaymentDetails(paymentId, null, "", "", pipe.getErrorMsg(), "", "", "", "", PaymentStatus.INIT, "", attributes);
|
125 |
paymentServiceClient.getClient().updatePaymentDetails(paymentId, null, "", "", pipe.getErrorMsg(), "", "", "", "", PaymentStatus.INIT, "", attributes);
|
| 124 |
redirectURL = errorURL + "?paymentId="+ paymentId + "&ErrorText="+pipe.getErrorMsg();
|
126 |
redirectURL = errorURL + "?paymentId="+ paymentId + "&ErrorText="+pipe.getErrorMsg();
|
| - |
|
127 |
return PAYMENT_NOT_CREATED;
|
| 125 |
}
|
128 |
}
|
| 126 |
else {
|
129 |
else {
|
| 127 |
log.info("Payment Initialization Request processed successfully for payment Id: " + paymentId);
|
130 |
log.info("Payment Initialization Request processed successfully for payment Id: " + paymentId);
|
| 128 |
String paymentID = pipe.getPaymentId();
|
131 |
String paymentID = pipe.getPaymentId();
|
| 129 |
paymentServiceClient.getClient().updatePaymentDetails(paymentId, paymentID, "", "", "", "", "", "", "", PaymentStatus.INIT, "", attributes);
|
132 |
paymentServiceClient.getClient().updatePaymentDetails(paymentId, paymentID, "", "", "", "", "", "", "", PaymentStatus.INIT, "", attributes);
|
| 130 |
|
133 |
|
| 131 |
String payURL = pipe.getPaymentPage();
|
134 |
String payURL = pipe.getPaymentPage();
|
| 132 |
redirectURL = payURL + "?PaymentID=" + paymentID;
|
135 |
redirectURL = payURL + "?PaymentID=" + paymentID;
|
| - |
|
136 |
return paymentId;
|
| 133 |
}
|
137 |
}
|
| 134 |
return paymentId;
|
- |
|
| 135 |
} catch (NotEnoughDataException e) {
|
138 |
} catch (NotEnoughDataException e) {
|
| 136 |
log.error("Error while initializing payment." + e.getMessage());
|
139 |
log.error("Error while initializing payment." + e.getMessage());
|
| 137 |
e.printStackTrace();
|
140 |
e.printStackTrace();
|
| 138 |
}catch (Exception e) {
|
141 |
}catch (Exception e) {
|
| 139 |
log.error("Error while initializing payment." + e.getMessage());
|
142 |
log.error("Error while initializing payment." + e.getMessage());
|