| Line 140... |
Line 140... |
| 140 |
} catch (TException e1) {
|
140 |
} catch (TException e1) {
|
| 141 |
log.error("Unable to update status of transaction. Thrift Exception:", e1);
|
141 |
log.error("Unable to update status of transaction. Thrift Exception:", e1);
|
| 142 |
} catch (TransactionServiceException e) {
|
142 |
} catch (TransactionServiceException e) {
|
| 143 |
log.error("Unable to update status of transaction. Thrift Exception: ", e);
|
143 |
log.error("Unable to update status of transaction. Thrift Exception: ", e);
|
| 144 |
}
|
144 |
}
|
| 145 |
trackCouponUsage(transaction, userServiceClient);
|
145 |
trackCouponUsage(transaction);
|
| 146 |
resetCart(transaction, userServiceClient);
|
146 |
resetCart(transaction, userServiceClient);
|
| 147 |
}
|
147 |
}
|
| 148 |
|
148 |
|
| 149 |
/**
|
149 |
/**
|
| 150 |
* Marks a transaction as well as all its orders as failed.
|
150 |
* Marks a transaction as well as all its orders as failed.
|
| Line 249... |
Line 249... |
| 249 |
* The transaction to track coupon for.
|
249 |
* The transaction to track coupon for.
|
| 250 |
*
|
250 |
*
|
| 251 |
* @param userServiceClient
|
251 |
* @param userServiceClient
|
| 252 |
* The user service client instance to use.
|
252 |
* The user service client instance to use.
|
| 253 |
*/
|
253 |
*/
|
| 254 |
private static void trackCouponUsage(Transaction transaction, UserContextServiceClient userServiceClient) {
|
254 |
private static void trackCouponUsage(Transaction transaction) {
|
| 255 |
try {
|
255 |
try {
|
| 256 |
// Tracking Coupon Usage
|
- |
|
| 257 |
UserContextService.Client userClient = userServiceClient.getClient();
|
- |
|
| 258 |
Cart cart = userClient.getCart(transaction.getShoppingCartid());
|
- |
|
| 259 |
String couponCode = cart.getCouponCode();
|
256 |
String couponCode = transaction.getCoupon_code();
|
| 260 |
|
257 |
|
| 261 |
if (couponCode != null && !couponCode.isEmpty()) {
|
258 |
if (couponCode != null && !couponCode.isEmpty()) {
|
| 262 |
PromotionServiceClient promotionServiceClient = new PromotionServiceClient();
|
259 |
PromotionServiceClient promotionServiceClient = new PromotionServiceClient();
|
| 263 |
promotionServiceClient.getClient().trackCouponUsage(couponCode, transaction.getId(), transaction.getCustomer_id());
|
260 |
promotionServiceClient.getClient().trackCouponUsage(couponCode, transaction.getId(), transaction.getCustomer_id());
|
| 264 |
}
|
261 |
}
|
| 265 |
} catch (ShoppingCartException e) {
|
- |
|
| 266 |
log.error("Error occurred in reading CardId for transaction", e);
|
- |
|
| 267 |
} catch (PromotionException e) {
|
262 |
} catch (PromotionException e) {
|
| 268 |
log.error("Promotion Exception: " + e);
|
263 |
log.error("Promotion Exception: " + e);
|
| 269 |
} catch (TException e) {
|
264 |
} catch (TException e) {
|
| 270 |
log.error("Transport from Promotion Service failed:", e);
|
265 |
log.error("Transport from Promotion Service failed:", e);
|
| 271 |
} catch (Exception e) {
|
266 |
} catch (Exception e) {
|