Compare commits

..

8 Commits

Author SHA1 Message Date
vchikalkin
cc78d4e26f SOAP: update KASKO Reference.cs 2024-05-16 11:19:05 +03:00
vchikalkin
3f03f0154a Revert "SOAP: update references"
This reverts commit 3834aa87fe57c87795dff490cd762b4be81c6e8f.
2024-05-16 10:07:57 +03:00
vchikalkin
3834aa87fe SOAP: update references 2024-05-16 09:51:03 +03:00
vchikalkin
7eba0b20ca project: add docker-compose.yml 2023-12-25 18:52:46 +03:00
vchikalkin
3504f9cfb9 SOAP: use https 2023-12-01 10:36:27 +03:00
vchikalkin
82baca1bfd Controllers/Common: return JSON response with error 2023-10-06 12:47:20 +03:00
vchikalkin
564ea80ef7 Controllers: add try/catch to CommonController.cs 2023-10-06 12:40:35 +03:00
vchikalkin
b42a9bb284 merge refactor/common 2023-10-04 17:37:26 +03:00
7 changed files with 3670 additions and 8727 deletions

View File

@ -1,7 +1,9 @@
{ {
"providerId": "Microsoft.Tools.ServiceModel.Svcutil",
"version": "2.1.0",
"ExtendedData": { "ExtendedData": {
"inputs": [ "inputs": [
"http://evolucia.elt-poisk.com/soap.php?wsdl" "https://evolucia.elt-poisk.com/soap.php?wsdl"
], ],
"collectionTypes": [ "collectionTypes": [
"System.Array", "System.Array",
@ -10,6 +12,7 @@
"namespaceMappings": [ "namespaceMappings": [
"*, ELTKasko" "*, ELTKasko"
], ],
"outputFile": "Reference",
"sync": true, "sync": true,
"targetFramework": "netcoreapp3.1", "targetFramework": "netcoreapp3.1",
"typeReuseMode": "All" "typeReuseMode": "All"

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
"Version": "15.0.40203.910", "Version": "15.0.40203.910",
"ExtendedData": { "ExtendedData": {
"inputs": [ "inputs": [
"http://evolucia.elt-poisk.com/soaposago.php?wsdl" "https://evolucia.elt-poisk.com/soaposago.php?wsdl"
], ],
"collectionTypes": [ "collectionTypes": [
"System.Array", "System.Array",

View File

@ -6792,6 +6792,7 @@ namespace ELTOsago
result.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max; result.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max;
result.MaxReceivedMessageSize = int.MaxValue; result.MaxReceivedMessageSize = int.MaxValue;
result.AllowCookies = true; result.AllowCookies = true;
result.Security.Mode = System.ServiceModel.BasicHttpSecurityMode.Transport;
return result; return result;
} }
throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration)); throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration));
@ -6801,7 +6802,7 @@ namespace ELTOsago
{ {
if ((endpointConfiguration == EndpointConfiguration.EltSoap)) if ((endpointConfiguration == EndpointConfiguration.EltSoap))
{ {
return new System.ServiceModel.EndpointAddress("http://evolucia.elt-poisk.com/soaposago.php"); return new System.ServiceModel.EndpointAddress("https://evolucia.elt-poisk.com/soaposago.php");
} }
throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration)); throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration));
} }

View File

@ -0,0 +1,6 @@
namespace ELT.Client.Models.Common;
public class ErrorResponse
{
public string Error { get; set; }
}

View File

