| Line 49... |
Line 49... |
| 49 |
import org.springframework.transaction.annotation.Transactional;
|
49 |
import org.springframework.transaction.annotation.Transactional;
|
| 50 |
|
50 |
|
| 51 |
import com.google.common.collect.Lists;
|
51 |
import com.google.common.collect.Lists;
|
| 52 |
import com.google.gson.Gson;
|
52 |
import com.google.gson.Gson;
|
| 53 |
import com.google.gson.GsonBuilder;
|
53 |
import com.google.gson.GsonBuilder;
|
| - |
|
54 |
import com.razorpay.Payment;
|
| - |
|
55 |
import com.razorpay.RazorpayException;
|
| 54 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
56 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
| 55 |
import com.spice.profitmandi.common.enumuration.RechargeStatus;
|
57 |
import com.spice.profitmandi.common.enumuration.RechargeStatus;
|
| 56 |
import com.spice.profitmandi.common.enumuration.ReporticoProject;
|
58 |
import com.spice.profitmandi.common.enumuration.ReporticoProject;
|
| 57 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
59 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 58 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
60 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| Line 457... |
Line 459... |
| 457 |
private PendingOrderRepository pendingOrderRepository;
|
459 |
private PendingOrderRepository pendingOrderRepository;
|
| 458 |
|
460 |
|
| 459 |
@Autowired
|
461 |
@Autowired
|
| 460 |
private PendingOrderItemRepository pendingOrderItemRepository;
|
462 |
private PendingOrderItemRepository pendingOrderItemRepository;
|
| 461 |
|
463 |
|
| 462 |
@Autowired
|
- |
|
| 463 |
private RazorPayRepository razorPayRepository;
|
- |
|
| 464 |
|
- |
|
| 465 |
@Value("${razorpay.account.keyId}")
|
464 |
@Value("${razorpay.account.keyId}")
|
| 466 |
private String keyId;
|
465 |
private String keyId;
|
| 467 |
|
466 |
|
| 468 |
@Value("${razorpay.account.keySecret}")
|
467 |
@Value("${razorpay.account.keySecret}")
|
| 469 |
private String keySecret;
|
468 |
private String keySecret;
|
| 470 |
|
469 |
|
| - |
|
470 |
@Autowired
|
| - |
|
471 |
private RazorpayPaymentService razorPaymentService;
|
| - |
|
472 |
|
| - |
|
473 |
@Autowired
|
| - |
|
474 |
private RazorPayRepository razorPayRepository;
|
| - |
|
475 |
|
| 471 |
private static final Logger LOGGER = LogManager.getLogger(ScheduledTasks.class);
|
476 |
private static final Logger LOGGER = LogManager.getLogger(ScheduledTasks.class);
|
| 472 |
|
477 |
|
| 473 |
private String FCM_URL = "https://fcm.googleapis.com/fcm/send";
|
478 |
private String FCM_URL = "https://fcm.googleapis.com/fcm/send";
|
| 474 |
private String FCM_API_KEY = "AAAASAjNcn4:APA91bG6fWRIgYJI0L9gCjP5ynaXz2hJHYKtD9dfH7Depdv31Nd9APJwhx-OPkAJ1WSz4BGNYG8lHThLFSjDGFxIwUZv241YcAJEGDLgt86mxq9FXJe-yBRu-S0_ZwHqmX-QaVKl5F_A";
|
479 |
private String FCM_API_KEY = "AAAASAjNcn4:APA91bG6fWRIgYJI0L9gCjP5ynaXz2hJHYKtD9dfH7Depdv31Nd9APJwhx-OPkAJ1WSz4BGNYG8lHThLFSjDGFxIwUZv241YcAJEGDLgt86mxq9FXJe-yBRu-S0_ZwHqmX-QaVKl5F_A";
|
| 475 |
|
480 |
|
| Line 1588... |
Line 1593... |
| 1588 |
// this.sendMailOfHtmlFomat("amit.gupta@smartukaan.com", saleReport, cc,
|
1593 |
// this.sendMailOfHtmlFomat("amit.gupta@smartukaan.com", saleReport, cc,
|
| 1589 |
// subject);
|
1594 |
// subject);
|
| 1590 |
this.sendMailOfHtmlFormat("amit.gupta@smartdukaan.com", statewiseSaleReport, cc, "Statewise" + subject);
|
1595 |
this.sendMailOfHtmlFormat("amit.gupta@smartdukaan.com", statewiseSaleReport, cc, "Statewise" + subject);
|
| 1591 |
}
|
1596 |
}
|
| 1592 |
|
1597 |
|
| 1593 |
public void checkRazorPayPaymentStatus() throws IOException {
|
1598 |
public void checkRazorPayPaymentStatus() throws IOException, RazorpayException {
|
| 1594 |
List<PendingOrder> pendingOrder = pendingOrderRepository
|
1599 |
List<PendingOrder> pendingOrder = pendingOrderRepository
|
| 1595 |
.selectAllByStatus(com.spice.profitmandi.dao.enumuration.transaction.OrderStatus.PENDING);
|
1600 |
.selectAllByStatus(com.spice.profitmandi.dao.enumuration.transaction.OrderStatus.PENDING);
|
| 1596 |
|
1601 |
|
| 1597 |
for (PendingOrder po : pendingOrder) {
|
1602 |
for (PendingOrder po : pendingOrder) {
|
| 1598 |
OkHttpClient client = new OkHttpClient();
|
- |
|
| 1599 |
|
- |
|
| 1600 |
RazorPay razorPay = razorPayRepository.selectByOrdeId(po.getId());
|
1603 |
RazorPay razorPay = razorPayRepository.selectByOrdeId(po.getId());
|
| 1601 |
Request request1 = new Request.Builder()
|
- |
|
| 1602 |
.url("https://api.razorpay.com/v1/orders/" + razorPay.getRazorOrderId() + "/payments").get()
|
- |
|
| 1603 |
.addHeader(keyId, keySecret).build();
|
- |
|
| 1604 |
|
1604 |
|
| - |
|
1605 |
LOGGER.info("razorPay" + razorPay);
|
| - |
|
1606 |
if (razorPay != null) {
|
| - |
|
1607 |
List<Payment> payments = razorPaymentService.fetchOrderForPayment(razorPay.getRazorOrderId());
|
| - |
|
1608 |
if (!payments.isEmpty()) {
|
| 1605 |
Response response = client.newCall(request1).execute();
|
1609 |
for (Payment payment : payments) {
|
| - |
|
1610 |
|
| - |
|
1611 |
}
|
| 1606 |
|
1612 |
|
| - |
|
1613 |
}
|
| 1607 |
LOGGER.info("response" + response);
|
1614 |
LOGGER.info("payment" + payments);
|
| 1608 |
|
1615 |
|
| - |
|
1616 |
}
|
| 1609 |
}
|
1617 |
}
|
| 1610 |
}
|
1618 |
}
|
| 1611 |
|
1619 |
|
| 1612 |
public static class SaleTargetReportModel {
|
1620 |
public static class SaleTargetReportModel {
|
| 1613 |
private double totalSale;
|
1621 |
private double totalSale;
|