private static Pagamento CancelamentoPagamento(V2Client v2Client) { var pagamento = "PAY-LZIGN8F3IHL0"; var pedidoCancelado = v2Client.CancelarPagamentoPreAutorizado(pagamento); return(pedidoCancelado); }
public Task <IEnumerable <VisualStudioUIPackageMetadata> > GetPackageMetadataForAllVersionsForVisualStudioUI(string packageId) { return(Task.Factory.StartNew(() => { return V2Client.FindPackagesById(packageId).Select(p => GetVisualStudioUIPackageMetadata(p)); })); }
void IJob.Execute(IJobExecutionContext context) { try { var v2Client = new V2Client( new Uri("https://sandbox.moip.com.br/"), "GSQV5MBTBI5ZZG8P8B1NPIS3F1DYJ0YO", "QS7QERT7QEMHMJX79SZYD1QQM4C8TZUFZPXLUNIS" ); // 1) Criar Pedido // CreateOrder(v2Client); // 2) Criar Pedido Com Repasse // CreateOrderRepasse(v2Client); // 3) Listar Pedido com filtros // FiltrarPedidos(v2Client); // 4) Consultar Pedido ConsultarPedido(v2Client); // 5) Cancelamento Total // CancelamentoPedido(v2Client); // 6) Cancelamento Pagamento // CancelamentoPagamento(v2Client); } catch (MoipException ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.ResponseError.Errors); Console.ReadKey(); } }
private static Pedido ConsultarPedido(V2Client v2Client) { var pedido = "ORD-5WAX9D2BC53I"; var pedidoConsultado = v2Client.ConsultarPedido(pedido); Console.WriteLine(pedidoConsultado.Id); return(pedidoConsultado); }
public Task <Versioning.NuGetVersion> GetLatestVersion(string packageId) { //*TODOs : No special processing for UNC or local share. Let the IPackageRepo handle it as it does today as of now. return(Task.Factory.StartNew(() => { SemanticVersion latestVersion = V2Client.FindPackagesById(packageId).OrderByDescending(p => p.Version).FirstOrDefault().Version; return new NuGetVersion(latestVersion.Version, latestVersion.SpecialVersion); })); }
private static Pedidos FiltrarPedidos(V2Client v2Client) { //Listar todos os pedidos pagos e criados com data superior a 01/01/2016 var filters = new Filters() .Add(new GreatherThanFilter <DateTime>("createdAt", new DateTime(2016, 01, 01))) .Add(new InFilter <OrderStatusType>("status", OrderStatusType.CREATED, OrderStatusType.PAID)); var pedidos = v2Client.ListarTodosPedidos(filters: filters); return(pedidos); }
public Task <IEnumerable <VisualStudioUISearchMetadata> > GetSearchResultsForVisualStudioUI(string searchTerm, SearchFilter filters, int skip, int take, System.Threading.CancellationToken cancellationToken) { return(Task.Factory.StartNew(() => { var query = V2Client.Search( searchTerm, filters.SupportedFrameworks, filters.IncludePrerelease, filters.IncludeDelisted); // V2 sometimes requires that we also use an OData filter for latest/latest prerelease version if (filters.IncludePrerelease) { query = query.Where(p => p.IsAbsoluteLatestVersion); } else { query = query.Where(p => p.IsLatestVersion); } if (V2Client is LocalPackageRepository) { // if the repository is a local repo, then query contains all versions of packages. // we need to explicitly select the latest version. query = query.OrderBy(p => p.Id) .ThenByDescending(p => p.Version) .GroupBy(p => p.Id) .Select(g => g.First()); } // Now apply skip and take and the rest of the party return (IEnumerable <VisualStudioUISearchMetadata>)query .Skip(skip) .Take(take) .ToList() .AsParallel() .AsOrdered() .Select(p => CreatePackageSearchResult(p, cancellationToken)) .ToList(); }, cancellationToken)); }
public Task <VisualStudioUIPackageMetadata> GetPackageMetadataForVisualStudioUI(string packageId, NuGetVersion version) { return(Task.Factory.StartNew(() => { var semver = new SemanticVersion(version.ToNormalizedString()); var package = V2Client.FindPackage(packageId, semver); // Sometimes, V2 APIs seem to fail to return a value for Packages(Id=,Version=) requests... if (package == null) { var packages = V2Client.FindPackagesById(packageId); package = packages.FirstOrDefault(p => Equals(p.Version, semver)); } // If still null, fail if (package == null) { return null; } return GetVisualStudioUIPackageMetadata(package); })); }
private VisualStudioUISearchMetadata CreatePackageSearchResult(IPackage package, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); var versions = V2Client.FindPackagesById(package.Id); if (!versions.Any()) { versions = new[] { package }; } string id = package.Id; NuGetVersion version = SafeToNuGetVer(package.Version); string summary = package.Summary; IEnumerable <NuGetVersion> nuGetVersions = versions.Select(p => SafeToNuGetVer(p.Version)); if (string.IsNullOrWhiteSpace(summary)) { summary = package.Description; } Uri iconUrl = package.IconUrl; VisualStudioUISearchMetadata searchMetaData = new VisualStudioUISearchMetadata(id, version, summary, iconUrl, nuGetVersions, null); return(searchMetaData); }
private static Pedido CreateOrderRepasse(V2Client v2Client) { var pedido = new Pedido() { OwnId = "15151515", Amount = new Valores() { Currency = CurrencyType.BRL, Subtotals = new Subtotal() { Shipping = 1000 } }, Items = new List <ItemPedido>() { new ItemPedido() { Product = "Curso Direito Civil", Quantity = 1, Detail = "Curso V18 Direito Civil", Price = 250000 } }, Receivers = new List <Recebedores>() { new Recebedores() { Type = ReceiverType.SECONDARY, FeePayor = true, Amount = new ValoresRecebedor { Fixed = 20000 }, moipAccount = new ContaMoip() { Id = "MPA-E3C8493A06AE" } } }, Customer = new Cliente() { OwnId = "333333", Fullname = "Milton Reis", Email = "*****@*****.**", BirthDate = DateTime.Now.Date.AddYears(-34).ToString("yyyy-MM-dd"), TaxDocument = new Documento() { Type = DocumentType.CPF, Number = "30877030871" }, Phone = new Telefone() { CountryCode = 55, AreaCode = 19, Number = 992129963 }, ShippingAddress = new Endereco() { ZipCode = "13145888", Street = "Rua 6", StreetNumber = "138", Complement = "Campos do Conde 2", City = "Paulinia", District = "", State = "SP", Country = "BRA" } } }; var clienteCriado = v2Client.CriarPedido(pedido); Console.WriteLine(clienteCriado); return(clienteCriado); }
private static void CancelamentoPedido(V2Client v2Client) { throw new NotImplementedException(); }