| Line 34... |
Line 34... |
| 34 |
*
|
34 |
*
|
| 35 |
*/
|
35 |
*/
|
| 36 |
public class CommonPaymentService {
|
36 |
public class CommonPaymentService {
|
| 37 |
|
37 |
|
| 38 |
private static final boolean PAYMENT_NOT_CREATED = false;
|
38 |
private static final boolean PAYMENT_NOT_CREATED = false;
|
| - |
|
39 |
private static final boolean selfPickupFlag = false;
|
| 39 |
|
40 |
|
| 40 |
private static Logger log = Logger.getLogger(Class.class);
|
41 |
private static Logger log = Logger.getLogger(Class.class);
|
| 41 |
|
42 |
|
| 42 |
private long paymentId;
|
43 |
private long paymentId;
|
| 43 |
private double amount;
|
44 |
private double amount;
|
| Line 142... |
Line 143... |
| 142 |
tStatus = TransactionStatus.FLAGGED;
|
143 |
tStatus = TransactionStatus.FLAGGED;
|
| 143 |
description = "Payment flagged for the order";
|
144 |
description = "Payment flagged for the order";
|
| 144 |
}
|
145 |
}
|
| 145 |
try {
|
146 |
try {
|
| 146 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = transactionServiceClient.getClient();
|
147 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = transactionServiceClient.getClient();
|
| 147 |
transactionClient.changeTransactionStatus(txnId, tStatus, description);
|
148 |
transactionClient.changeTransactionStatus(txnId, tStatus, description, selfPickupFlag);
|
| 148 |
transaction = transactionClient.getTransaction(txnId);
|
149 |
transaction = transactionClient.getTransaction(txnId);
|
| 149 |
transactionClient.enqueueTransactionInfoEmail(txnId);
|
150 |
transactionClient.enqueueTransactionInfoEmail(txnId);
|
| 150 |
} catch (TException e1) {
|
151 |
} catch (TException e1) {
|
| 151 |
log.error("Unable to update status of transaction. Thrift Exception:", e1);
|
152 |
log.error("Unable to update status of transaction. Thrift Exception:", e1);
|
| 152 |
} catch (TransactionServiceException e) {
|
153 |
} catch (TransactionServiceException e) {
|
| Line 164... |
Line 165... |
| 164 |
* @param transactionServiceClient
|
165 |
* @param transactionServiceClient
|
| 165 |
*/
|
166 |
*/
|
| 166 |
public static void processFailedTxn(long txnId, TransactionClient transactionServiceClient) {
|
167 |
public static void processFailedTxn(long txnId, TransactionClient transactionServiceClient) {
|
| 167 |
try {
|
168 |
try {
|
| 168 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = transactionServiceClient.getClient();
|
169 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = transactionServiceClient.getClient();
|
| 169 |
transactionClient.changeTransactionStatus(txnId, TransactionStatus.FAILED, "Payment failed for the transaction.");
|
170 |
transactionClient.changeTransactionStatus(txnId, TransactionStatus.FAILED, "Payment failed for the transaction.", selfPickupFlag);
|
| 170 |
} catch(TException e){
|
171 |
} catch(TException e){
|
| 171 |
log.error("Thrift exception while getting information from transaction service.", e);
|
172 |
log.error("Thrift exception while getting information from transaction service.", e);
|
| 172 |
} catch (TransactionServiceException e) {
|
173 |
} catch (TransactionServiceException e) {
|
| 173 |
log.error("Error while updating status information in transaction database.", e);
|
174 |
log.error("Error while updating status information in transaction database.", e);
|
| 174 |
}
|
175 |
}
|
| Line 197... |
Line 198... |
| 197 |
*/
|
198 |
*/
|
| 198 |
public static void processCodTxn(long txnId){
|
199 |
public static void processCodTxn(long txnId){
|
| 199 |
try {
|
200 |
try {
|
| 200 |
TransactionClient transactionServiceClient = new TransactionClient();
|
201 |
TransactionClient transactionServiceClient = new TransactionClient();
|
| 201 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = transactionServiceClient.getClient();
|
202 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = transactionServiceClient.getClient();
|
| 202 |
transactionClient.changeTransactionStatus(txnId, TransactionStatus.COD_IN_PROCESS, "COD payment awaited");
|
203 |
transactionClient.changeTransactionStatus(txnId, TransactionStatus.COD_IN_PROCESS, "COD payment awaited", selfPickupFlag);
|
| 203 |
Transaction transaction = transactionClient.getTransaction(txnId);
|
204 |
Transaction transaction = transactionClient.getTransaction(txnId);
|
| 204 |
transactionClient.enqueueTransactionInfoEmail(txnId);
|
205 |
transactionClient.enqueueTransactionInfoEmail(txnId);
|
| 205 |
|
206 |
|
| 206 |
UserClient userServiceClient = new UserClient();
|
207 |
UserClient userServiceClient = new UserClient();
|
| 207 |
trackCouponUsage(transaction);
|
208 |
trackCouponUsage(transaction);
|