| Line 1... |
Line 1... |
| 1 |
package com.smartdukaan.cron.monitored;
|
1 |
package com.smartdukaan.cron.monitored;
|
| 2 |
|
2 |
|
| 3 |
import java.io.File;
|
- |
|
| 4 |
import java.io.IOException;
|
3 |
import java.io.IOException;
|
| 5 |
import java.util.HashMap;
|
4 |
import java.util.HashMap;
|
| 6 |
import java.util.LinkedHashMap;
|
5 |
import java.util.LinkedHashMap;
|
| 7 |
import java.util.Map;
|
6 |
import java.util.Map;
|
| 8 |
|
7 |
|
| Line 11... |
Line 10... |
| 11 |
import org.springframework.beans.factory.annotation.Autowired;
|
10 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 12 |
import org.springframework.beans.factory.annotation.Value;
|
11 |
import org.springframework.beans.factory.annotation.Value;
|
| 13 |
import org.springframework.stereotype.Component;
|
12 |
import org.springframework.stereotype.Component;
|
| 14 |
|
13 |
|
| 15 |
import com.smartdukaan.cron.properties.WriteToPropertiesFile;
|
14 |
import com.smartdukaan.cron.properties.WriteToPropertiesFile;
|
| 16 |
import com.spice.profitmandi.common.enumuration.ProviderBalanceFrom;
|
- |
|
| 17 |
import com.spice.profitmandi.common.enumuration.SchemeType;
|
15 |
import com.spice.profitmandi.common.enumuration.SchemeType;
|
| 18 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
16 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 19 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
- |
|
| 20 |
import com.spice.profitmandi.common.model.RechargeCredential;
|
17 |
import com.spice.profitmandi.common.model.RechargeCredential;
|
| 21 |
import com.spice.profitmandi.common.web.client.RestClient;
|
18 |
import com.spice.profitmandi.common.web.client.RestClient;
|
| 22 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
19 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| 23 |
import com.spice.profitmandi.service.recharge.RechargeService;
|
20 |
import com.spice.profitmandi.service.recharge.RechargeService;
|
| 24 |
import com.spice.profitmandi.service.recharge.provider.OxigenRechargeProviderService;
|
- |
|
| 25 |
import com.spice.profitmandi.service.recharge.provider.ThinkWalnutDigitalRechargeProviderService;
|
21 |
import com.spice.profitmandi.service.recharge.provider.ThinkWalnutDigitalRechargeProviderService;
|
| 26 |
|
22 |
|
| 27 |
@Component
|
23 |
@Component
|
| 28 |
public class NagiosMonitorTasks {
|
24 |
public class NagiosMonitorTasks {
|
| 29 |
|
25 |
|
| 30 |
private static final Logger log = LogManager.getLogger(NagiosMonitorTasks.class);
|
26 |
private static final Logger log = LogManager.getLogger(NagiosMonitorTasks.class);
|
| 31 |
|
27 |
|
| 32 |
@Value("${oxigen.recharge.transaction.url}")
|
- |
|
| 33 |
private String oxigenRechargeTransactionUrl;
|
- |
|
| 34 |
|
- |
|
| 35 |
@Value("${oxigen.recharge.enquiry.url}")
|
- |
|
| 36 |
private String oxigenRechargeEnquiryUrl;
|
- |
|
| 37 |
|
- |
|
| 38 |
@Value("${oxigen.recharge.auth.key}")
|
- |
|
| 39 |
private String oxigenRechargeAuthKey;
|
- |
|
| 40 |
|
- |
|
| 41 |
@Value("${oxigen.recharge.validation.url}")
|
- |
|
| 42 |
private String oxigenRechargeValidationUrl;
|
- |
|
| 43 |
|
- |
|
| 44 |
@Value("${oxigen.recharge.validation.auth.key}")
|
- |
|
| 45 |
private String oxigenRechargeValidationAuthKey;
|
- |
|
| 46 |
|
- |
|
| 47 |
@Value("${think.walnut.digital.recharge.transaction.mobile.url}")
|
28 |
@Value("${think.walnut.digital.recharge.transaction.mobile.url}")
|
| 48 |
private String thinkWalnutDigitalRechargeTransactionMobileUrl;
|
29 |
private String thinkWalnutDigitalRechargeTransactionMobileUrl;
|
| 49 |
|
30 |
|
| 50 |
@Value("${think.walnut.digital.recharge.transaction.dth.url}")
|
31 |
@Value("${think.walnut.digital.recharge.transaction.dth.url}")
|
| 51 |
private String thinkWalnutDigitalRechargeTransactionDthUrl;
|
32 |
private String thinkWalnutDigitalRechargeTransactionDthUrl;
|
| Line 64... |
Line 45... |
| 64 |
|
45 |
|
| 65 |
@Value("${think.walnut.digital.recharge.auth.key}")
|
46 |
@Value("${think.walnut.digital.recharge.auth.key}")
|
| 66 |
private String thinkWalnutDigitalRechargeAuthKey;
|
47 |
private String thinkWalnutDigitalRechargeAuthKey;
|
| 67 |
|
48 |
|
| 68 |
@Autowired
|
49 |
@Autowired
|
| 69 |
private OxigenRechargeProviderService oxigenRechargeProviderService;
|
- |
|
| 70 |
|
- |
|
| 71 |
@Autowired
|
- |
|
| 72 |
private ThinkWalnutDigitalRechargeProviderService thinkWalnutDigitalRechargeProviderService;
|
50 |
private ThinkWalnutDigitalRechargeProviderService thinkWalnutDigitalRechargeProviderService;
|
| 73 |
|
51 |
|
| 74 |
@Autowired
|
52 |
@Autowired
|
| 75 |
private RestClient restClient;
|
53 |
private RestClient restClient;
|
| 76 |
|
54 |
|
| Line 105... |
Line 83... |
| 105 |
|
83 |
|
| 106 |
}
|
84 |
}
|
| 107 |
|
85 |
|
| 108 |
}
|
86 |
}
|
| 109 |
|
87 |
|
| 110 |
public void currentOxygenBalance() throws ProfitMandiBusinessException, IOException {
|
- |
|
| 111 |
LinkedHashMap<String, String> propertiesDetails = new LinkedHashMap<>();
|
- |
|
| 112 |
float oxygenBalance = oxigenRechargeProviderService.doCheckBalanceRequest(oxigenRechargeTransactionUrl,
|
- |
|
| 113 |
oxigenRechargeAuthKey);
|
- |
|
| 114 |
log.info("Got oxygenBalance successfully parsed {}", oxygenBalance);
|
- |
|
| 115 |
propertiesDetails.put("oxigenBalance", Float.toString(oxygenBalance));
|
- |
|
| 116 |
writeToPropertiesFile.saveParamChanges(propertiesDetails, nagiosPropertiesFile);
|
- |
|
| 117 |
|
- |
|
| 118 |
}
|
- |
|
| 119 |
|
- |
|
| 120 |
public void currentThinkWalnutBalace() throws ProfitMandiBusinessException, IOException {
|
88 |
public void currentThinkWalnutBalace() throws ProfitMandiBusinessException, IOException {
|
| 121 |
LinkedHashMap<String, String> propertiesDetails = new LinkedHashMap<>();
|
89 |
LinkedHashMap<String, String> propertiesDetails = new LinkedHashMap<>();
|
| 122 |
RechargeCredential thinkWalnutDigitalRechargeCredential = new RechargeCredential();
|
90 |
RechargeCredential thinkWalnutDigitalRechargeCredential = new RechargeCredential();
|
| 123 |
thinkWalnutDigitalRechargeCredential.setRechargeUrl(thinkWalnutDigitalRechargeBalanceUrl);
|
91 |
thinkWalnutDigitalRechargeCredential.setRechargeUrl(thinkWalnutDigitalRechargeBalanceUrl);
|
| 124 |
thinkWalnutDigitalRechargeCredential.setRechargeUserName(thinkWalnutDigitalRechargeUserName);
|
92 |
thinkWalnutDigitalRechargeCredential.setRechargeUserName(thinkWalnutDigitalRechargeUserName);
|