39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
using LeasingTrial;
|
|
using System;
|
|
using System.ServiceModel;
|
|
|
|
namespace _1C.Gateway.Managers
|
|
{
|
|
public class LeasingTrialManager
|
|
{
|
|
private readonly md_exchPortTypeClient _mdExchPortTypeClient;
|
|
|
|
public LeasingTrialManager()
|
|
{
|
|
var url = Environment.GetEnvironmentVariable("1C_URL_LEASING_TRIAL");
|
|
var username = Environment.GetEnvironmentVariable("1C_USERNAME");
|
|
var password = Environment.GetEnvironmentVariable("1C_PASSWORD");
|
|
|
|
|
|
var address = new EndpointAddress(url);
|
|
var binding = new BasicHttpBinding
|
|
{
|
|
MaxReceivedMessageSize = int.MaxValue,
|
|
Security =
|
|
{
|
|
Mode = BasicHttpSecurityMode.TransportCredentialOnly,
|
|
Transport = {ClientCredentialType = HttpClientCredentialType.Basic}
|
|
}
|
|
};
|
|
_mdExchPortTypeClient = new md_exchPortTypeClient(binding, address);
|
|
_mdExchPortTypeClient.ClientCredentials.UserName.UserName = username;
|
|
_mdExchPortTypeClient.ClientCredentials.UserName.Password = password;
|
|
}
|
|
|
|
public TransTaxResponse TransTax(TransTaxRequest transTaxRequest)
|
|
{
|
|
var res = _mdExchPortTypeClient.TransTax(transTaxRequest);
|
|
return res;
|
|
}
|
|
}
|
|
} |