| Line 142... |
Line 142... |
| 142 |
e1.printStackTrace();
|
142 |
e1.printStackTrace();
|
| 143 |
} catch (TransactionServiceException e) {
|
143 |
} catch (TransactionServiceException e) {
|
| 144 |
log.error("Unable to update status of transaction. Thrift Exception" + e.getErrorCode() + e.getMessage());
|
144 |
log.error("Unable to update status of transaction. Thrift Exception" + e.getErrorCode() + e.getMessage());
|
| 145 |
e.printStackTrace();
|
145 |
e.printStackTrace();
|
| 146 |
}
|
146 |
}
|
| 147 |
|
- |
|
| 148 |
try {
|
- |
|
| 149 |
//TODO Optimize the function to send less amount of data over network
|
- |
|
| 150 |
log.info("Transaction shopping cart id is: " + transaction.getShoppingCartid());
|
- |
|
| 151 |
log.info("Items to restr in cart are: " + items );
|
- |
|
| 152 |
|
- |
|
| 153 |
userServiceClient.getClient().resetCart(transaction.getShoppingCartid(), items);
|
- |
|
| 154 |
|
- |
|
| 155 |
}catch (TException e) {
|
- |
|
| 156 |
log.error("Error while updating information in payment database.");
|
- |
|
| 157 |
e.printStackTrace();
|
- |
|
| 158 |
//FIXME Even we get exception we should sent url back to payment gateway. And some thing back channel should be done
|
- |
|
| 159 |
|
- |
|
| 160 |
} catch (ShoppingCartException e) {
|
- |
|
| 161 |
log.error("Error while reseting the cart in cart database.");
|
- |
|
| 162 |
e.printStackTrace();
|
- |
|
| 163 |
}catch (Exception e) {
|
- |
|
| 164 |
// TODO: handle exception
|
- |
|
| 165 |
}
|
147 |
|
| 166 |
|
- |
|
| 167 |
try {
|
148 |
try {
|
| 168 |
// Tracking Coupon Usage
|
149 |
// Tracking Coupon Usage
|
| 169 |
UserContextService.Client userClient = userServiceClient.getClient();
|
150 |
UserContextService.Client userClient = userServiceClient.getClient();
|
| 170 |
Cart cart = userClient.getCart(transaction.getShoppingCartid());
|
151 |
Cart cart = userClient.getCart(transaction.getShoppingCartid());
|
| 171 |
|
152 |
|
| 172 |
PromotionServiceClient promotionServiceClient = new PromotionServiceClient();
|
153 |
PromotionServiceClient promotionServiceClient = new PromotionServiceClient();
|
| 173 |
String couponCode = cart.getCouponCode();
|
154 |
String couponCode = cart.getCouponCode();
|
| 174 |
|
155 |
|
| 175 |
if (couponCode != null && !couponCode.isEmpty()) {
|
156 |
if (couponCode != null && !couponCode.isEmpty()) {
|
| 176 |
promotionServiceClient.getClient().trackCouponUsage(couponCode, txnId, transaction.getCustomer_id());
|
157 |
promotionServiceClient.getClient().trackCouponUsage(couponCode, txnId, transaction.getCustomer_id());
|
| 177 |
}
|
158 |
}
|
| 178 |
} catch (ShoppingCartException e) {
|
159 |
} catch (ShoppingCartException e) {
|
| 179 |
log.error("Error occurred in reading CardId for transaction");
|
160 |
log.error("Error occurred in reading CardId for transaction");
|
| 180 |
e.printStackTrace();
|
161 |
e.printStackTrace();
|
| 181 |
} catch (PromotionException e) {
|
162 |
} catch (PromotionException e) {
|
| 182 |
log.error("Promotion Exception: " + e.getMessage());
|
163 |
log.error("Promotion Exception: " + e.getMessage());
|
| 183 |
e.printStackTrace();
|
164 |
e.printStackTrace();
|
| 184 |
} catch (TException e) {
|
165 |
} catch (TException e) {
|
| 185 |
log.error("Transport from Promotion Service failed");
|
166 |
log.error("Transport from Promotion Service failed");
|
| 186 |
e.printStackTrace();
|
167 |
e.printStackTrace();
|
| 187 |
} catch (Exception e) {
|
168 |
} catch (Exception e) {
|
| 188 |
e.printStackTrace();
|
169 |
e.printStackTrace();
|
| 189 |
}
|
170 |
}
|
| - |
|
171 |
|
| - |
|
172 |
try {
|
| - |
|
173 |
//TODO Optimize the function to send less amount of data over network
|
| - |
|
174 |
log.info("Transaction shopping cart id is: " + transaction.getShoppingCartid());
|
| - |
|
175 |
log.info("Items to restr in cart are: " + items );
|
| - |
|
176 |
|
| - |
|
177 |
userServiceClient.getClient().resetCart(transaction.getShoppingCartid(), items);
|
| - |
|
178 |
|
| - |
|
179 |
}catch (TException e) {
|
| - |
|
180 |
log.error("Error while updating information in payment database.");
|
| - |
|
181 |
e.printStackTrace();
|
| - |
|
182 |
//FIXME Even we get exception we should sent url back to payment gateway. And some thing back channel should be done
|
| - |
|
183 |
|
| - |
|
184 |
} catch (ShoppingCartException e) {
|
| - |
|
185 |
log.error("Error while reseting the cart in cart database.");
|
| - |
|
186 |
e.printStackTrace();
|
| - |
|
187 |
}catch (Exception e) {
|
| - |
|
188 |
// TODO: handle exception
|
| - |
|
189 |
}
|
| 190 |
}
|
190 |
}
|
| 191 |
|
191 |
|
| 192 |
/**
|
192 |
/**
|
| 193 |
* Enqueues the transaction successful email, containing transaction info,
|
193 |
* Enqueues the transaction successful email, containing transaction info,
|
| 194 |
* to be sent later by batch job.
|
194 |
* to be sent later by batch job.
|