osigu.sales.reporting.sdk
1.0.0
dotnet add package osigu.sales.reporting.sdk --version 1.0.0
NuGet\Install-Package osigu.sales.reporting.sdk -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="osigu.sales.reporting.sdk" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add osigu.sales.reporting.sdk --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: osigu.sales.reporting.sdk, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install osigu.sales.reporting.sdk as a Cake Addin #addin nuget:?package=osigu.sales.reporting.sdk&version=1.0.0 // Install osigu.sales.reporting.sdk as a Cake Tool #tool nuget:?package=osigu.sales.reporting.sdk&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Osigu Sales Reporting SDK
How to install
Nuget
First, you need to have the nuget client tool installed on your development machine. In case you are using Visual Studio 2012 or later, it should come already preinstalled. Otherwise here is a handy link with information: https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools#visual-studio
How to Use
C# .NET Sample Code
using System.Collections.Generic;
using System.Globalization;
using Osigu.SalesReporting;
namespace DotNetSample
{
class SalesReporting
{
private const string ClientId = "some-client-id";
private const string ClientSecret = "some-client-secret";
static void Main(string[] args)
{
var cultureInfo = new CultureInfo("es-GT");
var regionInfo = new RegionInfo(cultureInfo.Name);
var environment = Environment.Sandbox;
var config = new ClientConfiguration(ClientId, ClientSecret, cultureInfo, environment);
var salesClient = new SalesReportingClient(config);
var customer = TransactionRequest.TransactionCustomer.Builder()
.Identification("2055-01234-0101")
.IdentificationType(IdentificationType.Cui)
.Build();
var item = TransactionRequest.Invoice.Item.Builder()
.CodeStandard("SKU")
.Code("10001")
.Name("Nexium")
.Quantity(10)
.Price(new decimal(15))
.DiscountAmount(new decimal(9.75))
.TotalAmount(new decimal(140.25))
.Build();
var transactionInvoice = TransactionRequest.Invoice.Builder()
.DocumentNumber("10001")
.DocumentSerial("A")
.DocumentDate(System.DateTime.Now)
.DigitalSignature("go/K9ZiVnO8iVL7vDNeVITVzNN0f0WvCKjUKnK88lG1pnBp3Xy")
.PayerName("Jose Mendoza")
.SubtotalAmount(new decimal(140.25))
.DiscountAmount(new decimal(10.25))
.TotalAmount(new decimal(130))
.CurrencyCode(regionInfo.ISOCurrencySymbol)
.Items(new List<TransactionRequest.Invoice.Item>() { item })
.Build();
var transactionRequest = TransactionRequest.Builder()
.Customer(customer)
.TransactionDate(System.DateTime.Now)
.ClerkCode("142AC")
.ClerkName("Jose Mendoza")
.TransactionInvoice(transactionInvoice)
.Build();
Transaction transaction;
try
{
transaction = salesClient.CreateTransaction(transactionRequest);
}
catch (ValidationException validationException)
{
System.Console.WriteLine("validationException: " + validationException.Message);
}
catch (ClientException clientException)
{
System.Console.WriteLine("HttpStatusCode: " + clientException.HttpStatusCode);
System.Console.WriteLine("Message: " + clientException.Message);
if (clientException.Errors != null)
{
var errorsToString = "";
var errorsEnumerator = clientException.Errors.GetEnumerator();
while (errorsEnumerator.MoveNext())
{
errorsToString += "[Path: " + errorsEnumerator.Current.path +
", Code:" + errorsEnumerator.Current.code +
", Message: " + errorsEnumerator.Current.message + "], ";
}
errorsEnumerator.Dispose();
System.Console.WriteLine("Error Details: " + errorsToString);
}
}
catch (ApiException apiException)
{
System.Console.WriteLine("HttpStatusCode: " + apiException.HttpStatusCode);
System.Console.WriteLine("Code: " + apiException.ErrorCode);
System.Console.WriteLine("Message: " + apiException.Message);
}
}
}
}
VB .NET Sample Code
Imports System.Globalization
Imports System.Net.Http
Imports Osigu.SalesReporting
Module VisualBasicSample
Private Const ClientId = "some-client-id"
Private Const ClientSecret = "some-client-secret"
Sub Main()
Dim cultureInfo = New CultureInfo("es-GT")
Dim regionInfo = New RegionInfo(cultureInfo.Name)
Dim clientConfiguration = New ClientConfiguration(
ClientId,
ClientSecret,
cultureInfo,
Environment.Sandbox)
Dim salesClient = New SalesReportingClient(clientConfiguration)
Dim transactionCustomer As TransactionRequest.TransactionCustomer =
TransactionRequest.TransactionCustomer.Builder() _
.Identification("1564242") _
.IdentificationType(IdentificationType.Provider) _
.Build()
Dim item As TransactionRequest.Invoice.Item =
TransactionRequest.Invoice.Item.Builder() _
.CodeStandard("SKU") _
.Code("10001") _
.Name("Termometro A") _
.Quantity(10) _
.Price(New Decimal(15.0)) _
.DiscountAmount(New Decimal(9.75)) _
.TotalAmount(New Decimal(140.25)) _
.Build()
Dim transactionInvoice As TransactionRequest.Invoice =
TransactionRequest.Invoice.Builder() _
.DocumentNumber("10001") _
.DocumentSerial("A") _
.DocumentDate(DateTime.Now) _
.DigitalSignature("go/K9ZiVnO8iVL7vDNeVITVzNN0f0WvCKjUKnK88lG1pnBp3Xy") _
.PayerName("Jose Mendoza") _
.SubtotalAmount(New Decimal(140.25)) _
.DiscountAmount(New Decimal(10.25)) _
.TotalAmount(New Decimal(130.0)) _
.CurrencyCode(regionInfo.ISOCurrencySymbol) _
.Items(New List(Of TransactionRequest.Invoice.Item) From {item}) _
.Build()
Dim transaction As TransactionRequest =
TransactionRequest.Builder() _
.Customer(transactionCustomer) _
.TransactionDate(DateTime.Now) _
.ClerkCode("142AC") _
.ClerkName("Jose Mendoza") _
.TransactionInvoice(transactionInvoice) _
.Build()
Dim transactionResponse
Try
transactionResponse = salesClient.CreateTransaction(transaction)
Catch validationException As ValidationException
Console.WriteLine("Message: " + validationException.Message)
Catch clientException As ClientException
Console.WriteLine("HttpStatusCode: " + clientException.HttpStatusCode.ToString())
Console.WriteLine("Message: " + clientException.Message)
If (Not (clientException.Errors Is Nothing)) Then
For Each errorValue As [Error] In clientException.Errors
Console.WriteLine(
"Error Path: " + errorValue.path + ", Error Code: " + errorValue.code + ", Message: " +
errorValue.message)
Next errorValue
End If
Catch apiException As ApiException
Console.WriteLine("HttpStatusCode: " + apiException.HttpStatusCode.ToString())
Console.WriteLine("Code: " + apiException.ErrorCode)
Console.WriteLine("Message: " + apiException.Message)
Catch httpRequestException As HttpRequestException
Console.WriteLine("Message: " + httpRequestException.Message)
Console.WriteLine("Source: " + httpRequestException.Source)
Console.WriteLine("ToString: " + httpRequestException.ToString())
Catch exception As Exception
Console.WriteLine("Something went wrong")
Console.WriteLine("Message: " + exception.ToString())
End Try
End Sub
End Module
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.5
- Newtonsoft.Json (>= 10.0.3)
- RestSharp (>= 105.2.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 1,047 | 4/11/2018 |