@ -3,6 +3,7 @@ using ELT.Client.Models.Common;
using ELTKasko; using ELTKasko;
using ELTOsago; using ELTOsago;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using AuthInfo = ELTOsago.AuthInfo;
using EltKaskoSoap = ELTKasko.EltSoap; using EltKaskoSoap = ELTKasko.EltSoap;
using ELTOsagoSoap = ELTOsago.EltSoap; using ELTOsagoSoap = ELTOsago.EltSoap;
@ -37,74 +38,88 @@ public class CommonController : ControllerBase
[HttpPost("get-kasko-calculation")] [HttpPost("get-kasko-calculation")]
public ActionResult<KASKOCalculationResult> GetKaskoCalculation([FromBody] GetKaskoCalculationInput data) public ActionResult<KASKOCalculationResult> GetKaskoCalculation([FromBody] GetKaskoCalculationInput data)
{ {
var preRequestData = this.GetPreRequestData(data.Preparams); try
var request = data.Params;
request.UsageCityKLADR = preRequestData.Kladr;
request.Mark = preRequestData.Brand;
request.Model = preRequestData.Model;
if (request.Modification != null)
request.Modification.Name = preRequestData.Modification;
var specialMachinery = data.Preparams.SpecialMachinery;
specialMachinery.SpecialMachineryMark = preRequestData.Brand;
specialMachinery.SpecialMachineryModel = preRequestData.Model;
request.SpecialMachinery = specialMachinery;
var res = _eltKaskoClient.PreliminaryKASKOCalculation(
new ELTKasko.AuthInfo
{
Login = _login,
Password = _password
}
, null
, data.CompanyId
, 0
, 0
, null
, null
, null
, "13"
, null
, false
, null
, null
, request);
if (res?.Error is { Length: > 0 })
{ {
return BadRequest(res); var preRequestData = this.GetPreRequestData(data.Preparams);
}
return Ok(res); var request = data.Params;
request.UsageCityKLADR = preRequestData.Kladr;
request.Mark = preRequestData.Brand;
request.Model = preRequestData.Model;
if (request.Modification != null)
request.Modification.Name = preRequestData.Modification;
var specialMachinery = data.Preparams.SpecialMachinery;
specialMachinery.SpecialMachineryMark = preRequestData.Brand;
specialMachinery.SpecialMachineryModel = preRequestData.Model;
request.SpecialMachinery = specialMachinery;
var res = _eltKaskoClient.PreliminaryKASKOCalculation(
new ELTKasko.AuthInfo
{
Login = _login,
Password = _password
}
, null
, data.CompanyId
, 0
, 0
, null
, null
, null
, "13"
, null
, false
, null
, null
, request);
if (res?.Error is { Length: > 0 })
{
return BadRequest(res);
}
return Ok(res);
}
catch (Exception e)
{
return StatusCode(500, new ErrorResponse { Error = e.Message });
}
} }
[HttpPost("get-osago-calculation")] [HttpPost("get-osago-calculation")]
public ActionResult<OSAGOFullCalculationResponse> GetOsagoCalculation([FromBody] GetOsagoCalculationInput data) public ActionResult<OSAGOFullCalculationResponse> GetOsagoCalculation([FromBody] GetOsagoCalculationInput data)
{ {
var prerequestData = this.GetPreRequestData(data.Preparams); try
var request = data.Params;
request.UsagePlace = prerequestData.Kladr;
request.CarInfo.Mark = prerequestData.Brand;
request.CarInfo.Model = prerequestData.Model;
request.AuthInfo = new ELTOsago.AuthInfo
{ {
Login = _login, var prerequestData = this.GetPreRequestData(data.Preparams);
Password = _password
};
request.InsuranceCompany ??= data.CompanyId; var request = data.Params;
request.UsagePlace = prerequestData.Kladr;
request.CarInfo.Mark = prerequestData.Brand;
request.CarInfo.Model = prerequestData.Model;
var res = _eltOsagoClient.OSAGOFullCalculation(data.Params); request.AuthInfo = new AuthInfo
{
Login = _login,
Password = _password
};
if (res?.Error is { Length: > 0 }) request.InsuranceCompany ??= data.CompanyId;
{
return BadRequest(res); var res = _eltOsagoClient.OSAGOFullCalculation(data.Params);
if (res?.Error is { Length: > 0 })
{
return BadRequest(res);
}
return Ok(res);
}
catch (Exception e)
{
return StatusCode(500, new ErrorResponse { Error = e.Message });
} }
return Ok(res);
} }
} }

17
docker-compose.yml Normal file
View File

@ -0,0 +1,17 @@
version: '3.3'
services:
elt:
build:
context: .
dockerfile: ./Dockerfile
environment:
- eltLogin=${ELT_LOGIN}
- eltPassword=${ELT_PASSWORD}
restart: always
networks:
- calc_network
networks:
calc_network:
external:
name: calc_network