| Line 2... |
Line 2... |
| 2 |
|
2 |
|
| 3 |
import in.shop2020.config.ConfigException;
|
3 |
import in.shop2020.config.ConfigException;
|
| 4 |
import in.shop2020.datalogger.EventType;
|
4 |
import in.shop2020.datalogger.EventType;
|
| 5 |
import in.shop2020.model.v1.order.RechargeOrder;
|
5 |
import in.shop2020.model.v1.order.RechargeOrder;
|
| 6 |
import in.shop2020.model.v1.order.RechargeOrderStatus;
|
6 |
import in.shop2020.model.v1.order.RechargeOrderStatus;
|
| - |
|
7 |
import in.shop2020.model.v1.order.TransactionServiceException;
|
| 7 |
import in.shop2020.payments.Attribute;
|
8 |
import in.shop2020.payments.Attribute;
|
| 8 |
import in.shop2020.payments.Payment;
|
9 |
import in.shop2020.payments.Payment;
|
| 9 |
import in.shop2020.payments.PaymentException;
|
10 |
import in.shop2020.payments.PaymentException;
|
| 10 |
import in.shop2020.payments.PaymentStatus;
|
11 |
import in.shop2020.payments.PaymentStatus;
|
| 11 |
import in.shop2020.serving.services.CommonPaymentService;
|
12 |
import in.shop2020.serving.services.CommonPaymentService;
|
| Line 131... |
Line 132... |
| 131 |
} catch (TException e) {
|
132 |
} catch (TException e) {
|
| 132 |
log.error("Unable to mark the payment as authorized", e);
|
133 |
log.error("Unable to mark the payment as authorized", e);
|
| 133 |
}
|
134 |
}
|
| 134 |
|
135 |
|
| 135 |
if(payment.isIsDigital()) {
|
136 |
if(payment.isIsDigital()) {
|
| - |
|
137 |
RechargeOrder rechargeOrder = null;
|
| 136 |
try {
|
138 |
try {
|
| 137 |
RechargeOrder rechargeOrder = transactionServiceClient.getClient().getRechargeOrdersForTransaction(txnId);
|
139 |
rechargeOrder = transactionServiceClient.getClient().getRechargeOrdersForTransaction(txnId);
|
| 138 |
transactionServiceClient.getClient().updateRechargeOrderStatus(rechargeOrder.getId(), RechargeOrderStatus.PAYMENT_SUCCESSFUL);
|
- |
|
| 139 |
} catch (Exception e) {
|
140 |
} catch (Exception e1) {
|
| 140 |
// TODO Auto-generated catch block
|
141 |
log.error("Problem with txn client while getting recharge object", e1);
|
| 141 |
e.printStackTrace();
|
- |
|
| 142 |
}
|
142 |
}
|
| - |
|
143 |
if(!isFlagged.equals("YES")) {
|
| - |
|
144 |
//Recharge only when payment is digital and is captured and is not flagged
|
| - |
|
145 |
try {
|
| - |
|
146 |
PaymentClient pcl = new PaymentClient();
|
| - |
|
147 |
boolean isCaptured = pcl.getClient().capturePayment(txnId);
|
| - |
|
148 |
|
| - |
|
149 |
if(isCaptured) {
|
| - |
|
150 |
transactionServiceClient.getClient().updateRechargeOrderStatus(rechargeOrder.getId(), RechargeOrderStatus.PAYMENT_SUCCESSFUL);
|
| - |
|
151 |
} else {
|
| - |
|
152 |
transactionServiceClient.getClient().updateRechargeOrderStatus(rechargeOrder.getId(), RechargeOrderStatus.PAYMENT_FAILED);
|
| - |
|
153 |
}
|
| - |
|
154 |
} catch (Exception e) {
|
| - |
|
155 |
log.error("Problem with txn client while trying to recharge", e);
|
| - |
|
156 |
}
|
| - |
|
157 |
} else {
|
| - |
|
158 |
try {
|
| - |
|
159 |
transactionServiceClient.getClient().updateRechargeOrderStatus(rechargeOrder.getId(), RechargeOrderStatus.PAYMENT_FAILED);
|
| - |
|
160 |
} catch (Exception e) {
|
| - |
|
161 |
log.error("Problem with txn client while trying to mark payment failed in recharge order", e);
|
| - |
|
162 |
}
|
| - |
|
163 |
}
|
| 143 |
this.redirectUrl = rechargeResultUri + "?paymentId=" + merchantPaymentId;
|
164 |
this.redirectUrl = rechargeResultUri + "?paymentId=" + merchantPaymentId;
|
| 144 |
} else {
|
165 |
} else {
|
| 145 |
|
- |
|
| - |
|
166 |
//For physical orders
|
| 146 |
if(isFlagged.equals("YES")){
|
167 |
if(isFlagged.equals("YES")){
|
| 147 |
CommonPaymentService.processSuccessfulTxn(txnId, userServiceClient, transactionServiceClient, true);
|
168 |
CommonPaymentService.processSuccessfulTxn(txnId, userServiceClient, transactionServiceClient, true);
|
| 148 |
this.redirectUrl = successUrl + "?paymentId=" + merchantPaymentId;
|
169 |
this.redirectUrl = successUrl + "?paymentId=" + merchantPaymentId;
|
| 149 |
}else{
|
170 |
}else{
|
| 150 |
CommonPaymentService.processSuccessfulTxn(txnId, userServiceClient, transactionServiceClient, false);
|
171 |
CommonPaymentService.processSuccessfulTxn(txnId, userServiceClient, transactionServiceClient, false);
|