Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New IPNhandler #58

Closed
wants to merge 66 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
82810b6
Web Checkout example
dotfede Jun 26, 2018
2dcf42e
cleanup
dotfede Jun 26, 2018
9ea1549
Newtonsoft Binding Redirect in Test Project
dotfede Jun 26, 2018
a377139
Cargar o pedir al usuario AccessToken/LiveToken dependiendo del ejemplo
dotfede Jun 28, 2018
5ccd60a
Se reemplaza float por decimal para todos los valores monetarios del …
dotfede Jun 28, 2018
076eb7e
Nested Validations
dotfede Jun 28, 2018
c248ebe
Validation Tests
dotfede Jun 28, 2018
313dc4c
Merge branch 'master' of https://github.com/mercadopago/dx-dotnet
dotfede Jun 29, 2018
37c03ac
Merge branch 'DecimalForCurrency' into CodeCleanup
dotfede Jun 29, 2018
093804c
Converted all field/property pairs to Auto Properties, while keeping …
dotfede Jun 29, 2018
7541a21
Merge branch 'CodeCleanup' into DeepValidations
dotfede Jun 29, 2018
b231948
partial commit
dotfede Jun 29, 2018
84d31d8
Deep Validation Tests Passed
dotfede Jun 29, 2018
3852bb5
Deep Validation level 2 test
dotfede Jun 29, 2018
b247aaa
Merge branch 'master' of https://github.com/fberasategui/dx-dotnet
dotfede Jun 29, 2018
00a2640
Merge branch 'master' into DeepValidations
dotfede Jun 29, 2018
a4745fc
Removed Validation logic from MPBase
dotfede Jun 29, 2018
14d7073
DeepValidation list support
dotfede Jun 29, 2018
2764e2b
List Validations / Tests OK
dotfede Jun 29, 2018
fae9b16
app.config fix
dotfede Jun 29, 2018
312478e
Fixed app.config filename casing in Test Project
dotfede Jul 6, 2018
2d0a47d
ReflectionLess Resources - Initial Commit
dotfede Jul 8, 2018
599be97
MercadoPagoSdk.CodeAnalysis - Initial Commit
dotfede Jul 9, 2018
7bc2639
CodeAnalysis Fixes
dotfede Jul 9, 2018
a18acd9
New Resource classes
dotfede Jul 9, 2018
1ac1a4d
Query Parameters Support
dotfede Jul 9, 2018
d3d973a
Serialization fix
dotfede Jul 9, 2018
6c85cfc
IdentificationType Resource
dotfede Jul 9, 2018
4f5c9a8
Payment Search Example
dotfede Jul 9, 2018
67ddb88
LINQ Provider - Initial Commit - Needs Visitor
dotfede Jul 9, 2018
52dfcd1
LINQ Provider - Implemented WHERE Visitor
dotfede Jul 9, 2018
c78c590
Replaced old MPBase-based resources by new ones based on Resource<T>
dotfede Jul 9, 2018
3df9a9d
Removed all traces of MPBase
dotfede Jul 10, 2018
01b335d
Hooked Validator logic to Resource POST/PUT
dotfede Jul 10, 2018
673b4e9
ResourceBase.UserAccessToken summary
dotfede Jul 10, 2018
6a44783
MercadoPagoExample - UserAccessToken
dotfede Jul 10, 2018
79218ae
internal all the things
dotfede Jul 10, 2018
037bc98
Fixing parse path and bulk process methods (#56)
Jul 11, 2018
b98d937
Update nuget version
Jul 11, 2018
c9933c3
Merge branch 'master' of https://github.com/mercadopago/dx-dotnet
dotfede Jul 11, 2018
18284e4
restored MPBase file in order to merge latest commits on origin/master
dotfede Jul 11, 2018
5161676
Merge branch 'master' into ReflectionLessResources
dotfede Jul 11, 2018
6c37908
Adapted changes from latest changes on master to new model.
dotfede Jul 11, 2018
c87c004
removed unneeded / extraneous code from LINQ Provider
dotfede Jul 11, 2018
69a6610
sponsor id from string to long
Jul 13, 2018
3dad465
update nuget version
Jul 13, 2018
a336bde
Merge branch 'master' of https://github.com/mercadopago/dx-dotnet
dotfede Jul 17, 2018
0fb544a
merge master
dotfede Jul 17, 2018
16a0332
Fixed Idempotency / POST call must send entire resource, not diff, as…
dotfede Jul 17, 2018
16ba439
Fixed possible NullReferenceException in MPRestClient
dotfede Jul 17, 2018
87f8039
Reenabled Card tests
dotfede Jul 17, 2018
1c0f935
Fixed Payment resource class errors
dotfede Jul 17, 2018
3ef846e
Improved CustomerTest error message
dotfede Jul 17, 2018
88116d6
Removed Regexp validation attribute from UnitPrice property
dotfede Jul 17, 2018
e98da9a
Added UnitTests.md and fixed minor issues in README.md
dotfede Jul 17, 2018
9047d5d
Resource base class Tests (adapted from MPBase tests)
dotfede Jul 17, 2018
4bb112f
fixed some unit tests
dotfede Jul 18, 2018
07b2884
fixed timeout tests
dotfede Jul 18, 2018
f68c8f8
Customer Endpoint error fix
dotfede Jul 25, 2018
1d4b7f0
Merchant Order Endpoints / Model error fixes
dotfede Jul 25, 2018
1266884
Payment Validation Attributes
dotfede Jul 25, 2018
1e1b35a
Ignore UserAccessToken in Json Serialization
dotfede Jul 25, 2018
bb698dd
Validator - Cosmetic fixes
dotfede Jul 25, 2018
a78730d
PayloadType enum is now internal
dotfede Jul 25, 2018
ad9357a
New Ipn Handler + Tests + Examples
dotfede Jul 25, 2018
6b23270
IPN string are now internal
dotfede Jul 25, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,4 @@ orleans.codegen.cs
FakesAssemblies/

.nuget
.DS_Store
.DS_Store
13 changes: 13 additions & 0 deletions MercadoPagoExample/MercadoPagoExample.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.Net.Compilers.2.8.2\build\Microsoft.Net.Compilers.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.2.8.2\build\Microsoft.Net.Compilers.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand All @@ -8,6 +9,8 @@
<RootNamespace>MercadoPagoExample</RootNamespace>
<AssemblyName>MercadoPagoExample</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -31,7 +34,10 @@
<Reference Include="System.Configuration" />
</ItemGroup>
<ItemGroup>
<Compile Include="Payments\IpnExample.cs" />
<Compile Include="Payments\PaymentSearchExample.cs" />
<Compile Include="Payments\SavedCardsExample.cs" />
<Compile Include="Payments\UserAccessTokenExample.cs" />
<Compile Include="Payments\WebCheckoutExample.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand All @@ -40,6 +46,7 @@
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\px-dotnet\MercadoPagoSDK.csproj">
Expand All @@ -48,4 +55,10 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\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\Microsoft.Net.Compilers.2.8.2\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.2.8.2\build\Microsoft.Net.Compilers.props'))" />
</Target>
</Project>
33 changes: 33 additions & 0 deletions MercadoPagoExample/Payments/IpnExample.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using MercadoPago;
using MercadoPago.Resources;

namespace MercadoPagoExample.Payments
{
public static class IpnExample
{
public static void Run()
{
Utils.LoadOrPromptAccessToken();

// You will receive this invocation via an HTTP POST from MercadoPago to your web application
IpnNotification("payment", "1234");
}

// Put this in an ASP.NET controller supporting HTTP POST
public static void IpnNotification(string topic, string id)
{
Ipn.HandleNotification(topic, id, onPaymentReceived: OnPaymentReceived, onMerchantOrderReceived: OnMerchantOrderReceived);
}

private static void OnPaymentReceived(Payment payment)
{
Console.WriteLine($"Payment Received: {payment.Id}");
}

private static void OnMerchantOrderReceived(MerchantOrder merchantOrder)
{
Console.WriteLine($"Merchant Order Received: {merchantOrder.Id}");
}
}
}
26 changes: 26 additions & 0 deletions MercadoPagoExample/Payments/PaymentSearchExample.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using MercadoPago.Resources;
using System.Linq;
using MercadoPago.Common;

namespace MercadoPagoExample.Payments
{
public static class PaymentSearchExample
{
public static void Run()
{
Utils.LoadOrPromptAccessToken();

var allPayments = Payment.All();

var approvedPayments =
Payment.Query()
.Where(x => x.Status == PaymentStatus.approved)
.ToList();

var rejectedPayments =
Payment.Query()
.Where(x => x.Status == PaymentStatus.rejected)
.ToList();
}
}
}
39 changes: 39 additions & 0 deletions MercadoPagoExample/Payments/UserAccessTokenExample.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System.Diagnostics;
using MercadoPago.Common;
using MercadoPago.DataStructures.Preference;
using MercadoPago.Resources;

namespace MercadoPagoExample.Payments
{
public static class UserAccessTokenExample
{
public static void Run()
{
// Create a preference object
var preference = new Preference
{
UserAccessToken = "YOUR_ACCESS_TOKEN",
Items =
{
new Item
{
Id = "1234",
Title = "Small Silk Plate",
Quantity = 5,
CurrencyId = CurrencyId.ARS,
UnitPrice = 44.23m
}
},
Payer = new Payer
{
Email = "augustus_mckenzie@gmail.com"
}
};

// Save and posting preference
preference.Save();

Process.Start(preference.InitPoint);
}
}
}
2 changes: 1 addition & 1 deletion MercadoPagoExample/Payments/WebCheckoutExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static void Run()
Title = "Small Silk Plate",
Quantity = 5,
CurrencyId = CurrencyId.ARS,
UnitPrice = 44.23f
UnitPrice = 44.23m
}
},
Payer = new Payer
Expand Down
12 changes: 12 additions & 0 deletions MercadoPagoExample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ private static decimal ShowMenu()
Console.WriteLine("\t1.1. Pago con Checkout Web");
Console.WriteLine("\t1.2. Pago via API");
Console.WriteLine("\t1.3. Pago con Tarjetas Guardadas");
Console.WriteLine("\t1.4. Búsqueda de Pagos");
Console.WriteLine("\t1.5. Token de Acceso por instancia.");
Console.WriteLine("\t1.6. Notificaciones IPN.");
Console.WriteLine("5. Exit");

var selection = Console.ReadLine();
Expand All @@ -41,6 +44,15 @@ public static void Main(string[] args)
case 1.3m:
SavedCardsExample.Run();
break;
case 1.4m:
PaymentSearchExample.Run();
break;
case 1.5m:
UserAccessTokenExample.Run();
break;
case 1.6m:
IpnExample.Run();
break;
case 5m:
return;
}
Expand Down
4 changes: 4 additions & 0 deletions MercadoPagoExample/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Net.Compilers" version="2.8.2" targetFramework="net461" developmentDependency="true" />
</packages>
Loading