private async Task <CustomerCardCreateRequest> BuildCardCreateRequestAsync() { CardToken cardToken = await cardTokenClient.CreateTestCardToken(User, "approved"); return(new CustomerCardCreateRequest { Token = cardToken.Id, }); }
private async Task <AdvancedPaymentCreateRequest> BuildCreateRequestAsync( bool capture, string paymentStatus) { CardToken cardToken = await cardTokenClient.CreateTestCardToken(User, paymentStatus); return(new AdvancedPaymentCreateRequest { ApplicationId = "59441713004005", Payments = new List <AdvancedPaymentSplitPaymentRequest> { new AdvancedPaymentSplitPaymentRequest { PaymentMethodId = "master", PaymentTypeId = "credit_card", Token = cardToken.Id, DateOfExpiration = DateTime.UtcNow.Add(TimeSpan.FromDays(120)), TransactionAmount = 1000, Installments = 1, ProcessingMode = "aggregator", Description = "Payment", ExternalReference = "Test" + Guid.NewGuid().ToString(), StatementDescriptor = "ADVPAYTEST", }, }, Disbursements = new List <AdvancedPaymentDisbursementRequest> { new AdvancedPaymentDisbursementRequest { Amount = 400, ExternalReference = "Seller1" + Guid.NewGuid().ToString(), CollectorId = 539673000, ApplicationFee = 1, MoneyReleaseDays = 5, }, new AdvancedPaymentDisbursementRequest { Amount = 600, ExternalReference = "Seller2" + Guid.NewGuid().ToString(), CollectorId = 488656838, ApplicationFee = 0.5m, }, }, Payer = new AdvancedPaymentPayerRequest { Email = Environment.GetEnvironmentVariable("USER_EMAIL"), FirstName = "Test", LastName = "User", Address = new AddressRequest { ZipCode = "06233200", StreetName = "Street", StreetNumber = "120", }, Identification = IdentificationHelper.GetIdentification(User), }, ExternalReference = "ADV" + Guid.NewGuid().ToString(), Description = "Test", BinaryMode = false, Capture = capture, AdditionalInfo = new AdvancedPaymentAdditionalInfoRequest { IpAddress = "127.0.0.1", Payer = new AdvancedPaymentAdditionalInfoPayerRequest { FirstName = "Test", LastName = "User", RegistrationDate = DateTime.UtcNow.AddDays(-10), Address = new AddressRequest { ZipCode = "06233200", StreetName = "Street", StreetNumber = "120", }, Phone = new PhoneRequest { AreaCode = "11", Number = "999999999", }, }, Items = new List <AdvancedPaymentItemRequest> { new AdvancedPaymentItemRequest { Id = "123", Title = "Title", PictureUrl = "https://www.mercadopago.com/logomp3.gif", Description = "Description", CategoryId = "Category", Quantity = 1, UnitPrice = 1000, }, }, Shipments = new AdvancedPaymentShipmentsRequest { ReceiverAddress = new AdvancedPaymentReceiverAddressRequest { ZipCode = "06233200", StreetName = "Street", StreetNumber = "120", Floor = "1", Apartment = "A", }, }, }, Metadata = new Dictionary <string, object> { ["key1"] = "value1", }, }); }
private async Task <PaymentCreateRequest> BuildCreateRequestAsync( bool capture, string paymentStatus) { CardToken cardToken = await cardTokenClient.CreateTestCardToken(User, paymentStatus); return(new PaymentCreateRequest { Payer = new PaymentPayerRequest { Email = Environment.GetEnvironmentVariable("USER_EMAIL"), EntityType = "individual", Type = "customer", Identification = IdentificationHelper.GetIdentification(User), FirstName = "Test", LastName = "User", }, BinaryMode = false, Capture = capture, ExternalReference = Guid.NewGuid().ToString(), Description = "Payment description", Metadata = new Dictionary <string, object> { ["key1"] = "value1", ["key2"] = "value2", }, TransactionAmount = 10, PaymentMethodId = "master", Token = cardToken.Id, Installments = 1, StatementDescriptor = "STAT-DESC", NotificationUrl = "https://seu-site.com.br/webhooks", CallbackUrl = "https://seu-site.com.br/callbackurl", ProcessingMode = "aggregator", DateOfExpiration = DateTime.Now.AddDays(30), AdditionalInfo = new PaymentAdditionalInfoRequest { IpAddress = "127.0.0.1", Items = new List <PaymentItemRequest> { new PaymentItemRequest { Id = "SKU-1", Title = "Product", PictureUrl = "https://www.mercadopago.com/org-img/MLB/design/2015/m_pago/logos/mp_processado_02.png", Description = "Product description", CategoryId = "cat", Quantity = 1, UnitPrice = 10, Warranty = false, EventDate = DateTime.Now, CategoryDescriptor = new PaymentCategoryDescriptorRequest { Passenger = new PaymentPassengerRequest { Identification = IdentificationHelper.GetIdentification(User), FirstName = "Test", LastName = "User", }, Route = new PaymentRouteRequest { ArrivalDateTime = DateTime.Now.AddDays(30), Company = "company", Departure = "derpature", DepartureDateTime = DateTime.Now.AddDays(30), Destination = "destination", }, }, }, }, Payer = new PaymentAdditionalInfoPayerRequest { FirstName = "Test", LastName = "User", RegistrationDate = DateTime.Now.AddDays(-30), Phone = new PhoneRequest { AreaCode = "11", Number = "999999999", }, Address = new AddressRequest { ZipCode = "0600000", StreetName = "Street", StreetNumber = "123", }, AuthenticationType = "None", IsFirstPurchaseOnline = false, IsPrimeUser = false, LastPurchase = DateTime.Now.AddDays(-10), }, Shipments = new PaymentShipmentsRequest { ReceiverAddress = new PaymentReceiverAddressRequest { ZipCode = "0600000", StreetName = "Street", StreetNumber = "123", Apartment = "23", Floor = "First", CityName = "City", StateName = "State", }, ExpressShipment = false, LocalPickup = false, }, }, }); }