public static MPOptions GetMPOptions()
        {
            var x = new MPOptions()
            {
                ClientId     = "701342797733779",
                ClientSecret = "uyjunhCODZnR7LNPykouD076Eig74hF8",
            };

            x.UseSandboxAccessToken("TEST-8600607042428103-060407-f91bbb3d5d0029bc342657a83aa08ee5-397002962");
            return(x);
        }
        public static IServiceCollection AddMercadoPago(this IServiceCollection services, Action <MPOptions> setupAction = null)
        {
            var option = new MPOptions();

            setupAction?.Invoke(option);
            services.AddSingleton(option);

            services.AddHttpClient("mercadopago", httpClient =>
            {
                httpClient.BaseAddress = new Uri("https://api.mercadopago.com");
                httpClient.DefaultRequestHeaders.Add("ContentType", "application/json");
                httpClient.DefaultRequestHeaders.Add("User-Agent", "MercadoPago DotNet SDK/1.0.30");
            });

            services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
            services.AddTransient <ICardsHubClient, CardsHubClient>();
            services.AddTransient <ICustomerHubClient, CustomerHubClient>();
            services.AddTransient <IMerchantOrderHubClient, MerchantOrderHubClient>();
            services.AddTransient <IPaymentHubClient, PaymentHubClient>();
            services.AddTransient <IPaymentMethodHubClient, PaymentMethodHubClient>();
            services.AddTransient <IPlanHubClient, PlanHubClient>();
            services.AddTransient <IPreapprovalHubClient, PreapprovalHubClient>();
            services.AddTransient <IPreferenceHubClient, PreferenceHubClient>();
            services.AddTransient <IRefundHubClient, RefundHubClient>();
            services.AddTransient <ITokenHubClient, TokenHubClient>();

            // Auto Mapper Configurations
            var mappingConfig = new MapperConfiguration(mc =>
            {
                mc.AddProfile(new MappingProfile());
            });

            IMapper mapper = mappingConfig.CreateMapper();

            services.AddSingleton(mapper);

            return(services);
        }
Ejemplo n.º 3
0
 public MercadoPagoHubClient(IHttpClientFactory httpClientFactory, MPOptions options, ITokenHubClient tokenHubService)
 {
     Client           = httpClientFactory.CreateClient("mercadopago");
     _options         = options;
     _tokenHubService = tokenHubService;
 }
 public PreapprovalHubClient(IHttpClientFactory httpClientFactory, MPOptions options, ITokenHubClient tokenHubClient) : base(httpClientFactory, options, tokenHubClient)
 {
 }
Ejemplo n.º 5
0
 public RefundHubClient(IHttpClientFactory httpClientFactory, MPOptions options, ITokenHubClient tokenHubClient) : base(httpClientFactory, options, tokenHubClient)
 {
 }
Ejemplo n.º 6
0
 public TokenHubClient(IHttpClientFactory httpClientFactory, MPOptions options)
 {
     Client   = httpClientFactory.CreateClient("mercadopago");
     _options = options;
 }
Ejemplo n.º 7
0
 public CustomerHubClient(IHttpClientFactory httpClientFactory, MPOptions options, ITokenHubClient tokenHubClient) : base(httpClientFactory, options, tokenHubClient)
 {
 }
Ejemplo n.º 8
0
 public PreferenceHubClient(IHttpClientFactory httpClientFactory, MPOptions options, ITokenHubClient tokenHubClient) : base(httpClientFactory, options, tokenHubClient)
 {
 }