PunchoutUtils 2.0.4
dotnet add package PunchoutUtils --version 2.0.4
NuGet\Install-Package PunchoutUtils -Version 2.0.4
<PackageReference Include="PunchoutUtils" Version="2.0.4" />
<PackageVersion Include="PunchoutUtils" Version="2.0.4" />
<PackageReference Include="PunchoutUtils" />
paket add PunchoutUtils --version 2.0.4
#r "nuget: PunchoutUtils, 2.0.4"
#:package PunchoutUtils@2.0.4
#addin nuget:?package=PunchoutUtils&version=2.0.4
#tool nuget:?package=PunchoutUtils&version=2.0.4
PunchoutUtils
A nifty utility pack for SAP OCI Punch-outs for dotnet
Features
For now there is only one feature
- Serialize and deserialize a punch-out
Constants
In this document, we will use the following string as a punch-out:
NEW_ITEM-DESCRIPTION%5B0%5D%3DRubber%20duck&NEW_ITEM-QUANTITY%5B0%5D%3D1&NEW_ITEM-DESCRIPTION%5B1%5D%3DData%20structures%20in%20PHP%20%28book%29&NEW_ITEM-QUANTITY%5B1%5D%3D1
Below is a neatly formatted version so you can read it:
NEW_ITEM-DESCRIPTION[0]=Rubber duck&
NEW_ITEM-QUANTITY[0]=1&
NEW_ITEM-DESCRIPTION[1]=Data structures in PHP (book)&
NEW_ITEM-QUANTITY[1]=1
Of course, there are many more fields as documented: https://punchoutcommerce.com/docs/sap-oci-5.pdf
Serialize / Deserialize
// Deserialize
var entries = PunchoutSerializer.Deserialize("NEW_ITEM-DESCRIPTION%5B0%5D%3DRubber%20duck&NEW_ITEM-QUANTITY%5B0%5D%3D1&NEW_ITEM-DESCRIPTION%5B1%5D%3DData%20structures%20in%20PHP%20%28book%29&NEW_ITEM-QUANTITY%5B1%5D%3D1");
// Serialize back to punch-out
var text = PunchoutSerializer.Serialize(entries);
// Or a single item
text = PunchoutSerialize.Serialize(entries.First());
You can also deserialize to your custom model you use for your webshop or your ERP system. Your model should implement the IPunchoutEntry interface.
It is also possible to inherit the PunchoutEntry model, since this class implements IPunchoutEntry as well. Make sure you map the correct fields to your model:
using PunchoutUtils.Attributes;
public class MyCustomModel : IPunchoutEntry
{
[FieldName("DESCRIPTION[n]")]
public string Description { get; set; }
[FieldName("QUANTITY[n]")]
public int Quantity { get; set; }
}
A list of valid field names can be found here: https://punchoutcommerce.com/docs/sap-oci-5.pdf.
The n will be replaced by the index of the item.
var entries = PunchoutSerializer.Deserialize<MyCustomModel>("NEW_ITEM-DESCRIPTION%5B0%5D%3DRubber%20duck&NEW_ITEM-QUANTITY%5B0%5D%3D1&NEW_ITEM-DESCRIPTION%5B1%5D%3DData%20structures%20in%20PHP%20%28book%29&NEW_ITEM-QUANTITY%5B1%5D%3D1");
Bugs
Please create an issue on the github repo if you find anything that doesn't seem right.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Fixed float decimal point localization