Пример #1
0
        public async Task Execute()
        {
            if (Invoice == null)
            {
                throw new ArgumentNullException("Invoice boş olamaz!");
            }

            var result = new ServiceResponse()
            {
                Hatali = false,
            };

            _serviceProxy = IngHelper.CreateServiceProxy(
                ServiceInfo.ServiceUrl,
                ServiceInfo.UserName,
                ServiceInfo.Password);

            var request = new sendUBLRequest()
            {
                DocData            = Serialization.SerializeToBytes(this.Invoice),
                SenderIdentifier   = this.ServiceInfo.SupplierPB,
                ReceiverIdentifier = this.ServiceInfo.CustomerPB,
                DocType            = "INVOICE",
                VKN_TCKN           = Invoice.AccountingSupplierParty.Party.PartyIdentification[0].ID.Value,
            };

            SendUBLResponseType[] response = _serviceProxy.sendUBL(request);

            result.Sonuc = response.Length > 0 ? "İşlem başarıyla tamamlandı" : "İşlem tamamlandı!";
            result.Data  = new { IntegratorResponse = response };
            this.Result  = Task.FromResult(result);
        }
        public static ClientEInvoiceServicesPortClient CreateServiceProxy(string serviceUrl, string userName, string password)
        {
            var basicHttpBinding = CreateBasicHttpBinding();
            var endPoint         = new EndpointAddress(serviceUrl);

            var proxy = new ClientEInvoiceServicesPortClient(basicHttpBinding, endPoint);

            proxy.ClientCredentials.UserName.UserName = userName;
            proxy.ClientCredentials.UserName.Password = password;
            return(proxy);
        }
        public async Task Execute()
        {
            var serviceResponse = new ServiceResponse()
            {
                Hatali = false,
            };

            _serviceProxy = new ClientEInvoiceServicesPortClient();
            getUBLRequest request = new getUBLRequest()
            {
                Identifier = this.ServiceInfo.SupplierPB,
                Type       = "INBOUND",
                Parameters = new[] { "zip" },
                DocType    = "INVOICE",
                VKN_TCKN   = ServiceInfo.SupplierVkn,
                UUID       = this.UUIDs
            };
            var ubl = _serviceProxy.getUBL(request);

            serviceResponse.Sonuc = "UBL Başarıyla alındı";
            serviceResponse.Data  = ubl[0];
            this.Result           = Task.FromResult(serviceResponse);
        }