Skip to content

Commit

Permalink
Merge pull request #7 from FacturAPI/feature/orgs-api
Browse files Browse the repository at this point in the history
Feature/orgs api
  • Loading branch information
javorosas authored May 12, 2018
2 parents 6536f99 + 22692c2 commit 4863da3
Show file tree
Hide file tree
Showing 21 changed files with 387 additions and 7 deletions.
2 changes: 1 addition & 1 deletion FacturapiTest/FacturapiTest.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down
5 changes: 5 additions & 0 deletions facturapi-net.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FacturapiTest", "FacturapiT
{A91D3CF3-1051-41F4-833E-C52EE8FBCE20} = {A91D3CF3-1051-41F4-833E-C52EE8FBCE20}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7375A381-9AA2-4E14-95DF-89068A6EBF76}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
2 changes: 1 addition & 1 deletion facturapi-net/Constants/InvoiceRelation.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Facturapi
{
class InvoiceRelation
public static class InvoiceRelation
{
public const string NOTA_DE_CREDITO = "01";
public const string NOTA_DE_DEBITO = "02";
Expand Down
33 changes: 33 additions & 0 deletions facturapi-net/Constants/TaxSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Facturapi
{
public static class TaxSystem
{
public const string GENERAL_LEY_DE_PERSONAS_MORALES = "601";
public const string PERSONAS_MORALES_CON_FINES_NO_LUCRATIVOS = "603";
public const string SUELDOS_Y_SALARIOS = "605";
public const string ARRENDAMIENTO = "606";
public const string DEMAS_INGRESOS = "608";
public const string CONSOLIDACION = "609";
public const string RESIDENTES_EN_EL_EXTRANJERO = "610";
public const string INGRESOS_POR_DIVIDENDOS_SOCIOS_Y_ACCIONISTAS = "611";
public const string PERSONAS_FISICAS_CON_ACTIVIDADES_EMPRESARIALES_Y_PROFESIONALES = "612";
public const string INGRESOS_POR_INTERESES = "614";
public const string SIN_OBLIGACIONES_FISCALES = "616";
public const string SOCIEDADES_COOPERATIVAS_DE_PRODUCCION = "620";
public const string REGIMEN_DE_INCORPORACION_FISCAL = "621";
public const string ACTIVIDADES_AGRICOLAS_GANADERAS_SILVICOLAS_Y_PESQUERAS = "622";
public const string OPCIONAL_PARA_GRUPOS_DE_SOCIEDADES = "623";
public const string COORDINADOS = "624";
public const string HIDROCARBUROS = "628";
public const string REGIMEN_DE_ENAJENACION_O_ADQUISICION_DE_BIENES = "607";
public const string PREFERENTES_Y_EMPRESAS_MULTINACIONALES = "629";
public const string ENAJENACION_DE_ACCIONES_EN_BOLSA_DE_VALORES = "630";
public const string REGIMEN_DE_LOS_INGRESOS_POR_OBTENCION_DE_PREMIOS = "615";
}
}
48 changes: 46 additions & 2 deletions facturapi-net/Facturapi.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\NuGet.Build.Packaging.0.2.2\build\NuGet.Build.Packaging.props" Condition="Exists('..\packages\NuGet.Build.Packaging.0.2.2\build\NuGet.Build.Packaging.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand All @@ -12,6 +13,23 @@
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<PackOnBuild>true</PackOnBuild>
<Authors>Javier Rosas</Authors>
<PackageIconUrl>https://github.com/FacturAPI/facturapi-net/raw/master/facturapi-net/facturapi.png</PackageIconUrl>
<NeutralLanguage>es-MX</NeutralLanguage>
<PackageLicenseUrl>https://raw.githubusercontent.com/FacturAPI/facturapi-net/master/LICENSE</PackageLicenseUrl>
<Owners>Facturapi</Owners>
<PackageProjectUrl>https://www.facturapi.io</PackageProjectUrl>
<Summary>Genera facturas electrónicas válidas en México (CFDI) lo más fácil posible. Obtén tus API Keys creando una cuenta gratuita en https://www.facturapi.io</Summary>
<PackageTags>factura factura-electronica cfdi facturapi mexico conekta</PackageTags>
<Title>Facturapi</Title>
<Description>Genera facturas electrónicas válidas en México (CFDI) lo más fácil posible. Obtén tus API Keys creando una cuenta gratuita en https://www.facturapi.io</Description>
<PackageId>Facturapi</PackageId>
<ReleaseVersion>0.3.0</ReleaseVersion>
<SynchReleaseVersion>false</SynchReleaseVersion>
<PackageVersion>0.3.1</PackageVersion>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -22,9 +40,17 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<CustomCommands>
<CustomCommands>
<Command>
<type>Build</type>
</Command>
</CustomCommands>
</CustomCommands>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DebugType>
</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
Expand Down Expand Up @@ -57,17 +83,26 @@
<Compile Include="Constants\InvoiceUse.cs" />
<Compile Include="Constants\PaymentMethod.cs" />
<Compile Include="Constants\PaymentForm.cs" />
<Compile Include="Constants\TaxSystem.cs" />
<Compile Include="FacturapiException.cs" />
<Compile Include="Models\Address.cs" />
<Compile Include="Models\ApiKeys.cs" />
<Compile Include="Models\Certificate.cs" />
<Compile Include="Models\CompletionStep.cs" />
<Compile Include="Models\Customer.cs" />
<Compile Include="Models\Customization.cs" />
<Compile Include="Models\Invoice.cs" />
<Compile Include="Models\InvoiceItem.cs" />
<Compile Include="Models\Legal.cs" />
<Compile Include="Models\Organization.cs" />
<Compile Include="Models\PdfExtra.cs" />
<Compile Include="Models\Product.cs" />
<Compile Include="Constants\TaxType.cs" />
<Compile Include="Models\SearchResult.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Models\Tax.cs" />
<Compile Include="Router\InvoiceRouter.cs" />
<Compile Include="Router\OrganizationRouter.cs" />
<Compile Include="Settings.cs" />
<Compile Include="Util\SnakeCasePropertyNamesContractResolver.cs" />
<Compile Include="Router\CustomerRouter.cs" />
Expand All @@ -76,6 +111,7 @@
<Compile Include="Router\ProductRouter.cs" />
<Compile Include="Router\Router.cs" />
<Compile Include="Wrapper\InvoiceWrapper.cs" />
<Compile Include="Wrapper\OrganizationWrapper.cs" />
<Compile Include="Wrapper\ProductWrapper.cs" />
<Compile Include="Wrapper\BaseWrapper.cs" />
</ItemGroup>
Expand All @@ -88,4 +124,12 @@
<Content Include="facturapi.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\NuGet.Build.Packaging.0.2.2\build\NuGet.Build.Packaging.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NuGet.Build.Packaging.0.2.2\build\NuGet.Build.Packaging.props'))" />
<Error Condition="!Exists('..\packages\NuGet.Build.Packaging.0.2.2\build\NuGet.Build.Packaging.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NuGet.Build.Packaging.0.2.2\build\NuGet.Build.Packaging.targets'))" />
</Target>
<Import Project="..\packages\NuGet.Build.Packaging.0.2.2\build\NuGet.Build.Packaging.targets" Condition="Exists('..\packages\NuGet.Build.Packaging.0.2.2\build\NuGet.Build.Packaging.targets')" />
</Project>
8 changes: 8 additions & 0 deletions facturapi-net/Models/ApiKeys.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Facturapi
{
public class ApiKeys
{
public string LiveKey { get; set; }
public string TestKey { get; set; }
}
}
11 changes: 11 additions & 0 deletions facturapi-net/Models/Certificate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;

namespace Facturapi
{
public class Certificate
{
public DateTime UpdatedAt { get; set; }
public DateTime ExpiresAt { get; set; }
public bool HasCertificate { get; set; }
}
}
15 changes: 15 additions & 0 deletions facturapi-net/Models/CompletionStep.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Facturapi.Wrappers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Facturapi
{
public class CompletionStep
{
public string Type { get; set; }
public string Description { get; set; }
}
}
7 changes: 6 additions & 1 deletion facturapi-net/Models/Customer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,32 @@ public class Customer
public Address Address { get; set; }
public string LegalName { get; set; }
public string TaxId { get; set; }


[Obsolete("Methods requiring you to set ApiKeys globally are deprecated and will be removed in the next major release. Use methods from the Facturapi.Wrapper instance instead.")]
public static Task<SearchResult<Customer>> ListAsync (Dictionary<string, object> query = null)
{
return new CustomerWrapper().ListAsync(query);
}

[Obsolete("Methods requiring you to set ApiKeys globally are deprecated and will be removed in the next major release. Use methods from the Facturapi.Wrapper instance instead.")]
public static Task<Customer> CreateAsync (Dictionary<string, object> data)
{
return new CustomerWrapper().CreateAsync(data);
}

[Obsolete("Methods requiring you to set ApiKeys globally are deprecated and will be removed in the next major release. Use methods from the Facturapi.Wrapper instance instead.")]
public static Task<Customer> RetrieveAsync (string id)
{
return new CustomerWrapper().RetrieveAsync(id);
}

[Obsolete("Methods requiring you to set ApiKeys globally are deprecated and will be removed in the next major release. Use methods from the Facturapi.Wrapper instance instead.")]
public static Task<Customer> DeleteAsync (string id)
{
return new CustomerWrapper().DeleteAsync(id);
}

[Obsolete("Methods requiring you to set ApiKeys globally are deprecated and will be removed in the next major release. Use methods from the Facturapi.Wrapper instance instead.")]
public static Task<Customer> UpdateAsync (string id, Dictionary<string, object> data)
{
return new CustomerWrapper().UpdateAsync(id, data);
Expand Down
9 changes: 9 additions & 0 deletions facturapi-net/Models/Customization.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Facturapi
{
public class Customization
{
public string Color { get; set; }
public bool HasLogo { get; set; }
public PdfExtra PdfExtra { get; set; }
}
}
8 changes: 8 additions & 0 deletions facturapi-net/Models/Invoice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,49 @@ public class Invoice
public string PaymentForm { get; set; }
public List<InvoiceItem> Items { get; set; }

[Obsolete("Methods requiring you to set ApiKeys globally are deprecated and will be removed in the next major release. Use methods from the Facturapi.Wrapper instance instead.")]
public static Task<SearchResult<Invoice>> ListAsync(Dictionary<string, object> query = null)
{
return new InvoiceWrapper().ListAsync(query);
}

[Obsolete("Methods requiring you to set ApiKeys globally are deprecated and will be removed in the next major release. Use methods from the Facturapi.Wrapper instance instead.")]
public static Task<Invoice> CreateAsync(Dictionary<string, object> data)
{
return new InvoiceWrapper().CreateAsync(data);
}

[Obsolete("Methods requiring you to set ApiKeys globally are deprecated and will be removed in the next major release. Use methods from the Facturapi.Wrapper instance instead.")]
public static Task<Invoice> RetrieveAsync(string id)
{
return new InvoiceWrapper().RetrieveAsync(id);
}

[Obsolete("Methods requiring you to set ApiKeys globally are deprecated and will be removed in the next major release. Use methods from the Facturapi.Wrapper instance instead.")]
public static Task<Invoice> CancelAsync(string id)
{
return new InvoiceWrapper().CancelAsync(id);
}

[Obsolete("Methods requiring you to set ApiKeys globally are deprecated and will be removed in the next major release. Use methods from the Facturapi.Wrapper instance instead.")]
public static Task SendByEmailAsync(string id)
{
return new InvoiceWrapper().SendByEmailAsync(id);
}

[Obsolete("Methods requiring you to set ApiKeys globally are deprecated and will be removed in the next major release. Use methods from the Facturapi.Wrapper instance instead.")]
public static Task<Stream> DownloadXmlAsync(string id)
{
return new InvoiceWrapper().DownloadXmlAsync(id);
}

[Obsolete("Methods requiring you to set ApiKeys globally are deprecated and will be removed in the next major release. Use methods from the Facturapi.Wrapper instance instead.")]
public static Task<Stream> DownloadPdfAsync(string id)
{
return new InvoiceWrapper().DownloadPdfAsync(id);
}

[Obsolete("Methods requiring you to set ApiKeys globally are deprecated and will be removed in the next major release. Use methods from the Facturapi.Wrapper instance instead.")]
public static Task<Stream> DownloadZipAsync(string id)
{
return new InvoiceWrapper().DownloadZipAsync(id);
Expand Down
12 changes: 12 additions & 0 deletions facturapi-net/Models/Legal.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace Facturapi
{
public class Legal {
public string Name { get; set; }
public string LegalName { get; set; }
public string TaxId { get; set; }
public string TaxSystem { get; set; }
public string Website { get; set; }
public string Phone { get; set; }
public Address Address { get; set; }
}
}
16 changes: 16 additions & 0 deletions facturapi-net/Models/Organization.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;

namespace Facturapi
{
public class Organization
{
public string Id { get; set; }
public DateTime CreatedAt { get; set; }
public bool IsProductionReady { get; set; }
public List<CompletionStep> PendingSteps { get; set; }
public Legal Legal { get; set; }
public Customization Customization { get; set; }
public Certificate Certificate { get; set; }
}
}
8 changes: 8 additions & 0 deletions facturapi-net/Models/PdfExtra.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Facturapi
{
public class PdfExtra
{
public bool Codes { get; set; }
public bool ProductKey { get; set; }
}
}
5 changes: 5 additions & 0 deletions facturapi-net/Models/Product.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,31 @@ public class Product
public string UnitName { get; set; }
public string Sku { get; set; }

[Obsolete("Methods requiring you to set ApiKeys globally are deprecated and will be removed in the next major release. Use methods from the Facturapi.Wrapper instance instead.")]
public static Task<SearchResult<Product>> ListAsync(Dictionary<string, object> query = null)
{
return new ProductWrapper().ListAsync(query);
}

[Obsolete("Methods requiring you to set ApiKeys globally are deprecated and will be removed in the next major release. Use methods from the Facturapi.Wrapper instance instead.")]
public static Task<Product> CreateAsync(Dictionary<string, object> data)
{
return new ProductWrapper().CreateAsync(data);
}

[Obsolete("Methods requiring you to set ApiKeys globally are deprecated and will be removed in the next major release. Use methods from the Facturapi.Wrapper instance instead.")]
public static Task<Product> RetrieveAsync(string id)
{
return new ProductWrapper().RetrieveAsync(id);
}

[Obsolete("Methods requiring you to set ApiKeys globally are deprecated and will be removed in the next major release. Use methods from the Facturapi.Wrapper instance instead.")]
public static Task<Product> DeleteAsync(string id)
{
return new ProductWrapper().DeleteAsync(id);
}

[Obsolete("Methods requiring you to set ApiKeys globally are deprecated and will be removed in the next major release. Use methods from the Facturapi.Wrapper instance instead.")]
public static Task<Product> UpdateAsync(string id, Dictionary<string, object> data)
{
return new ProductWrapper().UpdateAsync(id, data);
Expand Down
4 changes: 2 additions & 2 deletions facturapi-net/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.3.2.*")]
[assembly: AssemblyFileVersion("0.3.2.0")]
[assembly: AssemblyVersion("0.4.0.*")]
[assembly: AssemblyFileVersion("0.4.0.0")]
Loading

0 comments on commit 4863da3

Please sign in to comment.