|
@@ -16,7 +16,8 @@ namespace EVCB_OCPP.TaskScheduler.Services
|
|
|
private NLog.ILogger logger = NLog.LogManager.GetCurrentClassLogger();
|
|
|
private Guid customerId = Guid.Empty;
|
|
|
private string customerName = string.Empty;
|
|
|
- private string partnerAPIRoot = string.Empty;
|
|
|
+ private string _partnerAPIRoot = string.Empty;
|
|
|
+ private string _saltkey = string.Empty;
|
|
|
private CancellationToken _ct;
|
|
|
private DatabaseService _dbService = new DatabaseService();
|
|
|
private ParallelOptions po = new ParallelOptions();
|
|
@@ -30,6 +31,10 @@ namespace EVCB_OCPP.TaskScheduler.Services
|
|
|
this.customerId = customerId;
|
|
|
customerName = _dbService.GetCustomerName(this.customerId);
|
|
|
_dbService.GetCustomerName(this.customerId);
|
|
|
+ var connectionInfo = _dbService.GetAPIConnectionInfo(customerId);
|
|
|
+ _saltkey = connectionInfo.ApiKey;
|
|
|
+ _partnerAPIRoot = connectionInfo.ApiUrl;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -112,11 +117,11 @@ namespace EVCB_OCPP.TaskScheduler.Services
|
|
|
StartTime = r.StartTime.ToString(DefaultSetting.UTC_DATETIMEFORMAT)
|
|
|
};
|
|
|
|
|
|
- var response = await httpClient.Post(partnerAPIRoot + "start_session", new Dictionary<string, string>()
|
|
|
+ var response = await httpClient.Post(_partnerAPIRoot + "start_session", new Dictionary<string, string>()
|
|
|
{
|
|
|
{ "PartnerId",customerId.ToString()}
|
|
|
|
|
|
- }, JsonConvert.SerializeObject(request, DefaultSetting.JSONSERIALIZER_FORMAT), _dbService.GetAPIKey(customerId));
|
|
|
+ }, JsonConvert.SerializeObject(request, DefaultSetting.JSONSERIALIZER_FORMAT), _saltkey);
|
|
|
|
|
|
|
|
|
lock (responseLock)
|
|
@@ -229,11 +234,11 @@ namespace EVCB_OCPP.TaskScheduler.Services
|
|
|
|
|
|
};
|
|
|
|
|
|
- var response = await httpClient.Post(partnerAPIRoot + "completed_session", new Dictionary<string, string>()
|
|
|
+ var response = await httpClient.Post(_partnerAPIRoot + "completed_session", new Dictionary<string, string>()
|
|
|
{
|
|
|
{ "PartnerId",customerId.ToString()}
|
|
|
|
|
|
- }, JsonConvert.SerializeObject(request, DefaultSetting.JSONSERIALIZER_FORMAT), _dbService.GetAPIKey(customerId));
|
|
|
+ }, JsonConvert.SerializeObject(request, DefaultSetting.JSONSERIALIZER_FORMAT), _saltkey);
|
|
|
|
|
|
|
|
|
lock (responseLock)
|
|
@@ -355,11 +360,11 @@ namespace EVCB_OCPP.TaskScheduler.Services
|
|
|
Message = r.GetExecution().Detail,
|
|
|
};
|
|
|
|
|
|
- var response = await httpClient.Post(partnerAPIRoot + "commands/results", new Dictionary<string, string>()
|
|
|
+ var response = await httpClient.Post(_partnerAPIRoot + "commands/results", new Dictionary<string, string>()
|
|
|
{
|
|
|
{ "PartnerId",customerId.ToString()}
|
|
|
|
|
|
- }, JsonConvert.SerializeObject(request,DefaultSetting.JSONSERIALIZER_FORMAT), _dbService.GetAPIKey(customerId));
|
|
|
+ }, JsonConvert.SerializeObject(request, DefaultSetting.JSONSERIALIZER_FORMAT), _saltkey);
|
|
|
|
|
|
|
|
|
lock (responseLock)
|