{"id":19795781,"url":"https://github.com/spoleto-software/spoleto.delivery","last_synced_at":"2026-01-30T12:03:27.315Z","repository":{"id":244088056,"uuid":"795483893","full_name":"spoleto-software/Spoleto.Delivery","owner":"spoleto-software","description":"Spoleto.Delivery provides an abstraction layer for Delivery of goods in .NET applications, offering the flexibility to separate your delivery logic from the specific implementation of any underlying service provider. This package supports integration with a variety of Delivery providers, including CDEK, MasterPost.","archived":false,"fork":false,"pushed_at":"2026-01-29T14:57:07.000Z","size":441,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-01-30T03:16:00.077Z","etag":null,"topics":["cdek","delivery","delivery-pipelines","dotnet","masterpost"],"latest_commit_sha":null,"homepage":"https://spoleto.ru","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spoleto-software.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-05-03T11:36:18.000Z","updated_at":"2026-01-29T14:58:09.000Z","dependencies_parsed_at":"2024-06-12T21:52:50.686Z","dependency_job_id":"94b7d16c-c3fa-42a1-9d7e-ae5d2f2bb46e","html_url":"https://github.com/spoleto-software/Spoleto.Delivery","commit_stats":null,"previous_names":["spoleto-software/spoleto.delivery"],"tags_count":57,"template":false,"template_full_name":null,"purl":"pkg:github/spoleto-software/Spoleto.Delivery","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spoleto-software%2FSpoleto.Delivery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spoleto-software%2FSpoleto.Delivery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spoleto-software%2FSpoleto.Delivery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spoleto-software%2FSpoleto.Delivery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spoleto-software","download_url":"https://codeload.github.com/spoleto-software/Spoleto.Delivery/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spoleto-software%2FSpoleto.Delivery/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28912237,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T11:55:24.701Z","status":"ssl_error","status_checked_at":"2026-01-30T11:54:13.194Z","response_time":66,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cdek","delivery","delivery-pipelines","dotnet","masterpost"],"created_at":"2024-11-12T07:17:18.496Z","updated_at":"2026-01-30T12:03:27.299Z","avatar_url":"https://github.com/spoleto-software.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spoleto.Delivery\n\n[![](https://img.shields.io/github/license/spoleto-software/Spoleto.Delivery)](https://github.com/spoleto-software/Spoleto.Delivery/blob/main/LICENSE)\n[![](https://img.shields.io/nuget/v/Spoleto.Delivery)](https://www.nuget.org/packages/Spoleto.Delivery/)\n[![total lines](https://img.shields.io/endpoint?url=https://ghloc.vercel.app/api/spoleto-software/Spoleto.Delivery/badge?style=flat\u0026label=total%20lines)](https://github.com/spoleto-software/Spoleto.Delivery)\n![Build](https://github.com/spoleto-software/Spoleto.Delivery/actions/workflows/ci.yml/badge.svg)\n\n**Spoleto.Delivery** is a comprehensive solution designed to integrate delivery functionality into your .NET applications. This project provides a maintainable architecture that simplifies interaction with various delivery providers (e.g., Cdek, MasterPost).  \nThis project supports .NET Standard 2.0, .NET 7, and .NET 8.\n\nhttps://github.com/spoleto-software/Spoleto.Delivery\n\n## Features\n\n- **Abstraction Layer**: Simplifies the integration of delivery services by providing a unified interface.\n- **Multiple Providers**: Supports various delivery providers, allowing you to switch or combine them easily.\n- **Async Support**: Fully supports asynchronous operations for improved performance.\n\n## Quick setup\n\nBegin by installing the package through the [NuGet](https://www.nuget.org/packages/Spoleto.Delivery/) package manager with the command:  \n``Install-Package Spoleto.Delivery``.\n\n## Usage\n\n### Main Interface\n\nThe main interface, `IDeliveryService`, serves as an abstraction layer for the delivery of goods.  \nIt includes all the necessary methods for work with delivery providers, such as getting available tariffs, creating and deleting delivery orders, and others.\n\n### DeliveryProvider\n\nEach delivery provider must implement the `IDeliveryProvider` interface.\n\nDeliveryProvider is the underlying mechanisms that enable the actual delivery functionality. When you incorporate Spoleto.Delivery into your application, it's mandatory to install at least one of the available delivery providers.\n\nThe providers come as pre-configured NuGet packages:\n\n- **[Spoleto.Delivery.Cdek](https://www.nuget.org/packages/Spoleto.Delivery.Cdek/)**: Delivery via CDEK https://www.cdek.ru/; \n- **[Spoleto.Delivery.MasterPost](https://www.nuget.org/packages/Spoleto.Delivery.MasterPost/)**: Delivery via MasterPost https://mplogistics.ru/; \n\n## Example\n\nHere is a simple example to demonstrate how to use Spoleto.Delivery in your project:\n\n```csharp\nusing Spoleto.Delivery;\nusing Spoleto.Delivery.Providers;\n\npublic class Example\n{\n    public async Task Run()\n    {\n        var deliveryService = new DeliveryServiceFactory()\n                                .WithOptions(x =\u003e x.DefaultProvider == CdekProvider.ProviderName)\n                                .AddProvider(new CdekProvider(cdekOptions))\n                                .AddProvider(new MasterPostProvider(masterPostOptions))\n                                .Build();\n\n        var cityRequest = new CityRequest\n        {\n            Name = \"Москва\"\n        };\n        var cities = await deliveryService.GetCitiesAsync(cityRequest);\n\n        var tariffRequest = new TariffRequest\n        {\n            FromLocation = new() { ProviderLocationCode = \"270\" },\n            ToLocation = new() { ProviderLocationCode = \"44\" },\n            Packages =\n            [\n                new()\n                {\n                    Weight = 4000,\n                    Height = 10,\n                    Width = 10,\n                    Length = 10\n                }\n            ],\n        };\n        var tariffs = await deliveryService.GetTariffsAsync(tariffRequest);\n\n        var deliveryOrderRequest = new DeliveryOrderRequest\n        {\n            Type = OrderType.RegularDelivery,\n            Comment = \"Just another test order\",\n            FromLocation = new()\n            {\n                Address = \"Москва, пр. Ленинградский, д.4\",\n            },\n            ToLocation = new()\n            {\n                Address = \"Москва, ул. Блюхера, 32\"\n            },\n            TariffCode = tariffs.First().Code,\n            Packages =\n            [\n                new()\n                {\n                    Number = \"1\",\n                    Comment = \"Test\",\n                    Weight = 1000,\n                    Width = 10,\n                    Height = 10,\n                    Length = 10,\n                },\n            ],\n            Sender = new()\n            {\n                Company = \"Roga\",\n                Name = \"Copyta\",\n                Email = \"roga@copyta.com\",\n                Phones =\n                [\n                    new() { Number = \"+71111111111\" },\n                ],\n            },\n            Recipient = new()\n            {\n                Company = \"Ushi\",\n                Name = \"Hvost\",\n                Email = \"ushi@hvost.com\",\n                Phones =\n                [\n                    new() { Number = \"+72222222222\" },\n                ],\n            },\n        };\n\n        var order = await deliveryService.CreateDeliveryOrderAsync(deliveryOrderRequest);\n        \n        Console.WriteLine($\"Order created with ID: {order.Uuid} and Number: {order.Number}\");\n    }\n}\n```\n\nMore actual examples you can find in tests here:  \nhttps://github.com/spoleto-software/Spoleto.Delivery/tree/main/src/Tests\n\n## Dependency Injection\n\nTo integrate Spoleto.Delivery into Microsoft Dependency injection framework, you should utilize the [**Spoleto.Delivery.Extensions**](https://www.nuget.org/packages/Spoleto.Delivery.Extensions/) NuGet package. This package provides an extension method for the ``IServiceCollection`` interface, which register the DeliveryService as a scoped service.\n\nThe extentions for Delivery providers come as pre-configured NuGet packages:\n\n- **[Spoleto.Delivery.Extensions.Cdek](https://www.nuget.org/packages/Spoleto.Delivery.Extensions.Cdek/)**: CDEK registration; \n- **[Spoleto.Delivery.Extensions.MasterPost](https://www.nuget.org/packages/Spoleto.Delivery.Extensions.MasterPost/)**: MasterPost registration.\n\nAfter ensuring that the ``Spoleto.Delivery.Extensions`` package with at least one Delivery provider package are installed from NuGet, you can proceed with the registration of Spoleto.Delivery within the ``Startup.cs`` or your DI configuration file in the following manner:\n\n```csharp\npublic void ConfigureServices(IServiceCollection services)\n{\n    // Other DI registrations...\n\n    // Register Spoleto.Delivery as a scoped service:\n    services.AddDelivery(MasterPostProvider.ProviderName)\n        .AddMasterPost(\"MasterPost_IndividualClientNumber\", \"MasterPost_ApiKey\", \"MasterPost_ApiKey\", \"MasterPost_ServiceUrl\")\n        .AddCdek(\"Cdek_CliendId\", \"Cdek_ClientSecret\", \"Cdek_ServiceUrl\");\n\n    // Continue with the rest of your service configuration...\n}\n\n```\n\n### Injecting the Delivery Service into Your Classes\nOnce Spoleto.Delivery has been registered with your Dependency Injection framework, you can facilitate the injection of the Delivery service into any class within your application.\n\nInject the ``IDeliveryService`` interface into the constructors of the classes where you want to use Delivery functionality:\n\n```csharp\npublic class YourDeliveryClass\n{\n    private readonly ILogger\u003cYourDeliveryClass\u003e _logger;\n    private readonly IDeliveryService _deliveryService;\n\n    public YourDeliveryClass(ILogger\u003cYourDeliveryClass\u003e logger, IDeliveryService deliveryService)\n    {\n        _logger = logger;\n        _deliveryService = deliveryService;\n    }\n\n    public async Task CreateDeliveryOrder(ModelRequest from, ModelRequest to, ModelData data)\n    {\n        // create a DeliveryOrderRequest\n        var deliveryOrderRequest = CreateDeliveryOrderRequest(from, to, data);\n\n        // create the delivery order using the default Delivery provider:\n        var order = await _deliveryService.CreateDeliveryOrderAsync(deliveryOrderRequest);\n\n        // create the delivery order using the specified Delivery provider:\n        var order1 = await _deliveryService.CreateDeliveryOrderAsync(DeliveryProviderName.Cdek, deliveryOrderRequest);\n        var order2 = await _deliveryService.CreateDeliveryOrderAsync(DeliveryProviderName.MasterPost, deliveryOrderRequest);\n\n        // log the result:\n        _logger.LogInformation(\"Order created with ID: {order.Uuid} and Number: {order.Number}\", order.Uuid, order.Number);\n    }\n}\n```\n\n## Spoleto.AddressResolver\n\n[**Spoleto.AddressResolver**](https://github.com/spoleto-software/Spoleto.AddressResolver) is a library for parsing textual representations of addresses. It is designed to break down an address into its components, such as city, street, house number, fias, kladr and postal code.  \n\nThis library is used in the following code:\n\n1. MasterPost provider to parse textual representations of an address to get a city Fias identifier, if it is not provided.\n2. Cdek provider in the GetDeliveryPoints method for the same reason.\n\n## Callbacks\n\nAlso the solution provides demo examples of implementation of services for updating delivery order statuses.\n\n### Spoleto.Delivery.Callback.Cdek\n\nWeb Api callback service for **[Cdek webhooks](https://api-docs.cdek.ru/29924139.html)**:  \n\nhttps://github.com/spoleto-software/Spoleto.Delivery/tree/main/src/Callbacks/Spoleto.Delivery.Callback.Cdek\n\n\n### Spoleto.Delivery.Callback.MasterPost\n\nWindows service to check delivery order statuses from MasterPost Web service with a specified frequency:  \n\nhttps://github.com/spoleto-software/Spoleto.Delivery/tree/main/src/Callbacks/Spoleto.Delivery.Callback.MasterPost\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspoleto-software%2Fspoleto.delivery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspoleto-software%2Fspoleto.delivery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspoleto-software%2Fspoleto.delivery/lists"}