This commit is contained in:
Chika 2021-05-17 19:01:00 +03:00
commit 9851a98065
15 changed files with 3260 additions and 0 deletions

25
.dockerignore Normal file
View File

@ -0,0 +1,25 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md

37
.gitignore vendored Normal file
View File

@ -0,0 +1,37 @@
*.swp
*.*~
project.lock.json
.DS_Store
*.pyc
nupkg/
# Visual Studio Code
.vscode
# Rider
.idea
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
msbuild.log
msbuild.err
msbuild.wrn
# Visual Studio 2015
.vs/

View File

@ -0,0 +1,23 @@
{
"ProviderId": "Microsoft.VisualStudio.ConnectedService.Wcf",
"Version": "15.0.40203.910",
"GettingStartedDocument": {
"Uri": "https://go.microsoft.com/fwlink/?linkid=858517"
},
"ExtendedData": {
"inputs": [
"http://1c-dev.evoleasing.ru/1c_leasing_trial/ws/wsmd_exch.1cws?wsdl"
],
"collectionTypes": [
"System.Array",
"System.Collections.Generic.Dictionary`2"
],
"messageContract": true,
"namespaceMappings": [
"*, LeasingTrial"
],
"sync": true,
"targetFramework": "netcoreapp3.1",
"typeReuseMode": "All"
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,35 @@
using LeasingTrial;
using System.ServiceModel;
namespace _1C.Gateway.Managers
{
public class LeasingTrialManager
{
private readonly md_exchPortTypeClient _mdExchPortTypeClient;
public LeasingTrialManager()
{
var binding = new BasicHttpBinding
{
MaxReceivedMessageSize = int.MaxValue,
Security =
{
Mode = BasicHttpSecurityMode.TransportCredentialOnly,
Transport = {ClientCredentialType = HttpClientCredentialType.Basic}
}
};
var address = new EndpointAddress("http://1c-dev.evoleasing.ru/1c_leasing_trial/ws/wsmd_exch.1cws");
_mdExchPortTypeClient = new md_exchPortTypeClient(binding, address);
_mdExchPortTypeClient.ClientCredentials.UserName.UserName = "ws";
_mdExchPortTypeClient.ClientCredentials.UserName.Password = "123";
}
public TransTaxResponse TransTax(TransTaxRequest transTaxRequest)
{
var res = _mdExchPortTypeClient.TransTax(transTaxRequest);
return res;
}
}
}

View File

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.15" />
<PackageReference Include="System.ServiceModel.Duplex" Version="4.4.*" />
<PackageReference Include="System.ServiceModel.Http" Version="4.4.*" />
<PackageReference Include="System.ServiceModel.NetTcp" Version="4.4.*" />
<PackageReference Include="System.ServiceModel.Security" Version="4.4.*" />
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services" />
</ItemGroup>
</Project>

31
_1C.Gateway.sln Normal file
View File

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31229.75
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_1C.Gateway", "_1C.Gateway\_1C.Gateway.csproj", "{0D296610-1E78-4CC9-8199-75F75C03B021}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_1C.Gateway.Managers", "_1C.Gateway.Managers\_1C.Gateway.Managers.csproj", "{83412C70-4360-41BC-836D-788BCB76F551}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0D296610-1E78-4CC9-8199-75F75C03B021}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0D296610-1E78-4CC9-8199-75F75C03B021}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0D296610-1E78-4CC9-8199-75F75C03B021}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0D296610-1E78-4CC9-8199-75F75C03B021}.Release|Any CPU.Build.0 = Release|Any CPU
{83412C70-4360-41BC-836D-788BCB76F551}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{83412C70-4360-41BC-836D-788BCB76F551}.Debug|Any CPU.Build.0 = Debug|Any CPU
{83412C70-4360-41BC-836D-788BCB76F551}.Release|Any CPU.ActiveCfg = Release|Any CPU
{83412C70-4360-41BC-836D-788BCB76F551}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A34563C0-6B48-45FE-BBCC-E755351B3E14}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,18 @@
using _1C.Gateway.Managers;
using LeasingTrial;
using Microsoft.AspNetCore.Mvc;
namespace _1C.Gateway.Controllers
{
[ApiController]
[Route("[controller]")]
public class LeasingTrialController : ControllerBase
{
[HttpPost("[action]")]
public ActionResult<TransTaxResponse> TransTax(TransTaxRequest transTaxRequest)
{
var res = new LeasingTrialManager().TransTax(transTaxRequest);
return res;
}
}
}

21
_1C.Gateway/Dockerfile Normal file
View File

@ -0,0 +1,21 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:3.1 AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build
WORKDIR /src
COPY ["_1C.Gateway/_1C.Gateway.csproj", "_1C.Gateway/"]
RUN dotnet restore "_1C.Gateway/_1C.Gateway.csproj"
COPY . .
WORKDIR "/src/_1C.Gateway"
RUN dotnet build "_1C.Gateway.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "_1C.Gateway.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "_1C.Gateway.dll"]

26
_1C.Gateway/Program.cs Normal file
View File

@ -0,0 +1,26 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace _1C.Gateway
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}

View File

@ -0,0 +1,36 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:61784",
"sslPort": 0
}
},
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "weatherforecast",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"_1C.Gateway": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "weatherforecast",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:5000"
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/weatherforecast",
"publishAllPorts": true
}
}
}

48
_1C.Gateway/Startup.cs Normal file
View File

@ -0,0 +1,48 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace _1C.Gateway
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers().AddNewtonsoftJson();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
}

View File

@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.15" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.13" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\_1C.Gateway.Managers\_1C.Gateway.Managers.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

View File

@ -0,0 +1,10 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}