Skip to content

Commit e29cc13

Browse files
author
Pedro Gonçalves
authored
Merge pull request #89 from mercadopago/add-taxes
Add taxes
2 parents 1ceb65c + 8033daa commit e29cc13

File tree

6 files changed

+132
-65
lines changed

6 files changed

+132
-65
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ This library provides developers with a simple set of bindings to the Mercado Pa
1717
**Using Package Manager**
1818

1919

20-
`PM> Install-Package mercadopago-sdk -Version 1.0.57`
20+
`PM> Install-Package mercadopago-sdk -Version 1.1.0`
2121

2222
**Using .Net CLI**
2323

24-
`> dotnet add package mercadopago-sdk --version 1.0.57`
24+
`> dotnet add package mercadopago-sdk --version 1.1.0`
2525

2626
**Using Packet CLI**
2727

28-
`> paket add mercadopago-sdk --version 1.0.57`
28+
`> paket add mercadopago-sdk --version 1.1.0`
2929

3030

3131
## Quick Start

px-dotnet/Common/TaxType.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
using Newtonsoft.Json;
3+
using Newtonsoft.Json.Converters;
4+
5+
namespace MercadoPago.Common
6+
{
7+
[JsonConverter(typeof(StringEnumConverter))]
8+
public enum TaxType
9+
{
10+
///<summary>IVA tax</summary>
11+
IVA,
12+
///<summary>INC tax</summary>
13+
INC
14+
}
15+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using MercadoPago.Common;
6+
7+
namespace MercadoPago.DataStructures.Preference
8+
{
9+
public struct Tax {
10+
#region Properties
11+
private TaxType? _type;
12+
private float? _value;
13+
#endregion
14+
15+
#region Accessors
16+
/// <summary>
17+
/// Tax type
18+
/// </summary>
19+
public TaxType? Type {
20+
get { return _type; }
21+
set { _type = value; }
22+
}
23+
/// <summary>
24+
/// Tax value
25+
/// </summary>
26+
public float? Value {
27+
get { return _value; }
28+
set { _value = value; }
29+
}
30+
#endregion
31+
}
32+
}

px-dotnet/MercadoPagoSDK.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@
150150
<Compile Include="DataStructures\Preference\Phone.cs" />
151151
<Compile Include="DataStructures\Preference\ReceiverAddress.cs" />
152152
<Compile Include="DataStructures\Preference\Shipment.cs" />
153+
<Compile Include="DataStructures\Preference\Tax.cs" />
153154
<Compile Include="Resources\Plan.cs" />
154155
<Compile Include="Resources\Subscription.cs" />
155156
<Compile Include="Resources\Preapproval.cs" />
@@ -188,6 +189,7 @@
188189
<Compile Include="DataStructures\Generic\BadParamsCause.cs" />
189190
<Compile Include="Resources\Refund.cs" />
190191
<Compile Include="Common\ProcessingMode.cs" />
192+
<Compile Include="Common\TaxType.cs" />
191193
</ItemGroup>
192194
<ItemGroup>
193195
<None Include="packages.config" />

px-dotnet/Resources/Preference.cs

Lines changed: 78 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
using System.ComponentModel.DataAnnotations;
55
using System.Linq;
66
using System.Text;
7-
using MercadoPago.Common;
8-
using Newtonsoft.Json.Converters;
9-
using Newtonsoft.Json;
10-
7+
using MercadoPago.Common;
8+
using Newtonsoft.Json.Converters;
9+
using Newtonsoft.Json;
10+
1111
namespace MercadoPago.Resources
1212
{
1313
/// <summary>
@@ -82,9 +82,10 @@ public Boolean Update()
8282
private DifferentialPricing? _differential_pricing;
8383
private long? _sponsor_id;
8484
private List<ProcessingMode> _processing_modes;
85-
private bool? _binary_mode;
85+
private bool? _binary_mode;
86+
private List<Tax> _taxes;
8687
#endregion
87-
88+
8889
#region Accesors
8990

9091
/// <summary>
@@ -401,68 +402,85 @@ public DifferentialPricing? Differential_pricing
401402
{
402403
_differential_pricing = value;
403404
}
404-
}
405-
406-
public List<Item> Items
407-
{
408-
get
405+
}
406+
407+
public List<Item> Items
408+
{
409+
get
409410
{
410411
if (_items == null)
411412
{
412413
_items = new List<Item>();
413-
}
414-
return _items;
415-
}
416-
417-
set
418-
{
419-
_items = value;
420-
}
421-
}
422-
423-
public long? SponsorId
424-
{
425-
get
426-
{
427-
return _sponsor_id;
428-
}
429-
430-
set
431-
{
432-
_sponsor_id = value;
433-
}
434-
}
435-
436-
public List<ProcessingMode> ProcessingModes
437-
{
438-
get
414+
}
415+
return _items;
416+
}
417+
418+
set
419+
{
420+
_items = value;
421+
}
422+
}
423+
424+
public long? SponsorId
425+
{
426+
get
427+
{
428+
return _sponsor_id;
429+
}
430+
431+
set
432+
{
433+
_sponsor_id = value;
434+
}
435+
}
436+
437+
public List<ProcessingMode> ProcessingModes
438+
{
439+
get
439440
{
440441
if (_processing_modes == null)
441442
{
442443
_processing_modes = new List<ProcessingMode>();
443-
}
444-
return _processing_modes;
445-
}
446-
447-
set
448-
{
449-
_processing_modes = value;
450-
}
451-
}
452-
453-
public bool? BinaryMode
454-
{
455-
get
456-
{
457-
return _binary_mode;
458-
}
459-
460-
set
461-
{
462-
_binary_mode = value;
463-
}
464-
}
465-
444+
}
445+
return _processing_modes;
446+
}
447+
448+
set
449+
{
450+
_processing_modes = value;
451+
}
452+
}
453+
454+
public bool? BinaryMode
455+
{
456+
get
457+
{
458+
return _binary_mode;
459+
}
460+
461+
set
462+
{
463+
_binary_mode = value;
464+
}
465+
}
466+
467+
public List<Tax> Taxes
468+
{
469+
get
470+
{
471+
if (_taxes == null)
472+
{
473+
_taxes = new List<Tax>();
474+
}
475+
return _taxes;
476+
}
477+
478+
set
479+
{
480+
_taxes = value;
481+
}
482+
}
483+
466484
#endregion
467485
}
468486
}

px-dotnet/px-dotnet.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<?xml version="1.0.1"?>
1+
<?xml version="1.0"?>
22
<package >
33
<metadata>
44
<id>mercadopago-sdk</id>
5-
<version>1</version>
5+
<version>1.1.0</version>
66
<title>MercadopagoSDK</title>
77
<authors>Williner Rafael, Zachary Gerardo, Joel Ibaceta</authors>
88
<owners>Kinexo SA</owners>

0 commit comments

Comments
 (0)