Skip to content

Commit

Permalink
including processing mode & binary mode
Browse files Browse the repository at this point in the history
  • Loading branch information
joelibaceta committed Nov 14, 2018
1 parent 4191927 commit b241fd5
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 9 deletions.
6 changes: 3 additions & 3 deletions MercadoPagoSDK.Test/Core/MPBaseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ public void MPBase_ParsePath_ShouldReplaceParamInUrlWithValues()
DummyClass dummy = new DummyClass();
dummy.id = 111;
dummy.email = "[email protected]";
dummy.address = "Evergreen 123";
dummy.address = "Evergreen123";
dummy.maritalStatus = "divorced";
dummy.hasCreditCard = true;

Expand All @@ -407,10 +407,10 @@ public void MPBase_ParsePath_ShouldReplaceParamInUrlWithValues()
Assert.AreEqual("https://api.mercadopago.com/v1/putpath/slug/111/pHasCreditCard/True?access_token=as987ge9ev6s5df4g32z1xv54654", processedPath2);

string processedPath3 = ParsePath("/v1/putpath/slug/:id/pEmail/:email/pAddress/:address", null, dummy);
Assert.AreEqual("https://api.mercadopago.com/v1/putpath/slug/111/pEmail/[email protected]/pAddress/Evergreen 123?access_token=as987ge9ev6s5df4g32z1xv54654", processedPath3);
Assert.AreEqual("https://api.mercadopago.com/v1/putpath/slug/111/pEmail/[email protected]/pAddress/Evergreen123?access_token=as987ge9ev6s5df4g32z1xv54654", processedPath3);

string processedPath4 = ParsePath("/v1/putpath/slug/:id/pEmail/:email/pAddress/:address/pMaritalstatus/:maritalStatus/pHasCreditCard/:hasCreditCard", null, dummy);
Assert.AreEqual("https://api.mercadopago.com/v1/putpath/slug/111/pEmail/[email protected]/pAddress/Evergreen 123/pMaritalstatus/divorced/pHasCreditCard/True?access_token=as987ge9ev6s5df4g32z1xv54654", processedPath4);
Assert.AreEqual("https://api.mercadopago.com/v1/putpath/slug/111/pEmail/[email protected]/pAddress/Evergreen123/pMaritalstatus/divorced/pHasCreditCard/True?access_token=as987ge9ev6s5df4g32z1xv54654", processedPath4);

}
}
Expand Down
3 changes: 0 additions & 3 deletions MercadoPagoSDK.Test/MercadoPagoSDK.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,5 @@
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
<Folder Include="MercadoPagoSDK\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
2 changes: 2 additions & 0 deletions MercadoPagoSDK.Test/Resources/PreferenceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public void Preference_CreateShouldBeOk()

preference.Shipments = shipments;

preference.ProcessingModes.Add(MercadoPago.Common.ProcessingMode.aggregator);

preference.Save();
LastPreference = preference;

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

namespace MercadoPago.Common
{
[JsonConverter(typeof(StringEnumConverter))]
public enum ProcessingMode
{
/// <summary> Payments will be processed with MercadoPago merchant numbers </summary>
aggregator,
/// <summary> Payments will be processed with your own merchant numbers </summary>
gateway
}
}
5 changes: 3 additions & 2 deletions px-dotnet/MercadoPagoSDK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<PackageId>mercadopago-sdk</PackageId>
<PackageVersion>1.0.45</PackageVersion>
<PackageVersion>1.0.46</PackageVersion>
<Authors>Williner Rafael, Zachary Gerardo, Joel Ibaceta</Authors>
<Description>MercadoPago SDK para .Net</Description>
<Owners>MercadoPago</Owners>
Expand All @@ -24,7 +24,7 @@
<Summary>SDK Oficial de MercadoPago para .Net</Summary>
<Title>Mercado Pago SDK</Title>
<NeutralLanguage>es</NeutralLanguage>
<PackageReleaseNotes>Se incluye el atributo SponsorId para la creacion de preferencias.</PackageReleaseNotes>
<PackageReleaseNotes>Se incluye el atributo ProcessingModes para soportar el modo Gateway</PackageReleaseNotes>
<PackageTags>mercadopago</PackageTags>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Expand Down Expand Up @@ -188,6 +188,7 @@
<Compile Include="DataStructures\Generic\RecuperableError.cs" />
<Compile Include="DataStructures\Generic\RecuperableErrorCause.cs" />
<Compile Include="Resources\Refund.cs" />
<Compile Include="Common\ProcessingMode.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
Expand Down
34 changes: 33 additions & 1 deletion px-dotnet/Resources/Preference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ public Preference Update()
private string _marketplace;
private float? _marketplace_fee;
private DifferentialPricing? _differential_pricing;
private string _sponsor_id;
private string _sponsor_id;
private List<ProcessingMode> _processing_modes;
private bool? _binary_mode;
#endregion

#region Accesors
Expand Down Expand Up @@ -431,6 +433,36 @@ public string SponsorId
}
}

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;
}
}

#endregion
}
}

0 comments on commit b241fd5

Please sign in to comment.