Skip to content

Commit

Permalink
Inclusion of Json Map for Payment Request
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagomoises committed Jun 21, 2019
1 parent e9e7e54 commit eeb4169
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/MercadoPago.NetCore/JsonMaps/PaymentRequestMap.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using MercadoPago.NetCore.Model.Resources;
using MercadoPago.NetCore.Request;
using Newtonsoft.FluentAPI.Abstracts;
using Newtonsoft.FluentAPI.Builders;
using Newtonsoft.Json.Converters;

namespace Moises.Toolkit.MercadoPago.NetCore.JsonMaps
{
internal class PaymentRequestMap : IJsonTypeConfiguration<PaymentRequest>
{
public void Configure(JsonTypeBuilder<PaymentRequest> jsonTypeBuilder)
{
jsonTypeBuilder.Property(x => x.IssuerId).HasFieldName("issuer_id");
jsonTypeBuilder.Property(x => x.PaymentMethodId).HasFieldName("payment_method_id");
jsonTypeBuilder.Property(x => x.CurrencyId)
.HasFieldName("currency_id")
.HasConverter(new StringEnumConverter());

jsonTypeBuilder.Property(x => x.Description).HasFieldName("description");
jsonTypeBuilder.Property(x => x.Payer).HasFieldName("payer");
jsonTypeBuilder.Property(x => x.Metadata).HasFieldName("metadata");
jsonTypeBuilder.Property(x => x.AdditionalInfo).HasFieldName("additional_info");
jsonTypeBuilder.Property(x => x.Order).HasFieldName("order");
jsonTypeBuilder.Property(x => x.ExternalReference).HasFieldName("external_reference");
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.BinaryMode).HasFieldName("binary_mode");
jsonTypeBuilder.Property(x => x.StatementDescriptor).HasFieldName("statement_descriptor");
jsonTypeBuilder.Property(x => x.NotificationUrl).HasFieldName("notification_url");
jsonTypeBuilder.Property(x => x.Installments).HasFieldName("installments");
}
}
}
1 change: 1 addition & 0 deletions src/MercadoPago.NetCore/MPUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ private static void ConfigureSerializerSettings()
_fcr.AddConfiguration(new Moises.Toolkit.MercadoPago.NetCore.JsonMaps.PaymentMethods.SecuryCodeMap());
_fcr.AddConfiguration(new Moises.Toolkit.MercadoPago.NetCore.JsonMaps.PaymentMethods.SettingsMap());
_fcr.AddConfiguration(new PaymentMap());
_fcr.AddConfiguration(new PaymentRequestMap());
_fcr.AddConfiguration(new Moises.Toolkit.MercadoPago.NetCore.JsonMaps.Payments.IdentificationMap());
_fcr.AddConfiguration(new Moises.Toolkit.MercadoPago.NetCore.JsonMaps.Payments.PayerMap());
_fcr.AddConfiguration(new Moises.Toolkit.MercadoPago.NetCore.JsonMaps.Payments.PhoneMap());
Expand Down

0 comments on commit eeb4169

Please sign in to comment.