{"id":18024350,"url":"https://github.com/stephanstapel/opentrans.net","last_synced_at":"2025-03-27T00:31:04.389Z","repository":{"id":37893157,"uuid":"91944695","full_name":"stephanstapel/OpenTrans.net","owner":"stephanstapel","description":".net implementation of OpenTrans eCommerce data transfer standard","archived":false,"fork":false,"pushed_at":"2023-10-15T09:09:56.000Z","size":16943,"stargazers_count":15,"open_issues_count":3,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-21T11:06:28.296Z","etag":null,"topics":["csharp","csharp-library","ebusiness","order","ordering"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stephanstapel.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}},"created_at":"2017-05-21T09:01:22.000Z","updated_at":"2024-03-18T07:31:00.000Z","dependencies_parsed_at":"2023-10-14T18:54:42.921Z","dependency_job_id":null,"html_url":"https://github.com/stephanstapel/OpenTrans.net","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephanstapel%2FOpenTrans.net","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephanstapel%2FOpenTrans.net/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephanstapel%2FOpenTrans.net/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephanstapel%2FOpenTrans.net/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stephanstapel","download_url":"https://codeload.github.com/stephanstapel/OpenTrans.net/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222178383,"owners_count":16943759,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["csharp","csharp-library","ebusiness","order","ordering"],"created_at":"2024-10-30T07:12:38.913Z","updated_at":"2024-10-30T07:12:39.372Z","avatar_url":"https://github.com/stephanstapel.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenTrans.net\n[![NuGet](https://img.shields.io/nuget/v/OpenTrans.net?color=blue)](https://www.nuget.org/packages/OpenTrans.net/)\n\nOpenTrans is an XML-based format that is used for electronic data exchange in the logistics industry. It defines a set of standardized XML schemas that can be used for exchanging information about orders, order responses, and other logistics-related information between different software systems.\n\nTo make it easier to work with OpenTrans data in C#, you can use the OpenTrans.net library, which provides classes and methods for reading and writing OpenTrans documents. This library can parse OpenTrans XML documents into C# objects and vice versa, allowing you to easily manipulate and process the data.\n\nOne of the most important types of OpenTrans documents are orders and order responses. An order document contains information about a customer's order, including details such as the order ID, customer information, shipping address, and the products being ordered. An order response document contains information about the status of the order, such as whether it has been accepted or rejected by the supplier.\n\nOpenTrans.net supports the latest version of the OpenTrans standard. Additionally, if you need to work with the related BMECat standard for catalog data exchange, you can also use the BMECat.net library (https://github.com/stephanstapel/BMECat.net), which provides similar functionality for reading and writing BMECat documents.\n\n\n# Installation\nYou can get the library from nuget or from Visual Studio Package Manager under the name OpenTrans.net.\n\nThe URL of the package is here:\n\n[![NuGet](https://img.shields.io/nuget/v/OpenTrans.net?color=blue)](https://www.nuget.org/packages/OpenTrans.net/)\n\nhttps://www.nuget.org/packages/OpenTrans.net/\n\n# Usage\n## Creating orders\nFor creating orders, you can simply create Order objects like this:\n\n```csharp\nOrder order = new Order()\n            {\n                Id = \"MyOrderId\",\n                OrderDate = new DateTime(2020, 06, 21, 12, 20, 0),\n                DesiredDeliveryDateStart = new DateTime(2020, 06, 21, 10, 0, 0),\n                DesiredDeliveryDateEnd = new DateTime(2020, 06, 21, 10, 0, 0),\n            };\n```\n\nwith order id being the internal identifier for your order.\nYou can then add parties to your order object where each party comes with specific roles like Buyer, Manufacturer, Supplier and its address and contact data:\n\n```csharp\norder.Parties.Add(new Party(){\n  Ids = new List\u003cPartyId\u003e() { new PartyId() { Id = \"iln-no\", Type = PartyIdTypes.ILN } },\n  Roles = { PartyRoles.Buyer },\n  Name = ....\n});\n```\n\nmake sure to add the appropriate party ids since the document needs to be used by both buyer and supplier and mapping of the ids needs to be possible on both ends.\n\nFinally, you need to add the order items:\n\n```csharp\norder.OrderItems.Add(new OrderItem()\n            {\n                LineItemId = \"1\",\n                OrderUnit = QuantityCodes.C62,\n                ProductId = new ProductId()\n                {\n                  SupplierPId = \"...\",\n                  DescriptionShort = \"...\"\n                },\n                Quantity = 1.0m,\n                LineAmount = 10,\n                Remarks = new List\u003cstring\u003e() { \"Please deliver soon\" }\n            });\n```\n\nAgain, make sure to use appropriate item ids and id reference to allow mapping on both ends of the comunication.\n  \nFinally, all you need is to save the order. You can write the order into a stream (open the stream before):\n```csharp\nStream s = ...\norder.Save(s);\n```\n\nor into a file:\n\n```csharp\norder.Save(\"order.xml\");\n```\n\n## Loading orders\nLoading orders looks similar to saving orders. Again, you can use streams:\n\n```csharp\nStream s = ...\nOrder order = Order.Load(s);\n```\n\nand alternatively you can use file names to load orders:\n\n```csharp\nOrder order = Order.Load(\"order.xml\");\n```\n\n## Creating order responses\nAfter the order is received by the supplier, the supplier answers the order by an order response, in order to acknowledge the order.\nMost information can be copied from the order object which is simple with this library since the exact same types (Party, OrderItem) are used for Order and OrderResponse.\n\n```csharp\nOrderResponse response = new OrderResponse()\n{\n            Id = \"Same id as in the order\",\n            OrderDate = DateTime(... same date as in the order ...),\n            OrderChangeSequenceId = 0           \n};\n```\n\nThen, add the parties (just like in the order):\n\n```csharp\nresponse.Parties.Add(new Party(){\n  ...\n});\n```\n\nand finally, the order items:\n\n```csharp\nresponse.OrderItems.Add(new OrderItem(){\n  ...\n});\n```\n\n\nSave the order response works just like saving orders:\n\n```csharp\nStream s = ...\nresponse.Save(s);\n```\n\nor into a file:\n\n```csharp\nresponse.Save(\"order-response.xml\");\n```\n\n## Loading order responses\nAs the buyer, you will receive the order response from the supplier. In order to read it, you just use:\n\n```csharp\nStream s = ...\nOrderResponse response = OrderResponse.Load(s);\n```\n\nand alternatively you can use file names to load the order response:\n\n```csharp\nOrderResponse response = OrderResponse.Load(\"order-response.xml\");\n```\n\nThe demo application contains some simple examples. Please see here for more details:\n\nhttps://github.com/stephanstapel/OpenTrans.net/blob/master/OpenTrans.net-Test/Application.cs \n\n## Dispatch Notification, Receipt Acknowledgement\nThe other message types will be implemented when someone should require it.\n\n# More information\n* https://www.opentrans.de/\n* https://de.wikipedia.org/wiki/OpenTRANS\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephanstapel%2Fopentrans.net","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstephanstapel%2Fopentrans.net","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephanstapel%2Fopentrans.net/lists"}