Skip to content

Commit

Permalink
Merge pull request mercadopago#89 from mercadopago/add-taxes
Browse files Browse the repository at this point in the history
Add taxes
  • Loading branch information
Pedro Gonçalves authored Sep 3, 2019
2 parents 1ceb65c + 8033daa commit e29cc13
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 65 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ This library provides developers with a simple set of bindings to the Mercado Pa
**Using Package Manager**


`PM> Install-Package mercadopago-sdk -Version 1.0.57`
`PM> Install-Package mercadopago-sdk -Version 1.1.0`

**Using .Net CLI**

`> dotnet add package mercadopago-sdk --version 1.0.57`
`> dotnet add package mercadopago-sdk --version 1.1.0`

**Using Packet CLI**

`> paket add mercadopago-sdk --version 1.0.57`
`> paket add mercadopago-sdk --version 1.1.0`


## Quick Start
Expand Down
15 changes: 15 additions & 0 deletions px-dotnet/Common/TaxType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace MercadoPago.Common
{
[JsonConverter(typeof(StringEnumConverter))]
public enum TaxType
{
///<summary>IVA tax</summary>
IVA,
///<summary>INC tax</summary>
INC
}
}
32 changes: 32 additions & 0 deletions px-dotnet/DataStructures/Preference/Tax.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MercadoPago.Common;

namespace MercadoPago.DataStructures.Preference
{
public struct Tax {
#region Properties
private TaxType? _type;
private float? _value;
#endregion

#region Accessors
/// <summary>
/// Tax type
/// </summary>
public TaxType? Type {
get { return _type; }
set { _type = value; }
}
/// <summary>
/// Tax value
/// </summary>
public float? Value {
get { return _value; }
set { _value = value; }
}
#endregion
}
}
2 changes: 2 additions & 0 deletions px-dotnet/MercadoPagoSDK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
<Compile Include="DataStructures\Preference\Phone.cs" />
<Compile Include="DataStructures\Preference\ReceiverAddress.cs" />
<Compile Include="DataStructures\Preference\Shipment.cs" />
<Compile Include="DataStructures\Preference\Tax.cs" />
<Compile Include="Resources\Plan.cs" />
<Compile Include="Resources\Subscription.cs" />
<Compile Include="Resources\Preapproval.cs" />
Expand Down Expand Up @@ -188,6 +189,7 @@
<Compile Include="DataStructures\Generic\BadParamsCause.cs" />
<Compile Include="Resources\Refund.cs" />
<Compile Include="Common\ProcessingMode.cs" />
<Compile Include="Common\TaxType.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
Expand Down
138 changes: 78 additions & 60 deletions px-dotnet/Resources/Preference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using MercadoPago.Common;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json;

using MercadoPago.Common;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json;

namespace MercadoPago.Resources
{
/// <summary>
Expand Down Expand Up @@ -82,9 +82,10 @@ public Boolean Update()
private DifferentialPricing? _differential_pricing;
private long? _sponsor_id;
private List<ProcessingMode> _processing_modes;
private bool? _binary_mode;
private bool? _binary_mode;
private List<Tax> _taxes;
#endregion


#region Accesors

/// <summary>
Expand Down Expand Up @@ -401,68 +402,85 @@ public DifferentialPricing? Differential_pricing
{
_differential_pricing = value;
}
}

public List<Item> Items
{
get
}

public List<Item> Items
{
get
{
if (_items == null)
{
_items = new List<Item>();
}
return _items;
}

set
{
_items = value;
}
}

public long? SponsorId
{
get
{
return _sponsor_id;
}

set
{
_sponsor_id = value;
}
}

public List<ProcessingMode> ProcessingModes
{
get
}
return _items;
}

set
{
_items = value;
}
}

public long? SponsorId
{
get
{
return _sponsor_id;
}

set
{
_sponsor_id = value;
}
}

public List<ProcessingMode> ProcessingModes
{
get
{
if (_processing_modes == null)
{
_processing_modes = new List<ProcessingMode>();
}
return _processing_modes;
}

set
{
_processing_modes = value;
}
}

public bool? BinaryMode
{
get
{
return _binary_mode;
}

set
{
_binary_mode = value;
}
}

}
return _processing_modes;
}

set
{
_processing_modes = value;
}
}

public bool? BinaryMode
{
get
{
return _binary_mode;
}

set
{
_binary_mode = value;
}
}

public List<Tax> Taxes
{
get
{
if (_taxes == null)
{
_taxes = new List<Tax>();
}
return _taxes;
}

set
{
_taxes = value;
}
}

#endregion
}
}
4 changes: 2 additions & 2 deletions px-dotnet/px-dotnet.nuspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0.1"?>
<?xml version="1.0"?>
<package >
<metadata>
<id>mercadopago-sdk</id>
<version>1</version>
<version>1.1.0</version>
<title>MercadopagoSDK</title>
<authors>Williner Rafael, Zachary Gerardo, Joel Ibaceta</authors>
<owners>Kinexo SA</owners>
Expand Down

0 comments on commit e29cc13

Please sign in to comment.