Skip to content

Commit

Permalink
Payment authorization suport
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagomoises committed Jun 24, 2019
1 parent 358f893 commit 8c21cfd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
4 changes: 3 additions & 1 deletion src/MercadoPago.NetCore/JsonMaps/PaymentRequestMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ public void Configure(JsonTypeBuilder<PaymentRequest> jsonTypeBuilder)
jsonTypeBuilder.Property(x => x.TransactionAmount).HasFieldName("transaction_amount");
jsonTypeBuilder.Property(x => x.CouponAmount).HasFieldName("coupon_amount");
jsonTypeBuilder.Property(x => x.DifferentialPricingId).HasFieldName("differential_pricing_id");
jsonTypeBuilder.Property(x => x.Capture).HasFieldName("capture");
jsonTypeBuilder.Property(x => x.Capture)
.HasFieldName("capture")
.AddDefaultValueHandling(Newtonsoft.Json.DefaultValueHandling.Include);
jsonTypeBuilder.Property(x => x.BinaryMode).HasFieldName("binary_mode");
jsonTypeBuilder.Property(x => x.StatementDescriptor).HasFieldName("statement_descriptor");
jsonTypeBuilder.Property(x => x.NotificationUrl).HasFieldName("notification_url");
Expand Down
2 changes: 1 addition & 1 deletion src/MercadoPago.NetCore/MercadoPago.NetCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="6.1.1" />
<PackageReference Include="IdentityModel" Version="3.10.10" />
<PackageReference Include="Microsoft.Extensions.Http" Version="2.2.0" />
<PackageReference Include="Moises.Toolkit.Newtonsoft.FluentAPI" Version="2.0.0" />
<PackageReference Include="Moises.Toolkit.Newtonsoft.FluentAPI" Version="2.0.2" />
<PackageReference Include="prmToolkit.NotificationPattern" Version="1.1.2" />
</ItemGroup>

Expand Down
22 changes: 9 additions & 13 deletions test/MercadoPago.NetCore.Tests/CardsHubClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using MercadoPago.NetCore.Model.Resources.Dataclassures.Auth;
using MercadoPago.NetCore.Model.Resources;
using MercadoPago.NetCore.Model.Resources.Dataclassures.Auth;
using Moises.Toolkit.MercadoPago.NetCore.HubClients;
using Moises.Toolkit.MercadoPago.NetCore.HubClients.Abstracts;
using Moises.Toolkit.MercadoPago.NetCore.Tests.Helpers;
Expand Down Expand Up @@ -28,7 +29,7 @@ public void Setup()

var customerHub = new CustomerHubClientTests();
customerHub.Setup();
if (customerHub.CustomerHubClient.SearchAsync(null).TryExecute(out var customers))
if (customerHub.CustomerHubClient.SearchAsync(null).TryExecute(out var customers, 10000))
CustomerId = customers.Results.Select(x => x.Id).FirstOrDefault();

tokenHubClient.Setup(x => x.GetTicketAsync())
Expand All @@ -45,20 +46,15 @@ public void Cleanup()
[Test]
public async Task SaveAsync_Test()
{
var Card = new Card()
Card card = new Card()
{
CustomerId = CustomerId,
ExpirationMonth = 9,
ExpirationYear = 2022,
FirstSixDigits = "123456",
LastFourDigits = "7890",
SecurityCode = new SecurityCode() { CardLocation = "back", Length = 3 },
CardHolder = new CardHolder { Name = "Thiago Moises" },
DateCreated = DateTime.Now
Token = "9b2d63e00d66a8c721607214cedaecda",
CustomerId = this.CustomerId
};
var result = await _CardHubClient.SaveAsync(Card);
bool firstCondition = (!string.IsNullOrEmpty(result?.Id) && Card.FirstSixDigits.Equals(result?.FirstSixDigits) && _CardHubClient.IsValid());
var result = await _CardHubClient.SaveAsync(card);
bool firstCondition = (!string.IsNullOrEmpty(result?.Id) && card.FirstSixDigits.Equals(result?.FirstSixDigits) && _CardHubClient.IsValid());
bool secondCondition = _CardHubClient.Notifications.Any(x => x.Message.Equals("the card already exist"));
Assert.IsTrue(firstCondition || secondCondition);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

<ItemGroup>
<PackageReference Include="Moises.Toolkit.Task.Extensions" Version="1.0.1" />
<PackageReference Include="Moq" Version="4.10.1" />
<PackageReference Include="nunit" Version="3.11.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.11.0" />
<PackageReference Include="Moq" Version="4.12.0" />
<PackageReference Include="nunit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
</ItemGroup>

Expand Down

0 comments on commit 8c21cfd

Please sign in to comment.