| Line 77... |
Line 77... |
| 77 |
}
|
77 |
}
|
| 78 |
try {
|
78 |
try {
|
| 79 |
in.shop2020.model.v1.user.UserContextService.Client userClient = new UserClient().getClient();
|
79 |
in.shop2020.model.v1.user.UserContextService.Client userClient = new UserClient().getClient();
|
| 80 |
user = userClient.getUserByEmail(sourceDetail.getEmail());
|
80 |
user = userClient.getUserByEmail(sourceDetail.getEmail());
|
| 81 |
} catch (Exception e) {
|
81 |
} catch (Exception e) {
|
| 82 |
logger.error("Unable to establish connection to the User service", e);
|
82 |
logger.error("Unable to establish connection to the User service", e);
|
| 83 |
}
|
83 |
}
|
| 84 |
for(Order order:orders.getOrder()){
|
84 |
for(Order order:orders.getOrder()){
|
| 85 |
long subOrderId = (long) order.getSuborderId();
|
85 |
long subOrderId = (long) order.getSuborderId();
|
| 86 |
Client transaction_client = null;
|
86 |
Client transaction_client = null;
|
| 87 |
try {
|
87 |
try {
|
| Line 213... |
Line 213... |
| 213 |
snapdealOrder.setProductName(productName);
|
213 |
snapdealOrder.setProductName(productName);
|
| 214 |
snapdealOrder.setSnapdealTxnDate(snapdealTxnDate.getTime());
|
214 |
snapdealOrder.setSnapdealTxnDate(snapdealTxnDate.getTime());
|
| 215 |
snapdealOrder.setListingPrice(lineItem.getTotal_price());
|
215 |
snapdealOrder.setListingPrice(lineItem.getTotal_price());
|
| 216 |
transaction_client.createSnapdealOrder(snapdealOrder);
|
216 |
transaction_client.createSnapdealOrder(snapdealOrder);
|
| 217 |
|
217 |
|
| 218 |
} catch (TException e) {
|
- |
|
| 219 |
logger.error("Error in creating payment " + order.getSuborderId());
|
- |
|
| 220 |
continue;
|
- |
|
| 221 |
}
|
218 |
}
|
| 222 |
catch (PaymentException e) {
|
- |
|
| 223 |
logger.error("Error in creating payment " + order.getSuborderId());
|
- |
|
| 224 |
continue;
|
- |
|
| 225 |
}
|
- |
|
| 226 |
catch (Exception e) {
|
219 |
catch (Exception e) {
|
| 227 |
logger.error("Error in creating transaction " + order.getSuborderId());
|
220 |
logger.error("Error in creating transaction " + order.getSuborderId());
|
| 228 |
continue;
|
221 |
continue;
|
| 229 |
}
|
222 |
}
|
| 230 |
}
|
223 |
}
|
| 231 |
|
224 |
|
| 232 |
}
|
225 |
}
|
| 233 |
|
226 |
|
| 234 |
public static void createPayment(User user, String subOrderId, double amount) throws NumberFormatException, PaymentException, TException {
|
227 |
public static void createPayment(User user, String subOrderId, double amount) {
|
| 235 |
in.shop2020.payments.PaymentService.Client client = new PaymentClient().getClient();
|
228 |
in.shop2020.payments.PaymentService.Client client = null;
|
| - |
|
229 |
try {
|
| - |
|
230 |
client = new PaymentClient().getClient();
|
| - |
|
231 |
} catch (TTransportException e) {
|
| - |
|
232 |
logger.error("Could not connect to payment service ");
|
| - |
|
233 |
e.printStackTrace();
|
| - |
|
234 |
}
|
| - |
|
235 |
long paymentId = 0;
|
| - |
|
236 |
try {
|
| 236 |
long paymentId = client.createPayment(user.getUserId(), amount, SNAPDEAL_GATEWAY_ID, Long.valueOf(transactionId), false);
|
237 |
paymentId = client.createPayment(user.getUserId(), amount, SNAPDEAL_GATEWAY_ID, Long.valueOf(transactionId), false);
|
| - |
|
238 |
} catch (NumberFormatException e) {
|
| - |
|
239 |
logger.error("Could not create payment");
|
| - |
|
240 |
e.printStackTrace();
|
| - |
|
241 |
} catch (PaymentException e) {
|
| - |
|
242 |
logger.error("Could not create payment payment exception");
|
| - |
|
243 |
e.printStackTrace();
|
| - |
|
244 |
} catch (TException e) {
|
| - |
|
245 |
logger.error("Could not create payment thrift exception");
|
| - |
|
246 |
e.printStackTrace();
|
| - |
|
247 |
}
|
| - |
|
248 |
try {
|
| 237 |
client.updatePaymentDetails(paymentId, null, null, null, null, null, null, subOrderId, null, PaymentStatus.AUTHORIZED, null, null);
|
249 |
client.updatePaymentDetails(paymentId, null, null, null, null, null, null, subOrderId, null, PaymentStatus.AUTHORIZED, null, null);
|
| - |
|
250 |
} catch (PaymentException e) {
|
| - |
|
251 |
logger.error("Could not update payment to order");
|
| - |
|
252 |
e.printStackTrace();
|
| - |
|
253 |
} catch (TException e) {
|
| - |
|
254 |
logger.error("Could not update payment thrift exception");
|
| - |
|
255 |
e.printStackTrace();
|
| - |
|
256 |
}
|
| 238 |
}
|
257 |
}
|
| 239 |
|
258 |
|
| 240 |
public static LineItem createLineItem(long itemId, double amount) throws CatalogServiceException, TException {
|
259 |
public static LineItem createLineItem(long itemId, double amount) throws CatalogServiceException, TException {
|
| 241 |
LineItem lineItem = new LineItem();
|
260 |
LineItem lineItem = new LineItem();
|
| 242 |
CatalogService.Client catalogClient = new CatalogClient().getClient();
|
261 |
CatalogService.Client catalogClient = new CatalogClient().getClient();
|