private static LinkRelation ListarCartoes(UsuarioRepresentation usuario)
        {
            var cartoes = new Uri(UriUsuarioIdComSegmentoComplementar("cartoes",usuario));
            var listarCartoes = new LinkRelation("usuarios/listar-cartoes", cartoes);

            return listarCartoes;
        }
Exemple #2
0
        public VerifyTransaction(VerifyTransactionDto dto)
            : base(dto.Id)
        {
            Amount                 = dto.Amount;
            VatAmount              = dto.VatAmount;
            FailedReason           = dto.FailedReason;
            FailedActivityName     = dto.FailedActivityName;
            FailedErrorCode        = dto.FailedErrorCode;
            FailedErrorDescription = dto.FailedErrorDescription;
            Activities             = dto.Activities;
            Created                = dto.Created;
            Updated                = dto.Updated;
            Activity               = dto.Activity;
            Description            = dto.Description;
            IsOperational          = dto.IsOperational;
            Number                 = dto.Number;
            PayeeReference         = dto.PayeeReference;
            State = dto.State;

            Type    = string.IsNullOrEmpty(dto.Type) ? TransactionType.Unknown : dto.Type.ParseTo <TransactionType>();
            Problem = dto.Problem?.Map();
            IOperationList operations = new OperationList();

            foreach (var item in dto.Operations)
            {
                var rel = new LinkRelation(item.Rel);
                operations.Add(new HttpOperation(item.Href, rel, item.Method, item.ContentType));
            }
            Operations = operations;
        }
        private static LinkRelation ValidarTelefone(UsuarioRepresentation usuario)
        {
            var uriValidarTelefone = new Uri(UriUsuarioIdComSegmentoComplementar("validacao-telefone",usuario));
            var validarTelefone = new LinkRelation("usuarios/registrar-numero-telefone", uriValidarTelefone);

            return validarTelefone;
        }
        private static LinkRelation Self(UsuarioRepresentation usuario)
        {
            var uri = new Uri(UriUsuarioComId(usuario));
            var self = new LinkRelation(uri);

            return self; 

        }
Exemple #5
0
        public void UnknownOperation_IsDeserializedTo_LinkrelationType()
        {
            var paymentResponse  = JsonSerializer.Deserialize <CardPaymentResponseDto>(TestResponse, JsonSerialization.JsonSerialization.Settings);
            var client           = new HttpClient();
            var operations       = new CardPaymentOperations(paymentResponse.Operations.Map(), client);
            var testLinkRelation = new LinkRelation(TestOperationName, TestOperationName);

            Assert.True(operations.ContainsKey(testLinkRelation), "Missing link relation in Operation list");

            Assert.True(operations.TryGetValue(testLinkRelation, out var httpOperation), "Missing value in operation list");

            Assert.Equal("text/html", httpOperation.ContentType);
            Assert.Equal(HttpMethod.Get, httpOperation.Method);
        }
Exemple #6
0
 /// <summary>
 /// Add a link to the document.
 /// </summary>
 /// <param name="href">Uri to the linked resource.</param>
 /// <param name="relation">Relationship of the linked resource to the current document.</param>
 /// <param name="type">Type of resource being linked.</param>
 /// <param name="length">Size in bytes.</param>
 /// <param name="title">Title of the linked resource.</param>
 /// <returns>Returns the current document instance.</returns>
 public XAtomBase AddLink(XUri href, LinkRelation relation, MimeType type, long?length, string title)
 {
     Start("link");
     Attr("href", href);
     Attr("rel", relation.ToString().ToLowerInvariant());
     if (type != null)
     {
         Attr("type", type.FullType);
     }
     if (length != null)
     {
         Attr("length", length ?? 0);
     }
     if (!string.IsNullOrEmpty(title))
     {
         Attr("title", title);
     }
     End();
     return(this);
 }
Exemple #7
0
 /// <summary>
 /// Add a link to the document.
 /// </summary>
 /// <param name="href">Uri to the linked resource.</param>
 /// <param name="relation">Relationship of the linked resource to the current document.</param>
 /// <param name="type">Type of resource being linked.</param>
 /// <param name="length">Size in bytes.</param>
 /// <param name="title">Title of the linked resource.</param>
 /// <returns>Returns the current document instance.</returns>
 public XAtomBase AddLink(XUri href, LinkRelation relation, MimeType type, long? length, string title)
 {
     Start("link");
     Attr("href", href);
     Attr("rel", relation.ToString().ToLowerInvariant());
     if(type != null) {
         Attr("type", type.FullType);
     }
     if(length != null) {
         Attr("length", length ?? 0);
     }
     if(!string.IsNullOrEmpty(title)) {
         Attr("title", title);
     }
     End();
     return this;
 }
Exemple #8
0
		public Links Remove(LinkRelation relation)
		{
			this.backend.Remove(link => link.Relatation == relation);
			this.Changed();
			return this;
		}
 private static LinkRelation ListarFavoritos(UsuarioRepresentation usuario)
 {
     var favoritos = new Uri(UriUsuarioIdComSegmentoComplementar("favoritos", usuario));
     var listaFavoritos = new LinkRelation("usuarios/listar-favoritos", favoritos);
     return listaFavoritos;
 }
 private static LinkRelation ValidarUsuario(UsuarioRepresentation usuario)
 {
     var uriValidacao = new Uri(UriUsuarioIdComSegmentoComplementar("validacao",usuario));
     var validacao = new LinkRelation("usuarios/validacao", uriValidacao);
     return validacao;
 }
 private static LinkRelation ValidarEmailUsuarios()
 {
     var uri = new Uri(Version.UsuariosComComplemento("validacao-email"));
     var linkRelation = new LinkRelation("usuarios/validar-email", uri);
     return linkRelation;
 }
 private static LinkRelation GeoLocalizarEstabelecimento()
 {
     var uri = new Uri(ApiEstabelecimentos.EstabelecimentosComComplemento("localizacao"));
     var linkRelation = new LinkRelation("estabelecimentos/geolocalizar-estabelecimento", uri);
     return linkRelation;
 }
 private static LinkRelation ListarCategoriasEstabelecimentos()
 {
     var uri = new Uri(ApiEstabelecimentos.EstabelecimentosComComplemento("categorias"));
     var linkRelation = new LinkRelation("estabelecimentos/listar-categorias", uri);
     return linkRelation;
 }