|
@@ -21,54 +21,9 @@ namespace EVCB_OCPP.WSServer.Service
|
|
|
|
|
|
async public Task<IdTagInfo> Authorize(string chargeBoxId, string idTag)
|
|
|
{
|
|
|
- await Task.Delay(10);
|
|
|
- IdTagInfo info = new IdTagInfo() { status = AuthorizationStatus.Invalid };
|
|
|
- try
|
|
|
- {
|
|
|
-
|
|
|
- OuterHttpClient _client = new OuterHttpClient();
|
|
|
-
|
|
|
-
|
|
|
- string url = ConfigurationManager.AppSettings["LocalAuthAPI"];
|
|
|
-
|
|
|
-
|
|
|
- HttpClientService service = new HttpClientService();
|
|
|
-
|
|
|
- Dictionary<string, string> postData = new Dictionary<string, string>()
|
|
|
- {
|
|
|
- { "ChargeBoxId", chargeBoxId },
|
|
|
- { "IdTag", idTag },
|
|
|
-
|
|
|
-
|
|
|
- };
|
|
|
- var _innerresult = await service.PostFormDataAsync(url, postData, null);
|
|
|
-
|
|
|
-
|
|
|
- if (_innerresult.StatusCode == HttpStatusCode.OK)
|
|
|
- {
|
|
|
- JObject jo = JObject.Parse(_innerresult.Response);
|
|
|
- if (jo["code"].ToString() == "1")
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- info.status = (AuthorizationStatus)Enum.Parse(typeof(AuthorizationStatus), jo["message"].ToString());
|
|
|
- }
|
|
|
- catch (Exception)
|
|
|
- {
|
|
|
- ;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+ await Task.Delay(10);
|
|
|
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- ;
|
|
|
- }
|
|
|
- return info;
|
|
|
+ return new IdTagInfo() { expiryDate = DateTime.UtcNow.AddDays(1), status = AuthorizationStatus.Accepted };
|
|
|
|
|
|
}
|
|
|
|